@svgsketch/core 2.3.0 → 2.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 CHANGED
@@ -1,20 +1,83 @@
1
- "use strict";var ji=Object.defineProperty;var fu=Object.getOwnPropertyDescriptor;var pu=Object.getOwnPropertyNames;var mu=Object.prototype.hasOwnProperty;var hu=(n,e)=>{for(var t in e)ji(n,t,{get:e[t],enumerable:!0})},gu=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pu(e))!mu.call(n,i)&&i!==t&&ji(n,i,{get:()=>e[i],enumerable:!(r=fu(e,i))||r.enumerable});return n};var yu=n=>gu(ji({},"__esModule",{value:!0}),n);var zp={};hu(zp,{Arrow:()=>Ri,Audio:()=>Gi,BUILTIN_MARKER_ID_MAP:()=>Ls,COLLAB_PROTOCOL_VERSION:()=>zo,COMMON_PROP_DEFAULTS:()=>J,COMMON_TRANSFORM_NODE_DEFAULTS:()=>qi,CURRENT_SCHEMA_VERSION:()=>xe,Circle:()=>hi,Cloud:()=>Mi,Container:()=>Ei,ContainerShapeBuilder:()=>tt,Cross:()=>Ti,DEFAULT_COORDINATE_PRECISION:()=>rl,DEFAULT_RICH_TEXT_STYLE:()=>Xt,Document:()=>wn,DocumentBuilder:()=>wn,EASING_CURVES:()=>Cn,EasingType:()=>Mn,Ellipse:()=>gi,Gear:()=>_i,Heart:()=>Ai,Hyperlink:()=>Di,IDENTITY_AFFINE:()=>rn,ImageShape:()=>Wi,KNOWN_STATE_KEYS:()=>Qi,LIBRARY_EMIT_ORDER:()=>Zs,Lightning:()=>Ii,Line:()=>Si,LinearGradientBuilder:()=>Pn,MARKER_HEIGHT:()=>Nr,MARKER_VIEWBOX:()=>Sn,MARKER_WIDTH:()=>Lr,MAX_COORDINATE_PRECISION:()=>il,MIGRATIONS:()=>_s,NGon:()=>vi,NON_WIRE_PROP_KEYS:()=>Fa,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS:()=>Bt,NestedSvg:()=>Li,NodeSchemaRegistry:()=>Wt,PUZZLE_DEFAULTS:()=>ya,Path:()=>Vi,PathCurveType:()=>Ki,PathPointType:()=>Aa,PatternBuilder:()=>Rn,Polyline:()=>Ui,RICH_TEXT_STYLE_KEYS:()=>vt,RadialGradientBuilder:()=>_n,Rectangle:()=>yi,Ring:()=>wi,SERIALIZED_SHAPE_STATE_KEYS:()=>Xi,SHAPE_TRANSFORM_STATE_KEYS:()=>Yi,SceneGraph:()=>Nn,SceneNode:()=>Be,ShapeBuilder:()=>ae,ShapeReference:()=>Ni,SpeechBubble:()=>Ci,Spiral:()=>Pi,Square:()=>bi,Star:()=>ki,Switch:()=>Fi,Text:()=>xi,Timeline:()=>mi,Track:()=>pi,Triangle:()=>$i,Video:()=>zi,View:()=>Oi,affine:()=>We,affineFromArray:()=>rr,affineToArray:()=>Ye,almostEqualAffine:()=>rc,applyAffineToPoint:()=>sc,applyAffineToVector:()=>ac,applyOpToSnapshot:()=>Do,applyOpsInPlace:()=>bs,applyOpsToSnapshot:()=>Fo,applyOpsToSnapshotWithAccepted:()=>Ss,applyRichTextFormat:()=>qt,applyTextSplice:()=>no,applyTextTransform:()=>xn,arcEndpointToCenter:()=>pa,areTracksTimingEquivalent:()=>ua,around:()=>vs,buildCompoundTransformValues:()=>Qr,buildSmilKeyframeData:()=>et,canonicalPolygonTransformString:()=>Ts,canonicalTransformString:()=>At,collaborationResourceKey:()=>us,collectMarkerReferences:()=>yn,collectReferencedLibraryDefs:()=>vn,collectReferencedMarkerIds:()=>yl,compareOrderKeys:()=>Ut,composeLegacyTransformMatrix:()=>ln,computeArrowVertices:()=>$r,computeCloudPath:()=>wr,computeCrossVertices:()=>xr,computeDashArray:()=>Mt,computeFlowchartBoxPath:()=>Ir,computeGearPath:()=>Rr,computeGearVertices:()=>Ds,computeHeartPath:()=>Tr,computeLightningVertices:()=>kr,computePolygonVertices:()=>mn,computeRectanglePath:()=>Ar,computeRingPath:()=>Pr,computeSpeechBubbleVertices:()=>vr,computeSpiralPath:()=>_r,computeSplinePath:()=>qe,computeStarVertices:()=>Sr,createDocument:()=>lr,createSceneNode:()=>rt,createShape:()=>tl,createViewbox:()=>fn,createWordSearchPrimitiveMask:()=>du,cubicBezierExtent1D:()=>si,customPatternDefToLibraryDef:()=>Ue,declaredRichTextDeltaKeys:()=>Xn,decomposeAffine2D:()=>Ac,defaultVariableMode:()=>Su,deriveRichTextFormatRanges:()=>uo,deriveSegments:()=>Ve,deriveTextSplice:()=>to,downTranslateAnimationKeyframeOps:()=>Lo,downTranslateCollectionMoveOps:()=>Bo,downTranslateDocumentFieldOps:()=>Go,downTranslateScenePlaceOps:()=>Oo,downTranslateTextFormatOps:()=>No,ellipticalArcBounds:()=>ma,escXml:()=>Y,extractVariables:()=>hr,filterAttr:()=>Er,findShapeById:()=>ct,flattenShapeStateTree:()=>Ht,flattenStateExtra:()=>Ne,foldLegacyAncestorTransformIntoMatrix:()=>ks,forEachLibraryRefInState:()=>gl,forEachMarkerRefInState:()=>hl,forEachReachableShape:()=>gn,forEachShapeInLibraryDefs:()=>ml,formatOperationValidationIssues:()=>eo,formatSmilKeySpline:()=>Wr,formatSmilKeyTime:()=>be,freezeSiblingOrderKeys:()=>tn,generateCode:()=>fi,generateCssCode:()=>di,generateD3Code:()=>ci,generateId:()=>_,generatePatternSvgContent:()=>Or,generatePuzzlePieces:()=>Hl,generateReactCode:()=>li,generateSudokuPuzzle:()=>nu,generateSvgCode:()=>oi,generateVueCode:()=>ui,generateWordSearch:()=>cu,getBuiltInMarkerDefs:()=>bl,getEasingCubicBezier:()=>bu,getEffectivePrecision:()=>sl,getKeyframeCubicBezier:()=>sa,getMarkerDescriptors:()=>pt,getPatternElements:()=>bn,getSmilAdditive:()=>qr,getSmilBeginValue:()=>mt,getSmilFillMode:()=>ht,getSmilMotionKeyPoints:()=>Zr,getSmilRepeatCount:()=>Yr,getSmilSetBeginValue:()=>Xr,getSmilTrackDuration:()=>Qe,getWordSearchDirections:()=>ka,initialOrderKeys:()=>On,invertAffine:()=>ic,isDefaultKeyPoints:()=>Hr,isDefaultKeyTimes:()=>kn,isFiniteAffineArray:()=>_t,isIdentityAffine:()=>$s,isIdentityLinearSplines:()=>la,isIndefiniteSetTrack:()=>jr,isReusablePatternTile:()=>Zt,isSetSequenceTrack:()=>Kr,isValidOrderKey:()=>Vt,keyBetween:()=>bt,keysBetween:()=>En,legacyEndpointMarkerId:()=>hn,linearGradient:()=>Nl,lintWordSearchOptions:()=>Ta,materializeSceneTreeOrderKeys:()=>Eo,matrixTransformPart:()=>xs,maxCollaborationTimestamp:()=>So,mergeRichTextStyle:()=>jn,migrateSnapshot:()=>ar,moveResourceById:()=>er,multiplyAffine:()=>ne,nodeSchemas:()=>O,normalizeRichTextRuns:()=>st,normalizeRichTextStyle:()=>Ce,normalizeRichTextStyleDelta:()=>Yt,orderSiblings:()=>Pe,parseDocument:()=>cr,parseSvgTransformList:()=>ir,parseVariableArgs:()=>nl,parseWordSearchWords:()=>lu,partitionShapeStateTree:()=>nt,partitionStateExtra:()=>Ln,pathDataBounds:()=>ga,pattern:()=>zl,patternLibraryDefToCustomPatternDef:()=>kt,patternTileSize:()=>as,planTransformFusion:()=>Jr,projectSceneTreeOntoClipMaskGroups:()=>Tt,projectSceneTreeOntoShapes:()=>gs,promoteRebasedShapeUpdateClock:()=>xo,quadraticBezierExtent1D:()=>ai,radialGradient:()=>Bl,rebaseRichTextFormatRanges:()=>lo,rebaseRichTextRuns:()=>co,reflectCubicBezier:()=>oa,removeResourceById:()=>ye,removeResourceByKey:()=>Un,removeResourceByName:()=>Hn,removeTrackKeyframe:()=>hs,renderAnimationElements:()=>ni,renderBuiltinMarkerDefs:()=>Ee,renderCircle:()=>zs,renderEllipse:()=>Gs,renderFilterDefs:()=>fl,renderFilterLibraryDef:()=>ia,renderFilterPrimitive:()=>Fr,renderFilterPrimitivesForType:()=>Es,renderFlowchartBox:()=>Ys,renderImage:()=>Ks,renderLibraryDef:()=>Js,renderLibraryDefs:()=>$n,renderLine:()=>Us,renderLinearGradientLibraryDef:()=>ta,renderMarkerLibraryDef:()=>ea,renderPatternLibraryDef:()=>ra,renderPolygonShape:()=>qs,renderPolyline:()=>js,renderRadialGradientLibraryDef:()=>na,renderRectangle:()=>Vs,renderReferencedLibraryDefs:()=>Ze,renderShape:()=>de,renderSpline:()=>Hs,renderSvgPrimitiveChainFilter:()=>Fs,renderSymbolInstance:()=>Xs,renderSymbolLibraryDef:()=>Qs,renderText:()=>Ws,renderToSvg:()=>Et,resolveRichTextStyleAt:()=>oo,resolveSymbolInstanceShapes:()=>Br,rewriteDocumentEmbeddedPayloads:()=>Jo,rewriteShapeStateEmbeddedPayloads:()=>or,richTextFontVariantCss:()=>Dt,richTextLineSpans:()=>is,richTextRunsFromState:()=>Zn,richTextStyleDelta:()=>Kn,richTextStyleDeltasEqual:()=>qn,richTextStylesEqual:()=>Yn,richTextTspanAttributes:()=>zr,rotateAffine:()=>Rt,roundCoord:()=>yr,roundNumberString:()=>Is,roundSerializedShape:()=>gr,roundSnapshot:()=>al,runsFromSegments:()=>at,sanitizeRichTextFormatRanges:()=>Jn,scaleAffine:()=>sn,senderCorrectionsForOp:()=>Mo,skewXAffine:()=>an,skewYAffine:()=>on,smilKeyframeAttributes:()=>Tn,solveCubicBezier:()=>aa,solveSudoku:()=>In,splinePathBounds:()=>Dl,stringifyDocument:()=>ur,substituteString:()=>dr,substituteVariables:()=>mr,symbolInstanceTargetId:()=>Ct,transformSplice:()=>Kt,translateAffine:()=>_e,tryParseSvgTransformList:()=>Ko,upsertResourceById:()=>ge,upsertResourceByKey:()=>Vn,upsertResourceByName:()=>Wn,upsertTrackKeyframe:()=>ms,validateDocumentOperations:()=>Ja,validateOperation:()=>Gn,validatePresenceOperation:()=>Qa,validateSnapshot:()=>dn,validateSudokuPuzzle:()=>tu,verticesToPath:()=>Ae});module.exports=yu(zp);var Mn=(C=>(C.LINEAR="linear",C.EASE="ease",C.EASE_IN="ease-in",C.EASE_OUT="ease-out",C.EASE_IN_OUT="ease-in-out",C.EASE_IN_QUAD="ease-in-quad",C.EASE_OUT_QUAD="ease-out-quad",C.EASE_IN_OUT_QUAD="ease-in-out-quad",C.EASE_IN_CUBIC="ease-in-cubic",C.EASE_OUT_CUBIC="ease-out-cubic",C.EASE_IN_OUT_CUBIC="ease-in-out-cubic",C.EASE_IN_QUART="ease-in-quart",C.EASE_OUT_QUART="ease-out-quart",C.EASE_IN_OUT_QUART="ease-in-out-quart",C.EASE_IN_SINE="ease-in-sine",C.EASE_OUT_SINE="ease-out-sine",C.EASE_IN_OUT_SINE="ease-in-out-sine",C.EASE_IN_QUINT="ease-in-quint",C.EASE_OUT_QUINT="ease-out-quint",C.EASE_IN_OUT_QUINT="ease-in-out-quint",C.EASE_IN_EXPO="ease-in-expo",C.EASE_OUT_EXPO="ease-out-expo",C.EASE_IN_OUT_EXPO="ease-in-out-expo",C.EASE_IN_CIRC="ease-in-circ",C.EASE_OUT_CIRC="ease-out-circ",C.EASE_IN_OUT_CIRC="ease-in-out-circ",C.EASE_IN_BACK="ease-in-back",C.EASE_OUT_BACK="ease-out-back",C.EASE_IN_OUT_BACK="ease-in-out-back",C.CUSTOM_BEZIER="custom-bezier",C.LINEAR_FUNCTION="linear-function",C.STEPS="steps",C))(Mn||{}),Cn={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 bu(n){let e=Cn[n];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var Ki=(a=>(a.LINEAR="linear",a.QUADRATIC="quadratic",a.CUBIC="cubic",a.CATMULL_ROM="catmull-rom",a.ARC="arc",a.BASIS="basis",a.MIXED="mixed",a))(Ki||{}),Aa=(r=>(r.SMOOTH="smooth",r.CORNER="corner",r.SYMMETRIC="symmetric",r))(Aa||{});function Su(n){return n==="color"?"live":"stamped"}var Xi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","ancestorTransform","layerName","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","groupId","structural","displayMode","display","visibility","inheritFill","inheritStroke","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","filterLibraryIds","fillRuleExplicit","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","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","fontSize","text","fontFamily","fontWeight","fontStyle","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","richTextData","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathRefShapeId","textPathImportRefId","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","symbolOverrides","variantKey","instancePresentation","scaleContentToViewport","groupData","mediaKind","mediaMimeType","naturalDuration","begin","trimStart","trimEnd","volume","muted","loop","playbackRate","mediaOpacity","fadeInDuration","fadeOutDuration","posterHref","sourceRect","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","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","isHomeView","children","viewLinkedSvgId"],xe=6;var Yi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],Bt=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],qi={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null};var Oe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Fn=Oe.length,Le=Oe[0],Ia=Oe[Fn-1],Ca=Oe[Math.floor(Fn/2)],Zi=97,xu=122;function yt(n){let e=Oe.indexOf(n);if(e===-1)throw new Error(`order-key: invalid digit '${n}'`);return e}function $u(n){let e=n.charCodeAt(0);if(e<Zi||e>xu)throw new Error(`order-key: invalid head '${n}'`);return e-Zi+1}function Ke(n){if(n<1||n>26)throw new Error(`order-key: integer length ${n} out of range`);return String.fromCharCode(Zi+n-1)}function zt(n){let e=$u(n[0]);if(n.length<1+e)throw new Error(`order-key: '${n}' shorter than its integer part`);let t=n.slice(1,1+e),r=n.slice(1+e);for(let i of t)yt(i);for(let i of r)yt(i);return{integer:t,fraction:r}}function Dn(n){for(let e of n)if(e!==Le)return!1;return!0}function Vt(n){if(n.length===0)return!1;try{let{integer:e,fraction:t}=zt(n);return!(t.endsWith(Le)||Dn(e)&&t.length===0||e.length>1&&e[0]===Le)}catch{return!1}}function Ma(n,e){if(!Vt(n))throw new Error(`order-key: invalid ${e} '${n}'`)}function Ut(n,e){return n<e?-1:n>e?1:0}function vu(n){let e=n.split("");for(let t=e.length-1;t>=0;t--){let r=yt(e[t]);if(r<Fn-1){e[t]=Oe[r+1];for(let i=t+1;i<e.length;i++)e[i]=Le;return e.join("")}}return null}function Ji(n){let{integer:e}=zt(n),t=vu(e);if(t!==null)return Ke(e.length)+t;let r="1"+Le.repeat(e.length);return Ke(r.length)+r}function ku(n){let e=n.split("");for(let t=e.length-1;t>=0;t--){let r=yt(e[t]);if(r>0){e[t]=Oe[r-1];for(let i=t+1;i<e.length;i++)e[i]=Ia;return e.join("")}e[t]=Ia}throw new Error(`order-key: cannot decrement zero integer '${n}'`)}function Tu(n){let e=0;for(;e<n.length-1&&n[e]===Le;)e++;return n.slice(e)}function wu(n){let{integer:e,fraction:t}=zt(n);if(!Dn(e)){let r=ku(e);if(!Dn(r)){let i=Tu(r);return Ke(i.length)+i}return Ke(1)+Le+Ca}return Ke(1)+Le+Gt("",t)}function Gt(n,e){if(e!==null){if(e.length===0||n>=e)throw new Error(`order-key: fraction bounds out of order ('${n}' >= '${e}')`);let i=0;for(;i<e.length&&(n[i]??Le)===e[i];)i++;if(i>0)return e.slice(0,i)+Gt(n.slice(i),e.slice(i))}let t=n.length>0?yt(n[0]):0,r=e!==null?yt(e[0]):Fn;return r-t>1?Oe[Math.floor((t+r)/2)]:Oe[t]+Gt(n.slice(1),null)}function bt(n,e){if(n!==null&&Ma(n,"lower bound"),e!==null&&Ma(e,"upper bound"),n!==null&&e!==null&&n>=e)throw new Error(`order-key: bounds out of order ('${n}' >= '${e}')`);if(n===null&&e===null)return Ke(1)+"1";if(n===null)return wu(e);if(e===null)return Ji(n);let t=zt(n),r=zt(e),i=Ke(t.integer.length)+t.integer,s=Ke(r.integer.length)+r.integer;if(i===s)return i+Gt(t.fraction,r.fraction);let o=Ji(i+(Dn(t.integer)?Ca:""));return Ut(o,e)<0?o:i+Gt(t.fraction,null)}function En(n,e,t){if(t<=0)return[];let r=[],i=n;for(let s=0;s<t;s++){let o=bt(i,e);r.push(o),i=o}return r}function On(n){if(n<=0)return[];let e=[],t=bt(null,null);e.push(t);for(let r=1;r<n;r++)t=Ji(t),e.push(t);return e}var Wt=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 i of Object.keys(t))r[i]=t[i].default;return r}validate(e,t,r){let i=this.schemas.get(e);if(!i)return r;let s=i[t];return s?.validate?s.validate(r):r}},E=n=>Math.max(0,n),St=n=>Math.max(0,Math.min(1,n)),te=n=>Math.max(0,Math.min(100,n)),Pu=n=>Math.max(1,n),_u=n=>Math.max(3,Math.min(100,Math.floor(n))),Ru=n=>Math.max(3,Math.min(50,Math.floor(n))),Au=n=>Math.max(3,Math.min(30,Math.floor(n))),Iu=n=>Math.max(1,Math.min(10,n));function Mu(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,{default:t}]))}var Cu=Mu(qi),J={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:St},fillOpacity:{default:1,validate:St},strokeOpacity:{default:1,validate:St},...Cu,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:Pu},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},groupId:{default:null}},ke={...J,cx:{default:0},cy:{default:0},radius:{default:50,validate:E},cornerRadius:{default:0,validate:E},shiftAngle:{default:0}},xt={...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:60,validate:E}},Da={...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},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:St},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:St},fadeInDuration:{default:0,validate:E},fadeOutDuration:{default:0,validate:E},posterHref:{default:""},sourceRect:{default:null}},O=new Wt;O.register("rectangle",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},rx:{default:0,validate:E},ry:{default:0,validate:E},cornerRadius:{default:0,validate:E},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:E},cornerRadiusTR:{default:0,validate:E},cornerRadiusBL:{default:0,validate:E},cornerRadiusBR:{default:0,validate:E},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});O.register("square",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},rx:{default:0,validate:E},ry:{default:0,validate:E},cornerRadius:{default:0,validate:E},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:E},cornerRadiusTR:{default:0,validate:E},cornerRadiusBL:{default:0,validate:E},cornerRadiusBR:{default:0,validate:E},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});O.register("circle",{...J,x:{default:0},y:{default:0},radius:{default:50,validate:E}});O.register("ellipse",{...J,cx:{default:0},cy:{default:0},rx:{default:50,validate:E},ry:{default:30,validate:E}});O.register("line",{...J,x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});O.register("text",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{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},richTextData:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},shapeInsideRef:{default:null},shapePadding:{default:0}});O.register("image",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:St}});O.register("path",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});O.register("polyline",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},polylinePoints:{default:[]},polylineClosed:{default:!1}});O.register("triangle",{...ke,sides:{default:3}});O.register("ngon",{...ke,sides:{default:6,validate:_u}});O.register("star",{...ke,arms:{default:5,validate:Ru},innerRadiusPercent:{default:40,validate:te}});O.register("cross",{...ke,armWidthPercent:{default:30,validate:te}});O.register("ring",{...ke,innerRadiusPercent:{default:50,validate:te}});O.register("spiral",{...ke,turns:{default:3,validate:Iu},thicknessPercent:{default:15,validate:te},spiralDirection:{default:1}});O.register("gear",{...ke,teeth:{default:8,validate:Au},toothDepthPercent:{default:25,validate:te},holeRadiusPercent:{default:20,validate:te}});O.register("arrow",{...ke,headWidthPercent:{default:100,validate:te},headLengthPercent:{default:40,validate:te},shaftWidthPercent:{default:40,validate:te}});O.register("symbol-instance",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},symbolId:{default:""}});O.register("group",{...J,groupId:{default:null}});O.register("cloud",{...ke,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:te}});O.register("heart",{...ke,lobeRadiusPercent:{default:50,validate:te},cleftDepthPercent:{default:25,validate:te}});O.register("lightning",{...ke,boltSegments:{default:3},boltWidthPercent:{default:30,validate:te},boltJaggednessPercent:{default:40,validate:te}});O.register("speechBubble",{...ke,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:te},tailWidthPercent:{default:25,validate:te}});O.register("diamond",{...xt});O.register("parallelogram",{...xt,slantPercent:{default:20,validate:te}});O.register("trapezoid",{...xt,topWidthPercent:{default:70,validate:te}});O.register("terminator",{...xt});O.register("cylinder",{...xt,capHeightPercent:{default:15,validate:te}});O.register("document-shape",{...xt,waveAmplitudePercent:{default:15,validate:te}});O.register("hyperlink",{...J,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});O.register("switch",{...J,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});O.register("svg",{...J,svgX:{default:0},svgY:{default:0},svgWidth:{default:0,validate:E},svgHeight:{default:0,validate:E},svgViewBoxX:{default:0},svgViewBoxY:{default:0},svgViewBoxWidth:{default:0,validate:E},svgViewBoxHeight:{default:0,validate:E},svgPreserveAspectRatio:{default:""}});O.register("view",{...J,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:E},viewBoxHeight:{default:0,validate:E},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});O.register("shape-reference",{...J,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:E},targetHeight:{default:0,validate:E},broken:{default:!1}});O.register("video",{...Da,mediaKind:{default:"video"}});O.register("audio",{...Da,mediaKind:{default:"audio"}});O.register("document",{});function Du(){let n=new Set(Xi);for(let e of Yi)n.add(e);for(let e of O.typeIds())for(let t of Object.keys(O.getDefaults(e)))n.add(t);return n.delete("scaleAnchor"),n.delete("extra"),n}var Qi=Du(),Fa=new Set(["scaleAnchor","displayAttr"]);function Ln(n){let e=n.extra&&typeof n.extra=="object"&&!Array.isArray(n.extra)?n.extra:void 0;for(let t of Object.keys(n)){if(t==="extra"||Qi.has(t))continue;let r=n[t];delete n[t],r!==void 0&&((e??={})[t]=r)}return e&&Object.keys(e).length>0?n.extra=e:delete n.extra,n}function nt(n){if(!n?.state||typeof n.state!="object")return n;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)nt(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))i&&typeof i=="object"&&!Array.isArray(i)&&Ln(i);return Ln(e),n}function Ht(n){if(!n?.state||typeof n.state!="object")return n;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)Ht(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))i&&typeof i=="object"&&!Array.isArray(i)&&Ne(i);return Ne(e),n}function Ne(n){let e=n.extra;if(!e||typeof e!="object"||Array.isArray(e))return delete n.extra,n;for(let[t,r]of Object.entries(e))t!=="extra"&&(t in n||(n[t]=r));return delete n.extra,n}function rt(n,e,t,r="verbatim"){if(r==="verbatim")return new Be(n,e,t&&"extra"in t?Ne({...t}):t);let i={...O.getDefaults(e),...t},s=O.get(e);if(s)for(let o of Object.keys(i)){let a=s[o];a?.validate&&i[o]!==void 0&&(i[o]=a.validate(i[o]))}return new Be(n,e,i)}var Be=class n{static writeHook=null;static _baseReadDepth=0;static withBaseProps(e){n._baseReadDepth++;try{return e()}finally{n._baseReadDepth--}}id;type;parent=null;children=[];onChange=null;_props;_dirty=new Set;_overlay=null;_propTimestamps=new Map;constructor(e,t,r){this.id=e,this.type=t,this._props=r?{...r}:{}}get(e){return this._overlay!==null&&n._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}set(e,t){this._props[e]!==t&&(n.writeHook?.(this,e),this._props[e]=t,this._dirty.add(e),this.onChange?.(this,this._dirty))}getProp(e){return this._overlay!==null&&n._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}getBaseProp(e){return this._props[e]}setProp(e,t){this._props[e]!==t&&(n.writeHook?.(this,e),this._props[e]=t,this._dirty.add(e),this.onChange?.(this,this._dirty))}deleteProp(e){e in this._props&&(n.writeHook?.(this,e),delete this._props[e],this._dirty.add(e),this.onChange?.(this,this._dirty))}setMany(e){let t=!1;for(let[r,i]of Object.entries(e))this._props[r]!==i&&(n.writeHook?.(this,r),this._props[r]=i,this._dirty.add(r),t=!0);t&&this.onChange?.(this,this._dirty)}setOverlayValue(e,t){this._overlay===null&&(this._overlay=new Map),this._overlay.set(e,t)}deleteOverlayValue(e){if(this._overlay===null)return!1;let t=this._overlay.delete(e);return this._overlay.size===0&&(this._overlay=null),t}getOverlayValue(e){return this._overlay?.get(e)}hasOverlayValue(e){return this._overlay?.has(e)??!1}overlayKeys(){return this._overlay?[...this._overlay.keys()]:[]}clearOverlay(){if(this._overlay===null)return[];let e=[...this._overlay.keys()];return this._overlay=null,e}get hasOverlay(){return this._overlay!==null}getDirtyKeys(){return this._dirty}clearDirty(){this._dirty.clear()}isDirty(){return this._dirty.size>0}getProps(){return this._props}snapshotProps(){return structuredClone(this._props)}restoreProps(e){this._props=structuredClone(e);for(let t of Object.keys(this._props))this._dirty.add(t);this.onChange?.(this,this._dirty)}getPropStamp(e){return this._propTimestamps.get(e)??null}stampProp(e,t,r){this._propTimestamps.set(e,{ts:t,clientId:r})}stampProps(e,t,r){let i={ts:t,clientId:r};for(let s of e)this._propTimestamps.set(s,i)}getPropStampsForKeys(e){let t={};for(let r of e){let i=this._propTimestamps.get(r);i&&(t[r]=i.ts)}return t}setPropIfWins(e,t,r,i){let s=this._propTimestamps.get(e),o=s?.ts??0,a=s?.clientId??"";return r>o||r===o&&i>a?(t===null?delete this._props[e]:this._props[e]=t,this._propTimestamps.set(e,{ts:r,clientId:i}),this._dirty.add(e),!0):!1}snapshotPropTimestamps(){return new Map(this._propTimestamps)}restorePropTimestamps(e){this._propTimestamps=new Map(e)}toSerialized(){return{id:this.id,type:this.type,state:{...this._props}}}static fromSerialized(e){return rt(e.id,e.type,e.state,"verbatim")}static create(e,t,r){return rt(e,t,r,"authoring")}};var Fu=5e3,Eu=1e4;function Ou(n){return n===null||n.size===0?"":[...n.entries()].sort((e,t)=>t[1].count-e[1].count).slice(0,5).map(([e,t])=>`${e.type}#${e.id} x${t.count} keys=[${[...t.keys].join(",")}]`).join("; ")}var Nn=class n{static _pendingGraphs=new Set;static flushAllPending(){if(n._pendingGraphs.size!==0)for(let e of[...n._pendingGraphs])e.flushBatched()}static get pendingGraphCount(){return n._pendingGraphs.size}root;_nodesById=new Map;_batchDepth=0;_batchDirtyNodes=new Map;_draining=!1;_changeListeners=[];_structureListeners=[];constructor(){this.root=rt("__root__","document"),this._nodesById.set(this.root.id,this.root)}onNodeChange(e){return this._changeListeners.push(e),()=>{let t=this._changeListeners.indexOf(e);t>=0&&this._changeListeners.splice(t,1)}}onStructureChange(e){return this._structureListeners.push(e),()=>{let t=this._structureListeners.indexOf(e);t>=0&&this._structureListeners.splice(t,1)}}addNode(e,t,r){let i=t??this.root;r!==void 0&&r>=0&&r<i.children.length?i.children.splice(r,0,e):i.children.push(e),e.parent=i,this._nodesById.set(e.id,e),e.onChange=this._handleNodeChange.bind(this),this._emitStructure("add",e,null,i)}removeNode(e){let t=this._nodesById.get(e);if(!t||t===this.root)return null;let r=t.parent,i=null;if(r){let s=r.children.indexOf(t);i={parentId:r===this.root?null:r.id,index:s},s>=0&&r.children.splice(s,1)}return t.parent=null,t.onChange=null,this._nodesById.delete(e),this._batchDirtyNodes.delete(t),this._removeDescendants(t),this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this),this._emitStructure("remove",t,r,null,i),t}getNode(e){return this._nodesById.get(e)??null}moveNode(e,t,r){let i=this._nodesById.get(e);if(!i||i===this.root)return;let s=i.parent,o=null;if(s){let a=s.children.indexOf(i);o={parentId:s===this.root?null:s.id,index:a},a>=0&&s.children.splice(a,1)}r!==void 0&&r>=0&&r<t.children.length?t.children.splice(r,0,i):t.children.push(i),i.parent=t,this._emitStructure("move",i,s,t,o)}moveNodeToParentId(e,t,r){let i=t?this._nodesById.get(t):this.root;i&&this.moveNode(e,i,r)}getChildren(e){let t=e?this._nodesById.get(e):this.root;return t?[...t.children]:[]}getRootShapes(){return[...this.root.children]}getParentId(e){let t=this._nodesById.get(e);return!t||!t.parent||t.parent===this.root?null:t.parent.id}getSiblingIndex(e){let t=this._nodesById.get(e);return!t||!t.parent?-1:t.parent.children.indexOf(t)}getAncestorIds(e){let t=[],r=this.getParentId(e);for(;r;)t.push(r),r=this.getParentId(r);return t}isAncestor(e,t){if(e===t)return!1;let r=this.getParentId(t);for(;r;){if(r===e)return!0;r=this.getParentId(r)}return!1}isDocumentRootNode(e){let t=this._nodesById.get(e);return!!t&&t!==this.root&&t.getProp("isRootSvg")===!0}contains(e,t){if(e===t)return!1;if(this.isDocumentRootNode(e)){let r=this._nodesById.get(t);return!!r&&r!==this.root&&!this.isDocumentRootNode(t)}return this.isAncestor(e,t)}getDepth(e){let t=this._nodesById.get(e);if(!t||t===this.root)return-1;let r=0,i=t.parent;for(;i&&i!==this.root;)r++,i=i.parent;return r}getAllNodes(){let e=[];for(let t of this._nodesById.values())t!==this.root&&e.push(t);return e}getDirtyNodes(){let e=[];for(let t of this._nodesById.values())t.isDirty()&&e.push(t);return e}clearAllDirty(){for(let e of this._nodesById.values())e.clearDirty()}beginBatch(){this._batchDepth++}commitBatch(){this._batchDepth=Math.max(0,this._batchDepth-1),this._batchDepth===0&&this._drainBatched()}flushBatched(){this._batchDirtyNodes.size>0&&this._drainBatched()}get hasPendingBatched(){return this._batchDirtyNodes.size>0}get isBatching(){return this._batchDepth>0}get isDraining(){return this._draining}dispose(){n._pendingGraphs.delete(this),this._batchDirtyNodes.clear(),this._changeListeners.length=0,this._structureListeners.length=0}notifyNodeChanged(e,t){this._handleNodeChange(e,t)}_handleNodeChange(e,t){if(this._batchDepth>0){let r=this._batchDirtyNodes.get(e);r||(r=new Set,this._batchDirtyNodes.set(e,r),n._pendingGraphs.add(this));for(let i of t)r.add(i);return}this._fireChangeListeners(e,t)}_drainBatched(){if(this._draining)return;this._draining=!0;let e=0,t=null;try{for(;this._batchDirtyNodes.size>0;){if(++e>Eu){console.error("[SceneGraph] batched-notification drain did not converge \u2014 render loop?",Ou(t)),this._batchDirtyNodes.clear();break}let[r,i]=this._batchDirtyNodes.entries().next().value;if(this._batchDirtyNodes.delete(r),this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this),e>Fu){t===null&&(t=new Map);let s=t.get(r);if(s){s.count++;for(let o of i)s.keys.add(o)}else t.set(r,{count:1,keys:new Set(i)})}this._fireChangeListeners(r,i)}}finally{this._draining=!1,this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this)}}_fireChangeListeners(e,t){let r=[...this._changeListeners];for(let i of r)i(e,t)}_emitStructure(e,t,r,i,s=null){let o=[...this._structureListeners];for(let a of o)a(e,t,r,i,s)}_removeDescendants(e){for(let t of e.children)t.onChange=null,this._nodesById.delete(t.id),this._batchDirtyNodes.delete(t),this._removeDescendants(t)}serializeShapes(){let e=[],t=r=>{for(let i of r)i.type!=="document"&&i.type!=="group"&&i.getProp("structural")!==!0&&e.push(i.toSerialized()),i.children.length>0&&t(i.children)};return t(this.root.children),e}static fromShapes(e){let t=new n;for(let r of e){let i=Be.fromSerialized(r);t.addNode(i)}return t}};var G=["updatedAt","clientId"];function z(n,e,t){n.push({path:e,message:t})}function Ka(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function U(n,e,t){return Ka(n)?n:(z(t,e,"must be an object"),null)}function I(n,e,t,r=[],i,s=!0){let o=new Set([...s?["type"]:[],...t,...r]);for(let a of t)Object.hasOwn(n,a)||z(i,`${e}.${a}`,"is required");for(let a of Object.keys(n))o.has(a)||z(i,`${e}.${a}`,"is not allowed")}function A(n,e,t,r=!1){return typeof n!="string"||!r&&n.length===0?(z(t,e,r?"must be a string":"must be a non-empty string"),!1):!0}function oe(n,e,t,r){return typeof n!="number"||!Number.isFinite(n)?(z(t,e,"must be a finite number"),!1):r!==void 0&&n<r?(z(t,e,`must be at least ${r}`),!1):!0}function we(n,e,t,r=0){return oe(n,e,t,r)?Number.isInteger(n)?!0:(z(t,e,"must be an integer"),!1):!1}function $t(n,e,t){return typeof n!="boolean"?(z(t,e,"must be a boolean"),!1):!0}function Q(n,e,t,r,i=!1){n[e]!==void 0&&A(n[e],`${t}.${e}`,r,i)}function es(n,e,t,r,i){n[e]!==void 0&&oe(n[e],`${t}.${e}`,r,i)}function se(n,e,t,r,i=0){n[e]!==void 0&&we(n[e],`${t}.${e}`,r,i)}function Bn(n,e,t,r){n[e]!==void 0&&$t(n[e],`${t}.${e}`,r)}function it(n,e,t){return Array.isArray(n)?(n.forEach((r,i)=>A(r,`${e}[${i}]`,t)),!0):(z(t,e,"must be an array"),!1)}function X(n,e,t,r){return Array.isArray(n)?(n.forEach((i,s)=>r(i,`${e}[${s}]`,t)),!0):(z(t,e,"must be an array"),!1)}function ie(n,e,t){let r=[{value:n,path:e,depth:0}],i=0;for(;r.length>0;){let s=r.pop();if(i++,i>25e4){z(t,e,"exceeds the 250000-node validation limit");return}if(s.depth>64){z(t,s.path,"exceeds the 64-level nesting limit");continue}let o=s.value;if(!(o===null||typeof o=="string"||typeof o=="boolean")){if(typeof o=="number"){Number.isFinite(o)||z(t,s.path,"must be a finite JSON number");continue}if(Array.isArray(o)){o.forEach((a,l)=>r.push({value:a,path:`${s.path}[${l}]`,depth:s.depth+1}));continue}if(Ka(o)){for(let[a,l]of Object.entries(o))r.push({value:l,path:`${s.path}.${a}`,depth:s.depth+1});continue}z(t,s.path,"must be JSON-serializable")}}}function V(n,e,t){es(n,"updatedAt",e,t,0),Q(n,"clientId",e,t)}function zn(n,e,t){let r=U(n,e,t);if(r)for(let[i,s]of Object.entries(r))A(s,`${e}.${i}`,t,!0)}function jt(n,e,t,r=0){if(r>64){z(t,e,"exceeds the 64-level shape nesting limit");return}let i=U(n,e,t);if(!i)return;I(i,e,["id","type","state"],[],t),A(i.id,`${e}.id`,t),A(i.type,`${e}.type`,t);let s=U(i.state,`${e}.state`,t);s&&(Object.hasOwn(s,"extra")&&z(t,`${e}.state.extra`,"is an at-rest field and is not allowed in operations"),ie(s,`${e}.state`,t),s.children!==void 0&&X(s.children,`${e}.state.children`,t,(o,a,l)=>jt(o,a,l,r+1)))}function Lu(n,e,t){let r=U(n,e,t);r&&(Object.hasOwn(r,"extra")&&z(t,`${e}.extra`,"is an at-rest field and is not allowed in operations"),ie(r,e,t),r.children!==void 0&&X(r.children,`${e}.children`,t,(i,s,o)=>jt(i,s,o)))}function ts(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.parentId!==null&&A(r.parentId,`${e}.parentId`,t),se(r,"siblingIndex",e,t),Q(r,"pluginId",e,t),Q(r,"pluginData",e,t,!0),r.attributes!==void 0&&zn(r.attributes,`${e}.attributes`,t),ie(r,e,t))}function Ea(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.type!=="clip"&&r.type!=="mask"&&z(t,`${e}.type`,'must be "clip" or "mask"'),r.clipShapeIds!==void 0&&it(r.clipShapeIds,`${e}.clipShapeIds`,t),r.clipShapeId!==void 0&&Q(r,"clipShapeId",e,t),r.clipShapeIds===void 0&&r.clipShapeId===void 0&&z(t,`${e}.clipShapeIds`,"or clipShapeId is required"),it(r.contentShapeIds,`${e}.contentShapeIds`,t),r.parentId!==null&&A(r.parentId,`${e}.parentId`,t),se(r,"siblingIndex",e,t),ie(r,e,t))}function Oa(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t);let i=r.orientation==="horizontal"||r.orientation==="vertical",s=r.axis==="x"||r.axis==="y";!i&&!s&&z(t,`${e}.orientation`,'must be "horizontal" or "vertical" (legacy axis "x" or "y" is also accepted)'),oe(r.position,`${e}.position`,t),i&&oe(r.controlPointOffset,`${e}.controlPointOffset`,t),Q(r,"color",e,t,!0),es(r,"opacity",e,t),ie(r,e,t)}function La(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t);let i=r.type==="distance"||r.type==="angle",s=["startX","startY","endX","endY"].every(o=>typeof r[o]=="number"&&Number.isFinite(r[o]));i?(X(r.points,`${e}.points`,t,(o,a,l)=>{let c=U(o,a,l);c&&(oe(c.x,`${a}.x`,l),oe(c.y,`${a}.y`,l))}),$t(r.visible,`${e}.visible`,t),we(r.snapDivisions,`${e}.snapDivisions`,t,1)):s||z(t,e,"must be a current or legacy measurement payload"),Q(r,"color",e,t,!0),es(r,"opacity",e,t),ie(r,e,t)}var Na=["title","description","author","keywords","license","licenseUrl","language","customMetadata","rawMetadata","rawDescription","rawHtmlMetadata","coordinatePrecision"];function Ba(n,e,t,r){let i=U(n,e,t);if(!i)return;I(i,e,r?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],r?Na:Na.slice(8),t,!1);for(let o of["title","description","author","license","licenseUrl","language"])(!r||i[o]!==void 0)&&A(i[o],`${e}.${o}`,t,!0);(!r||i.keywords!==void 0)&&it(i.keywords,`${e}.keywords`,t),(!r||i.customMetadata!==void 0)&&zn(i.customMetadata,`${e}.customMetadata`,t),Q(i,"rawMetadata",e,t,!0),Q(i,"rawDescription",e,t,!0),Q(i,"rawHtmlMetadata",e,t,!0),se(i,"coordinatePrecision",e,t)}function za(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.source!=="inline"&&r.source!=="external"&&z(t,`${e}.source`,'must be "inline" or "external"'),A(r.content,`${e}.content`,t,!0),A(r.type,`${e}.type`,t,!0),Q(r,"svgId",e,t,!0),Q(r,"href",e,t,!0),Bn(r,"async",e,t),Bn(r,"defer",e,t),r.customAttrs!==void 0&&zn(r.customAttrs,`${e}.customAttrs`,t),ie(r,e,t))}function Ga(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.css,`${e}.css`,t,!0),$t(r.preserved,`${e}.preserved`,t),Q(r,"svgId",e,t,!0),Q(r,"type",e,t,!0),Q(r,"media",e,t,!0),r.customAttrs!==void 0&&zn(r.customAttrs,`${e}.customAttrs`,t),ie(r,e,t))}function Va(n,e,t){let r=U(n,e,t);if(r){if(A(r.name,`${e}.name`,t),["string","color","number"].includes(String(r.type))||z(t,`${e}.type`,'must be "string", "color", or "number"'),A(r.defaultValue,`${e}.defaultValue`,t,!0),Q(r,"label",e,t,!0),Q(r,"description",e,t,!0),r.mode!==void 0&&r.mode!=="live"&&r.mode!=="stamped"&&z(t,`${e}.mode`,'must be "live" or "stamped"'),r.source!==void 0){let i=U(r.source,`${e}.source`,t);i&&i.kind!=="user"&&z(t,`${e}.source.kind`,'must be "user"')}ie(r,e,t)}}function Ua(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.filename,`${e}.filename`,t,!0),A(r.format,`${e}.format`,t),ie(r,e,t))}function Nu(n,e,t){let r=U(n,e,t);r&&(we(r.glyphId,`${e}.glyphId`,t),Array.isArray(r.codepoints)?r.codepoints.forEach((i,s)=>we(i,`${e}.codepoints[${s}]`,t)):z(t,`${e}.codepoints`,"must be an array"),A(r.svgDocument,`${e}.svgDocument`,t,!0),Q(r,"glyphName",e,t,!0),se(r,"advanceWidth",e,t),Q(r,"sourceFamily",e,t,!0),se(r,"sourceGlyphId",e,t),Q(r,"label",e,t,!0),ie(r,e,t))}function Wa(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.name,`${e}.name`,t,!0),A(r.svgContent,`${e}.svgContent`,t,!0),oe(r.width,`${e}.width`,t,0),oe(r.height,`${e}.height`,t,0),ie(r,e,t))}function Ha(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"].includes(String(r.type))||z(t,`${e}.type`,"is not a supported paint-server type"),A(r.markup,`${e}.markup`,t),Bn(r,"passthrough",e,t),ie(r,e,t))}function ja(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t),A(r.name,`${e}.name`,t,!0);let i=r.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||z(t,`${e}.kind`,"is not a supported library kind"),(i==="symbol"||i==="marker")&&(X(r.shapes,`${e}.shapes`,t,jt),r.groups!==void 0&&X(r.groups,`${e}.groups`,t,ts)),i==="symbol"&&A(r.viewBox,`${e}.viewBox`,t,!0),i==="marker"){for(let s of["refX","refY","markerWidth","markerHeight"])oe(r[s],`${e}.${s}`,t);r.markerUnits!=="strokeWidth"&&r.markerUnits!=="userSpaceOnUse"&&z(t,`${e}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),r.orient!=="auto"&&r.orient!=="auto-start-reverse"&&!(typeof r.orient=="number"&&Number.isFinite(r.orient))&&z(t,`${e}.orient`,"must be an orientation keyword or finite number")}(i==="linear-gradient"||i==="radial-gradient")&&U(r.gradient,`${e}.gradient`,t),i==="pattern"&&U(r.pattern,`${e}.pattern`,t),i==="filter"&&X(r.filters,`${e}.filters`,t,(s,o,a)=>{U(s,o,a)}),ie(r,e,t)}function Bu(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),Q(r,"viewBox",e,t,!0),r.shapes!==void 0&&X(r.shapes,`${e}.shapes`,t,jt),r.groups!==void 0&&X(r.groups,`${e}.groups`,t,ts),ie(r,e,t))}function Xa(n,e,t,r){let i=U(n,e,t);i&&((r||i.id!==void 0)&&A(i.id,`${e}.id`,t),oe(i.time,`${e}.time`,t,0),typeof i.value!="string"&&!(typeof i.value=="number"&&Number.isFinite(i.value))&&!(Array.isArray(i.value)&&i.value.every(s=>typeof s=="number"&&Number.isFinite(s)))&&z(t,`${e}.value`,"must be a string, finite number, or finite number array"),A(i.easing,`${e}.easing`,t),ie(i,e,t))}function Ya(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.shapeId,`${e}.shapeId`,t),A(r.property,`${e}.property`,t),$t(r.enabled,`${e}.enabled`,t),Bn(r,"locked",e,t),X(r.keyframes,`${e}.keyframes`,t,(i,s,o)=>Xa(i,s,o,!1)),ie(r,e,t))}function zu(n,e,t){let r=U(n,e,t);r&&(oe(r.duration,`${e}.duration`,t,0),$t(r.loop,`${e}.loop`,t),oe(r.playbackSpeed,`${e}.playbackSpeed`,t,0),X(r.tracks,`${e}.tracks`,t,Ya))}function Gu(n,e,t){let r=U(n,e,t);if(!r)return;we(r.start,`${e}.start`,t),we(r.end,`${e}.end`,t),typeof r.start=="number"&&typeof r.end=="number"&&r.end<=r.start&&z(t,`${e}.end`,"must be greater than start");let i=U(r.style,`${e}.style`,t);i&&Object.keys(i).length===0&&z(t,`${e}.style`,"must not be empty"),ie(r,e,t)}function Vu(n,e,t){let r=U(n,e,t);r&&(I(r,e,["start","deleteCount","insert"],[],t,!1),we(r.start,`${e}.start`,t),we(r.deleteCount,`${e}.deleteCount`,t),A(r.insert,`${e}.insert`,t,!0))}var qa={"shape:add":(n,e,t)=>{I(n,e,["shape"],[],t),jt(n.shape,`${e}.shape`,t)},"shape:update":(n,e,t)=>{if(I(n,e,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],t),A(n.id,`${e}.id`,t),Lu(n.state,`${e}.state`,t),n.propTimestamps!==void 0){let r=U(n.propTimestamps,`${e}.propTimestamps`,t);if(r)for(let[i,s]of Object.entries(r))oe(s,`${e}.propTimestamps.${i}`,t,0)}Q(n,"clientId",e,t),n.textSplices!==void 0&&X(n.textSplices,`${e}.textSplices`,t,Vu),se(n,"baseSeq",e,t)},"shape:remove":(n,e,t)=>{I(n,e,["id"],[],t),A(n.id,`${e}.id`,t)},"text:format":(n,e,t)=>{I(n,e,["id","ranges"],["baseSeq",...G],t),A(n.id,`${e}.id`,t),X(n.ranges,`${e}.ranges`,t,Gu),se(n,"baseSeq",e,t),V(n,e,t)},"scene:move":(n,e,t)=>{I(n,e,["id","parentId","index"],G,t),A(n.id,`${e}.id`,t),n.parentId!==null&&A(n.parentId,`${e}.parentId`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"scene:place":(n,e,t)=>{I(n,e,["id","parentId","orderKey"],G,t),A(n.id,`${e}.id`,t),n.parentId!==null&&A(n.parentId,`${e}.parentId`,t),A(n.orderKey,`${e}.orderKey`,t),V(n,e,t)},"shapes:reorder":(n,e,t)=>{I(n,e,["ids"],[],t),it(n.ids,`${e}.ids`,t)},"groups:set":(n,e,t)=>{I(n,e,["groups"],[],t),X(n.groups,`${e}.groups`,t,ts)},"clipmasks:set":(n,e,t)=>{I(n,e,["clipMaskGroups"],[],t),X(n.clipMaskGroups,`${e}.clipMaskGroups`,t,Ea)},"clipMask:upsert":(n,e,t)=>{I(n,e,["clipMaskGroup"],["index",...G],t),Ea(n.clipMaskGroup,`${e}.clipMaskGroup`,t),se(n,"index",e,t),V(n,e,t)},"clipMask:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"guides:set":(n,e,t)=>{I(n,e,["guides"],[],t),X(n.guides,`${e}.guides`,t,Oa)},"guide:upsert":(n,e,t)=>{I(n,e,["guide"],["index",...G],t),Oa(n.guide,`${e}.guide`,t),se(n,"index",e,t),V(n,e,t)},"guide:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"guide:move":(n,e,t)=>{I(n,e,["id","index"],G,t),A(n.id,`${e}.id`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"measurements:set":(n,e,t)=>{I(n,e,["measurements"],[],t),X(n.measurements,`${e}.measurements`,t,La)},"measurement:upsert":(n,e,t)=>{I(n,e,["measurement"],["index",...G],t),La(n.measurement,`${e}.measurement`,t),se(n,"index",e,t),V(n,e,t)},"measurement:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"measurement:move":(n,e,t)=>{I(n,e,["id","index"],G,t),A(n.id,`${e}.id`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"metadata:set":(n,e,t)=>{I(n,e,["metadata"],[],t),Ba(n.metadata,`${e}.metadata`,t,!1)},"metadata:patch":(n,e,t)=>{I(n,e,["patch"],["removeKeys",...G],t),Ba(n.patch,`${e}.patch`,t,!0),n.removeKeys!==void 0&&it(n.removeKeys,`${e}.removeKeys`,t),V(n,e,t)},"documentScripts:set":(n,e,t)=>{I(n,e,["documentScripts"],[],t),X(n.documentScripts,`${e}.documentScripts`,t,za)},"documentScript:upsert":(n,e,t)=>{I(n,e,["documentScript"],["index",...G],t),za(n.documentScript,`${e}.documentScript`,t),se(n,"index",e,t),V(n,e,t)},"documentScript:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"documentStyles:set":(n,e,t)=>{I(n,e,["documentStyles"],[],t),X(n.documentStyles,`${e}.documentStyles`,t,Ga)},"documentStyle:upsert":(n,e,t)=>{I(n,e,["documentStyle"],["index",...G],t),Ga(n.documentStyle,`${e}.documentStyle`,t),se(n,"index",e,t),V(n,e,t)},"documentStyle:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"templateVariables:set":(n,e,t)=>{I(n,e,["templateVariables"],G,t),X(n.templateVariables,`${e}.templateVariables`,t,Va),V(n,e,t)},"templateVariable:upsert":(n,e,t)=>{I(n,e,["templateVariable"],["index",...G],t),Va(n.templateVariable,`${e}.templateVariable`,t),se(n,"index",e,t),V(n,e,t)},"templateVariable:remove":(n,e,t)=>{I(n,e,["name"],G,t),A(n.name,`${e}.name`,t),V(n,e,t)},"exportItems:set":(n,e,t)=>{I(n,e,["exportItems"],G,t),X(n.exportItems,`${e}.exportItems`,t,Ua),V(n,e,t)},"exportItem:upsert":(n,e,t)=>{I(n,e,["exportItem"],["index",...G],t),Ua(n.exportItem,`${e}.exportItem`,t),se(n,"index",e,t),V(n,e,t)},"exportItem:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"colorGlyphLibrary:set":(n,e,t)=>{if(I(n,e,["colorGlyphLibrary"],G,t),n.colorGlyphLibrary!==null){let r=U(n.colorGlyphLibrary,`${e}.colorGlyphLibrary`,t);r&&(r.version!==1&&z(t,`${e}.colorGlyphLibrary.version`,"must be 1"),X(r.entries,`${e}.colorGlyphLibrary.entries`,t,Nu),ie(r,`${e}.colorGlyphLibrary`,t))}V(n,e,t)},"animation:set":(n,e,t)=>{I(n,e,["animationTimeline"],[],t),n.animationTimeline!==void 0&&zu(n.animationTimeline,`${e}.animationTimeline`,t)},"animation:config":(n,e,t)=>{I(n,e,["config"],G,t);let r=U(n.config,`${e}.config`,t);r&&(I(r,`${e}.config`,["duration","loop","playbackSpeed"],[],t,!1),oe(r.duration,`${e}.config.duration`,t,0),$t(r.loop,`${e}.config.loop`,t),oe(r.playbackSpeed,`${e}.config.playbackSpeed`,t,0)),V(n,e,t)},"animation:clear":(n,e,t)=>{I(n,e,[],G,t),V(n,e,t)},"animationTrack:upsert":(n,e,t)=>{I(n,e,["track"],["index",...G],t),Ya(n.track,`${e}.track`,t),se(n,"index",e,t),V(n,e,t)},"animationTrack:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"animationKeyframe:upsert":(n,e,t)=>{I(n,e,["trackId","keyframe"],G,t),A(n.trackId,`${e}.trackId`,t),Xa(n.keyframe,`${e}.keyframe`,t,!0),V(n,e,t)},"animationKeyframe:remove":(n,e,t)=>{I(n,e,["trackId","keyframeId"],G,t),A(n.trackId,`${e}.trackId`,t),A(n.keyframeId,`${e}.keyframeId`,t),V(n,e,t)},"symbols:set":(n,e,t)=>{I(n,e,["symbols"],[],t),X(n.symbols,`${e}.symbols`,t,Bu)},"customPatterns:set":(n,e,t)=>{I(n,e,["customPatterns"],[],t),X(n.customPatterns,`${e}.customPatterns`,t,Wa)},"customPattern:upsert":(n,e,t)=>{I(n,e,["customPattern"],["index",...G],t),Wa(n.customPattern,`${e}.customPattern`,t),se(n,"index",e,t),V(n,e,t)},"customPattern:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"library:set":(n,e,t)=>{I(n,e,["library"],[],t),X(n.library,`${e}.library`,t,ja)},"library:upsert":(n,e,t)=>{I(n,e,["def"],["index",...G],t),ja(n.def,`${e}.def`,t),se(n,"index",e,t),V(n,e,t)},"library:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"rawPaintServerDefs:set":(n,e,t)=>{I(n,e,["rawPaintServerDefs"],[],t),it(n.rawPaintServerDefs,`${e}.rawPaintServerDefs`,t)},"paintServerDefs:set":(n,e,t)=>{I(n,e,["paintServerDefs"],[],t),X(n.paintServerDefs,`${e}.paintServerDefs`,t,Ha)},"paintServerDef:upsert":(n,e,t)=>{I(n,e,["paintServerDef"],["index",...G],t),Ha(n.paintServerDef,`${e}.paintServerDef`,t),se(n,"index",e,t),V(n,e,t)},"paintServerDef:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"presence:cursor":(n,e,t)=>{I(n,e,["position"],[],t);let r=U(n.position,`${e}.position`,t);r&&(I(r,`${e}.position`,["x","y"],[],t,!1),oe(r.x,`${e}.position.x`,t),oe(r.y,`${e}.position.y`,t))},"presence:selection":(n,e,t)=>{I(n,e,["shapeIds"],[],t),it(n.shapeIds,`${e}.shapeIds`,t)}},Uu=new Set(Object.keys(qa)),Za=new Set(["presence:cursor","presence:selection"]);function Gn(n,e="operation"){let t=[],r=U(n,e,t);return r?!A(r.type,`${e}.type`,t)||!Uu.has(r.type)?(typeof r.type=="string"&&r.type.length>0&&z(t,`${e}.type`,`unknown operation type "${r.type}"`),{valid:!1,issues:t}):(qa[r.type](r,e,t),t.length===0?{valid:!0,value:r}:{valid:!1,issues:t}):{valid:!1,issues:t}}function Ja(n,e={}){let t=[];if(!Array.isArray(n))return{valid:!1,issues:[{path:"ops",message:"must be an array"}]};let r=e.minItems??1,i=e.maxItems??5e3;(n.length<r||n.length>i)&&z(t,"ops",`must contain ${r}-${i} operations`);let s=[];return n.forEach((o,a)=>{let l=Gn(o,`ops[${a}]`);if(!l.valid){t.push(...l.issues);return}if(Za.has(l.value.type)){z(t,`ops[${a}].type`,"presence operations are not document operations");return}s.push(l.value)}),t.length===0?{valid:!0,value:s}:{valid:!1,issues:t}}function Qa(n){let e=Gn(n,"op");return e.valid?Za.has(e.value.type)?{valid:!0,value:e.value}:{valid:!1,issues:[{path:"op.type",message:"must be a presence operation"}]}:e}function eo(n){return n.slice(0,5).map(({path:e,message:t})=>`${e} ${t}`).join("; ")}function Vn(n,e,t,r){let i=e[t],s=typeof i=="string"?i:"",o=(n??[]).filter(l=>l[t]!==s),a=typeof r=="number"&&Number.isFinite(r)?Math.max(0,Math.min(r,o.length)):o.length;return o.splice(a,0,e),o}function Un(n,e,t){return(n??[]).filter(r=>r[e]!==t)}function ge(n,e,t){return Vn(n,e,"id",t)}function ye(n,e){return Un(n,"id",e)}function Wn(n,e,t){return Vn(n,e,"name",t)}function Hn(n,e){return Un(n,"name",e)}function to(n,e){if(n===e)return null;let t=0,r=Math.min(n.length,e.length);for(;t<r&&n.charCodeAt(t)===e.charCodeAt(t);)t++;let i=0,s=Math.min(n.length,e.length)-t;for(;i<s&&n.charCodeAt(n.length-1-i)===e.charCodeAt(e.length-1-i);)i++;return{start:t,deleteCount:n.length-t-i,insert:e.slice(t,e.length-i)}}function no(n,e){return n.slice(0,e.start)+e.insert+n.slice(e.start+e.deleteCount)}function Kt(n,e){let t=e.start,r=e.start+e.deleteCount,i=e.insert.length-e.deleteCount,s=n.start,o=n.start+n.deleteCount;return r<=s?{start:s+i,deleteCount:n.deleteCount,insert:n.insert}:t>=o?{start:s,deleteCount:n.deleteCount,insert:n.insert}:t<=s&&r>=o?{start:t+e.insert.length,deleteCount:0,insert:n.insert}:t>=s&&r<=o?{start:s,deleteCount:n.deleteCount+i,insert:n.insert}:t<s?{start:t+e.insert.length,deleteCount:n.deleteCount-(r-s),insert:n.insert}:{start:s,deleteCount:t-s,insert:n.insert}}var Xt=Object.freeze({fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:Object.freeze({underline:!1,strikethrough:!1,overline:!1}),textTransform:"none",baselineShift:"baseline",dominantBaseline:"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}),vt=Object.keys(Xt);function Ge(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ze(n){return typeof n=="string"?n:void 0}function le(n){if(typeof n=="number")return Number.isFinite(n)?n:void 0;if(typeof n=="string"&&n.trim()!==""){let e=Number.parseFloat(n);return Number.isFinite(e)?e:void 0}}function Xe(n){return e=>typeof e=="string"&&n.includes(e)?e:void 0}function Wu(n){return n==="normal"||n==="bold"?n:le(n)}function Hu(n){return n==="baseline"||n==="super"||n==="sub"?n:le(n)}function io(n){if(typeof n=="string"){let t=n.toLowerCase();return{underline:t.includes("underline"),strikethrough:t.includes("line-through")||t.includes("strikethrough"),overline:t.includes("overline")}}if(!Ge(n))return;let e={};return typeof n.underline=="boolean"&&(e.underline=n.underline),typeof n.strikethrough=="boolean"&&(e.strikethrough=n.strikethrough),typeof n.overline=="boolean"&&(e.overline=n.overline),e}function so(n){if(!Ge(n))return;let e={};for(let[t,r]of Object.entries(n)){let i=le(r);i!==void 0&&(e[t]=i)}return e}var ao={fontFamily:ze,fontSize:le,fontWeight:Wu,fontStyle:Xe(["normal","italic","oblique"]),fontVariant:ze,fontVariantLigatures:ze,fontVariantPosition:ze,fontVariantCaps:ze,fontVariantNumeric:ze,fontVariantEastAsian:ze,textTransform:Xe(["none","capitalize","uppercase","lowercase"]),baselineShift:Hu,dominantBaseline:Xe(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),writingMode:Xe(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Xe(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Xe(["ltr","rtl"]),unicodeBidi:Xe(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Xe(["start","middle","end"]),letterSpacing:le,wordSpacing:le,lineHeight:le,fill:ze,fillOpacity:le,stroke:ze,strokeWidth:le,strokeOpacity:le};function jn(n,e){return{...n,...e,textDecoration:{...n.textDecoration,...e.textDecoration??{}},fontVariationSettings:{...e.fontVariationSettings??n.fontVariationSettings}}}function rs(n,e){let t=Object.keys(n);return t.length!==Object.keys(e).length?!1:t.every(r=>Object.prototype.hasOwnProperty.call(e,r)&&n[r]===e[r])}function Yn(n,e){for(let t of vt)if(t==="textDecoration"){if(n.textDecoration.underline!==e.textDecoration.underline||n.textDecoration.strikethrough!==e.textDecoration.strikethrough||n.textDecoration.overline!==e.textDecoration.overline)return!1}else if(t==="fontVariationSettings"){if(!rs(n.fontVariationSettings,e.fontVariationSettings))return!1}else if(n[t]!==e[t])return!1;return!0}function qn(n,e){let t=Object.keys(n).sort(),r=Object.keys(e).sort();if(t.length!==r.length||t.some((i,s)=>i!==r[s]))return!1;for(let i of t)if(i==="textDecoration"){let s=n.textDecoration??{},o=e.textDecoration??{},a=new Set([...Object.keys(s),...Object.keys(o)]);for(let l of a){let c=l;if(s[c]!==o[c])return!1}}else if(i==="fontVariationSettings"){if(!rs(n.fontVariationSettings??{},e.fontVariationSettings??{}))return!1}else{let s=i;if(n[s]!==e[s])return!1}return!0}function Kn(n,e){let t={};for(let i of vt)i==="textDecoration"||i==="fontVariationSettings"||n[i]!==e[i]&&(t[i]=n[i]);let r={};return n.textDecoration.underline!==e.textDecoration.underline&&(r.underline=n.textDecoration.underline),n.textDecoration.strikethrough!==e.textDecoration.strikethrough&&(r.strikethrough=n.textDecoration.strikethrough),n.textDecoration.overline!==e.textDecoration.overline&&(r.overline=n.textDecoration.overline),Object.keys(r).length>0&&(t.textDecoration=r),rs(n.fontVariationSettings,e.fontVariationSettings)||(t.fontVariationSettings={...n.fontVariationSettings}),t}function Ce(n,e=Xt){let t=Ge(n)?n:{},r={...e};for(let i of vt){if(i==="textDecoration"||i==="fontVariationSettings")continue;let s=ao[i](t[i]);s!==void 0&&(r[i]=s)}return r.textDecoration={...e.textDecoration,...io(t.textDecoration)??{}},r.fontVariationSettings={...so(t.fontVariationSettings)??e.fontVariationSettings},r}function Yt(n){let e=Ge(n)?n:{},t={};for(let r of vt){if(r==="textDecoration"||r==="fontVariationSettings"||e[r]===void 0)continue;let i=ao[r](e[r]);i!==void 0&&(t[r]=i)}if(e.textDecoration!==void 0){let r=io(e.textDecoration);r&&Object.keys(r).length>0&&(t.textDecoration=r)}if(e.fontVariationSettings!==void 0){let r=so(e.fontVariationSettings);r&&(t.fontVariationSettings=r)}return t}function is(n){let e=[],t=0;for(;;){let r=n.indexOf(`
2
- `,t);if(r===-1)return e.push({text:n.slice(t),start:t,end:n.length}),e;e.push({text:n.slice(t,r),start:t,end:r}),t=r+1}}function ju(n,e,t){return n.start===n.end?t&&n.start===e:n.start<=e&&e<n.end}function ns(n,e,t,r){let i=n;for(let s of e)ju(s,t,r)&&(i=jn(i,s.style));return i===n?jn(n,{}):i}function oo(n,e,t={}){let r=Ce(n.baseStyle),i=typeof n.text=="string"?n.text:"";return ns(r,ss(n.runs,i.length),e,t.collapsed===!0)}function st(n,e=Xt){let t=Ge(n)?n:{},r=Ce(t.baseStyle,e),i=typeof t.text=="string"?t.text:"";return{text:i,runs:ss(t.runs,i.length),baseStyle:r,lineHeight:le(t.lineHeight)??r.lineHeight}}function ss(n,e){if(!Array.isArray(n))return[];let t=[];for(let r of n){if(!Ge(r))continue;let i=le(r.start),s=le(r.end);if(i===void 0||s===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(s),0),e);o>a||t.push({start:o,end:a,style:Yt(r.style)})}return t}function Ve(n){let e=typeof n.text=="string"?n.text:"",t=Ce(n.baseStyle),r=ss(n.runs,e.length),i=le(n.lineHeight)??t.lineHeight;return{lines:is(e).map(o=>{if(o.text.length===0)return{segments:[{text:"",style:ns(t,r,o.start,!0)}]};let a=new Set([o.start,o.end]);for(let f of r)f.start!==f.end&&(f.start>o.start&&f.start<o.end&&a.add(f.start),f.end>o.start&&f.end<o.end&&a.add(f.end));let l=[...a].sort((f,d)=>f-d),c=[];for(let f=0;f<l.length-1;f++){let d=l[f],p=l[f+1],m=ns(t,r,d,!1),h=c[c.length-1];h&&Yn(h.style,m)?h.text+=e.slice(d,p):c.push({text:e.slice(d,p),style:m})}return{segments:c}}),baseStyle:t,lineHeight:i}}function at(n){let e=Ce(n?.baseStyle),t=le(n?.lineHeight)??e.lineHeight,r=Array.isArray(n?.lines)?n.lines:[],i=r.length>0?r:[{segments:[]}],s=[],o=[],a=0;for(let f=0;f<i.length;f++){f>0&&(s.push(`
3
- `),a+=1);let d=i[f]?.segments,p=Array.isArray(d)?d:[],m=a;for(let h of p){let g=typeof h?.text=="string"?h.text:"";if(g.length===0)continue;let b=Ce(h?.style,e),$=Kn(b,e);Object.keys($).length>0&&o.push({start:a,end:a+g.length,style:$}),s.push(g),a+=g.length}if(a===m){let h=Ce(p[0]?.style,e),g=Kn(h,e);Object.keys(g).length>0&&o.push({start:m,end:m,style:g})}}let l=s.join(""),c=[];for(let f of o){let d=c[c.length-1];d!==void 0&&d.start!==d.end&&f.start!==f.end&&(d.end===f.start||d.end+1===f.start&&l.charAt(d.end)===`
4
- `)&&qn(d.style,f.style)&&d?d.end=f.end:c.push({start:f.start,end:f.end,style:f.style})}return{text:l,runs:c,baseStyle:e,lineHeight:t}}function Zn(n){let e=n.richTextRuns;if(Ge(e))return st(e);let t=n.richTextData;return Ge(t)&&Array.isArray(t.lines)&&t.lines.length>0?at(t):null}function Xn(n){let e=new Set;for(let t of Object.keys(n))if(t==="textDecoration")for(let r of Object.keys(n.textDecoration??{}))e.add(`textDecoration.${r}`);else e.add(t);return e}function Ku(n,e){if(n.start===n.end||e.start>=e.end||n.start<e.start||n.end>e.end)return!1;let t=Xn(e.style);for(let r of Xn(n.style))if(!t.has(r))return!1;return!0}function qt(n,e){let t=[...n];for(let r of e)r.start>=r.end||Object.keys(r.style).length!==0&&(t=t.filter(i=>!Ku(i,r)),t.push({start:r.start,end:r.end,style:r.style}));return t}function Jn(n,e){if(!Array.isArray(n))return[];let t=[];for(let r of n){if(!Ge(r))continue;let i=le(r.start),s=le(r.end);if(i===void 0||s===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(s),0),e);if(o>=a)continue;let l=Yt(r.style);Object.keys(l).length!==0&&t.push({start:o,end:a,style:l})}return t}function lo(n,e){let t=[];for(let r of n){let i=Kt({start:r.start,deleteCount:r.end-r.start,insert:""},e),s=i.start,o=s+i.deleteCount;s>=o||t.push({start:s,end:o,style:r.style})}return t}function ro(n,e){return n.start===e.start&&n.end===e.end&&qn(n.style,e.style)}function uo(n,e){if(n.text!==e.text||n.lineHeight!==e.lineHeight||!Yn(Ce(n.baseStyle),Ce(e.baseStyle)))return null;let t=Array.isArray(n.runs)?n.runs:[],r=Array.isArray(e.runs)?e.runs:[],i=0,s=0;for(;s<r.length;){let l=-1;for(let c=i;c<t.length;c++)if(ro(t[c],r[s])){l=c;break}if(l===-1)break;i=l+1,s++}let o=r.slice(s);if(o.length===0)return null;for(let l of o)if(l.start>=l.end||Object.keys(l.style).length===0)return null;let a=qt(t,o);if(a.length!==r.length)return null;for(let l=0;l<a.length;l++)if(!ro(a[l],r[l]))return null;return o.map(l=>({start:l.start,end:l.end,style:Yt(l.style)}))}function Xu(n,e){let t=e===0||n.charAt(e-1)===`
5
- `,r=e===n.length||n.charAt(e)===`
6
- `;return t&&r}function co(n,e,t){let r=[];for(let i of n){let s=i.start===i.end,o=Kt({start:i.start,deleteCount:i.end-i.start,insert:""},e),a=o.start,l=o.start+o.deleteCount;a===l&&(!s||!Xu(t,a))||r.push({start:a,end:l,style:i.style})}return r}function Ue(n,e=n.id){return{kind:"pattern",id:e,name:n.name??e,pattern:{type:"pattern",svgContent:n.svgContent,width:n.width,height:n.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Zt(n){if(n.builtIn)return!1;let e=n.pattern;return!e||typeof e!="object"?!1:e.patternType==="custom"&&typeof e.svgContent=="string"}function as(n){let e=(n.viewBox??"").trim().split(/[\s,]+/).filter(s=>s.length>0).map(Number),t=e.length===4&&e.every(s=>Number.isFinite(s)),r=t&&e[2]>0?e[2]:n.width??10,i=t&&e[3]>0?e[3]:n.height??10;return{width:r,height:i}}function kt(n){if(!Zt(n))return null;let{width:e,height:t}=as(n.pattern);return{id:n.id,name:n.name,svgContent:n.pattern.svgContent??"",width:e,height:t}}function Pe(n){let e=[...n].sort((i,s)=>i.index-s.index);if(!e.some(i=>i.orderKey))return e;let t=On(e.length),r=new Map;return e.forEach((i,s)=>{r.set(i.id,i.orderKey??t[s])}),e.sort((i,s)=>{let o=Ut(r.get(i.id)??"",r.get(s.id)??"");return o!==0?o:i.id<s.id?-1:i.id>s.id?1:0})}var Yu=/^structural:(clip|mask):(.+):(group|path|content)$/;function fo(n,e){let t=`structural:${n}:${e}`;return{group:`${t}:group`,path:`${t}:path`,content:`${t}:content`}}function po(n,e){for(let t of n){e.add(t.id);let r=t.state.children;Array.isArray(r)&&po(r,e)}}function mo(n,e=null){let t=[];return n.forEach((r,i)=>{t.push({id:r.id,parentId:e,index:i});let s=r.state.children;Array.isArray(s)&&t.push(...mo(s,r.id))}),t}function Qn(n){let e=n.sceneTree&&n.sceneTree.length>0?n.sceneTree:mo(n.shapes),t=new Map(e.map(S=>[S.id,S])),r=new Map;for(let S of e){let x=r.get(S.parentId)??[];x.push(S),r.set(S.parentId,x)}for(let[S,x]of r)r.set(S,Pe(x));let i=S=>Yu.test(S),s=new Set(e.filter(S=>!i(S.id)).map(S=>S.id)),o=new Set;po(n.shapes,o);let a=new Map,l=new Set,c=(S,x)=>{let v=[];for(let w of r.get(S)??[]){if(!i(w.id)){l.has(w.id)||(l.add(w.id),v.push(w.id));continue}if(x.has(w.id))continue;let T=new Set(x);T.add(w.id),v.push(...c(w.id,T))}return v},f=[null,...s];for(let S of f){let x=c(S,new Set);x.length>0&&a.set(S,x)}for(let S of s){if(l.has(S))continue;let x=t.get(S)?.parentId??null,v=x!==null&&s.has(x)?x:null,w=a.get(v)??[];w.push(S),a.set(v,w),l.add(S)}let d=S=>{for(let[x,v]of a){let w=v.indexOf(S);if(w>=0)return{parentId:x,index:w}}return null},p=S=>{for(let x of a.values()){let v=x.indexOf(S);v>=0&&x.splice(v,1)}},m=n.clipMaskGroups??[],h=new Map(m.map(S=>[fo(S.type,S.id).content,S])),g=(S,x=new Set)=>{if(x.has(S.id))return Number.MAX_SAFE_INTEGER;let v=S.parentId?h.get(S.parentId):void 0;if(!v)return 0;let w=new Set(x);return w.add(S.id),1+g(v,w)},b=[...m].sort((S,x)=>g(S)-g(x)||(S.siblingIndex??0)-(x.siblingIndex??0)),$=new Map;for(let S of b){let x=(S.clipShapeIds.length>0?S.clipShapeIds:S.clipShapeId?[S.clipShapeId]:[]).filter(L=>o.has(L)),v=S.contentShapeIds.filter(L=>o.has(L));if(v.length===0||x.length===0&&!S.rawDefinition)continue;let w=[...v,...x].map(d).filter(L=>L!==null),T=w[0]?.parentId??null,P=w.length>0?Math.min(...w.map(L=>L.index)):void 0,R=S.parentId===null||s.has(S.parentId)||h.has(S.parentId)?S.parentId:T;for(let L of[...x,...v])p(L);let M=fo(S.type,S.id),N=a.get(R)??[],B=S.siblingIndex??P??N.length,D=Math.min(Math.max(0,B),N.length);N.splice(D,0,M.group),a.set(R,N),a.set(M.group,[M.path,M.content]),a.set(M.path,[...x]),a.set(M.content,[...v]),$.set(M.group,{id:M.group,parentId:R,index:0}),$.set(M.path,{id:M.path,parentId:M.group,index:0}),$.set(M.content,{id:M.content,parentId:M.group,index:1})}let k=[];for(let[S,x]of a)x.forEach((v,w)=>{let T=$.get(v);if(T){k.push({...T,parentId:S,index:w});return}let P=t.get(v);P&&P.parentId===S?k.push({...P,index:w}):k.push({id:v,parentId:S,index:w})});n.sceneTree=k}function $e(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function os(n){return $e(n)&&typeof n.updatedAt=="number"&&Number.isSafeInteger(n.updatedAt)&&n.updatedAt>=0&&typeof n.clientId=="string"}function ot(n,e){return{updatedAt:typeof n=="number"&&Number.isSafeInteger(n)&&n>=0?n:0,clientId:e??""}}function Jt(n,e){return os(e)?n.updatedAt>e.updatedAt||n.updatedAt===e.updatedAt&&n.clientId>=e.clientId:!0}function ho(n){return $e(n.collaborationState)||(n.collaborationState={}),n.collaborationState}function go(n,e){let t=ho(n);$e(t.shapeProps)||(t.shapeProps={});let r=t.shapeProps;return $e(r[e])||(r[e]={}),r[e]}function Qt(n,e){let t=n.collaborationState?.shapeProps;if(!$e(t))return{};let r=t[e];return $e(r)?r:{}}function yo(n,e,t,r){if(t.length===0)return;let i=go(n,e);for(let s of t)Jt(r,i[s])&&(i[s]=r)}function ls(n,e){let t=n.collaborationState?.shapeProps;if($e(t)){for(let r of e)delete t[r];qu(n)}}function qu(n){let e=n.collaborationState;if($e(e)){for(let t of["shapeProps","resources"]){let r=e[t];$e(r)&&Object.keys(r).length===0&&delete e[t]}Object.keys(e).length===0&&delete n.collaborationState}}function us(n){switch(n.type){case"guide:upsert":return`guide:${n.guide.id}`;case"guide:remove":case"guide:move":return`guide:${n.id}`;case"measurement:upsert":return`measurement:${n.measurement.id}`;case"measurement:remove":case"measurement:move":return`measurement:${n.id}`;case"metadata:patch":return"metadata:document";case"documentScript:upsert":return`documentScript:${n.documentScript.id}`;case"documentScript:remove":return`documentScript:${n.id}`;case"documentStyle:upsert":return`documentStyle:${n.documentStyle.id}`;case"documentStyle:remove":return`documentStyle:${n.id}`;case"templateVariable:upsert":return`templateVariable:${n.templateVariable.name}`;case"templateVariable:remove":return`templateVariable:${n.name}`;case"exportItem:upsert":return`exportItem:${n.exportItem.id}`;case"exportItem:remove":return`exportItem:${n.id}`;case"colorGlyphLibrary:set":return"colorGlyphLibrary";case"animation:config":case"animation:clear":case"animationTrack:upsert":case"animationTrack:remove":return"animation:timeline";case"animationKeyframe:upsert":return`animationKeyframe:${n.trackId}:${n.keyframe.id}`;case"animationKeyframe:remove":return`animationKeyframe:${n.trackId}:${n.keyframeId}`;case"clipMask:upsert":return`clipMask:${n.clipMaskGroup.id}`;case"clipMask:remove":return`clipMask:${n.id}`;case"library:upsert":return`library:${n.def.id}`;case"library:remove":return`library:${n.id}`;case"customPattern:upsert":return`customPattern:${n.customPattern.id}`;case"customPattern:remove":return`customPattern:${n.id}`;case"paintServerDef:upsert":return`paintServerDef:${n.paintServerDef.id}`;case"paintServerDef:remove":return`paintServerDef:${n.id}`;default:return null}}function bo(n,e,t){if(e.type==="shape:update"&&e.propTimestamps){if(!t)return null;let a=Qt(n,e.id),l={},c={},f=[];for(let[p,m]of Object.entries(e.state)){let h=ot(e.propTimestamps[p],e.clientId);Jt(h,a[p])&&(l[p]=m,c[p]=h.updatedAt,f.push([p,h]))}if(f.length===0)return null;let d=go(n,e.id);for(let[p,m]of f)d[p]=m;return{...e,state:l,propTimestamps:c}}let r=us(e);if(r===null||!("updatedAt"in e)||e.updatedAt===void 0)return e;let i=ot(e.updatedAt,e.clientId),s=ho(n);$e(s.resources)||(s.resources={});let o=s.resources;return Jt(i,o[r])?(o[r]=i,{...e,updatedAt:i.updatedAt,clientId:i.clientId}):null}function So(n){let e=0,t=n.collaborationState?.shapeProps;if($e(t)){for(let i of Object.values(t))if($e(i))for(let s of Object.values(i))os(s)&&(e=Math.max(e,s.updatedAt))}let r=n.collaborationState?.resources;if($e(r))for(let i of Object.values(r))os(i)&&(e=Math.max(e,i.updatedAt));for(let i of n.sceneTree??[])typeof i.updatedAt=="number"&&Number.isSafeInteger(i.updatedAt)&&i.updatedAt>=0&&(e=Math.max(e,i.updatedAt));return e}function xo(n,e){let t=Object.keys(e.state);if(t.length===0)return;let r=Qt(n,e.id),i=0;for(let o of t){let a=ot(e.propTimestamps?.[o],e.clientId);i=Math.max(i,r[o]?.updatedAt??0,a.updatedAt)}let s=i+1;e.propTimestamps=Object.fromEntries(t.map(o=>[o,s]))}function lt(n){n.symbols!==void 0&&(n.symbols=(n.library??[]).filter(e=>e.kind==="symbol").map(({kind:e,...t})=>t)),n.customPatterns!==void 0&&(n.customPatterns=(n.library??[]).filter(e=>e.kind==="pattern").map(e=>kt(e)).filter(e=>e!==null))}function Po(n,e=null){let t=[];return n.forEach((r,i)=>{t.push({id:r.id,parentId:e,index:i});let s=r.state.children;Array.isArray(s)&&t.push(...Po(s,r.id))}),t}function pe(n,e){if(n===e)return!0;let t=n??$o,r=e??$o;if(t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==r[i])return!1;return!0}var $o=[];function en(n){return n.sceneTree&&n.sceneTree.length>0?n.sceneTree:Po(n.shapes)}function Zu(n,e){let t=n,r=new Set(n.map(o=>o.id)),i=(o,a,l)=>{r.has(o.id)||(t=ds(t,{id:o.id,parentId:a,index:l}),r.add(o.id)),wt(o)?.forEach((f,d)=>i(f,o.id,d))},s=t.filter(o=>o.parentId===null).length;return i(e,null,s),t}function _o(n){let e=new Map;for(let r of n){let i=e.get(r.parentId)??[];i.push(r),e.set(r.parentId,i)}let t=[];for(let r of e.values())Pe(r).forEach((i,s)=>t.push({...i,index:s}));return t}function tn(n,e){let t=n.filter(l=>l.parentId===e);if(t.every(l=>l.orderKey))return n;let r=Pe(t),i=new Map,s=[],o=null,a=l=>{if(s.length===0)return;let c=En(o,l,s.length);s.forEach((f,d)=>i.set(f.id,c[d])),s=[]};for(let l of r)l.orderKey?(a(l.orderKey),o=l.orderKey):s.push(l);return a(null),n.map(l=>i.has(l.id)?{...l,orderKey:i.get(l.id)}:l)}function ds(n,e){let t,r=[],i=[],s=!1;for(let l of n){if(l.id===e.id){if(t=l,!fs(e,t))return n;continue}l.parentId===e.parentId?(r.push(l),l.orderKey&&(s=!0)):i.push(l)}if(s){let l=tn([...i,...r],e.parentId),c=Pe(l.filter(h=>h.parentId===e.parentId)),f=Math.min(Math.max(0,e.index),c.length),d=f>0?c[f-1].orderKey??null:null,p=f<c.length?c[f].orderKey??null:null,m=d!==null&&p!==null&&d>=p?d:bt(d,p);return[...i,...c,{...e,orderKey:m}]}let o=r.sort((l,c)=>l.index-c.index).map((l,c)=>({...l,index:c})),a=Math.min(Math.max(0,e.index),o.length);return[...i,...o,{...e,index:a-.5}]}function er(n,e,t){let r=n?[...n]:[],i=r.find(s=>s.id===e);return i?ge(r,i,t):r}function Ju(n){n.keyframes.sort((e,t)=>{if(e.time!==t.time)return e.time-t.time;let r=e.id??"",i=t.id??"";return r<i?-1:r>i?1:0})}function ms(n,e){let t=n.keyframes.findIndex(r=>r.id===e.id);t>=0?n.keyframes[t]=e:n.keyframes.push(e),Ju(n)}function hs(n,e){n.keyframes=n.keyframes.filter(t=>t.id!==e)}function vo(n,e){let t=n.animationTimeline?.tracks;return Array.isArray(t)?t.find(r=>r.id===e)??null:null}function fs(n,e){let t=n.updatedAt??0,r=e.updatedAt??0;return t!==r?t>r:(n.clientId??"")>=(e.clientId??"")}function wt(n){let e=n.state.children;return Array.isArray(e)?e:void 0}var cs=new Set(["group","hyperlink","switch","container","svg"]);function Ro(n,e,t,r){for(let i of n){t.set(i.id,e),r.set(i.id,i);let s=wt(i);s&&Ro(s,i.id,t,r)}}function gs(n){let e=n.sceneTree;if(!e||e.length===0)return;let t=new Map,r=new Map;if(Ro(n.shapes,null,t,r),r.size===0)return;for(let d of r.values())delete d.state.groupId;let i=new Map;for(let d of e){let p=i.get(d.parentId)??[];p.push(d),i.set(d.parentId,p)}let s=new Map,o=(d,p)=>{let m=s.get(d);m?m.push(p):s.set(d,[p])},a=new Set,l=new Set,c=(d,p)=>{for(let m of Pe(i.get(d)??[])){if(l.has(m.id))continue;l.add(m.id);let h=r.get(m.id);if(!h){c(m.id,p);continue}o(p,h),a.add(h.id),cs.has(h.type)&&c(m.id,h.id)}};if(c(null,null),a.size===0)return;let f=d=>{let p=t.get(d)??null,m=new Set;for(;p!==null&&!m.has(p);){m.add(p);let h=r.get(p);if(h&&cs.has(h.type))return p;p=t.get(p)??null}return null};for(let[d,p]of r)a.has(d)||o(f(d),p);for(let[d,p]of r){if(!cs.has(p.type))continue;let m=p.state,h=s.get(d);h&&h.length>0?m.children=h:"children"in m&&delete m.children}n.shapes=s.get(null)??[]}function Qu(n){let e=`structural:${n.type}:${n.id}`;return{group:`${e}:group`,path:`${e}:path`,content:`${e}:content`}}function Tt(n){let e=n.clipMaskGroups;if(!e||e.length===0)return;let t=n.sceneTree;if(!t||t.length===0)return;let r=new Set(t.map(o=>o.id)),i=new Map;for(let o of t){if(o.parentId===null)continue;let a=i.get(o.parentId);a?a.push(o):i.set(o.parentId,[o])}let s=o=>Pe(i.get(o)??[]).map(a=>a.id).filter(a=>!a.startsWith("structural:"));n.clipMaskGroups=e.map(o=>{let a=Qu(o);if(!r.has(a.group))return o;let l=r.has(a.path)?s(a.path):o.clipShapeIds,c=r.has(a.content)?s(a.content):o.contentShapeIds;if(ko(l,o.clipShapeIds)&&ko(c,o.contentShapeIds))return o;let f={...o,clipShapeIds:l,contentShapeIds:c};return(f.clipShapeId!==void 0||l.length>0)&&(f.clipShapeId=l[0]),f})}function ko(n,e){return!e||n.length!==e.length?!1:n.every((t,r)=>t===e[r])}function ys(n,e){e.add(n.id);let t=wt(n);if(t)for(let r of t)ys(r,e)}function ps(n,e){for(let t of n){e.set(t.id,t);let r=wt(t);r&&ps(r,e)}}var tr=class{constructor(e,t){this.snapshot=e;this.indexed=t}snapshot;indexed;shapeIndex=null;inlineProjectionPending=!1;sceneTreeNormalizePending=!1;memoId=null;memoShape=null;findShape(e){if(this.memoId===e)return this.memoShape;let t;return this.indexed?(this.shapeIndex===null&&(this.shapeIndex=new Map,ps(this.snapshot.shapes,this.shapeIndex)),t=this.shapeIndex.get(e)??null):t=ct(this.snapshot.shapes,e),this.memoId=e,this.memoShape=t,t}noteShapesAdded(e){this.memoId=null,this.memoShape=null,this.shapeIndex!==null&&ps([e],this.shapeIndex)}noteShapesRemoved(){this.shapeIndex=null,this.memoId=null,this.memoShape=null}requestInlineProjection(){this.inlineProjectionPending=!0}requestSceneTreeNormalize(){this.sceneTreeNormalizePending=!0}settle(){if(this.sceneTreeNormalizePending){this.sceneTreeNormalizePending=!1;let e=this.snapshot.sceneTree;e&&e.length>0&&(this.snapshot.sceneTree=_o(e))}this.inlineProjectionPending&&(this.inlineProjectionPending=!1,gs(this.snapshot))}};function ct(n,e){for(let t of n){if(t.id===e)return t;let r=wt(t);if(!r)continue;let i=ct(r,e);if(i)return i}return null}function ut(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ec(n){let e=n.richTextRuns;return!ut(e)||typeof e.text!="string"?null:st(e)}function tc(n,e){let t=n.state;"extra"in t&&Ne(t);let r=new Set;for(let[i,s]of Object.entries(e))s===null?r.add(i):t[i]=s;if(r.size>0){let i={};for(let[s,o]of Object.entries(t))r.has(s)||(i[s]=o);n.state=i}}function Ao(n,e,t){let r=[];for(let i of n){if(i.id===e){ys(i,t);continue}let s=wt(i);if(s){let o=Ao(s,e,t),a=i.state;o.length>0?a.children=o:delete a.children}r.push(i)}return r}function Io(n,e){let t=n.snapshot,r=t,i=bo(t,e,e.type!=="shape:update"||n.findShape(e.id)!==null);if(i===null)return null;let s=i,o=s;switch(s.type){case"shape:add":{if(!(n.findShape(s.shape.id)!==null)){let l=en(r),c=Ht(structuredClone(s.shape));r.shapes.push(c),r.sceneTree=Zu(l,c),n.noteShapesAdded(c),n.requestSceneTreeNormalize(),n.requestInlineProjection();let f=new Set;ys(c,f),ls(t,f)}break}case"shape:update":{let a=n.findShape(s.id);if(!a)return null;tc(a,s.state);break}case"text:format":{let a=n.findShape(s.id);if(!a)return null;let l=a.state;"extra"in l&&Ne(l);let c=ec(l);if(!c)return null;let f=Jn(s.ranges,c.text.length);if(f.length===0)return null;let d={...c,runs:qt(c.runs,f)};l.richTextRuns=d;let p=["richTextRuns"];if(ut(l.richTextData)&&(l.richTextData=Ve(d),p.push("richTextData")),s.updatedAt!==void 0){let m=ot(s.updatedAt,s.clientId),h=Qt(t,s.id);if(p.some(b=>!Jt(m,h?.[b]))){let b=Math.max(0,...p.map($=>h?.[$]?.updatedAt??0));m={updatedAt:Math.max(m.updatedAt,b)+1,clientId:m.clientId},o={...s,updatedAt:m.updatedAt,clientId:m.clientId}}yo(t,s.id,p,m)}break}case"shape:remove":{let a=new Set,l=Ao(r.shapes,s.id,a),c=a.size>0;c||a.add(s.id);let f=en(r),d=f.filter(p=>!a.has(p.id));if(!c&&d.length===f.length)return null;r.shapes=l,r.sceneTree=d,n.noteShapesRemoved(),ls(t,a),Tt(r);break}case"scene:move":{let a=en(r),l=a.find(d=>d.id===s.id),c=s.updatedAt===void 0?void 0:ot(s.updatedAt,s.clientId),f={id:s.id,parentId:s.parentId,index:s.index,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!fs(f,l))return null;r.sceneTree=ds(a,f),n.requestSceneTreeNormalize(),c&&(o={...s,...c}),n.requestInlineProjection(),Tt(r);break}case"scene:place":{if(!Vt(s.orderKey))return null;let a=en(r),l=a.find(p=>p.id===s.id),c=s.updatedAt===void 0?void 0:ot(s.updatedAt,s.clientId),f={id:s.id,parentId:s.parentId,index:l?.index??Number.MAX_SAFE_INTEGER,orderKey:s.orderKey,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!fs(f,l))return null;let d=tn(a,s.parentId);r.sceneTree=[...d.filter(p=>p.id!==s.id),f],n.requestSceneTreeNormalize(),n.requestInlineProjection(),Tt(r),c&&(o={...s,...c});break}case"shapes:reorder":{let a=en(r);s.ids.forEach((l,c)=>{a.some(f=>f.id===l&&f.parentId===null)&&(a=ds(a,{id:l,parentId:null,index:c}))}),r.sceneTree=a,n.requestSceneTreeNormalize(),n.requestInlineProjection(),Tt(r);break}case"groups:set":r.groups=s.groups;break;case"clipmasks:set":r.clipMaskGroups=s.clipMaskGroups,Qn(r);break;case"clipMask:upsert":r.clipMaskGroups=ge(r.clipMaskGroups,s.clipMaskGroup,s.index),Qn(r);break;case"clipMask:remove":{let a=ye(r.clipMaskGroups,s.id);if(pe(r.clipMaskGroups,a))return null;r.clipMaskGroups=a,Qn(r);break}case"guides:set":r.guides=s.guides;break;case"guide:upsert":r.guides=ge(r.guides,s.guide,s.index);break;case"guide:remove":{let a=ye(r.guides,s.id);if(pe(r.guides,a))return null;r.guides=a;break}case"guide:move":{let a=er(r.guides,s.id,s.index);if(pe(r.guides,a))return null;r.guides=a;break}case"measurements:set":r.measurements=s.measurements;break;case"measurement:upsert":r.measurements=ge(r.measurements,s.measurement,s.index);break;case"measurement:remove":{let a=ye(r.measurements,s.id);if(pe(r.measurements,a))return null;r.measurements=a;break}case"measurement:move":{let a=er(r.measurements,s.id,s.index);if(pe(r.measurements,a))return null;r.measurements=a;break}case"metadata:set":r.documentMetadata=s.metadata;break;case"metadata:patch":{let a=Object.fromEntries(Object.entries({...r.documentMetadata??{},...s.patch}).filter(([l])=>!(s.removeKeys??[]).includes(l)));r.documentMetadata=a;break}case"documentScripts:set":r.documentScripts=s.documentScripts;break;case"documentScript:upsert":r.documentScripts=ge(r.documentScripts,s.documentScript,s.index);break;case"documentScript:remove":{let a=ye(r.documentScripts,s.id);if(pe(r.documentScripts,a))return null;r.documentScripts=a;break}case"documentStyles:set":r.documentStyles=s.documentStyles;break;case"documentStyle:upsert":r.documentStyles=ge(r.documentStyles,s.documentStyle,s.index);break;case"documentStyle:remove":{let a=ye(r.documentStyles,s.id);if(pe(r.documentStyles,a))return null;r.documentStyles=a;break}case"templateVariables:set":r.templateVariables=s.templateVariables;break;case"templateVariable:upsert":r.templateVariables=Wn(r.templateVariables,s.templateVariable,s.index);break;case"templateVariable:remove":{let a=Hn(r.templateVariables,s.name);if(pe(r.templateVariables,a))return null;r.templateVariables=a;break}case"exportItems:set":r.exportItems=s.exportItems;break;case"exportItem:upsert":r.exportItems=ge(r.exportItems,s.exportItem,s.index);break;case"exportItem:remove":{let a=ye(r.exportItems,s.id);if(pe(r.exportItems,a))return null;r.exportItems=a;break}case"colorGlyphLibrary:set":s.colorGlyphLibrary===null?delete r.colorGlyphLibrary:r.colorGlyphLibrary=s.colorGlyphLibrary;break;case"animation:set":r.animationTimeline=s.animationTimeline;break;case"animation:config":r.animationTimeline={duration:s.config.duration,loop:s.config.loop,playbackSpeed:s.config.playbackSpeed,tracks:Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[]};break;case"animation:clear":delete r.animationTimeline;break;case"animationTrack:upsert":r.animationTimeline={duration:typeof r.animationTimeline?.duration=="number"?r.animationTimeline.duration:0,loop:typeof r.animationTimeline?.loop=="boolean"?r.animationTimeline.loop:!1,playbackSpeed:typeof r.animationTimeline?.playbackSpeed=="number"?r.animationTimeline.playbackSpeed:1,tracks:ge(Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],s.track,s.index)};break;case"animationTrack:remove":{let a=Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],l=ye(a,s.id);if(pe(a,l)&&!r.animationTimeline)return null;l.length>0&&r.animationTimeline?r.animationTimeline={...r.animationTimeline,tracks:l}:delete r.animationTimeline;break}case"animationKeyframe:upsert":{let a=vo(r,s.trackId);if(!a)return null;ms(a,structuredClone(s.keyframe));break}case"animationKeyframe:remove":{let a=vo(r,s.trackId);if(!a)return null;let l=a.keyframes;if(hs(a,s.keyframeId),pe(l,a.keyframes))return null;break}case"symbols:set":{r.symbols=s.symbols;let a=s.symbols.map(c=>({...c,kind:"symbol"})),l=(r.library??[]).filter(c=>c.kind!=="symbol");r.library=[...a,...l],lt(r);break}case"customPatterns:set":r.customPatterns=s.customPatterns;{let a=new Set(s.customPatterns.map(c=>c.id)),l=(r.library??[]).filter(c=>!a.has(c.id)&&(c.kind!=="pattern"||!Zt(c)));r.library=[...l,...s.customPatterns.map(c=>Ue(c))]}lt(r);break;case"customPattern:upsert":{r.customPatterns=ge(r.customPatterns,s.customPattern,s.index);let a=Ue(s.customPattern),l=[...r.library??[]],c=l.findIndex(f=>f.id===a.id);c>=0?l[c]=a:l.push(a),r.library=l,lt(r);break}case"customPattern:remove":{let a=ye(r.customPatterns,s.id),l=ye(r.library,s.id);if(pe(r.customPatterns,a)&&pe(r.library,l))return null;r.customPatterns=a,r.library=l,lt(r);break}case"library:set":r.library=s.library,lt(r);break;case"library:upsert":r.library=ge(r.library,s.def,s.index),lt(r);break;case"library:remove":{let a=ye(r.library,s.id);if(pe(r.library,a))return null;r.library=a,lt(r);break}case"rawPaintServerDefs:set":r.rawPaintServerDefs=s.rawPaintServerDefs,delete r.paintServerDefs;break;case"paintServerDefs:set":r.paintServerDefs=s.paintServerDefs,r.rawPaintServerDefs=s.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:upsert":r.paintServerDefs=ge(r.paintServerDefs,s.paintServerDef,s.index),r.rawPaintServerDefs=r.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:remove":{let a=ye(r.paintServerDefs,s.id);if(pe(r.paintServerDefs,a))return null;r.paintServerDefs=a,r.rawPaintServerDefs=a.map(l=>l.markup);break}case"presence:cursor":case"presence:selection":break;default:{let a=s;return null}}return o}function Mo(n,e,t){if(e.type==="shape:update"&&e.propTimestamps){let r=t?.type==="shape:update"?new Set(Object.keys(t.state)):new Set,i=Object.keys(e.state).filter(s=>!r.has(s));return To(n,e.id,i)}if(e.type==="text:format"&&t?.type==="text:format"){if(!(t.updatedAt!==e.updatedAt||t.clientId!==e.clientId))return[];let i=ct(n.shapes,e.id)?.state,s=i&&ut(Co(i,"richTextData"))?["richTextRuns","richTextData"]:["richTextRuns"];return To(n,e.id,s)}return[]}function Co(n,e){if(e in n)return n[e];let t=n.extra;return ut(t)?t[e]:void 0}function nc(n,e){if(e in n)return!0;let t=n.extra;return ut(t)&&e in t}function To(n,e,t){if(t.length===0)return[];let r=ct(n.shapes,e);if(!r)return[];let i=r.state,s=Qt(n,e),o=new Map;for(let l of t){let c=s[l];if(!c)continue;let f=o.get(c.clientId);f?f.push(l):o.set(c.clientId,[l])}let a=[];for(let[l,c]of o){let f={},d={};for(let p of c)f[p]=nc(i,p)?structuredClone(Co(i,p)):null,d[p]=s[p].updatedAt;a.push({type:"shape:update",id:e,state:f,propTimestamps:d,clientId:l})}return a}function Do(n,e){let t=new tr(n,!1),r=Io(t,e);return t.settle(),r}function bs(n,e){let t=new tr(n,e.length>1),r=[];for(let i of e){let s=Io(t,i);s&&r.push(s)}return t.settle(),r}function Ss(n,e){let t=structuredClone(n);return{snapshot:t,acceptedOps:bs(t,e)}}function Fo(n,e){return Ss(n,e).snapshot}function Eo(n){if(!n||n.length===0||n.every(t=>t.orderKey))return n;let e=n;for(let t of new Set(n.map(r=>r.parentId)))e=tn(e,t);return _o(e)}function Oo(n,e){if(!n.some(r=>r.type==="scene:place"))return n;let t=new Map((e??[]).map(r=>[r.id,r]));return n.map(r=>{if(r.type!=="scene:place")return r;let i=t.get(r.id);return{type:"scene:move",id:r.id,parentId:i?.parentId??r.parentId,index:i?.index??0,updatedAt:r.updatedAt,clientId:r.clientId}})}function Lo(n,e){if(!n.some(i=>i.type==="animationKeyframe:upsert"||i.type==="animationKeyframe:remove"))return n;let t=Array.isArray(e?.tracks)?e.tracks:[],r=[];for(let i of n){if(i.type!=="animationKeyframe:upsert"&&i.type!=="animationKeyframe:remove"){r.push(i);continue}let s=t.findIndex(o=>o.id===i.trackId);s!==-1&&r.push({type:"animationTrack:upsert",track:structuredClone(t[s]),index:s,updatedAt:i.updatedAt,clientId:i.clientId})}return r}function No(n,e){if(!n.some(r=>r.type==="text:format"))return n;let t=[];for(let r of n){if(r.type!=="text:format"){t.push(r);continue}let i=ct(e,r.id);if(!i)continue;let s=i.state.richTextRuns;if(!ut(s))continue;let o={richTextRuns:structuredClone(s)},a=i.state.richTextData;ut(a)&&(o.richTextData=structuredClone(a)),t.push({type:"shape:update",id:r.id,state:o,...typeof r.updatedAt=="number"?{propTimestamps:Object.fromEntries(Object.keys(o).map(l=>[l,r.updatedAt]))}:{},...r.clientId!==void 0?{clientId:r.clientId}:{}})}return t}function Bo(n,e){if(!n.some(r=>r.type==="guide:move"||r.type==="measurement:move"))return n;let t=[];for(let r of n)if(r.type==="guide:move"){let i=e.guides??[],s=i.findIndex(o=>o.id===r.id);if(s===-1)continue;t.push({type:"guide:upsert",guide:structuredClone(i[s]),index:s,updatedAt:r.updatedAt,clientId:r.clientId})}else if(r.type==="measurement:move"){let i=e.measurements??[],s=i.findIndex(o=>o.id===r.id);if(s===-1)continue;t.push({type:"measurement:upsert",measurement:structuredClone(i[s]),index:s,updatedAt:r.updatedAt,clientId:r.clientId})}else t.push(r);return t}var zo=6,wo=new Set(["templateVariables:set","templateVariable:upsert","templateVariable:remove","exportItems:set","exportItem:upsert","exportItem:remove","colorGlyphLibrary:set"]);function Go(n){return n.some(e=>wo.has(e.type))?n.filter(e=>!wo.has(e.type)):n}var rn=Object.freeze([1,0,0,1,0,0]);function We(n,e,t,r,i,s){return[n,e,t,r,i,s]}function rr(n){return We(n[0]??1,n[1]??0,n[2]??0,n[3]??1,n[4]??0,n[5]??0)}function Ye(n){return[n[0],n[1],n[2],n[3],n[4],n[5]]}function _t(n){return Array.isArray(n)&&n.length>=6&&n.slice(0,6).every(Number.isFinite)}function $s(n,e=1e-9){return Math.abs((n[0]??1)-1)<=e&&Math.abs(n[1]??0)<=e&&Math.abs(n[2]??0)<=e&&Math.abs((n[3]??1)-1)<=e&&Math.abs(n[4]??0)<=e&&Math.abs(n[5]??0)<=e}function rc(n,e,t=1e-9){for(let r=0;r<6;r++)if(Math.abs(n[r]-e[r])>t)return!1;return!0}function ne(n,e){return We(n[0]*e[0]+n[2]*e[1],n[1]*e[0]+n[3]*e[1],n[0]*e[2]+n[2]*e[3],n[1]*e[2]+n[3]*e[3],n[0]*e[4]+n[2]*e[5]+n[4],n[1]*e[4]+n[3]*e[5]+n[5])}function ic(n){let e=n[0]*n[3]-n[2]*n[1];if(Math.abs(e)<1e-10)return null;let t=1/e;return We(n[3]*t,-n[1]*t,-n[2]*t,n[0]*t,(n[2]*n[5]-n[3]*n[4])*t,(n[1]*n[4]-n[0]*n[5])*t)}function sc(n,e){return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}function ac(n,e){return{x:n[0]*e.x+n[2]*e.y,y:n[1]*e.x+n[3]*e.y}}function _e(n,e=0){return We(1,0,0,1,n,e)}function sn(n,e=n){return We(n,0,0,e,0,0)}function Rt(n){let e=n*Math.PI/180,t=Math.cos(e),r=Math.sin(e);return We(t,r,-r,t,0,0)}function an(n){return We(1,0,Math.tan(n*Math.PI/180),1,0,0)}function on(n){return We(1,Math.tan(n*Math.PI/180),0,1,0,0)}function vs(n,e){return ne(ne(_e(n.x,n.y),e),_e(-n.x,-n.y))}var oc=9,lc=10,uc=12,cc=13,dc=32,Vo=43,fc=44,Uo=45,pc=46,mc=48,hc=57,gc=40,yc=41,bc=69,Sc=101,xc=0,$c=1,Ho=2,vc=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function kc(n){return n===dc||n===oc||n===lc||n===cc||n===uc}function nr(n){return n>=mc&&n<=hc}function Tc(n){let e=n>=65&&n<=90,t=n>=97&&n<=122;return e||t||nr(n)}function Pt(n){for(;n.pos<n.src.length&&kc(n.src.charCodeAt(n.pos));)n.pos++}function jo(n){let e=n.pos;return Pt(n),n.src.charCodeAt(n.pos)===fc?(n.pos++,Pt(n),Ho):n.pos>e?$c:xc}function Wo(n){let e=n.src,t=n.pos,r=t,i=e.charCodeAt(r);(i===Vo||i===Uo)&&r++;let s=!1;for(;r<e.length&&nr(e.charCodeAt(r));)r++,s=!0;if(e.charCodeAt(r)===pc){let l=r+1;for(;l<e.length&&nr(e.charCodeAt(l));)l++;l>r+1&&(r=l,s=!0)}if(!s)return null;let o=e.charCodeAt(r);if(o===Sc||o===bc){let l=r+1,c=e.charCodeAt(l);(c===Vo||c===Uo)&&l++;let f=l;for(;f<e.length&&nr(e.charCodeAt(f));)f++;f>l&&(r=f)}let a=Number(e.slice(t,r));return Number.isFinite(a)?(n.pos=r,a):null}function wc(n,e){switch(n){case"matrix":return rr(e);case"translate":return _e(e[0],e[1]??0);case"scale":return sn(e[0],e[1]??e[0]);case"rotate":return e.length===3?vs({x:e[1],y:e[2]},Rt(e[0])):Rt(e[0]);case"skewX":return an(e[0]);case"skewY":return on(e[0]);default:return null}}function Pc(n){let e=n.src,t=n.pos;for(;n.pos<e.length&&Tc(e.charCodeAt(n.pos));)n.pos++;if(n.pos===t)return null;let r=e.slice(t,n.pos),i=vc.get(r);if(!i||(Pt(n),e.charCodeAt(n.pos)!==gc))return null;n.pos++,Pt(n);let s=i[i.length-1],o=Wo(n);if(o===null)return null;let a=[o];for(;;){let l=n.pos;jo(n);let c=Wo(n);if(c===null){n.pos=l;break}if(a.push(c),a.length>s)return null}return Pt(n),e.charCodeAt(n.pos)!==yc||(n.pos++,!i.includes(a.length))?null:wc(r,a)}function _c(n){let e={src:n,pos:0};if(Pt(e),e.pos>=n.length)return rn;let t=rn;for(;;){let r=Pc(e);if(r===null)return null;t=ne(t,r);let i=jo(e);if(e.pos>=n.length)return i===Ho?null:t}}var Rc=2048,nn=new Map;function Ko(n){if(!n)return rn;let e=nn.get(n);if(e!==void 0)return e;let t=_c(n),r=t===null?null:Object.freeze(t);if(nn.size>=Rc){let i=nn.keys().next().value;i!==void 0&&nn.delete(i)}return nn.set(n,r),r}function ir(n){return Ko(n)??rn}function Ac(n){let e=n[0],t=n[1],r=n[2],i=n[3],s=Math.sqrt(e*e+t*t);if(s<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(r*r+i*i),skewX:0};let o=Math.atan2(t,e),l=(e*i-t*r)/s,c=l!==0?(e*r+t*i)/(s*s):0,f=Math.atan(c),d=180/Math.PI;return{rotation:o*d,scaleX:s,scaleY:l,skewX:f*d}}function xs(n){return!_t(n)||$s(n)?null:`matrix(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]}, ${n[4]}, ${n[5]})`}function ln(n,e){let t=n.translateX??0,r=n.translateY??0,i=typeof n.rawTransform=="string"?n.rawTransform:"",s=n.rotation??0,o=n.skewX??0,a=n.skewY??0,l=n.scaleX??1,c=n.scaleY??1,f=_e(t,r);if(i)return ne(f,ir(i));if(s===0&&o===0&&a===0&&l===1&&c===1)return f;let d=n.customPivot??e;if(!d)return f;let p=ne(ne(ne(Rt(s),sn(l,c)),an(o)),on(a));return ne(f,vs(d,p))}function At(n,e){let t=xs(n.transformMatrix);return t||(xs(Ye(ln(n,e)))??null)}function ks(n,e){let t=n.ancestorTransform;if(!_t(t)){delete n.ancestorTransform;return}if($s(t)){delete n.ancestorTransform;return}let r=_t(n.transformMatrix)?rr(n.transformMatrix):ln(n,e);n.transformMatrix=Ye(ne(rr(t),r)),delete n.ancestorTransform}function Ts(n,e,t){let r=At(n,{x:e,y:t});return r?`${r} translate(${e}, ${t})`:`translate(${e}, ${t})`}function qo(n){let e=n.customPivot;if(e)return e;let t=n.x,r=n.y,i=n.width,s=n.height;if(typeof t=="number"&&typeof r=="number"&&typeof i=="number"&&typeof s=="number")return{x:t+i/2,y:r+s/2};let o=n.radius;if(typeof t=="number"&&typeof r=="number"&&typeof o=="number")return{x:t,y:r};let a=n.cx,l=n.cy;if(typeof a=="number"&&typeof l=="number")return{x:a,y:l};let c=n.x1,f=n.y1,d=n.x2,p=n.y2;if(typeof c=="number"&&typeof f=="number"&&typeof d=="number"&&typeof p=="number")return{x:(c+d)/2,y:(f+p)/2};let m=n.pathPoints;if(m?.[0])return{x:m[0].x,y:m[0].y};let h=n.polylinePoints;if(h?.[0])return{x:h[0].x,y:h[0].y}}function un(n){if(Array.isArray(n))for(let e of n){let t=e.state;ks(t,qo(t));let r=e.state.children;un(r)}}function Ic(n){un(n.shapes);for(let e of n.library??[])if(e.kind==="symbol"){un(e.shapes);for(let t of Object.values(e.variants??{}))un(t)}else e.kind==="marker"&&un(e.shapes);return n.schemaVersion=3,n}function ws(n){let e=n;return e&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)?{x:e.x,y:e.y}:null}function Mc(n,e){let t=n.translateX??0,r=n.translateY??0,i=typeof n.rawTransform=="string"?n.rawTransform:"",s=_e(t,r);if(i)return Ye(ne(s,ir(i)));let o=n.rotation??0,a=n.skewX??0,l=n.skewY??0;if(o!==0||a!==0||l!==0){let d=ws(n.customPivot)??e??ws(n.scaleAnchor);d&&(s=ne(s,_e(d.x,d.y)),o!==0&&(s=ne(s,Rt(o))),a!==0&&(s=ne(s,an(a))),l!==0&&(s=ne(s,on(l))),s=ne(s,_e(-d.x,-d.y)))}let c=n.scaleX??1,f=n.scaleY??1;if(c!==1||f!==1){let d=ws(n.scaleAnchor)??e;d&&(s=ne(s,_e(d.x,d.y)),s=ne(s,sn(c,f)),s=ne(s,_e(-d.x,-d.y)))}return Ye(s)}function cn(n){if(Array.isArray(n))for(let e of n){let t=e.state;"scaleAnchor"in t&&(e.type==="text"&&!_t(t.transformMatrix)&&(t.transformMatrix=Mc(t,qo(t))),delete t.scaleAnchor);let r=e.state.children;cn(r)}}function Cc(n){cn(n.shapes);for(let e of n.library??[])if(e.kind==="symbol"){cn(e.shapes);for(let t of Object.values(e.variants??{}))cn(t)}else e.kind==="marker"&&cn(e.shapes);return n.schemaVersion=4,n}function Dc(n){let e=Array.isArray(n.library)?[...n.library]:[],t=new Set(e.map(l=>l.id));if(Array.isArray(n.symbols))for(let l of n.symbols)!l||t.has(l.id)||(e.push({...l,kind:"symbol"}),t.add(l.id));if(Array.isArray(n.markers))for(let l of n.markers)!l||t.has(l.id)||(e.push({...l,kind:"marker"}),t.add(l.id));let r=new Map,i=(l,c)=>{let{id:f,sourceId:d,...p}=l,m=JSON.stringify({kind:c,...p}),h=r.get(m);if(h)return h;let g=t.has(l.id)?`grd-${sr()}`:l.id;t.add(g),r.set(m,g);let b=c==="linear-gradient"?{kind:"linear-gradient",id:g,name:l.sourceId??g,sourceId:l.sourceId,gradient:Xo(l)}:{kind:"radial-gradient",id:g,name:l.sourceId??g,sourceId:l.sourceId,gradient:Xo(l)};return e.push(b),g},s=new Map;if(Array.isArray(n.customPatterns))for(let l of n.customPatterns){if(!l)continue;let c=t.has(l.id)?`pat-${sr()}`:l.id;t.add(c),s.set(l.id,c),e.push(Ue(l,c))}let o=l=>{if(l.customPatternId){let $=s.get(l.customPatternId);if($)return $}let{id:c,sourceId:f,customPatternId:d,...p}=l,m=JSON.stringify({kind:"pattern",...p}),h=r.get(m);if(h)return h;let g=t.has(l.id)?`pat-${sr()}`:l.id;t.add(g),r.set(m,g);let b={kind:"pattern",id:g,name:l.sourceId??g,sourceId:l.sourceId,pattern:p};return e.push(b),g};for(let l of n.shapes??[]){let c=l.state;if(!c)continue;let f=c.fillGradient;f&&(f.type==="linear-gradient"||f.type==="radial-gradient"?c.fillLibraryId=i(f,f.type):f.type==="pattern"&&(c.fillLibraryId=o(f)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=o(d)));let p=c.filters;if(Array.isArray(p)&&p.length>0){let m=a(p,c,l.id);c.filterLibraryIds=[m]}}return n.library=e,n;function a(l,c,f){let d={filters:l,colorInterpolation:c.filterColorInterpolation,filterUnits:c.filterUnits,primitiveUnits:c.primitiveUnits,x:c.filterX,y:c.filterY,width:c.filterWidth,height:c.filterHeight},p=JSON.stringify({kind:"filter",...d}),m=r.get(p);if(m)return m;let h=`filter-${f}`,g=t.has(h)?`flt-${sr()}`:h;t.add(g),r.set(p,g);let b={kind:"filter",id:g,name:g,filters:d.filters,...d.colorInterpolation?{colorInterpolation:d.colorInterpolation}:{},...d.filterUnits?{filterUnits:d.filterUnits}:{},...d.primitiveUnits?{primitiveUnits:d.primitiveUnits}:{},...d.x!==void 0?{x:d.x}:{},...d.y!==void 0?{y:d.y}:{},...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{}};return e.push(b),g}}function Xo(n){let{id:e,sourceId:t,...r}=n;return r}var Ps=0;function sr(){return Ps=Ps+1&65535,`${Date.now().toString(36)}-${Ps.toString(36)}`}function Fc(n){let e=t=>{if(Array.isArray(t))for(let r of t)nt(r)};e(n.shapes);for(let t of n.library??[])if(t.kind==="symbol"){e(t.shapes);for(let r of Object.values(t.variants??{}))e(r)}else t.kind==="marker"&&e(t.shapes);return n.schemaVersion=5,n}function Yo(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n;if(e.richTextRuns!==void 0&&e.richTextRuns!==null)return;let t=e.richTextData;!t||typeof t!="object"||Array.isArray(t)||Array.isArray(t.lines)&&(e.richTextRuns=at(t))}function Zo(n){if(!n?.state||typeof n.state!="object")return;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)Zo(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))Yo(i);Yo(e)}function Ec(n){let e=t=>{if(Array.isArray(t))for(let r of t)Zo(r)};e(n.shapes);for(let t of n.library??[])if(t.kind==="symbol"){e(t.shapes);for(let r of Object.values(t.variants??{}))e(r)}else t.kind==="marker"&&e(t.shapes);return n.schemaVersion=6,n}var _s=Object.freeze({1:Dc,2:Ic,3:Cc,4:Fc,5:Ec});function Oc(n){let e=n.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function ar(n,e=_s){let t=JSON.parse(JSON.stringify(n)),r=Oc(t);if(r>xe)return t;if(r===xe)return t.schemaVersion=xe,t;for(;r<xe;){let i=e[r];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${r} \u2192 ${r+1}. Cannot safely upgrade this document to version ${xe}.`);t=i(t),r+=1}return t.schemaVersion=xe,t}function dt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}async function As(n,e,t,r){let i=n[e];typeof i=="string"&&(n[e]=await r(i,t))}async function Rs(n,e){dt(n)&&await As(n,"svgContent","svgMarkup",e)}async function or(n,e){if(!dt(n))return;await As(n,"href","href",e),await Rs(n.fillGradient,e),await Rs(n.strokeGradient,e);let t=n.children;if(Array.isArray(t))for(let r of t)dt(r)&&await or(r.state,e)}async function Jo(n,e){if(!dt(n))return;let t=n.shapes;if(Array.isArray(t))for(let s of t)dt(s)&&await or(s.state,e);let r=n.library;if(Array.isArray(r))for(let s of r)dt(s)&&s.kind==="pattern"&&await Rs(s.pattern,e);let i=n.customPatterns;if(Array.isArray(i))for(let s of i)dt(s)&&await As(s,"svgContent","svgMarkup",e)}var Lc=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function dn(n){let e=[],t=[];if(n==null||typeof n!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:t};let r=n;if(r.schemaVersion!==void 0&&(typeof r.schemaVersion!="number"||!Number.isInteger(r.schemaVersion)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):r.schemaVersion>xe&&t.push({path:"schemaVersion",message:`schemaVersion ${r.schemaVersion} is newer than supported (${xe})`,severity:"warning"})),!Array.isArray(r.shapes))e.push({path:"shapes",message:"shapes must be an array",severity:"error"});else{let i=new Set;r.shapes.forEach((s,o)=>{Vc(s,`shapes[${o}]`,e,t,i)})}if(!Array.isArray(r.viewboxes))e.push({path:"viewboxes",message:"viewboxes must be an array",severity:"error"});else{let i=new Set;r.viewboxes.forEach((s,o)=>{Hc(s,`viewboxes[${o}]`,e,t,i)})}if(r.guides!==void 0&&(Array.isArray(r.guides)?r.guides.forEach((i,s)=>{jc(i,`guides[${s}]`,e,t)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),r.groups!==void 0&&(Array.isArray(r.groups)?r.groups.forEach((i,s)=>{Kc(i,`groups[${s}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),r.sceneTree!==void 0)if(!Array.isArray(r.sceneTree))e.push({path:"sceneTree",message:"sceneTree must be an array",severity:"error"});else{let i=Nc(r.shapes),s=new Set;r.sceneTree.forEach((o,a)=>{Bc(o,`sceneTree[${a}]`,e,t,i,s)})}if(r.clipMaskGroups!==void 0&&(Array.isArray(r.clipMaskGroups)?r.clipMaskGroups.forEach((i,s)=>{Xc(i,`clipMaskGroups[${s}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),r.paintServerDefs!==void 0)if(!Array.isArray(r.paintServerDefs))e.push({path:"paintServerDefs",message:"paintServerDefs must be an array",severity:"error"});else{let i=new Set;r.paintServerDefs.forEach((s,o)=>{Gc(s,`paintServerDefs[${o}]`,e,i)})}return r.measurements!==void 0&&(Array.isArray(r.measurements)||e.push({path:"measurements",message:"measurements must be an array",severity:"error"})),{valid:e.length===0,errors:e,warnings:t}}function Nc(n){let e=new Set;if(!Array.isArray(n))return e;let t=r=>{if(r===null||typeof r!="object")return;let i=r;typeof i.id=="string"&&i.id.length>0&&e.add(i.id);let o=i.state?.children;if(Array.isArray(o))for(let a of o)t(a)};for(let r of n)t(r);return e}function Qo(n){return n.startsWith("structural:")}function Bc(n,e,t,r,i,s){if(n===null||typeof n!="object"){t.push({path:e,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=n;typeof o.id!="string"||o.id.length===0?t.push({path:`${e}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(s.has(o.id)&&t.push({path:`${e}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),s.add(o.id),!i.has(o.id)&&!Qo(o.id)&&r.push({path:`${e}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?t.push({path:`${e}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!Qo(o.parentId)&&r.push({path:`${e}.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)&&t.push({path:`${e}.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)&&t.push({path:`${e}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),o.clientId!==void 0&&typeof o.clientId!="string"&&t.push({path:`${e}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var zc=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function Gc(n,e,t,r){if(n===null||typeof n!="object"){t.push({path:e,message:"Paint server def must be a non-null object",severity:"error"});return}let i=n;typeof i.id!="string"||i.id.length===0?t.push({path:`${e}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):r.has(i.id)?t.push({path:`${e}.id`,message:`Duplicate paint server def id: "${i.id}"`,severity:"error"}):r.add(i.id),(typeof i.type!="string"||!zc.has(i.type))&&t.push({path:`${e}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof i.markup!="string"||i.markup.length===0)&&t.push({path:`${e}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),i.passthrough!==void 0&&typeof i.passthrough!="boolean"&&t.push({path:`${e}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"})}function Vc(n,e,t,r,i){if(n===null||typeof n!="object"){t.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let s=n;typeof s.id!="string"||s.id.length===0?t.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(s.id)?t.push({path:`${e}.id`,message:`Duplicate shape id: "${s.id}"`,severity:"error"}):i.add(s.id),typeof s.type!="string"?t.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):Lc.has(s.type)||r.push({path:`${e}.type`,message:`Unknown shape type: "${s.type}"`,severity:"warning"}),s.state===void 0||s.state===null||typeof s.state!="object"?t.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Wc(s.state,`${e}.state`,t,r)}var Uc=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function el(n){return typeof n=="number"?isFinite(n):typeof n=="string"?Uc.test(n):!1}function Wc(n,e,t,r){let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)n[o]!==void 0&&!el(n[o])&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of Bt){let a=n[o];if(a!=null){if(o==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(l=>typeof l=="number"&&Number.isFinite(l)))&&t.push({path:`${e}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}el(a)||t.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"})}}let s=["width","height","radius","fontSize"];for(let o of s){let a=n[o];typeof a=="number"&&a<=0&&r.push({path:`${e}.${o}`,message:`${o} should be positive (got ${a})`,severity:"warning"})}}function Hc(n,e,t,r,i){if(n===null||typeof n!="object"){t.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let s=n;typeof s.id!="string"||s.id.length===0?t.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(s.id)?t.push({path:`${e}.id`,message:`Duplicate viewbox id: "${s.id}"`,severity:"error"}):i.add(s.id);for(let o of["x","y","width","height"])(typeof s[o]!="number"||!isFinite(s[o]))&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof s.width=="number"&&s.width<=0&&t.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof s.height=="number"&&s.height<=0&&t.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function jc(n,e,t,r){if(n===null||typeof n!="object"){t.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=n;(typeof i.id!="string"||i.id.length===0)&&t.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&t.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&t.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function Kc(n,e,t){if(n===null||typeof n!="object"){t.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let r=n;(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),r.parentId!==null&&typeof r.parentId!="string"&&t.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function Xc(n,e,t){if(n===null||typeof n!="object"){t.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let r=n;(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),r.type!=="clip"&&r.type!=="mask"&&t.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof r.clipShapeId!="string"||r.clipShapeId.length===0)&&t.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(r.contentShapeIds)||t.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function _(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function lr(n={}){let e={schemaVersion:xe,shapes:n.shapes?n.shapes.map(t=>({...t})):[],viewboxes:n.viewboxes?n.viewboxes.map(t=>({...t})):[]};return n.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...n.metadata}),e}function tl(n){let{type:e,id:t,...r}=n,i={};for(let[s,o]of Object.entries(r))o!==void 0&&(i[s]=o);return{id:t??_(),type:e,state:i}}function fn(n,e,t,r,i){return{id:i??_(),x:n,y:e,width:t,height:r}}var Yc=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","sceneTree","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","paintServerDefs","rawPaintServerDefs","animationTimeline","shapes"];function ur(n,e={}){let{indent:t=2,trailingNewline:r=!0,validate:i=!1}=e;if(i){let a=dn(n);if(!a.valid){let l=a.errors.map(c=>` ${c.path}: ${c.message}`).join(`
7
- `);throw new Error(`Invalid document:
8
- ${l}`)}}let s={};for(let a of Yc){let l=n[a];if(l!==void 0)switch(a){case"shapes":s[a]=l.map(c=>Zc(nt(structuredClone(c))));break;case"viewboxes":case"guides":case"measurements":case"groups":case"sceneTree":case"clipMaskGroups":case"symbols":case"markers":case"customPatterns":case"library":case"paintServerDefs":case"rawPaintServerDefs":s[a]=Array.isArray(l)&&typeof l[0]=="string"?l:qc(l).map(ft);break;case"documentMetadata":s[a]=ft(l);break;case"animationTimeline":s[a]=ft(l);break;case"colorGlyphLibrary":s[a]=ft(l);break;default:s[a]=l}}let o=JSON.stringify(s,null,t);return r?o+`
9
- `:o}function cr(n,e={}){let{validate:t=!0,migrate:r=!0}=e,i;try{i=JSON.parse(n)}catch(o){throw new Error(`Failed to parse .svgs document: ${o.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let s=i;if(r&&(s=ar(s)),t){let o=dn(s);if(!o.valid){let a=o.errors.map(l=>` ${l.path}: ${l.message}`).join(`
1
+ "use strict";var lp=Object.defineProperty;var bw=Object.getOwnPropertyDescriptor;var vw=Object.getOwnPropertyNames;var xw=Object.prototype.hasOwnProperty;var Iw=(t,e)=>{for(var n in e)lp(t,n,{get:e[n],enumerable:!0})},ww=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vw(e))!xw.call(t,i)&&i!==n&&lp(t,i,{get:()=>e[i],enumerable:!(r=bw(e,i))||r.enumerable});return t};var kw=t=>ww(lp({},"__esModule",{value:!0}),t);var VD={};Iw(VD,{ANIMATION_MANAGER_INTERPOLATION_POLICY:()=>Rc,Arrow:()=>Hu,Audio:()=>ip,BROWSER_SVG_EXTENSION_URIS:()=>tb,BUILTIN_MARKER_ID_MAP:()=>ca,CANONICAL_NORMALIZATION_FAULT_POINTS:()=>Bx,CC_NS:()=>xr,COLLAB_PROTOCOL_VERSION:()=>xy,COMMON_PROP_DEFAULTS:()=>Ge,COMMON_TRANSFORM_NODE_DEFAULTS:()=>pp,CURRENT_SCHEMA_VERSION:()=>Tt,CanonicalDocument:()=>Kr,Circle:()=>Nu,Cloud:()=>Xu,Container:()=>Ju,ContainerShapeBuilder:()=>Nr,Cross:()=>Gu,DC_NS:()=>Dt,DEFAULT_COORDINATE_PRECISION:()=>oa,DEFAULT_RICH_TEXT_STYLE:()=>_r,DOCUMENT_FIELDS:()=>gt,DOCUMENT_FIELD_LIVE_AUTHORITY:()=>rl,DOCUMENT_INGEST_POLICIES:()=>ta,DOCUMENT_SECTION_ORDER:()=>Td,Document:()=>$a,DocumentBuilder:()=>$a,DocumentModel:()=>or,DocumentSession:()=>sl,EASING_CURVES:()=>Or,EasingType:()=>An,Ellipse:()=>Mu,Gear:()=>Uu,HEADLESS_SVG_STYLE_ENVIRONMENT:()=>Bm,Heart:()=>Wu,Hyperlink:()=>qu,IDENTITY_AFFINE:()=>Ae,INGEST_APPLY_STAGES:()=>LS,INGEST_DIAGNOSTIC_CODES:()=>PS,INGEST_DOCUMENT_ROOT_IDENTITY:()=>ws,INGEST_FEATURES:()=>Is,INGEST_FEATURE_CAPABILITIES:()=>Xl,INGEST_PLAN_VERSION:()=>Yl,INGRESS_INTENTS:()=>Hi,INLINE_CHILD_CONTAINER_TYPES:()=>ts,ImageShape:()=>ap,IngestApplicationError:()=>Ts,KNOWN_METADATA_PREFIXES:()=>js,KNOWN_STATE_KEYS:()=>gp,LIBRARY_ASSEMBLY_KIND_ORDER:()=>il,LIBRARY_EMIT_ORDER:()=>kg,Lightning:()=>Ku,Line:()=>zu,LinearGradientBuilder:()=>Ea,MARKER_HEIGHT:()=>Vd,MARKER_VIEWBOX:()=>la,MARKER_WIDTH:()=>Gd,MATHML_EXTENSION_URI:()=>$f,MAX_COORDINATE_PRECISION:()=>zd,MIGRATIONS:()=>rg,NGon:()=>Lu,NON_WIRE_PROP_KEYS:()=>uh,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS:()=>_o,NestedSvg:()=>ep,NodeSchemaRegistry:()=>Vo,PAINT_SERVER_PASSTHROUGH_ATTR:()=>Oi,PRESENTATION_SEMANTICS:()=>Vs,PUZZLE_DEFAULTS:()=>Zg,Path:()=>op,PathCurveType:()=>cp,PathPointType:()=>sh,PatternBuilder:()=>Na,Polyline:()=>sp,RDF_NS:()=>ci,RENDER_DIAGNOSTIC_CODES:()=>Ld,RENDER_FEATURES:()=>Xx,RENDER_FEATURE_CAPABILITIES:()=>Yx,RENDER_TARGETS:()=>Ax,RICH_TEXT_STYLE_KEYS:()=>Ei,RadialGradientBuilder:()=>Aa,Rectangle:()=>Ou,Ring:()=>Vu,SAXES_SVG_XML_PARSER_HOST:()=>kf,SERIALIZED_SHAPE_STATE_KEYS:()=>dp,SHAPE_ENVELOPE_KEYS:()=>Nx,SHAPE_TRANSFORM_STATE_KEYS:()=>up,SVGSKETCH_NS:()=>vr,SVGSKETCH_PATH_EXTENSIONS:()=>Qy,SVG_CONDITIONAL_PROCESSING_ATTRIBUTES:()=>rc,SVG_IMPORT_CAPABILITY_OWNERS:()=>Ef,SVG_NAMESPACE:()=>U,SVG_NS:()=>jv,SVG_PRESENTATION_PROPERTIES:()=>$s,SceneGraph:()=>tr,SceneNode:()=>_t,ShapeBuilder:()=>at,ShapeReference:()=>tp,SpeechBubble:()=>Yu,Spiral:()=>ju,Square:()=>Du,Star:()=>Bu,SvgImportError:()=>ea,SvgXmlParserHostError:()=>Wi,Switch:()=>Zu,TYPED_FIELD_PREDICATES:()=>Us,Text:()=>_u,TextLayoutEngine:()=>aa,Timeline:()=>Au,Track:()=>Eu,Triangle:()=>Fu,VARIANT_INTERPOLATION_POLICY:()=>Ns,Video:()=>rp,View:()=>Qu,XHTML_EXTENSION_URI:()=>Cf,addSmilPointsValues:()=>bs,affine:()=>rt,affineFromArray:()=>cs,affineToArray:()=>it,almostEqualAffine:()=>Ak,animationBackwardsFillTrack:()=>Bp,animationCycleDuration:()=>_p,animationTrackActiveEnd:()=>Lp,animationTrackDocumentBegin:()=>Fp,applyAffineToPoint:()=>Fe,applyAffineToVector:()=>ml,applyClipMaskGroupDelta:()=>rr,applyClipMaskPlanToShapes:()=>Bg,applyCssAnimationLonghandOverrides:()=>jp,applyGuideDeltaOp:()=>Wo,applyIngestPlan:()=>BS,applyMeasurementDeltaOp:()=>Ko,applyMetadataDeltaOp:()=>_h,applyOpToSnapshot:()=>tl,applyOpsInPlace:()=>Ap,applyOpsToSnapshot:()=>gy,applyOpsToSnapshotWithAccepted:()=>Np,applyRichTextFormat:()=>qo,applyTextSplice:()=>Lh,applyTextTransform:()=>da,applyTimingFunctionToKeyframe:()=>Dp,arcEndpointToCenter:()=>af,areTracksTimingEquivalent:()=>Dg,around:()=>Wp,assembleLibraryDefs:()=>Mp,assembleSvgFromPlan:()=>Hg,assertIngestFeatureRegistry:()=>AS,assertIngestPolicyRegistry:()=>Jm,assertSvgImportCapabilityOwners:()=>sb,buildCompoundTransformValues:()=>iu,buildFreshMetadataBlock:()=>td,buildGuideDeltaOps:()=>Oh,buildManagedChildren:()=>rd,buildManagedDescription:()=>Sm,buildMeasurementDeltaOps:()=>Dh,buildMetadataDeltaOps:()=>zh,buildRenderPlan:()=>sn,buildSmilKeyframeData:()=>Ar,buildSmilKeyframes:()=>pn,buildSvgDestinationIdentityIndex:()=>gE,buildSymbolMaterializationPlan:()=>uu,canonicalPolygonTransformString:()=>Xp,canonicalTransformMatrix:()=>Jt,canonicalTransformString:()=>pt,classifySvgExternalAssetUrl:()=>Ir,clipMaskDefinitionFromGroup:()=>Ja,clipMaskDefinitionsFromGroups:()=>xn,clipMaskGroupDefId:()=>Ia,clipMaskGroupDefinitionId:()=>St,clipMaskGroupIsRawBacked:()=>Za,clipMaskGroupWithDefinition:()=>Gr,clipMaskOwnedDefIds:()=>hu,collaborationResourceKey:()=>kp,collectDocumentEnvelopeLibraryReferenceIds:()=>Xd,collectFontFamiliesFromPlan:()=>Ug,collectMarkerReferences:()=>ni,collectReferencedLibraryDefs:()=>fa,collectReferencedMarkerIds:()=>FS,collectUnknownDocumentFields:()=>Pd,compareOrderKeys:()=>Go,composeLegacyTransformMatrix:()=>ms,computeArrowVertices:()=>wl,computeCloudPath:()=>Pl,computeCrossVertices:()=>Il,computeDashArray:()=>Ml,computeFlowchartBoxPath:()=>Nl,computeGearPath:()=>El,computeGearVertices:()=>nf,computeHeartPath:()=>Tl,computeLightningVertices:()=>Rl,computePolygonVertices:()=>ys,computeRectanglePath:()=>Al,computeRingPath:()=>Cl,computeSpeechBubbleVertices:()=>kl,computeSpiralPath:()=>$l,computeSplinePath:()=>cr,computeStarVertices:()=>xl,computeSvgViewportMatrix:()=>ZR,containerTransformNeedsContentPivot:()=>Ct,createDocument:()=>co,createSceneNode:()=>Dr,createShape:()=>fx,createSvgDestinationIdAllocator:()=>hE,createViewbox:()=>ui,createWordSearchPrimitiveMask:()=>Sw,cssAnimationFillField:()=>Hp,cssNamedColorToRgb:()=>eo,cubicBezierExtent1D:()=>Fl,cubicBezierToEasingFields:()=>al,customPatternDefToLibraryDef:()=>Bn,declaredRichTextDeltaKeys:()=>Xa,decodeCssEscapes:()=>zi,decomposeAffine2D:()=>ps,defaultVariableMode:()=>Tw,deriveRichTextFormatRanges:()=>Wh,deriveSegments:()=>Ln,deriveTextSplice:()=>Fh,documentObjectBounds:()=>$x,downTranslateAnimationKeyframeOps:()=>Sy,downTranslateCollectionMoveOps:()=>vy,downTranslateDocumentFieldOps:()=>Iy,downTranslateScenePlaceOps:()=>yy,downTranslateTextFormatOps:()=>by,ellipticalArcBounds:()=>lf,emptyDocumentMetadata:()=>ol,escXml:()=>de,evaluateParsedTimingFunction:()=>zp,evaluateSvgConditionalProcessing:()=>nb,extractVariables:()=>Dd,fillPaintServerReference:()=>fm,filterAttr:()=>Ov,filterChainExtendsBounds:()=>lm,filterDefinitionEnvelope:()=>jc,filterReferenceValue:()=>Gs,finalizeRenderPlan:()=>xu,findShapeById:()=>Wr,fingerprintIngestSource:()=>NS,flattenShapeStateTree:()=>Ba,flattenStateExtra:()=>er,flattenUnknownDocumentFields:()=>yo,foldLegacyAncestorTransformIntoMatrix:()=>Kp,forEachLibraryRefInState:()=>_S,forEachMarkerRefInState:()=>DS,forEachReachableShape:()=>Rs,forEachShapeInLibraryDefs:()=>ql,formatOperationValidationIssues:()=>Ah,formatSmilKeySpline:()=>Zd,formatSmilKeyTime:()=>ht,freezeIngestPlan:()=>MS,freezeSiblingOrderKeys:()=>ns,generateCode:()=>$u,generateCodeWithDiagnostics:()=>qg,generateCssCode:()=>Cu,generateD3Code:()=>Pu,generateId:()=>W,generatePatternSvgContent:()=>Lc,generatePuzzlePieces:()=>JI,generateReactCode:()=>ku,generateSudokuPuzzle:()=>cw,generateSvgCode:()=>Iu,generateVueCode:()=>Ru,generateWordSearch:()=>yw,getBuiltInMarkerDefs:()=>nI,getEasingCubicBezier:()=>Rw,getEffectivePrecision:()=>_d,getIngestFeatureCapability:()=>ES,getIngestFieldPolicy:()=>Ps,getKeyframeCubicBezier:()=>Ng,getLicenseLabel:()=>ym,getLicenseUrl:()=>hm,getMarkerDescriptors:()=>gi,getPatternElements:()=>Ls,getShapeGeometryKernel:()=>ji,getSmilAdditive:()=>tu,getSmilBeginValue:()=>hi,getSmilFillMode:()=>yi,getSmilMotionKeyPoints:()=>nu,getSmilRepeatCount:()=>eu,getSmilSetBeginValue:()=>Qd,getSmilTrackDuration:()=>Er,getSvgPropertySemantics:()=>mr,getSvgSourceAttribute:()=>E,getSvgSourceHref:()=>Pe,getWordSearchDirections:()=>rh,hasAnyTypedMetadataField:()=>ed,hasSvgSourceAttribute:()=>ot,importSvg:()=>Rd,importSvgWithDiagnostics:()=>Zm,indexLibraryDefinitions:()=>uo,initialOrderKeys:()=>Fa,injectClipMaskReference:()=>Su,inspectCssTransformValue:()=>Jp,interpolateAngle:()=>Xf,interpolateCharOffsetArray:()=>tv,interpolateColor:()=>Yf,interpolateDasharrayLists:()=>kC,interpolateGradient:()=>nv,interpolateNumericArray:()=>kc,interpolatePathData:()=>IC,interpolatePlainObject:()=>rv,interpolatePointArray:()=>Qb,interpolatePolylinePoints:()=>wC,interpolateShapeTrees:()=>iv,interpolateSplinePointArray:()=>ev,invertAffine:()=>Nk,isColorValue:()=>vC,isCssNamedColor:()=>wc,isDefaultKeyPoints:()=>Jd,isDefaultKeyTimes:()=>ga,isFiniteAffineArray:()=>Un,isGradientLike:()=>Kf,isIdentityAffine:()=>Bt,isIdentityLinearSplines:()=>Og,isIndefiniteSetTrack:()=>ha,isNumericArray:()=>Yn,isReusablePatternTile:()=>Zo,isSetSequenceTrack:()=>ya,isSvgPresentationProperty:()=>lc,isValidOrderKey:()=>Bo,keyBetween:()=>wi,keysBetween:()=>_a,layoutText:()=>tI,legacyEndpointMarkerId:()=>ks,lerpNumber:()=>Ie,linearGradient:()=>HI,linearGradientEnvelope:()=>Gc,lintWordSearchOptions:()=>ih,mapAnimationTrackTime:()=>Sk,matchCubicBezierToPreset:()=>Ey,materializeSceneTreeOrderKeys:()=>hy,matrixTransformPart:()=>fs,maxCollaborationTimestamp:()=>ty,mergeRichTextStyle:()=>$i,migrateLegacySplineShape:()=>Cd,migrateLegacySplines:()=>Mx,migrateLegacyViewboxesToViews:()=>na,migrateSnapshot:()=>vo,migrateV6toV7:()=>ng,motionPathD:()=>Ra,moveResourceById:()=>Ci,multiplyAffine:()=>ce,mutateSvgClipMaskDefinitionMarkup:()=>ax,nodeSchemas:()=>se,normalizeClipMaskGroups:()=>Ft,normalizeLegacyShapeAliases:()=>bo,normalizePaintServerDef:()=>rs,normalizeRichTextRuns:()=>Fr,normalizeRichTextStyle:()=>vn,normalizeRichTextStyleDelta:()=>Yo,normalizeSmilPointsValue:()=>yS,normalizeSnapshotStructure:()=>jx,normalizeSnapshotToCanonicalDocument:()=>Ux,normalizeSnapshotToInlineChildren:()=>Ed,orderSiblings:()=>tt,paintServerDefsFromRawFragments:()=>is,parseColor:()=>Ms,parseCssAnimationShorthand:()=>cl,parseCssTimingFunction:()=>Xr,parseCssTransformOrigin:()=>Zp,parseDocument:()=>Md,parseDocumentWithDiagnostics:()=>sg,parseInterpolationNumbers:()=>xC,parsePreserveAspectRatio:()=>Ki,parseSmilAdditive:()=>Ul,parseSmilClockValue:()=>Vn,parseSmilDuration:()=>Hl,parseSmilFillField:()=>pf,parseSmilKeySplines:()=>Kn,parseSmilKeyTimes:()=>Wn,parseSmilRepeatSettings:()=>uf,parseSmilValues:()=>dr,parseSvgAbsoluteLength:()=>Mt,parseSvgLength:()=>he,parseSvgLengthList:()=>pl,parseSvgLengthToken:()=>nt,parseSvgPathData:()=>Hn,parseSvgRootFrame:()=>Jl,parseSvgSourceDocument:()=>mn,parseSvgStyleAttribute:()=>Mb,parseSvgTransformList:()=>Ot,parseSvgViewBox:()=>Ue,parseVariableArgs:()=>Zx,parseWordSearchWords:()=>gw,partitionShapeStateTree:()=>La,partitionStateExtra:()=>jo,partitionUnknownDocumentFields:()=>So,pathCommandStructuresMatch:()=>Jb,pathDataBounds:()=>en,pattern:()=>KI,patternDefinitionEnvelope:()=>Bc,patternLibraryDefToCustomPatternDef:()=>Ai,patternTileSize:()=>xp,pickCssAnimationListItem:()=>ss,planClipMaskGroups:()=>yu,planSnapshotExternalEffects:()=>px,planSvgAnimations:()=>bc,planSvgAuthoredAttributes:()=>mc,planSvgClipMasks:()=>Cc,planSvgConditionalProcessing:()=>ic,planSvgContainerHierarchy:()=>nc,planSvgEmbeddedFrames:()=>tc,planSvgExternalEffects:()=>md,planSvgFilters:()=>_c,planSvgGradients:()=>Ec,planSvgImport:()=>gd,planSvgLeafGeometry:()=>Ic,planSvgMarkers:()=>$c,planSvgMetadata:()=>sd,planSvgPaintServerDefinitions:()=>Mc,planSvgPatterns:()=>Ac,planSvgResourceDependencies:()=>fc,planSvgScripts:()=>Fc,planSvgSourceIdentifiers:()=>oc,planSvgStyleCascade:()=>yc,planSvgSymbolUses:()=>uc,planSvgUseOccurrences:()=>ac,planSvgViews:()=>Ql,planTransformFusion:()=>ru,planVariantTransitionsCss:()=>GI,planVariantTransitionsSmil:()=>BI,planVariantTransitionsWaapi:()=>VI,prepareSvgAuthorCssForLiveProjection:()=>Ks,prepareSvgExternalAssetUrlForLiveProjection:()=>Em,prepareSvgMarkupForLiveProjection:()=>ox,prepareSvgXmlSource:()=>If,preserveAspectRatioAlignFactor:()=>Rf,projectCssTransformStops:()=>Qp,projectPresentation:()=>oo,projectPresentationEntry:()=>Jc,projectSceneTreeOntoClipMaskGroups:()=>Ni,projectSceneTreeOntoShapes:()=>Hr,projectSvgAnimationPlan:()=>gf,projectSvgAnimationTimeline:()=>Wl,projectSvgImportToSnapshot:()=>qm,promoteManagedDescription:()=>bm,promoteRebasedShapeUpdateClock:()=>ny,pruneAndWrapSubtree:()=>wa,quadraticBezierExtent1D:()=>Ll,radialGradient:()=>WI,radialGradientEnvelope:()=>Vc,rebaseRichTextFormatRanges:()=>Hh,rebaseRichTextRuns:()=>Kh,reflectCubicBezier:()=>ma,registeredShapeGeometryTypes:()=>gS,removeResourceById:()=>dt,removeResourceByKey:()=>Ua,removeResourceByName:()=>Wa,removeTrackKeyframe:()=>$p,renderAnimationElements:()=>lu,renderBuiltinMarkerDefs:()=>Kd,renderCircle:()=>pg,renderDescriptiveElements:()=>od,renderDocumentScripts:()=>mu,renderDocumentStyles:()=>fu,renderEllipse:()=>fg,renderFilterDefs:()=>Mv,renderFilterElement:()=>Bs,renderFilterLibraryDef:()=>Ag,renderFilterPrimitive:()=>Wc,renderFilterPrimitivesForType:()=>dm,renderFlowchartBox:()=>Ig,renderForeignObject:()=>vg,renderGradientDefs:()=>dI,renderImage:()=>bg,renderLibraryDef:()=>Rg,renderLibraryDefs:()=>pa,renderLine:()=>gg,renderLinearGradient:()=>Ro,renderLinearGradientLibraryDef:()=>Cg,renderMarkerLibraryDef:()=>Pg,renderPaintServerDefs:()=>gu,renderPatternLibraryDef:()=>Eg,renderPlanDefsBody:()=>Et,renderPolygonShape:()=>wg,renderPolyline:()=>Sg,renderRadialGradient:()=>To,renderRadialGradientLibraryDef:()=>$g,renderRectangle:()=>mg,renderReferencedLibraryDefs:()=>mI,renderResolvedSymbolLibraryDef:()=>Po,renderShape:()=>on,renderShapeContextForLibrary:()=>Cr,renderSpline:()=>yg,renderSvgPrimitiveChainFilter:()=>cm,renderSymbolInstance:()=>xg,renderSymbolLibraryDef:()=>Tg,renderTemplateVariablesStyle:()=>pu,renderText:()=>hg,renderToSvg:()=>Eo,renderToSvgWithDiagnostics:()=>Ca,replaceClipMaskDefinition:()=>Qa,replaceClipMaskGroupsInSceneTree:()=>ir,replaySceneTreePlacements:()=>wy,resolveContainerTransform:()=>po,resolveContainerTransformFromContentBounds:()=>Ys,resolveCssAnimationEasingType:()=>Vp,resolveEmbeddedSvgTransform:()=>Rr,resolveEmbeddedSvgViewportFrameBounds:()=>Rx,resolveInlineContainerTransform:()=>Id,resolveMetadataQName:()=>nd,resolveRichTextStyleAt:()=>Uh,resolveShapeGeometry:()=>jt,resolveShapeLocalObjectBounds:()=>bd,resolveShapeObjectBounds:()=>ho,resolveShapeReferenceTransform:()=>vd,resolveSvgGradientGeometry:()=>rm,resolveSvgLengthToken:()=>jn,resolveSvgPatternTile:()=>im,resolveSvgViewport:()=>ri,resolveSymbolInstanceContent:()=>ei,resolveSymbolInstanceShapes:()=>uS,resolveSymbolInstanceTransform:()=>xd,resolveSymbolViewport:()=>fo,rewriteDocumentEmbeddedPayloads:()=>qx,rewriteIdReferencesInMarkup:()=>vu,rewriteShapeStateEmbeddedPayloads:()=>Ad,rewriteSvgResourceReferenceValue:()=>xb,richTextFontVariantCss:()=>wo,richTextLineSpans:()=>bp,richTextRunsFromState:()=>Br,richTextStyleDelta:()=>Ka,richTextStyleDeltasEqual:()=>Ya,richTextStylesEqual:()=>Fn,richTextTspanAttributes:()=>jd,rootMetadataAttrs:()=>id,rootPaintServerDefId:()=>Di,rotateAffine:()=>Fi,roundCoord:()=>bn,roundMarkupCoordinates:()=>Vg,roundNumberString:()=>sa,roundSerializedShape:()=>cg,roundSnapshot:()=>Jx,runsFromSegments:()=>Lr,sanitizeRichTextFormatRanges:()=>qa,sanitizeXmlId:()=>Pn,scaleAffine:()=>qr,scanCssFunctionTokens:()=>cn,scanCssLocalUrlTokens:()=>wn,senderCorrectionsForOp:()=>fy,serializeSvgPathData:()=>zl,serializedPresentationReader:()=>Zn,shapeLocalObjectBounds:()=>Ss,shapeLocalObjectCenter:()=>Vl,shapeObjectBoundsInSpace:()=>hd,skewXAffine:()=>ds,skewYAffine:()=>us,smilKeyframeAttributes:()=>Sa,snapshotBoundsView:()=>kr,solveCubicBezier:()=>Mg,solveSudoku:()=>Oa,splinePathBounds:()=>lS,splitCssAnimationList:()=>os,splitCssTopLevel:()=>Yr,splitCssTopLevelRanges:()=>In,splitTopLevelElements:()=>Pa,stringifyDocument:()=>Nd,stripAnimationDeclarations:()=>ba,strokePaintServerReference:()=>mm,substituteString:()=>Od,substituteVariables:()=>ia,symbolInstanceTargetId:()=>Gi,synthesizeCssAnimationShorthand:()=>Up,templateVariablesCss:()=>va,transformSplice:()=>Xo,transformSvgPathData:()=>iS,translateAffine:()=>_e,translateSvgPathData:()=>rS,tryParseSvgTransformList:()=>Gt,upsertResourceById:()=>ct,upsertResourceByKey:()=>ja,upsertResourceByName:()=>Ha,upsertTrackKeyframe:()=>Cp,validateDocumentOperations:()=>$h,validateOperation:()=>Va,validatePresenceOperation:()=>Eh,validateSnapshot:()=>wr,validateSudokuPuzzle:()=>lw,verticesToPath:()=>un,visitShapeTree:()=>qt,visitSnapshotShapeTrees:()=>Nt});module.exports=kw(VD);var An=(O=>(O.LINEAR="linear",O.EASE="ease",O.EASE_IN="ease-in",O.EASE_OUT="ease-out",O.EASE_IN_OUT="ease-in-out",O.EASE_IN_QUAD="ease-in-quad",O.EASE_OUT_QUAD="ease-out-quad",O.EASE_IN_OUT_QUAD="ease-in-out-quad",O.EASE_IN_CUBIC="ease-in-cubic",O.EASE_OUT_CUBIC="ease-out-cubic",O.EASE_IN_OUT_CUBIC="ease-in-out-cubic",O.EASE_IN_QUART="ease-in-quart",O.EASE_OUT_QUART="ease-out-quart",O.EASE_IN_OUT_QUART="ease-in-out-quart",O.EASE_IN_SINE="ease-in-sine",O.EASE_OUT_SINE="ease-out-sine",O.EASE_IN_OUT_SINE="ease-in-out-sine",O.EASE_IN_QUINT="ease-in-quint",O.EASE_OUT_QUINT="ease-out-quint",O.EASE_IN_OUT_QUINT="ease-in-out-quint",O.EASE_IN_EXPO="ease-in-expo",O.EASE_OUT_EXPO="ease-out-expo",O.EASE_IN_OUT_EXPO="ease-in-out-expo",O.EASE_IN_CIRC="ease-in-circ",O.EASE_OUT_CIRC="ease-out-circ",O.EASE_IN_OUT_CIRC="ease-in-out-circ",O.EASE_IN_BACK="ease-in-back",O.EASE_OUT_BACK="ease-out-back",O.EASE_IN_OUT_BACK="ease-in-out-back",O.CUSTOM_BEZIER="custom-bezier",O.LINEAR_FUNCTION="linear-function",O.STEPS="steps",O))(An||{}),Or={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 Rw(t){let e=Or[t];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var cp=(a=>(a.LINEAR="linear",a.QUADRATIC="quadratic",a.CUBIC="cubic",a.CATMULL_ROM="catmull-rom",a.ARC="arc",a.BASIS="basis",a.MIXED="mixed",a))(cp||{}),sh=(r=>(r.SMOOTH="smooth",r.CORNER="corner",r.SYMMETRIC="symmetric",r))(sh||{});function Tw(t){return t==="color"?"live":"stamped"}var dp=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","ancestorTransform","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","groupId","structural","displayMode","display","visibility","inheritFill","inheritStroke","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","filterLibraryIds","fillRuleExplicit","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","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","fontSize","text","fontFamily","fontWeight","fontStyle","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","richTextData","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapeInsideImportRefId","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathRefShapeId","textPathImportRefId","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","rawContent","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","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","isHomeView","children","viewLinkedSvgId"],Tt=8;var up=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],_o=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],pp={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null};var Nn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",za=Nn.length,Mn=Nn[0],ah=Nn[za-1],ch=Nn[Math.floor(za/2)],fp=97,Pw=122;function Ii(t){let e=Nn.indexOf(t);if(e===-1)throw new Error(`order-key: invalid digit '${t}'`);return e}function Cw(t){let e=t.charCodeAt(0);if(e<fp||e>Pw)throw new Error(`order-key: invalid head '${t}'`);return e-fp+1}function Qn(t){if(t<1||t>26)throw new Error(`order-key: integer length ${t} out of range`);return String.fromCharCode(fp+t-1)}function Fo(t){let e=Cw(t[0]);if(t.length<1+e)throw new Error(`order-key: '${t}' shorter than its integer part`);let n=t.slice(1,1+e),r=t.slice(1+e);for(let i of n)Ii(i);for(let i of r)Ii(i);return{integer:n,fraction:r}}function Da(t){for(let e of t)if(e!==Mn)return!1;return!0}function Bo(t){if(t.length===0)return!1;try{let{integer:e,fraction:n}=Fo(t);return!(n.endsWith(Mn)||Da(e)&&n.length===0||e.length>1&&e[0]===Mn)}catch{return!1}}function lh(t,e){if(!Bo(t))throw new Error(`order-key: invalid ${e} '${t}'`)}function Go(t,e){return t<e?-1:t>e?1:0}function $w(t){let e=t.split("");for(let n=e.length-1;n>=0;n--){let r=Ii(e[n]);if(r<za-1){e[n]=Nn[r+1];for(let i=n+1;i<e.length;i++)e[i]=Mn;return e.join("")}}return null}function mp(t){let{integer:e}=Fo(t),n=$w(e);if(n!==null)return Qn(e.length)+n;let r="1"+Mn.repeat(e.length);return Qn(r.length)+r}function Ew(t){let e=t.split("");for(let n=e.length-1;n>=0;n--){let r=Ii(e[n]);if(r>0){e[n]=Nn[r-1];for(let i=n+1;i<e.length;i++)e[i]=ah;return e.join("")}e[n]=ah}throw new Error(`order-key: cannot decrement zero integer '${t}'`)}function Aw(t){let e=0;for(;e<t.length-1&&t[e]===Mn;)e++;return t.slice(e)}function Nw(t){let{integer:e,fraction:n}=Fo(t);if(!Da(e)){let r=Ew(e);if(!Da(r)){let i=Aw(r);return Qn(i.length)+i}return Qn(1)+Mn+ch}return Qn(1)+Mn+Lo("",n)}function Lo(t,e){if(e!==null){if(e.length===0||t>=e)throw new Error(`order-key: fraction bounds out of order ('${t}' >= '${e}')`);let i=0;for(;i<e.length&&(t[i]??Mn)===e[i];)i++;if(i>0)return e.slice(0,i)+Lo(t.slice(i),e.slice(i))}let n=t.length>0?Ii(t[0]):0,r=e!==null?Ii(e[0]):za;return r-n>1?Nn[Math.floor((n+r)/2)]:Nn[n]+Lo(t.slice(1),null)}function wi(t,e){if(t!==null&&lh(t,"lower bound"),e!==null&&lh(e,"upper bound"),t!==null&&e!==null&&t>=e)throw new Error(`order-key: bounds out of order ('${t}' >= '${e}')`);if(t===null&&e===null)return Qn(1)+"1";if(t===null)return Nw(e);if(e===null)return mp(t);let n=Fo(t),r=Fo(e),i=Qn(n.integer.length)+n.integer,o=Qn(r.integer.length)+r.integer;if(i===o)return i+Lo(n.fraction,r.fraction);let s=mp(i+(Da(n.integer)?ch:""));return Go(s,e)<0?s:i+Lo(n.fraction,null)}function _a(t,e,n){if(n<=0)return[];let r=[],i=t;for(let o=0;o<n;o++){let s=wi(i,e);r.push(s),i=s}return r}function Fa(t){if(t<=0)return[];let e=[],n=wi(null,null);e.push(n);for(let r=1;r<t;r++)n=mp(n),e.push(n);return e}var Vo=class{schemas=new Map;register(e,n){this.schemas.set(e,n)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let n=this.schemas.get(e);if(!n)return{};let r={};for(let i of Object.keys(n))r[i]=n[i].default;return r}validate(e,n,r){let i=this.schemas.get(e);if(!i)return r;let o=i[n];return o?.validate?o.validate(r):r}},le=t=>Math.max(0,t),ki=t=>Math.max(0,Math.min(1,t)),We=t=>Math.max(0,Math.min(100,t)),Mw=t=>Math.max(1,t),Ow=t=>Math.max(3,Math.min(100,Math.floor(t))),Dw=t=>Math.max(3,Math.min(50,Math.floor(t))),zw=t=>Math.max(3,Math.min(30,Math.floor(t))),_w=t=>Math.max(1,Math.min(10,t));function Fw(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,{default:n}]))}var Lw=Fw(pp),Ge={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:ki},fillOpacity:{default:1,validate:ki},strokeOpacity:{default:1,validate:ki},...Lw,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:Mw},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},groupId:{default:null}},Yt={...Ge,cx:{default:0},cy:{default:0},radius:{default:50,validate:le},cornerRadius:{default:0,validate:le},shiftAngle:{default:0}},Ri={...Ge,x:{default:0},y:{default:0},width:{default:100,validate:le},height:{default:60,validate:le}},dh={...Ge,x:{default:0},y:{default:0},width:{default:0,validate:le},height:{default:0,validate:le},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:ki},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:ki},fadeInDuration:{default:0,validate:le},fadeOutDuration:{default:0,validate:le},posterHref:{default:""},sourceRect:{default:null}},se=new Vo;se.register("rectangle",{...Ge,x:{default:0},y:{default:0},width:{default:100,validate:le},height:{default:100,validate:le},rx:{default:0,validate:le},ry:{default:0,validate:le},cornerRadius:{default:0,validate:le},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:le},cornerRadiusTR:{default:0,validate:le},cornerRadiusBL:{default:0,validate:le},cornerRadiusBR:{default:0,validate:le},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});se.register("square",{...Ge,x:{default:0},y:{default:0},size:{default:100,validate:le},width:{default:100,validate:le},height:{default:100,validate:le},rx:{default:0,validate:le},ry:{default:0,validate:le},cornerRadius:{default:0,validate:le},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:le},cornerRadiusTR:{default:0,validate:le},cornerRadiusBL:{default:0,validate:le},cornerRadiusBR:{default:0,validate:le},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});se.register("circle",{...Ge,x:{default:0},y:{default:0},radius:{default:50,validate:le}});se.register("ellipse",{...Ge,cx:{default:0},cy:{default:0},rx:{default:50,validate:le},ry:{default:30,validate:le}});se.register("line",{...Ge,x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});se.register("text",{...Ge,x:{default:0},y:{default:0},width:{default:0,validate:le},height:{default:0,validate:le},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{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},richTextData:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},shapeInsideRef:{default:null},shapePadding:{default:0}});se.register("image",{...Ge,x:{default:0},y:{default:0},width:{default:100,validate:le},height:{default:100,validate:le},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:ki}});se.register("path",{...Ge,x:{default:0},y:{default:0},width:{default:0,validate:le},height:{default:0,validate:le},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});se.register("polyline",{...Ge,x:{default:0},y:{default:0},width:{default:0,validate:le},height:{default:0,validate:le},polylinePoints:{default:[]},polylineClosed:{default:!1}});se.register("triangle",{...Yt,sides:{default:3}});se.register("ngon",{...Yt,sides:{default:6,validate:Ow}});se.register("star",{...Yt,arms:{default:5,validate:Dw},innerRadiusPercent:{default:40,validate:We}});se.register("cross",{...Yt,armWidthPercent:{default:30,validate:We}});se.register("ring",{...Yt,innerRadiusPercent:{default:50,validate:We}});se.register("spiral",{...Yt,turns:{default:3,validate:_w},thicknessPercent:{default:15,validate:We},spiralDirection:{default:1}});se.register("gear",{...Yt,teeth:{default:8,validate:zw},toothDepthPercent:{default:25,validate:We},holeRadiusPercent:{default:20,validate:We}});se.register("arrow",{...Yt,headWidthPercent:{default:100,validate:We},headLengthPercent:{default:40,validate:We},shaftWidthPercent:{default:40,validate:We}});se.register("symbol-instance",{...Ge,x:{default:0},y:{default:0},width:{default:100,validate:le},height:{default:100,validate:le},symbolId:{default:""}});se.register("group",{...Ge,groupId:{default:null}});se.register("container",{...Ge,groupId:{default:null}});se.register("cloud",{...Yt,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:We}});se.register("heart",{...Yt,lobeRadiusPercent:{default:50,validate:We},cleftDepthPercent:{default:25,validate:We}});se.register("lightning",{...Yt,boltSegments:{default:3},boltWidthPercent:{default:30,validate:We},boltJaggednessPercent:{default:40,validate:We}});se.register("speechBubble",{...Yt,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:We},tailWidthPercent:{default:25,validate:We}});se.register("diamond",{...Ri});se.register("parallelogram",{...Ri,slantPercent:{default:20,validate:We}});se.register("trapezoid",{...Ri,topWidthPercent:{default:70,validate:We}});se.register("terminator",{...Ri});se.register("cylinder",{...Ri,capHeightPercent:{default:15,validate:We}});se.register("document-shape",{...Ri,waveAmplitudePercent:{default:15,validate:We}});se.register("hyperlink",{...Ge,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});se.register("switch",{...Ge,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});se.register("svg",{...Ge});se.register("view",{...Ge,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:le},viewBoxHeight:{default:0,validate:le},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});se.register("shape-reference",{...Ge,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:le},targetHeight:{default:0,validate:le},broken:{default:!1}});se.register("foreign-object",{...Ge,x:{default:0},y:{default:0},width:{default:0,validate:le},height:{default:0,validate:le},rawContent:{default:""}});se.register("video",{...dh,mediaKind:{default:"video"}});se.register("audio",{...dh,mediaKind:{default:"audio"}});se.register("document",{});function On(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function qt(t,e,n=""){if(!On(t))return;e.onShape?.(t,n);let r=t.state;if(!On(r))return;let i=r.children;if(Array.isArray(i)&&i.forEach((o,s)=>{qt(o,e,`${n}.state.children[${s}]`)}),e.onState){let o=r.symbolOverrides;if(On(o))for(let[s,a]of Object.entries(o))On(a)&&e.onState(a,`${n}.state.symbolOverrides[${s}]`);e.onState(r,`${n}.state`)}}function Ti(t,e,n){Array.isArray(t)&&t.forEach((r,i)=>qt(r,e,`${n}[${i}]`))}function Nt(t,e,n={}){if(On(t)&&(Ti(t.shapes,e,"shapes"),Array.isArray(t.library)&&t.library.forEach((r,i)=>{if(On(r))if(r.kind==="symbol"){if(Ti(r.shapes,e,`library[${i}].shapes`),On(r.variants))for(let[o,s]of Object.entries(r.variants))Ti(s,e,`library[${i}].variants[${o}]`)}else r.kind==="marker"&&Ti(r.shapes,e,`library[${i}].shapes`)}),n.includeDeprecatedSymbols)){let r=t.symbols;Array.isArray(r)&&r.forEach((i,o)=>{if(On(i)&&(Ti(i.shapes,e,`symbols[${o}].shapes`),On(i.variants)))for(let[s,a]of Object.entries(i.variants))Ti(a,e,`symbols[${o}].variants[${s}]`)})}}function Bw(){let t=new Set(dp);for(let e of up)t.add(e);for(let e of se.typeIds())for(let n of Object.keys(se.getDefaults(e)))t.add(n);return t.delete("scaleAnchor"),t.delete("extra"),t}var gp=Bw(),uh=new Set(["scaleAnchor","displayAttr"]);function jo(t){let e=t.extra&&typeof t.extra=="object"&&!Array.isArray(t.extra)?t.extra:void 0;for(let n of Object.keys(t)){if(n==="extra"||gp.has(n))continue;let r=t[n];delete t[n],r!==void 0&&((e??={})[n]=r)}return e&&Object.keys(e).length>0?t.extra=e:delete t.extra,t}function La(t){return qt(t,{onState:e=>{jo(e)}}),t}function Ba(t){return qt(t,{onState:e=>{er(e)}}),t}function er(t){let e=t.extra;if(!e||typeof e!="object"||Array.isArray(e))return delete t.extra,t;for(let[n,r]of Object.entries(e))n!=="extra"&&(n in t||(t[n]=r));return delete t.extra,t}function Dr(t,e,n,r="verbatim"){if(r==="verbatim")return new _t(t,e,n&&"extra"in n?er({...n}):n);let i={...se.getDefaults(e),...n},o=se.get(e);if(o)for(let s of Object.keys(i)){let a=o[s];a?.validate&&i[s]!==void 0&&(i[s]=a.validate(i[s]))}return new _t(t,e,i)}var _t=class t{static writeHook=null;static _baseReadDepth=0;static withBaseProps(e){t._baseReadDepth++;try{return e()}finally{t._baseReadDepth--}}id;type;parent=null;children=[];onChange=null;_props;_dirty=new Set;_preservedSerializedState=null;_overlay=null;_propTimestamps=new Map;constructor(e,n,r){this.id=e,this.type=n,this._props=r?{...r}:{}}get(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}set(e,n){this._props[e]!==n&&(this._preservedSerializedState=null,t.writeHook?.(this,e),this._props[e]=n,this._dirty.add(e),this.onChange?.(this,this._dirty))}getProp(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}getBaseProp(e){return this._props[e]}setProp(e,n){this._props[e]!==n&&(this._preservedSerializedState=null,t.writeHook?.(this,e),this._props[e]=n,this._dirty.add(e),this.onChange?.(this,this._dirty))}deleteProp(e){e in this._props&&(this._preservedSerializedState=null,t.writeHook?.(this,e),delete this._props[e],this._dirty.add(e),this.onChange?.(this,this._dirty))}setMany(e){let n=!1;for(let[r,i]of Object.entries(e))this._props[r]!==i&&(this._preservedSerializedState=null,t.writeHook?.(this,r),this._props[r]=i,this._dirty.add(r),n=!0);n&&this.onChange?.(this,this._dirty)}setOverlayValue(e,n){this._overlay===null&&(this._overlay=new Map),this._overlay.set(e,n)}deleteOverlayValue(e){if(this._overlay===null)return!1;let n=this._overlay.delete(e);return this._overlay.size===0&&(this._overlay=null),n}getOverlayValue(e){return this._overlay?.get(e)}hasOverlayValue(e){return this._overlay?.has(e)??!1}overlayKeys(){return this._overlay?[...this._overlay.keys()]:[]}clearOverlay(){if(this._overlay===null)return[];let e=[...this._overlay.keys()];return this._overlay=null,e}get hasOverlay(){return this._overlay!==null}getDirtyKeys(){return this._dirty}clearDirty(){this._dirty.clear()}isDirty(){return this._dirty.size>0}getProps(){return this._props}snapshotProps(){return structuredClone(this._props)}restoreProps(e){this._preservedSerializedState=null,this._props=structuredClone(e);for(let n of Object.keys(this._props))this._dirty.add(n);this.onChange?.(this,this._dirty)}getPropStamp(e){return this._propTimestamps.get(e)??null}stampProp(e,n,r){this._propTimestamps.set(e,{ts:n,clientId:r})}stampProps(e,n,r){let i={ts:n,clientId:r};for(let o of e)this._propTimestamps.set(o,i)}getPropStampsForKeys(e){let n={};for(let r of e){let i=this._propTimestamps.get(r);i&&(n[r]=i.ts)}return n}setPropIfWins(e,n,r,i){let o=this._propTimestamps.get(e),s=o?.ts??0,a=o?.clientId??"";return r>s||r===s&&i>a?(this._preservedSerializedState=null,n===null?delete this._props[e]:this._props[e]=n,this._propTimestamps.set(e,{ts:r,clientId:i}),this._dirty.add(e),!0):!1}snapshotPropTimestamps(){return new Map(this._propTimestamps)}restorePropTimestamps(e){this._propTimestamps=new Map(e)}preserveSerializedState(e){this._preservedSerializedState=structuredClone(e)}hasPreservedSerializedState(){return this._preservedSerializedState!==null}toSerialized(){return{id:this.id,type:this.type,state:this._preservedSerializedState?structuredClone(this._preservedSerializedState):{...this._props}}}static fromSerialized(e){return Dr(e.id,e.type,structuredClone(e.state),"verbatim")}static create(e,n,r){return Dr(e,n,r,"authoring")}};var Gw=5e3,Vw=1e4;function jw(t){return t===null||t.size===0?"":[...t.entries()].sort((e,n)=>n[1].count-e[1].count).slice(0,5).map(([e,n])=>`${e.type}#${e.id} x${n.count} keys=[${[...n.keys].join(",")}]`).join("; ")}var tr=class t{static _activeInstanceCount=0;static _createdInstanceCount=0;static _disposedInstanceCount=0;static _pendingGraphs=new Set;static flushAllPending(){if(t._pendingGraphs.size!==0)for(let e of[...t._pendingGraphs])e.flushBatched()}static get pendingGraphCount(){return t._pendingGraphs.size}static get activeInstanceCount(){return t._activeInstanceCount}static get createdInstanceCount(){return t._createdInstanceCount}static get disposedInstanceCount(){return t._disposedInstanceCount}root;_nodesById=new Map;_batchDepth=0;_batchDirtyNodes=new Map;_draining=!1;_changeListeners=[];_structureListeners=[];_disposed=!1;constructor(){t._activeInstanceCount++,t._createdInstanceCount++,this.root=Dr("__root__","document"),this._nodesById.set(this.root.id,this.root)}onNodeChange(e){return this._disposed?()=>{}:(this._changeListeners.push(e),()=>{let n=this._changeListeners.indexOf(e);n>=0&&this._changeListeners.splice(n,1)})}onStructureChange(e){return this._disposed?()=>{}:(this._structureListeners.push(e),()=>{let n=this._structureListeners.indexOf(e);n>=0&&this._structureListeners.splice(n,1)})}addNode(e,n,r){if(this._disposed)return;let i=n??this.root;r!==void 0&&r>=0&&r<i.children.length?i.children.splice(r,0,e):i.children.push(e),e.parent=i,this._nodesById.set(e.id,e),e.onChange=this._handleNodeChange.bind(this),this._emitStructure("add",e,null,i)}removeNode(e){if(this._disposed)return null;let n=this._nodesById.get(e);if(!n||n===this.root)return null;let r=n.parent,i=null;if(r){let o=r.children.indexOf(n);i={parentId:r===this.root?null:r.id,index:o},o>=0&&r.children.splice(o,1)}return n.parent=null,n.onChange=null,this._nodesById.delete(e),this._batchDirtyNodes.delete(n),this._removeDescendants(n),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),this._emitStructure("remove",n,r,null,i),n}getNode(e){return this._nodesById.get(e)??null}moveNode(e,n,r){if(this._disposed)return;let i=this._nodesById.get(e);if(!i||i===this.root)return;if(n===i||this.isAncestor(e,n.id))throw new Error(`Cannot move scene node "${e}" below itself or one of its descendants.`);let o=i.parent,s=null;if(o){let a=o.children.indexOf(i);s={parentId:o===this.root?null:o.id,index:a},a>=0&&o.children.splice(a,1)}r!==void 0&&r>=0&&r<n.children.length?n.children.splice(r,0,i):n.children.push(i),i.parent=n,this._emitStructure("move",i,o,n,s)}moveNodeToParentId(e,n,r){if(this._disposed)return;let i=n?this._nodesById.get(n):this.root;i&&this.moveNode(e,i,r)}getChildren(e){let n=e?this._nodesById.get(e):this.root;return n?[...n.children]:[]}getRootShapes(){return[...this.root.children]}getParentId(e){let n=this._nodesById.get(e);return!n||!n.parent||n.parent===this.root?null:n.parent.id}getSiblingIndex(e){let n=this._nodesById.get(e);return!n||!n.parent?-1:n.parent.children.indexOf(n)}getAncestorIds(e){let n=[],r=new Set,i=this.getParentId(e);for(;i;){if(r.has(i))throw new Error(`Scene graph cycle detected while resolving ancestors of "${e}".`);r.add(i),n.push(i),i=this.getParentId(i)}return n}isAncestor(e,n){if(e===n)return!1;let r=new Set,i=this.getParentId(n);for(;i;){if(i===e)return!0;if(r.has(i))throw new Error(`Scene graph cycle detected while resolving ancestry of "${n}".`);r.add(i),i=this.getParentId(i)}return!1}isDocumentRootNode(e){let n=this._nodesById.get(e);return!!n&&n!==this.root&&n.getProp("isRootSvg")===!0}contains(e,n){if(e===n)return!1;if(this.isDocumentRootNode(e)){let r=this._nodesById.get(n);return!!r&&r!==this.root&&!this.isDocumentRootNode(n)}return this.isAncestor(e,n)}getDepth(e){let n=this._nodesById.get(e);if(!n||n===this.root)return-1;let r=0,i=n.parent;for(;i&&i!==this.root;)r++,i=i.parent;return r}getAllNodes(){let e=[];for(let n of this._nodesById.values())n!==this.root&&e.push(n);return e}getDirtyNodes(){let e=[];for(let n of this._nodesById.values())n.isDirty()&&e.push(n);return e}clearAllDirty(){for(let e of this._nodesById.values())e.clearDirty()}beginBatch(){this._disposed||this._batchDepth++}commitBatch(){this._disposed||(this._batchDepth=Math.max(0,this._batchDepth-1),this._batchDepth===0&&this._drainBatched())}flushBatched(){this._disposed||this._batchDirtyNodes.size>0&&this._drainBatched()}get hasPendingBatched(){return this._batchDirtyNodes.size>0}get isBatching(){return this._batchDepth>0}get isDraining(){return this._draining}get isDisposed(){return this._disposed}get listenerCount(){return this._changeListeners.length+this._structureListeners.length}dispose(){if(!this._disposed){this._disposed=!0,t._activeInstanceCount--,t._disposedInstanceCount++,t._pendingGraphs.delete(this),this._batchDirtyNodes.clear(),this._batchDepth=0,this._draining=!1,this._changeListeners.length=0,this._structureListeners.length=0;for(let e of this._nodesById.values())e.onChange=null}}notifyNodeChanged(e,n){this._disposed||this._handleNodeChange(e,n)}_handleNodeChange(e,n){if(!this._disposed){if(this._batchDepth>0){let r=this._batchDirtyNodes.get(e);r||(r=new Set,this._batchDirtyNodes.set(e,r),t._pendingGraphs.add(this));for(let i of n)r.add(i);return}this._fireChangeListeners(e,n)}}_drainBatched(){if(this._disposed||this._draining)return;this._draining=!0;let e=0,n=null;try{for(;this._batchDirtyNodes.size>0;){if(++e>Vw){console.error("[SceneGraph] batched-notification drain did not converge \u2014 render loop?",jw(n)),this._batchDirtyNodes.clear();break}let[r,i]=this._batchDirtyNodes.entries().next().value;if(this._batchDirtyNodes.delete(r),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),e>Gw){n===null&&(n=new Map);let o=n.get(r);if(o){o.count++;for(let s of i)o.keys.add(s)}else n.set(r,{count:1,keys:new Set(i)})}this._fireChangeListeners(r,i)}}finally{this._draining=!1,this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this)}}_fireChangeListeners(e,n){if(this._disposed)return;let r=[...this._changeListeners];for(let i of r)i(e,n)}_emitStructure(e,n,r,i,o=null){if(this._disposed)return;let s=[...this._structureListeners];for(let a of s)a(e,n,r,i,o)}_removeDescendants(e){for(let n of e.children)n.onChange=null,this._nodesById.delete(n.id),this._batchDirtyNodes.delete(n),this._removeDescendants(n)}serializeShapes(){let e=[],n=r=>{for(let i of r)i.type!=="document"&&i.type!=="group"&&i.getProp("structural")!==!0&&e.push(i.toSerialized()),i.children.length>0&&n(i.children)};return n(this.root.children),e}static fromShapes(e){let n=new t;for(let r of e){let i=_t.fromSerialized(r);n.addNode(i)}return n}clone(){let e=new t,n=(r,i)=>{for(let o of r.children){let s=o.toSerialized(),a=_t.fromSerialized(s);o.hasPreservedSerializedState()&&a.preserveSerializedState(s.state),a.restorePropTimestamps(o.snapshotPropTimestamps()),e.addNode(a,i),n(o,a)}};return n(this.root,e.root),e}};var ye=["updatedAt","clientId"];function ae(t,e,n){t.push({path:e,message:n})}function kh(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function fe(t,e,n){return kh(t)?t:(ae(n,e,"must be an object"),null)}function Q(t,e,n,r=[],i,o=!0){let s=new Set([...o?["type"]:[],...n,...r]);for(let a of n)Object.hasOwn(t,a)||ae(i,`${e}.${a}`,"is required");for(let a of Object.keys(t))s.has(a)||ae(i,`${e}.${a}`,"is not allowed")}function j(t,e,n,r=!1){return typeof t!="string"||!r&&t.length===0?(ae(n,e,r?"must be a string":"must be a non-empty string"),!1):!0}function et(t,e,n,r){return typeof t!="number"||!Number.isFinite(t)?(ae(n,e,"must be a finite number"),!1):r!==void 0&&t<r?(ae(n,e,`must be at least ${r}`),!1):!0}function ln(t,e,n,r=0){return et(t,e,n,r)?Number.isInteger(t)?!0:(ae(n,e,"must be an integer"),!1):!1}function Pi(t,e,n){return typeof t!="boolean"?(ae(n,e,"must be a boolean"),!1):!0}function Oe(t,e,n,r,i=!1){t[e]!==void 0&&j(t[e],`${n}.${e}`,r,i)}function zr(t,e,n,r,i){t[e]!==void 0&&et(t[e],`${n}.${e}`,r,i)}function Qe(t,e,n,r,i=0){t[e]!==void 0&&ln(t[e],`${n}.${e}`,r,i)}function Uo(t,e,n,r){t[e]!==void 0&&Pi(t[e],`${n}.${e}`,r)}function Dn(t,e,n){return Array.isArray(t)?(t.forEach((r,i)=>j(r,`${e}[${i}]`,n)),!0):(ae(n,e,"must be an array"),!1)}function Ee(t,e,n,r){return Array.isArray(t)?(t.forEach((i,o)=>r(i,`${e}[${o}]`,n)),!0):(ae(n,e,"must be an array"),!1)}function Ke(t,e,n){let r=[{value:t,path:e,depth:0}],i=0;for(;r.length>0;){let o=r.pop();if(i++,i>25e4){ae(n,e,"exceeds the 250000-node validation limit");return}if(o.depth>64){ae(n,o.path,"exceeds the 64-level nesting limit");continue}let s=o.value;if(!(s===null||typeof s=="string"||typeof s=="boolean")){if(typeof s=="number"){Number.isFinite(s)||ae(n,o.path,"must be a finite JSON number");continue}if(Array.isArray(s)){s.forEach((a,l)=>r.push({value:a,path:`${o.path}[${l}]`,depth:o.depth+1}));continue}if(kh(s)){for(let[a,l]of Object.entries(s))r.push({value:l,path:`${o.path}.${a}`,depth:o.depth+1});continue}ae(n,o.path,"must be JSON-serializable")}}}function Se(t,e,n){zr(t,"updatedAt",e,n,0),Oe(t,"clientId",e,n)}function Ga(t,e,n){let r=fe(t,e,n);if(r)for(let[i,o]of Object.entries(r))j(o,`${e}.${i}`,n,!0)}function Ho(t,e,n,r=0){if(r>64){ae(n,e,"exceeds the 64-level shape nesting limit");return}let i=fe(t,e,n);if(!i)return;Q(i,e,["id","type","state"],[],n),j(i.id,`${e}.id`,n),j(i.type,`${e}.type`,n);let o=fe(i.state,`${e}.state`,n);o&&(Object.hasOwn(o,"extra")&&ae(n,`${e}.state.extra`,"is an at-rest field and is not allowed in operations"),Ke(o,`${e}.state`,n),o.children!==void 0&&Ee(o.children,`${e}.state.children`,n,(s,a,l)=>Ho(s,a,l,r+1)))}function Uw(t,e,n){let r=fe(t,e,n);r&&(Object.hasOwn(r,"extra")&&ae(n,`${e}.extra`,"is an at-rest field and is not allowed in operations"),Ke(r,e,n),r.children!==void 0&&Ee(r.children,`${e}.children`,n,(i,o,s)=>Ho(i,o,s)))}function hp(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),r.parentId!==null&&j(r.parentId,`${e}.parentId`,n),Qe(r,"siblingIndex",e,n),Oe(r,"pluginId",e,n),Oe(r,"pluginData",e,n,!0),r.attributes!==void 0&&Ga(r.attributes,`${e}.attributes`,n),Ke(r,e,n))}function ph(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),r.type!=="clip"&&r.type!=="mask"&&ae(n,`${e}.type`,'must be "clip" or "mask"'),r.clipShapeIds!==void 0&&Dn(r.clipShapeIds,`${e}.clipShapeIds`,n),r.clipShapeId!==void 0&&Oe(r,"clipShapeId",e,n),r.clipShapeIds===void 0&&r.clipShapeId===void 0&&ae(n,`${e}.clipShapeIds`,"or clipShapeId is required"),Dn(r.contentShapeIds,`${e}.contentShapeIds`,n),r.parentId!==null&&j(r.parentId,`${e}.parentId`,n),Qe(r,"siblingIndex",e,n),Ke(r,e,n))}function fh(t,e,n){let r=fe(t,e,n);if(!r)return;j(r.id,`${e}.id`,n);let i=r.orientation==="horizontal"||r.orientation==="vertical",o=r.axis==="x"||r.axis==="y";!i&&!o&&ae(n,`${e}.orientation`,'must be "horizontal" or "vertical" (legacy axis "x" or "y" is also accepted)'),et(r.position,`${e}.position`,n),i&&et(r.controlPointOffset,`${e}.controlPointOffset`,n),Oe(r,"color",e,n,!0),zr(r,"opacity",e,n),Ke(r,e,n)}function mh(t,e,n){let r=fe(t,e,n);if(!r)return;j(r.id,`${e}.id`,n);let i=r.type==="distance"||r.type==="angle",o=["startX","startY","endX","endY"].every(s=>typeof r[s]=="number"&&Number.isFinite(r[s]));i?(Ee(r.points,`${e}.points`,n,(s,a,l)=>{let c=fe(s,a,l);c&&(et(c.x,`${a}.x`,l),et(c.y,`${a}.y`,l))}),Pi(r.visible,`${e}.visible`,n),ln(r.snapDivisions,`${e}.snapDivisions`,n,1)):o||ae(n,e,"must be a current or legacy measurement payload"),Oe(r,"color",e,n,!0),zr(r,"opacity",e,n),Ke(r,e,n)}var gh=["title","description","author","keywords","license","licenseUrl","language","customMetadata","rawMetadata","rawMetadataAuthoritative","rawDescription","rawHtmlMetadata","descriptiveElements","coordinatePrecision"];function hh(t,e,n,r){let i=fe(t,e,n);if(!i)return;Q(i,e,r?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],r?gh:gh.slice(8),n,!1);for(let s of["title","description","author","license","licenseUrl","language"])(!r||i[s]!==void 0)&&j(i[s],`${e}.${s}`,n,!0);(!r||i.keywords!==void 0)&&Dn(i.keywords,`${e}.keywords`,n),(!r||i.customMetadata!==void 0)&&Ga(i.customMetadata,`${e}.customMetadata`,n),Oe(i,"rawMetadata",e,n,!0),Uo(i,"rawMetadataAuthoritative",e,n),Oe(i,"rawDescription",e,n,!0),Oe(i,"rawHtmlMetadata",e,n,!0),i.descriptiveElements!==void 0&&Ee(i.descriptiveElements,`${e}.descriptiveElements`,n,(s,a,l)=>{let c=fe(s,a,l);c&&(Q(c,a,["kind","language","text","rawXml"],[],l,!1),c.kind!=="title"&&c.kind!=="desc"&&ae(l,`${a}.kind`,'must be "title" or "desc"'),c.language!==null&&j(c.language,`${a}.language`,l,!0),j(c.text,`${a}.text`,l,!0),j(c.rawXml,`${a}.rawXml`,l,!0))}),Qe(i,"coordinatePrecision",e,n)}function yh(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),r.source!=="inline"&&r.source!=="external"&&ae(n,`${e}.source`,'must be "inline" or "external"'),j(r.content,`${e}.content`,n,!0),j(r.type,`${e}.type`,n,!0),Oe(r,"svgId",e,n,!0),Oe(r,"href",e,n,!0),Uo(r,"async",e,n),Uo(r,"defer",e,n),r.customAttrs!==void 0&&Ga(r.customAttrs,`${e}.customAttrs`,n),Ke(r,e,n))}function Sh(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),j(r.css,`${e}.css`,n,!0),Pi(r.preserved,`${e}.preserved`,n),Oe(r,"svgId",e,n,!0),Oe(r,"type",e,n,!0),Oe(r,"media",e,n,!0),r.customAttrs!==void 0&&Ga(r.customAttrs,`${e}.customAttrs`,n),Ke(r,e,n))}function bh(t,e,n){let r=fe(t,e,n);if(r){if(j(r.name,`${e}.name`,n),["string","color","number"].includes(String(r.type))||ae(n,`${e}.type`,'must be "string", "color", or "number"'),j(r.defaultValue,`${e}.defaultValue`,n,!0),Oe(r,"label",e,n,!0),Oe(r,"description",e,n,!0),r.mode!==void 0&&r.mode!=="live"&&r.mode!=="stamped"&&ae(n,`${e}.mode`,'must be "live" or "stamped"'),r.source!==void 0){let i=fe(r.source,`${e}.source`,n);i&&i.kind!=="user"&&ae(n,`${e}.source.kind`,'must be "user"')}Ke(r,e,n)}}function vh(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),j(r.filename,`${e}.filename`,n,!0),j(r.format,`${e}.format`,n),Ke(r,e,n))}function Hw(t,e,n){let r=fe(t,e,n);r&&(ln(r.glyphId,`${e}.glyphId`,n),Array.isArray(r.codepoints)?r.codepoints.forEach((i,o)=>ln(i,`${e}.codepoints[${o}]`,n)):ae(n,`${e}.codepoints`,"must be an array"),j(r.svgDocument,`${e}.svgDocument`,n,!0),Oe(r,"glyphName",e,n,!0),Qe(r,"advanceWidth",e,n),Oe(r,"sourceFamily",e,n,!0),Qe(r,"sourceGlyphId",e,n),Oe(r,"label",e,n,!0),Ke(r,e,n))}function xh(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),j(r.name,`${e}.name`,n,!0),j(r.svgContent,`${e}.svgContent`,n,!0),et(r.width,`${e}.width`,n,0),et(r.height,`${e}.height`,n,0),Ke(r,e,n))}function Ih(t,e,n){let r=fe(t,e,n);if(!r)return;j(r.id,`${e}.id`,n);let i=["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"],o=r.role===void 0?"resource":String(r.role);o!=="resource"&&o!=="referenced-fragment"&&ae(n,`${e}.role`,"is not a supported raw SVG definition role");let s=String(r.type);(o==="resource"&&!i.includes(s)||o==="referenced-fragment"&&!/^[A-Za-z][\w.-]*$/u.test(s))&&ae(n,`${e}.type`,"is not a supported paint-server type"),j(r.markup,`${e}.markup`,n),r.definitionChildIds!==void 0&&Dn(r.definitionChildIds,`${e}.definitionChildIds`,n),r.sourceDefinitionChildIds!==void 0&&Dn(r.sourceDefinitionChildIds,`${e}.sourceDefinitionChildIds`,n),Array.isArray(r.definitionChildIds)&&Array.isArray(r.sourceDefinitionChildIds)&&r.definitionChildIds.length!==r.sourceDefinitionChildIds.length&&ae(n,e,"definition child id arrays must have equal lengths"),Uo(r,"passthrough",e,n),Ke(r,e,n)}function wh(t,e,n){let r=fe(t,e,n);if(!r)return;j(r.id,`${e}.id`,n),j(r.name,`${e}.name`,n,!0),r.metadata!==void 0&&Ke(r.metadata,`${e}.metadata`,n);let i=r.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||ae(n,`${e}.kind`,"is not a supported library kind"),(i==="symbol"||i==="marker")&&(Ee(r.shapes,`${e}.shapes`,n,Ho),i==="marker"&&r.groups!==void 0&&Ee(r.groups,`${e}.groups`,n,hp)),i==="symbol"){for(let o of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])Oe(r,o,e,n,!0);if(r.rootAttributes!==void 0){let o=fe(r.rootAttributes,`${e}.rootAttributes`,n);if(o)for(let[s,a]of Object.entries(o))["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(s)&&ae(n,`${e}.rootAttributes.${s}`,"must use its typed symbol field"),j(a,`${e}.rootAttributes.${s}`,n,!0)}for(let o of["wrapperAttrs","groups","overflow"])r[o]!==void 0&&ae(n,`${e}.${o}`,"is schema-v7 migration input only")}if(i==="marker"){Oe(r,"viewBox",e,n,!0),Oe(r,"preserveAspectRatio",e,n,!0);for(let o of["refX","refY","markerWidth","markerHeight"])et(r[o],`${e}.${o}`,n);if(r.markerUnits!=="strokeWidth"&&r.markerUnits!=="userSpaceOnUse"&&ae(n,`${e}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),r.orient!=="auto"&&r.orient!=="auto-start-reverse"&&!(typeof r.orient=="number"&&Number.isFinite(r.orient))&&ae(n,`${e}.orient`,"must be an orientation keyword or finite number"),r.authoredGeometry!==void 0){let o=fe(r.authoredGeometry,`${e}.authoredGeometry`,n);if(o)for(let s of["refX","refY","markerWidth","markerHeight","markerUnits","orient"])Oe(o,s,`${e}.authoredGeometry`,n,!0)}if(r.rootAttributes!==void 0){let o=fe(r.rootAttributes,`${e}.rootAttributes`,n);if(o)for(let[s,a]of Object.entries(o))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(s)&&ae(n,`${e}.rootAttributes.${s}`,"must use its typed marker field"),j(a,`${e}.rootAttributes.${s}`,n,!0)}}if(i==="linear-gradient"||i==="radial-gradient"){let o=`${e}.gradient`,s=fe(r.gradient,o,n);if(s){let a=i==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let l of a)zr(s,l,o,n);if(zr(s,"fr",o,n),s.authoredGeometry!==void 0){let l=`${o}.authoredGeometry`,c=fe(s.authoredGeometry,l,n);if(c){let u=new Set(i==="linear-gradient"?["x1","y1","x2","y2","gradientTransform"]:["cx","cy","fx","fy","r","fr","gradientTransform"]);for(let[d,p]of Object.entries(c))u.has(d)?j(p,`${l}.${d}`,n,!0):ae(n,`${l}.${d}`,"is not allowed")}}if(s.gradientTransform!==void 0){let l=s.gradientTransform;(!Array.isArray(l)||l.length!==6||!l.every(c=>typeof c=="number"&&Number.isFinite(c)))&&ae(n,`${o}.gradientTransform`,"must be a 6-element finite affine matrix")}Ee(s.stops,`${o}.stops`,n,(l,c,u)=>{let d=fe(l,c,u);d&&(et(d.offset,`${c}.offset`,u),j(d.color,`${c}.color`,u,!0),zr(d,"opacity",c,u))})}}if(i==="pattern"){let o=`${e}.pattern`,s=fe(r.pattern,o,n);if(s){for(let a of["x","y","width","height","scale","rotation","opacity"])zr(s,a,o,n);s.patternUnits!==void 0&&s.patternUnits!=="userSpaceOnUse"&&s.patternUnits!=="objectBoundingBox"&&ae(n,`${o}.patternUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"'),s.patternContentUnits!==void 0&&s.patternContentUnits!=="userSpaceOnUse"&&s.patternContentUnits!=="objectBoundingBox"&&ae(n,`${o}.patternContentUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"');for(let a of["svgContent","patternTransform","viewBox","preserveAspectRatio"])Oe(s,a,o,n,!0);if(s.authoredGeometry!==void 0){let a=`${o}.authoredGeometry`,l=fe(s.authoredGeometry,a,n);if(l)for(let[c,u]of Object.entries(l))["x","y","width","height"].includes(c)?j(u,`${a}.${c}`,n,!0):ae(n,`${a}.${c}`,"is not a supported authored pattern field")}}}i==="filter"&&Ee(r.filters,`${e}.filters`,n,(o,s,a)=>{fe(o,s,a)}),Ke(r,e,n)}function Ww(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),Oe(r,"viewBox",e,n,!0),r.shapes!==void 0&&Ee(r.shapes,`${e}.shapes`,n,Ho),r.groups!==void 0&&Ee(r.groups,`${e}.groups`,n,hp),Ke(r,e,n))}function Rh(t,e,n,r){let i=fe(t,e,n);i&&((r||i.id!==void 0)&&j(i.id,`${e}.id`,n),et(i.time,`${e}.time`,n,0),typeof i.value!="string"&&!(typeof i.value=="number"&&Number.isFinite(i.value))&&!(Array.isArray(i.value)&&i.value.every(o=>typeof o=="number"&&Number.isFinite(o)))&&ae(n,`${e}.value`,"must be a string, finite number, or finite number array"),j(i.easing,`${e}.easing`,n),Ke(i,e,n))}function Th(t,e,n){let r=fe(t,e,n);r&&(j(r.id,`${e}.id`,n),j(r.shapeId,`${e}.shapeId`,n),j(r.property,`${e}.property`,n),Pi(r.enabled,`${e}.enabled`,n),Uo(r,"locked",e,n),Ee(r.keyframes,`${e}.keyframes`,n,(i,o,s)=>Rh(i,o,s,!1)),Ke(r,e,n))}function Kw(t,e,n){let r=fe(t,e,n);r&&(et(r.duration,`${e}.duration`,n,0),Pi(r.loop,`${e}.loop`,n),et(r.playbackSpeed,`${e}.playbackSpeed`,n,0),Ee(r.tracks,`${e}.tracks`,n,Th))}function Xw(t,e,n){let r=fe(t,e,n);if(!r)return;ln(r.start,`${e}.start`,n),ln(r.end,`${e}.end`,n),typeof r.start=="number"&&typeof r.end=="number"&&r.end<=r.start&&ae(n,`${e}.end`,"must be greater than start");let i=fe(r.style,`${e}.style`,n);i&&Object.keys(i).length===0&&ae(n,`${e}.style`,"must not be empty"),Ke(r,e,n)}function Yw(t,e,n){let r=fe(t,e,n);r&&(Q(r,e,["start","deleteCount","insert"],[],n,!1),ln(r.start,`${e}.start`,n),ln(r.deleteCount,`${e}.deleteCount`,n),j(r.insert,`${e}.insert`,n,!0))}var Ph={"shape:add":(t,e,n)=>{Q(t,e,["shape"],[],n),Ho(t.shape,`${e}.shape`,n)},"shape:update":(t,e,n)=>{if(Q(t,e,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],n),j(t.id,`${e}.id`,n),Uw(t.state,`${e}.state`,n),t.propTimestamps!==void 0){let r=fe(t.propTimestamps,`${e}.propTimestamps`,n);if(r)for(let[i,o]of Object.entries(r))et(o,`${e}.propTimestamps.${i}`,n,0)}Oe(t,"clientId",e,n),t.textSplices!==void 0&&Ee(t.textSplices,`${e}.textSplices`,n,Yw),Qe(t,"baseSeq",e,n)},"shape:remove":(t,e,n)=>{Q(t,e,["id"],[],n),j(t.id,`${e}.id`,n)},"text:format":(t,e,n)=>{Q(t,e,["id","ranges"],["baseSeq",...ye],n),j(t.id,`${e}.id`,n),Ee(t.ranges,`${e}.ranges`,n,Xw),Qe(t,"baseSeq",e,n),Se(t,e,n)},"scene:move":(t,e,n)=>{Q(t,e,["id","parentId","index"],ye,n),j(t.id,`${e}.id`,n),t.parentId!==null&&j(t.parentId,`${e}.parentId`,n),ln(t.index,`${e}.index`,n),Se(t,e,n)},"scene:place":(t,e,n)=>{Q(t,e,["id","parentId","orderKey"],ye,n),j(t.id,`${e}.id`,n),t.parentId!==null&&j(t.parentId,`${e}.parentId`,n),j(t.orderKey,`${e}.orderKey`,n),Se(t,e,n)},"shapes:reorder":(t,e,n)=>{Q(t,e,["ids"],[],n),Dn(t.ids,`${e}.ids`,n)},"groups:set":(t,e,n)=>{Q(t,e,["groups"],[],n),Ee(t.groups,`${e}.groups`,n,hp)},"clipmasks:set":(t,e,n)=>{Q(t,e,["clipMaskGroups"],[],n),Ee(t.clipMaskGroups,`${e}.clipMaskGroups`,n,ph)},"clipMask:upsert":(t,e,n)=>{Q(t,e,["clipMaskGroup"],["index",...ye],n),ph(t.clipMaskGroup,`${e}.clipMaskGroup`,n),Qe(t,"index",e,n),Se(t,e,n)},"clipMask:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"guides:set":(t,e,n)=>{Q(t,e,["guides"],[],n),Ee(t.guides,`${e}.guides`,n,fh)},"guide:upsert":(t,e,n)=>{Q(t,e,["guide"],["index",...ye],n),fh(t.guide,`${e}.guide`,n),Qe(t,"index",e,n),Se(t,e,n)},"guide:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"guide:move":(t,e,n)=>{Q(t,e,["id","index"],ye,n),j(t.id,`${e}.id`,n),ln(t.index,`${e}.index`,n),Se(t,e,n)},"measurements:set":(t,e,n)=>{Q(t,e,["measurements"],[],n),Ee(t.measurements,`${e}.measurements`,n,mh)},"measurement:upsert":(t,e,n)=>{Q(t,e,["measurement"],["index",...ye],n),mh(t.measurement,`${e}.measurement`,n),Qe(t,"index",e,n),Se(t,e,n)},"measurement:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"measurement:move":(t,e,n)=>{Q(t,e,["id","index"],ye,n),j(t.id,`${e}.id`,n),ln(t.index,`${e}.index`,n),Se(t,e,n)},"metadata:set":(t,e,n)=>{Q(t,e,["metadata"],[],n),hh(t.metadata,`${e}.metadata`,n,!1)},"metadata:patch":(t,e,n)=>{Q(t,e,["patch"],["removeKeys",...ye],n),hh(t.patch,`${e}.patch`,n,!0),t.removeKeys!==void 0&&Dn(t.removeKeys,`${e}.removeKeys`,n),Se(t,e,n)},"documentScripts:set":(t,e,n)=>{Q(t,e,["documentScripts"],[],n),Ee(t.documentScripts,`${e}.documentScripts`,n,yh)},"documentScript:upsert":(t,e,n)=>{Q(t,e,["documentScript"],["index",...ye],n),yh(t.documentScript,`${e}.documentScript`,n),Qe(t,"index",e,n),Se(t,e,n)},"documentScript:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"documentStyles:set":(t,e,n)=>{Q(t,e,["documentStyles"],[],n),Ee(t.documentStyles,`${e}.documentStyles`,n,Sh)},"documentStyle:upsert":(t,e,n)=>{Q(t,e,["documentStyle"],["index",...ye],n),Sh(t.documentStyle,`${e}.documentStyle`,n),Qe(t,"index",e,n),Se(t,e,n)},"documentStyle:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"templateVariables:set":(t,e,n)=>{Q(t,e,["templateVariables"],ye,n),Ee(t.templateVariables,`${e}.templateVariables`,n,bh),Se(t,e,n)},"templateVariable:upsert":(t,e,n)=>{Q(t,e,["templateVariable"],["index",...ye],n),bh(t.templateVariable,`${e}.templateVariable`,n),Qe(t,"index",e,n),Se(t,e,n)},"templateVariable:remove":(t,e,n)=>{Q(t,e,["name"],ye,n),j(t.name,`${e}.name`,n),Se(t,e,n)},"exportItems:set":(t,e,n)=>{Q(t,e,["exportItems"],ye,n),Ee(t.exportItems,`${e}.exportItems`,n,vh),Se(t,e,n)},"exportItem:upsert":(t,e,n)=>{Q(t,e,["exportItem"],["index",...ye],n),vh(t.exportItem,`${e}.exportItem`,n),Qe(t,"index",e,n),Se(t,e,n)},"exportItem:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"colorGlyphLibrary:set":(t,e,n)=>{if(Q(t,e,["colorGlyphLibrary"],ye,n),t.colorGlyphLibrary!==null){let r=fe(t.colorGlyphLibrary,`${e}.colorGlyphLibrary`,n);r&&(r.version!==1&&ae(n,`${e}.colorGlyphLibrary.version`,"must be 1"),Ee(r.entries,`${e}.colorGlyphLibrary.entries`,n,Hw),Ke(r,`${e}.colorGlyphLibrary`,n))}Se(t,e,n)},"animation:set":(t,e,n)=>{Q(t,e,["animationTimeline"],[],n),t.animationTimeline!==void 0&&Kw(t.animationTimeline,`${e}.animationTimeline`,n)},"animation:config":(t,e,n)=>{Q(t,e,["config"],ye,n);let r=fe(t.config,`${e}.config`,n);r&&(Q(r,`${e}.config`,["duration","loop","playbackSpeed"],[],n,!1),et(r.duration,`${e}.config.duration`,n,0),Pi(r.loop,`${e}.config.loop`,n),et(r.playbackSpeed,`${e}.config.playbackSpeed`,n,0)),Se(t,e,n)},"animation:clear":(t,e,n)=>{Q(t,e,[],ye,n),Se(t,e,n)},"animationTrack:upsert":(t,e,n)=>{Q(t,e,["track"],["index",...ye],n),Th(t.track,`${e}.track`,n),Qe(t,"index",e,n),Se(t,e,n)},"animationTrack:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"animationKeyframe:upsert":(t,e,n)=>{Q(t,e,["trackId","keyframe"],ye,n),j(t.trackId,`${e}.trackId`,n),Rh(t.keyframe,`${e}.keyframe`,n,!0),Se(t,e,n)},"animationKeyframe:remove":(t,e,n)=>{Q(t,e,["trackId","keyframeId"],ye,n),j(t.trackId,`${e}.trackId`,n),j(t.keyframeId,`${e}.keyframeId`,n),Se(t,e,n)},"symbols:set":(t,e,n)=>{Q(t,e,["symbols"],[],n),Ee(t.symbols,`${e}.symbols`,n,Ww)},"customPatterns:set":(t,e,n)=>{Q(t,e,["customPatterns"],[],n),Ee(t.customPatterns,`${e}.customPatterns`,n,xh)},"customPattern:upsert":(t,e,n)=>{Q(t,e,["customPattern"],["index",...ye],n),xh(t.customPattern,`${e}.customPattern`,n),Qe(t,"index",e,n),Se(t,e,n)},"customPattern:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"library:set":(t,e,n)=>{Q(t,e,["library"],[],n),Ee(t.library,`${e}.library`,n,wh)},"library:upsert":(t,e,n)=>{Q(t,e,["def"],["index",...ye],n),wh(t.def,`${e}.def`,n),Qe(t,"index",e,n),Se(t,e,n)},"library:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"rawPaintServerDefs:set":(t,e,n)=>{Q(t,e,["rawPaintServerDefs"],[],n),Dn(t.rawPaintServerDefs,`${e}.rawPaintServerDefs`,n)},"paintServerDefs:set":(t,e,n)=>{Q(t,e,["paintServerDefs"],[],n),Ee(t.paintServerDefs,`${e}.paintServerDefs`,n,Ih)},"paintServerDef:upsert":(t,e,n)=>{Q(t,e,["paintServerDef"],["index",...ye],n),Ih(t.paintServerDef,`${e}.paintServerDef`,n),Qe(t,"index",e,n),Se(t,e,n)},"paintServerDef:remove":(t,e,n)=>{Q(t,e,["id"],ye,n),j(t.id,`${e}.id`,n),Se(t,e,n)},"presence:cursor":(t,e,n)=>{Q(t,e,["position"],[],n);let r=fe(t.position,`${e}.position`,n);r&&(Q(r,`${e}.position`,["x","y"],[],n,!1),et(r.x,`${e}.position.x`,n),et(r.y,`${e}.position.y`,n))},"presence:selection":(t,e,n)=>{Q(t,e,["shapeIds"],[],n),Dn(t.shapeIds,`${e}.shapeIds`,n)}},qw=new Set(Object.keys(Ph)),Ch=new Set(["presence:cursor","presence:selection"]);function Va(t,e="operation"){let n=[],r=fe(t,e,n);return r?!j(r.type,`${e}.type`,n)||!qw.has(r.type)?(typeof r.type=="string"&&r.type.length>0&&ae(n,`${e}.type`,`unknown operation type "${r.type}"`),{valid:!1,issues:n}):(Ph[r.type](r,e,n),n.length===0?{valid:!0,value:r}:{valid:!1,issues:n}):{valid:!1,issues:n}}function $h(t,e={}){let n=[];if(!Array.isArray(t))return{valid:!1,issues:[{path:"ops",message:"must be an array"}]};let r=e.minItems??1,i=e.maxItems??5e3;(t.length<r||t.length>i)&&ae(n,"ops",`must contain ${r}-${i} operations`);let o=[];return t.forEach((s,a)=>{let l=Va(s,`ops[${a}]`);if(!l.valid){n.push(...l.issues);return}if(Ch.has(l.value.type)){ae(n,`ops[${a}].type`,"presence operations are not document operations");return}o.push(l.value)}),n.length===0?{valid:!0,value:o}:{valid:!1,issues:n}}function Eh(t){let e=Va(t,"op");return e.valid?Ch.has(e.value.type)?{valid:!0,value:e.value}:{valid:!1,issues:[{path:"op.type",message:"must be a presence operation"}]}:e}function Ah(t){return t.slice(0,5).map(({path:e,message:n})=>`${e} ${n}`).join("; ")}function ja(t,e,n,r){let i=e[n],o=typeof i=="string"?i:"",s=(t??[]).filter(l=>l[n]!==o),a=typeof r=="number"&&Number.isFinite(r)?Math.max(0,Math.min(r,s.length)):s.length;return s.splice(a,0,e),s}function Ua(t,e,n){return(t??[]).filter(r=>r[e]!==n)}function ct(t,e,n){return ja(t,e,"id",n)}function dt(t,e){return Ua(t,"id",e)}function Ha(t,e,n){return ja(t,e,"name",n)}function Wa(t,e){return Ua(t,"name",e)}function Nh(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Ci(t,e,n){let r=t?[...t]:[],i=r.find(o=>o.id===e);return i?ct(r,i,n):r}function Mh(t,e,n,r,i){let o=[],s=new Map(t.map(c=>[c.id,c])),a=new Set(e.map(c=>c.id)),l=[...t];for(let c of t)a.has(c.id)||(o.push(r(c.id)),l=dt(l,c.id));return e.forEach((c,u)=>{let d=s.get(c.id);(!d||!Nh(d,c))&&(o.push(n(c,u)),l=ct(l,c,u))}),e.forEach((c,u)=>{l[u]?.id!==c.id&&(o.push(i(c.id,u)),l=Ci(l,c.id,u))}),o}function Oh(t,e){return Mh(t,e,(n,r)=>({type:"guide:upsert",guide:n,index:r}),n=>({type:"guide:remove",id:n}),(n,r)=>({type:"guide:move",id:n,index:r}))}function Dh(t,e){return Mh(t,e,(n,r)=>({type:"measurement:upsert",measurement:n,index:r}),n=>({type:"measurement:remove",id:n}),(n,r)=>({type:"measurement:move",id:n,index:r}))}function zh(t,e){let n=t??{},r=e??{},i={},o=[];for(let[s,a]of Object.entries(r))Nh(n[s],a)||(i[s]=a);for(let s of Object.keys(n))s in r||o.push(s);return Object.keys(i).length>0||o.length>0?[{type:"metadata:patch",patch:i,removeKeys:o.length>0?o:void 0}]:[]}function Wo(t,e){switch(e.type){case"guide:upsert":return ct(t,e.guide,e.index);case"guide:remove":return dt(t,e.id);case"guide:move":return Ci(t,e.id,e.index)}}function Ko(t,e){switch(e.type){case"measurement:upsert":return ct(t,e.measurement,e.index);case"measurement:remove":return dt(t,e.id);case"measurement:move":return Ci(t,e.id,e.index)}}function _h(t,e){let n=new Set(e.removeKeys??[]),r={};for(let[i,o]of Object.entries({...t??{},...e.patch}))n.has(i)||(r[i]=o);return r}function Fh(t,e){if(t===e)return null;let n=0,r=Math.min(t.length,e.length);for(;n<r&&t.charCodeAt(n)===e.charCodeAt(n);)n++;let i=0,o=Math.min(t.length,e.length)-n;for(;i<o&&t.charCodeAt(t.length-1-i)===e.charCodeAt(e.length-1-i);)i++;return{start:n,deleteCount:t.length-n-i,insert:e.slice(n,e.length-i)}}function Lh(t,e){return t.slice(0,e.start)+e.insert+t.slice(e.start+e.deleteCount)}function Xo(t,e){let n=e.start,r=e.start+e.deleteCount,i=e.insert.length-e.deleteCount,o=t.start,s=t.start+t.deleteCount;return r<=o?{start:o+i,deleteCount:t.deleteCount,insert:t.insert}:n>=s?{start:o,deleteCount:t.deleteCount,insert:t.insert}:n<=o&&r>=s?{start:n+e.insert.length,deleteCount:0,insert:t.insert}:n>=o&&r<=s?{start:o,deleteCount:t.deleteCount+i,insert:t.insert}:n<o?{start:n+e.insert.length,deleteCount:t.deleteCount-(r-o),insert:t.insert}:{start:o,deleteCount:n-o,insert:t.insert}}var _r=Object.freeze({fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:Object.freeze({underline:!1,strikethrough:!1,overline:!1}),textTransform:"none",baselineShift:"baseline",dominantBaseline:"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}),Ei=Object.keys(_r);function _n(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zn(t){return typeof t=="string"?t:void 0}function ut(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"&&t.trim()!==""){let e=Number.parseFloat(t);return Number.isFinite(e)?e:void 0}}function nr(t){return e=>typeof e=="string"&&t.includes(e)?e:void 0}function Zw(t){if(t==="normal"||t==="bold")return t;let e=ut(t);return e===400?"normal":e===700?"bold":e}function Jw(t){return t==="baseline"||t==="super"||t==="sub"?t:ut(t)}function Gh(t){if(typeof t=="string"){let n=t.toLowerCase();return{underline:n.includes("underline"),strikethrough:n.includes("line-through")||n.includes("strikethrough"),overline:n.includes("overline")}}if(!_n(t))return;let e={};return typeof t.underline=="boolean"&&(e.underline=t.underline),typeof t.strikethrough=="boolean"&&(e.strikethrough=t.strikethrough),typeof t.overline=="boolean"&&(e.overline=t.overline),e}function Vh(t){if(!_n(t))return;let e={};for(let[n,r]of Object.entries(t)){let i=ut(r);i!==void 0&&(e[n]=i)}return e}var jh={fontFamily:zn,fontSize:ut,fontWeight:Zw,fontStyle:nr(["normal","italic","oblique"]),fontVariant:zn,fontVariantLigatures:zn,fontVariantPosition:zn,fontVariantCaps:zn,fontVariantNumeric:zn,fontVariantEastAsian:zn,textTransform:nr(["none","capitalize","uppercase","lowercase"]),baselineShift:Jw,dominantBaseline:nr(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),writingMode:nr(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:nr(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:nr(["ltr","rtl"]),unicodeBidi:nr(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:nr(["start","middle","end"]),letterSpacing:ut,wordSpacing:ut,lineHeight:ut,fill:zn,fillOpacity:ut,stroke:zn,strokeWidth:ut,strokeOpacity:ut};function $i(t,e){return{...t,...e,textDecoration:{...t.textDecoration,...e.textDecoration??{}},fontVariationSettings:{...e.fontVariationSettings??t.fontVariationSettings}}}function Sp(t,e){let n=Object.keys(t);return n.length!==Object.keys(e).length?!1:n.every(r=>Object.prototype.hasOwnProperty.call(e,r)&&t[r]===e[r])}function Fn(t,e){for(let n of Ei)if(n==="textDecoration"){if(t.textDecoration.underline!==e.textDecoration.underline||t.textDecoration.strikethrough!==e.textDecoration.strikethrough||t.textDecoration.overline!==e.textDecoration.overline)return!1}else if(n==="fontVariationSettings"){if(!Sp(t.fontVariationSettings,e.fontVariationSettings))return!1}else if(t[n]!==e[n])return!1;return!0}function Ya(t,e){let n=Object.keys(t).sort(),r=Object.keys(e).sort();if(n.length!==r.length||n.some((i,o)=>i!==r[o]))return!1;for(let i of n)if(i==="textDecoration"){let o=t.textDecoration??{},s=e.textDecoration??{},a=new Set([...Object.keys(o),...Object.keys(s)]);for(let l of a){let c=l;if(o[c]!==s[c])return!1}}else if(i==="fontVariationSettings"){if(!Sp(t.fontVariationSettings??{},e.fontVariationSettings??{}))return!1}else{let o=i;if(t[o]!==e[o])return!1}return!0}function Ka(t,e){let n={};for(let i of Ei)i==="textDecoration"||i==="fontVariationSettings"||t[i]!==e[i]&&(n[i]=t[i]);let r={};return t.textDecoration.underline!==e.textDecoration.underline&&(r.underline=t.textDecoration.underline),t.textDecoration.strikethrough!==e.textDecoration.strikethrough&&(r.strikethrough=t.textDecoration.strikethrough),t.textDecoration.overline!==e.textDecoration.overline&&(r.overline=t.textDecoration.overline),Object.keys(r).length>0&&(n.textDecoration=r),Sp(t.fontVariationSettings,e.fontVariationSettings)||(n.fontVariationSettings={...t.fontVariationSettings}),n}function vn(t,e=_r){let n=_n(t)?t:{},r={...e};for(let i of Ei){if(i==="textDecoration"||i==="fontVariationSettings")continue;let o=jh[i](n[i]);o!==void 0&&(r[i]=o)}return r.textDecoration={...e.textDecoration,...Gh(n.textDecoration)??{}},r.fontVariationSettings={...Vh(n.fontVariationSettings)??e.fontVariationSettings},r}function Yo(t){let e=_n(t)?t:{},n={};for(let r of Ei){if(r==="textDecoration"||r==="fontVariationSettings"||e[r]===void 0)continue;let i=jh[r](e[r]);i!==void 0&&(n[r]=i)}if(e.textDecoration!==void 0){let r=Gh(e.textDecoration);r&&Object.keys(r).length>0&&(n.textDecoration=r)}if(e.fontVariationSettings!==void 0){let r=Vh(e.fontVariationSettings);r&&(n.fontVariationSettings=r)}return n}function bp(t){let e=[],n=0;for(;;){let r=t.indexOf(`
2
+ `,n);if(r===-1)return e.push({text:t.slice(n),start:n,end:t.length}),e;e.push({text:t.slice(n,r),start:n,end:r}),n=r+1}}function Qw(t,e,n){return t.start===t.end?n&&t.start===e:t.start<=e&&e<t.end}function yp(t,e,n,r){let i=t;for(let o of e)Qw(o,n,r)&&(i=$i(i,o.style));return i===t?$i(t,{}):i}function Uh(t,e,n={}){let r=vn(t.baseStyle),i=typeof t.text=="string"?t.text:"";return yp(r,vp(t.runs,i.length),e,n.collapsed===!0)}function Fr(t,e=_r){let n=_n(t)?t:{},r=vn(n.baseStyle,e),i=typeof n.text=="string"?n.text:"";return{text:i,runs:vp(n.runs,i.length),baseStyle:r,lineHeight:ut(n.lineHeight)??r.lineHeight}}function vp(t,e){if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!_n(r))continue;let i=ut(r.start),o=ut(r.end);if(i===void 0||o===void 0)continue;let s=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(o),0),e);s>a||n.push({start:s,end:a,style:Yo(r.style)})}return n}function Ln(t){let e=typeof t.text=="string"?t.text:"",n=vn(t.baseStyle),r=vp(t.runs,e.length),i=ut(t.lineHeight)??n.lineHeight;return{lines:bp(e).map(s=>{if(s.text.length===0)return{segments:[{text:"",style:yp(n,r,s.start,!0)}]};let a=new Set([s.start,s.end]);for(let u of r)u.start!==u.end&&(u.start>s.start&&u.start<s.end&&a.add(u.start),u.end>s.start&&u.end<s.end&&a.add(u.end));let l=[...a].sort((u,d)=>u-d),c=[];for(let u=0;u<l.length-1;u++){let d=l[u],p=l[u+1],f=yp(n,r,d,!1),g=c[c.length-1];g&&Fn(g.style,f)?g.text+=e.slice(d,p):c.push({text:e.slice(d,p),style:f})}return{segments:c}}),baseStyle:n,lineHeight:i}}function Lr(t){let e=vn(t?.baseStyle),n=ut(t?.lineHeight)??e.lineHeight,r=Array.isArray(t?.lines)?t.lines:[],i=r.length>0?r:[{segments:[]}],o=[],s=[],a=0;for(let u=0;u<i.length;u++){u>0&&(o.push(`
3
+ `),a+=1);let d=i[u]?.segments,p=Array.isArray(d)?d:[],f=a;for(let g of p){let m=typeof g?.text=="string"?g.text:"";if(m.length===0)continue;let h=vn(g?.style,e),b=Ka(h,e);Object.keys(b).length>0&&s.push({start:a,end:a+m.length,style:b}),o.push(m),a+=m.length}if(a===f){let g=vn(p[0]?.style,e),m=Ka(g,e);Object.keys(m).length>0&&s.push({start:f,end:f,style:m})}}let l=o.join(""),c=[];for(let u of s){let d=c[c.length-1];d!==void 0&&d.start!==d.end&&u.start!==u.end&&(d.end===u.start||d.end+1===u.start&&l.charAt(d.end)===`
4
+ `)&&Ya(d.style,u.style)&&d?d.end=u.end:c.push({start:u.start,end:u.end,style:u.style})}return{text:l,runs:c,baseStyle:e,lineHeight:n}}function Br(t){let e=t.richTextRuns;if(_n(e))return Fr(e);let n=t.richTextData;return _n(n)&&Array.isArray(n.lines)&&n.lines.length>0?Lr(n):null}function Xa(t){let e=new Set;for(let n of Object.keys(t))if(n==="textDecoration")for(let r of Object.keys(t.textDecoration??{}))e.add(`textDecoration.${r}`);else e.add(n);return e}function ek(t,e){if(t.start===t.end||e.start>=e.end||t.start<e.start||t.end>e.end)return!1;let n=Xa(e.style);for(let r of Xa(t.style))if(!n.has(r))return!1;return!0}function qo(t,e){let n=[...t];for(let r of e)r.start>=r.end||Object.keys(r.style).length!==0&&(n=n.filter(i=>!ek(i,r)),n.push({start:r.start,end:r.end,style:r.style}));return n}function qa(t,e){if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!_n(r))continue;let i=ut(r.start),o=ut(r.end);if(i===void 0||o===void 0)continue;let s=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(o),0),e);if(s>=a)continue;let l=Yo(r.style);Object.keys(l).length!==0&&n.push({start:s,end:a,style:l})}return n}function Hh(t,e){let n=[];for(let r of t){let i=Xo({start:r.start,deleteCount:r.end-r.start,insert:""},e),o=i.start,s=o+i.deleteCount;o>=s||n.push({start:o,end:s,style:r.style})}return n}function Bh(t,e){return t.start===e.start&&t.end===e.end&&Ya(t.style,e.style)}function Wh(t,e){if(t.text!==e.text||t.lineHeight!==e.lineHeight||!Fn(vn(t.baseStyle),vn(e.baseStyle)))return null;let n=Array.isArray(t.runs)?t.runs:[],r=Array.isArray(e.runs)?e.runs:[],i=0,o=0;for(;o<r.length;){let l=-1;for(let c=i;c<n.length;c++)if(Bh(n[c],r[o])){l=c;break}if(l===-1)break;i=l+1,o++}let s=r.slice(o);if(s.length===0)return null;for(let l of s)if(l.start>=l.end||Object.keys(l.style).length===0)return null;let a=qo(n,s);if(a.length!==r.length)return null;for(let l=0;l<a.length;l++)if(!Bh(a[l],r[l]))return null;return s.map(l=>({start:l.start,end:l.end,style:Yo(l.style)}))}function tk(t,e){let n=e===0||t.charAt(e-1)===`
5
+ `,r=e===t.length||t.charAt(e)===`
6
+ `;return n&&r}function Kh(t,e,n){let r=[];for(let i of t){let o=i.start===i.end,s=Xo({start:i.start,deleteCount:i.end-i.start,insert:""},e),a=s.start,l=s.start+s.deleteCount;a===l&&(!o||!tk(n,a))||r.push({start:a,end:l,style:i.style})}return r}function Bn(t,e=t.id){return{kind:"pattern",id:e,name:t.name??e,pattern:{type:"pattern",svgContent:t.svgContent,width:t.width,height:t.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Zo(t){if(t.builtIn)return!1;let e=t.pattern;return!e||typeof e!="object"?!1:e.patternType==="custom"&&typeof e.svgContent=="string"}function xp(t){let e=(t.viewBox??"").trim().split(/[\s,]+/).filter(o=>o.length>0).map(Number),n=e.length===4&&e.every(o=>Number.isFinite(o)),r=n&&e[2]>0?e[2]:t.width??10,i=n&&e[3]>0?e[3]:t.height??10;return{width:r,height:i}}function Ai(t){if(!Zo(t))return null;let{width:e,height:n}=xp(t.pattern);return{id:t.id,name:t.name,svgContent:t.pattern.svgContent??"",width:e,height:n}}function tt(t){let e=[...t].sort((i,o)=>i.index-o.index);if(!e.some(i=>i.orderKey))return e;let n=Fa(e.length),r=new Map;return e.forEach((i,o)=>{r.set(i.id,i.orderKey??n[o])}),e.sort((i,o)=>{let s=Go(r.get(i.id)??"",r.get(o.id)??"");return s!==0?s:i.id<o.id?-1:i.id>o.id?1:0})}function St(t){return t.definitionId??`${t.type}-${t.id}`}function Za(t){return t.rawDefinition!==void 0?!0:t.clipShapeIds&&t.clipShapeIds.length>0?!1:!t.clipShapeId}function Ja(t){let e=Za(t);return t.type==="clip"?{type:"clip",...t.clipPathUnits!==void 0?{clipPathUnits:t.clipPathUnits}:{},...!e&&t.clipRule!==void 0?{clipRule:t.clipRule}:{},...e&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}:{type:"mask",...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)}:{},...e&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}}function Gr(t,e,n){let{clipPathUnits:r,clipRule:i,maskUnits:o,maskContentUnits:s,maskType:a,maskBounds:l,rawDefinition:c,...u}=structuredClone(t),d=e.rawDefinition!==void 0||Za(t);return t.type==="clip"?{...u,type:"clip",...e.clipPathUnits!==void 0?{clipPathUnits:e.clipPathUnits}:{},...!d&&e.clipRule!==void 0?{clipRule:e.clipRule}:{},...d&&n&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}:{...u,type:"mask",...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)}:{},...d&&n&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}}function xn(t){let e=new Map;for(let n of t??[]){let r=St(n),i=Ja(n),o=e.get(r);i.rawDefinition===void 0&&o?.rawDefinition!==void 0&&(i.rawDefinition=o.rawDefinition),e.set(r,i)}return e}function Ft(t){let e=structuredClone(t??[]),n=xn(e),r=new Set;return e.map(i=>{let o=St(i),s=n.get(o)??Ja(i),a=s.rawDefinition!==void 0&&!r.has(o);a&&r.add(o);let l=Gr(i,s,a);return Array.isArray(l.clipShapeIds)&&delete l.clipShapeId,l})}function rr(t,e){let n=structuredClone(t??[]);if(e.type==="clipMask:remove"){let l=n.find(f=>f.id===e.id);if(!l)return Ft(n);let c=St(l),u=xn(n).get(c),d=n.filter(f=>f.id!==e.id),p=d.findIndex(f=>St(f)===c);return u&&p>=0&&(d[p]=Gr(d[p],u,!0)),Ft(d)}let r=n.findIndex(l=>l.id===e.clipMaskGroup.id),i=r>=0?n[r]:void 0,o=i?xn(n).get(St(i)):void 0;r>=0&&n.splice(r,1);let s=Math.min(Math.max(0,e.index??n.length),n.length),a=structuredClone(e.clipMaskGroup);return o?.rawDefinition!==void 0&&a.rawDefinition===void 0&&St(i)===St(a)&&(a=Gr(a,o,!0)),n.splice(s,0,a),Ft(n)}function Qa(t,e,n,r){if(!t.some(o=>o.id===e))throw new Error(`Unknown clip/mask group: ${e}`);let i=t.map(o=>o.id===e?Gr({...o,definitionId:n},r,r.rawDefinition!==void 0):St(o)!==n?structuredClone(o):Gr(o,r,!1));return Ft(i)}var nk=/^structural:(clip|mask):(.+):(group|path|content)$/;function Xh(t,e){let n=`structural:${t}:${e}`;return{group:`${n}:group`,path:`${n}:path`,content:`${n}:content`}}function Yh(t,e){for(let n of t){e.add(n.id);let r=n.state.children;Array.isArray(r)&&Yh(r,e)}}function qh(t,e=null){let n=[];return t.forEach((r,i)=>{n.push({id:r.id,parentId:e,index:i});let o=r.state.children;Array.isArray(o)&&n.push(...qh(o,r.id))}),n}function ir(t){let e=t.sceneTree&&t.sceneTree.length>0?t.sceneTree:qh(t.shapes),n=new Map(e.map(I=>[I.id,I])),r=new Map;for(let I of e){let x=r.get(I.parentId)??[];x.push(I),r.set(I.parentId,x)}for(let[I,x]of r)r.set(I,tt(x));let i=I=>nk.test(I),o=new Set(e.filter(I=>!i(I.id)).map(I=>I.id)),s=new Set;Yh(t.shapes,s);let a=new Map,l=new Set,c=(I,x)=>{let P=[];for(let T of r.get(I)??[]){if(!i(T.id)){l.has(T.id)||(l.add(T.id),P.push(T.id));continue}if(x.has(T.id))continue;let k=new Set(x);k.add(T.id),P.push(...c(T.id,k))}return P},u=[null,...o];for(let I of u){let x=c(I,new Set);x.length>0&&a.set(I,x)}for(let I of o){if(l.has(I))continue;let x=n.get(I)?.parentId??null,P=x!==null&&o.has(x)?x:null,T=a.get(P)??[];T.push(I),a.set(P,T),l.add(I)}let d=I=>{for(let[x,P]of a){let T=P.indexOf(I);if(T>=0)return{parentId:x,index:T}}return null},p=I=>{for(let x of a.values()){let P=x.indexOf(I);P>=0&&x.splice(P,1)}},f=t.clipMaskGroups??[],g=xn(f),m=new Map(f.map(I=>[Xh(I.type,I.id).content,I])),h=(I,x=new Set)=>{if(x.has(I.id))return Number.MAX_SAFE_INTEGER;let P=I.parentId?m.get(I.parentId):void 0;if(!P)return 0;let T=new Set(x);return T.add(I.id),1+h(P,T)},b=[...f].sort((I,x)=>h(I)-h(x)||(I.siblingIndex??0)-(x.siblingIndex??0)),S=new Map;for(let I of b){let x=(I.clipShapeIds.length>0?I.clipShapeIds:I.clipShapeId?[I.clipShapeId]:[]).filter(O=>s.has(O)),P=I.contentShapeIds.filter(O=>s.has(O)),T=g.get(St(I));if(P.length===0||x.length===0&&!T?.rawDefinition)continue;let k=[...P,...x].map(d).filter(O=>O!==null),w=k[0]?.parentId??null,$=k.length>0?Math.min(...k.map(O=>O.index)):void 0,R=I.parentId===null||o.has(I.parentId)||m.has(I.parentId)?I.parentId:w;for(let O of[...x,...P])p(O);let C=Xh(I.type,I.id),A=a.get(R)??[],D=I.siblingIndex??$??A.length,_=Math.min(Math.max(0,D),A.length);A.splice(_,0,C.group),a.set(R,A),a.set(C.group,[C.path,C.content]),a.set(C.path,[...x]),a.set(C.content,[...P]),S.set(C.group,{id:C.group,parentId:R,index:0}),S.set(C.path,{id:C.path,parentId:C.group,index:0}),S.set(C.content,{id:C.content,parentId:C.group,index:1})}let v=[];for(let[I,x]of a)x.forEach((P,T)=>{let k=S.get(P);if(k){v.push({...k,parentId:I,index:T});return}let w=n.get(P);w&&w.parentId===I?v.push({...w,index:T}):v.push({id:P,parentId:I,index:T})});t.sceneTree=v}function Lt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ip(t){return Lt(t)&&typeof t.updatedAt=="number"&&Number.isSafeInteger(t.updatedAt)&&t.updatedAt>=0&&typeof t.clientId=="string"}function Vr(t,e){return{updatedAt:typeof t=="number"&&Number.isSafeInteger(t)&&t>=0?t:0,clientId:e??""}}function Jo(t,e){return Ip(e)?t.updatedAt>e.updatedAt||t.updatedAt===e.updatedAt&&t.clientId>=e.clientId:!0}function Zh(t){return Lt(t.collaborationState)||(t.collaborationState={}),t.collaborationState}function Jh(t,e){let n=Zh(t);Lt(n.shapeProps)||(n.shapeProps={});let r=n.shapeProps;return Lt(r[e])||(r[e]={}),r[e]}function Qo(t,e){let n=t.collaborationState?.shapeProps;if(!Lt(n))return{};let r=n[e];return Lt(r)?r:{}}function Qh(t,e,n,r){if(n.length===0)return;let i=Jh(t,e);for(let o of n)Jo(r,i[o])&&(i[o]=r)}function wp(t,e){let n=t.collaborationState?.shapeProps;if(Lt(n)){for(let r of e)delete n[r];rk(t)}}function rk(t){let e=t.collaborationState;if(Lt(e)){for(let n of["shapeProps","resources"]){let r=e[n];Lt(r)&&Object.keys(r).length===0&&delete e[n]}Object.keys(e).length===0&&delete t.collaborationState}}function kp(t){switch(t.type){case"guide:upsert":return`guide:${t.guide.id}`;case"guide:remove":case"guide:move":return`guide:${t.id}`;case"measurement:upsert":return`measurement:${t.measurement.id}`;case"measurement:remove":case"measurement:move":return`measurement:${t.id}`;case"metadata:patch":return"metadata:document";case"documentScript:upsert":return`documentScript:${t.documentScript.id}`;case"documentScript:remove":return`documentScript:${t.id}`;case"documentStyle:upsert":return`documentStyle:${t.documentStyle.id}`;case"documentStyle:remove":return`documentStyle:${t.id}`;case"templateVariable:upsert":return`templateVariable:${t.templateVariable.name}`;case"templateVariable:remove":return`templateVariable:${t.name}`;case"exportItem:upsert":return`exportItem:${t.exportItem.id}`;case"exportItem:remove":return`exportItem:${t.id}`;case"colorGlyphLibrary:set":return"colorGlyphLibrary";case"animation:config":case"animation:clear":case"animationTrack:upsert":case"animationTrack:remove":return"animation:timeline";case"animationKeyframe:upsert":return`animationKeyframe:${t.trackId}:${t.keyframe.id}`;case"animationKeyframe:remove":return`animationKeyframe:${t.trackId}:${t.keyframeId}`;case"clipMask:upsert":return`clipMask:${t.clipMaskGroup.id}`;case"clipMask:remove":return`clipMask:${t.id}`;case"library:upsert":return`library:${t.def.id}`;case"library:remove":return`library:${t.id}`;case"customPattern:upsert":return`customPattern:${t.customPattern.id}`;case"customPattern:remove":return`customPattern:${t.id}`;case"paintServerDef:upsert":return`paintServerDef:${t.paintServerDef.id}`;case"paintServerDef:remove":return`paintServerDef:${t.id}`;default:return null}}function ey(t,e,n){if(e.type==="shape:update"&&e.propTimestamps){if(!n)return null;let a=Qo(t,e.id),l={},c={},u=[];for(let[p,f]of Object.entries(e.state)){let g=Vr(e.propTimestamps[p],e.clientId);Jo(g,a[p])&&(l[p]=f,c[p]=g.updatedAt,u.push([p,g]))}if(u.length===0)return null;let d=Jh(t,e.id);for(let[p,f]of u)d[p]=f;return{...e,state:l,propTimestamps:c}}let r=kp(e);if(r===null||!("updatedAt"in e)||e.updatedAt===void 0)return e;let i=Vr(e.updatedAt,e.clientId),o=Zh(t);Lt(o.resources)||(o.resources={});let s=o.resources;return Jo(i,s[r])?(s[r]=i,{...e,updatedAt:i.updatedAt,clientId:i.clientId}):null}function ty(t){let e=0,n=t.collaborationState?.shapeProps;if(Lt(n)){for(let i of Object.values(n))if(Lt(i))for(let o of Object.values(i))Ip(o)&&(e=Math.max(e,o.updatedAt))}let r=t.collaborationState?.resources;if(Lt(r))for(let i of Object.values(r))Ip(i)&&(e=Math.max(e,i.updatedAt));for(let i of t.sceneTree??[])typeof i.updatedAt=="number"&&Number.isSafeInteger(i.updatedAt)&&i.updatedAt>=0&&(e=Math.max(e,i.updatedAt));return e}function ny(t,e){let n=Object.keys(e.state);if(n.length===0)return;let r=Qo(t,e.id),i=0;for(let s of n){let a=Vr(e.propTimestamps?.[s],e.clientId);i=Math.max(i,r[s]?.updatedAt??0,a.updatedAt)}let o=i+1;e.propTimestamps=Object.fromEntries(n.map(s=>[s,o]))}function jr(t){t.symbols!==void 0&&(t.symbols=(t.library??[]).filter(e=>e.kind==="symbol").map(({kind:e,...n})=>n)),t.customPatterns!==void 0&&(t.customPatterns=(t.library??[]).filter(e=>e.kind==="pattern").map(e=>Ai(e)).filter(e=>e!==null))}function ly(t,e=null){let n=[];return t.forEach((r,i)=>{n.push({id:r.id,parentId:e,index:i});let o=r.state.children;Array.isArray(o)&&n.push(...ly(o,r.id))}),n}function Zt(t,e){if(t===e)return!0;let n=t??ry,r=e??ry;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return!0}var ry=[];function es(t){return t.sceneTree&&t.sceneTree.length>0?t.sceneTree:ly(t.shapes)}function ik(t,e){let n=t,r=new Set(t.map(s=>s.id)),i=(s,a,l)=>{r.has(s.id)||(n=Rp(n,{id:s.id,parentId:a,index:l}),r.add(s.id)),Mi(s)?.forEach((u,d)=>i(u,s.id,d))},o=n.filter(s=>s.parentId===null).length;return i(e,null,o),n}function cy(t){let e=new Map;for(let r of t){let i=e.get(r.parentId)??[];i.push(r),e.set(r.parentId,i)}let n=[];for(let r of e.values())tt(r).forEach((i,o)=>n.push({...i,index:o}));return n}function ns(t,e){let n=t.filter(l=>l.parentId===e);if(n.every(l=>l.orderKey))return t;let r=tt(n),i=new Map,o=[],s=null,a=l=>{if(o.length===0)return;let c=_a(s,l,o.length);o.forEach((u,d)=>i.set(u.id,c[d])),o=[]};for(let l of r)l.orderKey?(a(l.orderKey),s=l.orderKey):o.push(l);return a(null),t.map(l=>i.has(l.id)?{...l,orderKey:i.get(l.id)}:l)}function Rp(t,e){let n,r=[],i=[],o=!1;for(let l of t){if(l.id===e.id){if(n=l,!Tp(e,n))return t;continue}l.parentId===e.parentId?(r.push(l),l.orderKey&&(o=!0)):i.push(l)}if(o){let l=ns([...i,...r],e.parentId),c=tt(l.filter(g=>g.parentId===e.parentId)),u=Math.min(Math.max(0,e.index),c.length),d=u>0?c[u-1].orderKey??null:null,p=u<c.length?c[u].orderKey??null:null,f=d!==null&&p!==null&&d>=p?d:wi(d,p);return[...i,...c,{...e,orderKey:f}]}let s=r.sort((l,c)=>l.index-c.index).map((l,c)=>({...l,index:c})),a=Math.min(Math.max(0,e.index),s.length);return[...i,...s,{...e,index:a-.5}]}function ok(t){t.keyframes.sort((e,n)=>{if(e.time!==n.time)return e.time-n.time;let r=e.id??"",i=n.id??"";return r<i?-1:r>i?1:0})}function Cp(t,e){let n=t.keyframes.findIndex(r=>r.id===e.id);n>=0?t.keyframes[n]=e:t.keyframes.push(e),ok(t)}function $p(t,e){t.keyframes=t.keyframes.filter(n=>n.id!==e)}function iy(t,e){let n=t.animationTimeline?.tracks;return Array.isArray(n)?n.find(r=>r.id===e)??null:null}function Tp(t,e){let n=t.updatedAt??0,r=e.updatedAt??0;return n!==r?n>r:(t.clientId??"")>=(e.clientId??"")}function Mi(t){let e=t.state.children;return Array.isArray(e)?e:void 0}var ts=new Set(["group","hyperlink","switch","container","svg"]);function dy(t,e,n,r){for(let i of t){n.set(i.id,e),r.set(i.id,i);let o=Mi(i);o&&dy(o,i.id,n,r)}}function Hr(t){let e=t.sceneTree;if(!e||e.length===0)return;let n=new Map,r=new Map;if(dy(t.shapes,null,n,r),r.size===0)return;for(let d of r.values())delete d.state.groupId;let i=new Map;for(let d of e){let p=i.get(d.parentId)??[];p.push(d),i.set(d.parentId,p)}let o=new Map,s=(d,p)=>{let f=o.get(d);f?f.push(p):o.set(d,[p])},a=new Set,l=new Set,c=(d,p)=>{for(let f of tt(i.get(d)??[])){if(l.has(f.id))continue;l.add(f.id);let g=r.get(f.id);if(!g){c(f.id,p);continue}s(p,g),a.add(g.id),ts.has(g.type)&&c(f.id,g.id)}};if(c(null,null),a.size===0)return;let u=d=>{let p=n.get(d)??null,f=new Set;for(;p!==null&&!f.has(p);){f.add(p);let g=r.get(p);if(g&&ts.has(g.type))return p;p=n.get(p)??null}return null};for(let[d,p]of r)a.has(d)||s(u(d),p);for(let[d,p]of r){if(!ts.has(p.type))continue;let f=p.state,g=o.get(d);g&&g.length>0?f.children=g:"children"in f&&delete f.children}t.shapes=o.get(null)??[]}function sk(t){let e=`structural:${t.type}:${t.id}`;return{group:`${e}:group`,path:`${e}:path`,content:`${e}:content`}}function Ni(t){let e=t.clipMaskGroups;if(!e||e.length===0)return;let n=t.sceneTree;if(!n||n.length===0)return;let r=new Set(n.map(a=>a.id)),i=new Map;for(let a of n){if(a.parentId===null)continue;let l=i.get(a.parentId);l?l.push(a):i.set(a.parentId,[a])}let o=a=>tt(i.get(a)??[]).map(l=>l.id).filter(l=>!l.startsWith("structural:")),s=new Map(n.map(a=>[a.id,a]));t.clipMaskGroups=e.map(a=>{let l=sk(a);if(!r.has(l.group))return a;let c=r.has(l.path)?o(l.path):a.clipShapeIds,u=r.has(l.content)?o(l.content):a.contentShapeIds,d=s.get(l.group),p=a.parentId,f=a.siblingIndex;if(d){p=d.parentId;let m=d.parentId===null?n.filter(b=>b.parentId===null):i.get(d.parentId)??[],h=tt(m).findIndex(b=>b.id===l.group);f=h>=0?h:d.index}if(oy(c,a.clipShapeIds)&&oy(u,a.contentShapeIds)&&p===a.parentId&&f===a.siblingIndex)return a;let g={...a,clipShapeIds:c,contentShapeIds:u,parentId:p,siblingIndex:f};return g.clipShapeId!==void 0&&(g.clipShapeId=c[0]),g})}function oy(t,e){return!e||t.length!==e.length?!1:t.every((n,r)=>n===e[r])}function Ep(t,e){e.add(t.id);let n=Mi(t);if(n)for(let r of n)Ep(r,e)}function Pp(t,e){for(let n of t){e.set(n.id,n);let r=Mi(n);r&&Pp(r,e)}}var el=class{constructor(e,n){this.snapshot=e;this.indexed=n}snapshot;indexed;shapeIndex=null;inlineProjectionPending=!1;sceneTreeNormalizePending=!1;memoId=null;memoShape=null;findShape(e){if(this.memoId===e)return this.memoShape;let n;return this.indexed?(this.shapeIndex===null&&(this.shapeIndex=new Map,Pp(this.snapshot.shapes,this.shapeIndex)),n=this.shapeIndex.get(e)??null):n=Wr(this.snapshot.shapes,e),this.memoId=e,this.memoShape=n,n}noteShapesAdded(e){this.memoId=null,this.memoShape=null,this.shapeIndex!==null&&Pp([e],this.shapeIndex)}noteShapesRemoved(){this.shapeIndex=null,this.memoId=null,this.memoShape=null}requestInlineProjection(){this.inlineProjectionPending=!0}requestSceneTreeNormalize(){this.sceneTreeNormalizePending=!0}settle(){if(this.sceneTreeNormalizePending){this.sceneTreeNormalizePending=!1;let e=this.snapshot.sceneTree;e&&e.length>0&&(this.snapshot.sceneTree=cy(e))}this.inlineProjectionPending&&(this.inlineProjectionPending=!1,Hr(this.snapshot))}};function Wr(t,e){for(let n of t){if(n.id===e)return n;let r=Mi(n);if(!r)continue;let i=Wr(r,e);if(i)return i}return null}function Ur(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ak(t){let e=t.richTextRuns;return!Ur(e)||typeof e.text!="string"?null:Fr(e)}function lk(t,e){let n=t.state;"extra"in n&&er(n);let r=new Set;for(let[i,o]of Object.entries(e))o===null?r.add(i):n[i]=o;if(r.size>0){let i={};for(let[o,s]of Object.entries(n))r.has(o)||(i[o]=s);t.state=i}}function uy(t,e,n){let r=[];for(let i of t){if(i.id===e){Ep(i,n);continue}let o=Mi(i);if(o){let s=uy(o,e,n),a=i.state;s.length>0?a.children=s:delete a.children}r.push(i)}return r}function py(t,e){let n=t.snapshot,r=n,i=ey(n,e,e.type!=="shape:update"||t.findShape(e.id)!==null);if(i===null)return null;let o=i,s=o;switch(o.type){case"shape:add":{if(!(t.findShape(o.shape.id)!==null)){let l=es(r),c=Ba(structuredClone(o.shape));r.shapes.push(c),r.sceneTree=ik(l,c),t.noteShapesAdded(c),t.requestSceneTreeNormalize(),t.requestInlineProjection();let u=new Set;Ep(c,u),wp(n,u)}break}case"shape:update":{let a=t.findShape(o.id);if(!a)return null;lk(a,o.state);break}case"text:format":{let a=t.findShape(o.id);if(!a)return null;let l=a.state;"extra"in l&&er(l);let c=ak(l);if(!c)return null;let u=qa(o.ranges,c.text.length);if(u.length===0)return null;let d={...c,runs:qo(c.runs,u)};l.richTextRuns=d;let p=["richTextRuns"];if(Ur(l.richTextData)&&(l.richTextData=Ln(d),p.push("richTextData")),o.updatedAt!==void 0){let f=Vr(o.updatedAt,o.clientId),g=Qo(n,o.id);if(p.some(h=>!Jo(f,g?.[h]))){let h=Math.max(0,...p.map(b=>g?.[b]?.updatedAt??0));f={updatedAt:Math.max(f.updatedAt,h)+1,clientId:f.clientId},s={...o,updatedAt:f.updatedAt,clientId:f.clientId}}Qh(n,o.id,p,f)}break}case"shape:remove":{let a=new Set,l=uy(r.shapes,o.id,a),c=a.size>0;c||a.add(o.id);let u=es(r),d=u.filter(p=>!a.has(p.id));if(!c&&d.length===u.length)return null;r.shapes=l,r.sceneTree=d,t.noteShapesRemoved(),wp(n,a),Ni(r);break}case"scene:move":{let a=es(r),l=a.find(d=>d.id===o.id),c=o.updatedAt===void 0?void 0:Vr(o.updatedAt,o.clientId),u={id:o.id,parentId:o.parentId,index:o.index,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!Tp(u,l))return null;r.sceneTree=Rp(a,u),t.requestSceneTreeNormalize(),c&&(s={...o,...c}),t.requestInlineProjection(),Ni(r);break}case"scene:place":{if(!Bo(o.orderKey))return null;let a=es(r),l=a.find(p=>p.id===o.id),c=o.updatedAt===void 0?void 0:Vr(o.updatedAt,o.clientId),u={id:o.id,parentId:o.parentId,index:l?.index??Number.MAX_SAFE_INTEGER,orderKey:o.orderKey,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!Tp(u,l))return null;let d=ns(a,o.parentId);r.sceneTree=[...d.filter(p=>p.id!==o.id),u],t.requestSceneTreeNormalize(),t.requestInlineProjection(),Ni(r),c&&(s={...o,...c});break}case"shapes:reorder":{let a=es(r);o.ids.forEach((l,c)=>{a.some(u=>u.id===l&&u.parentId===null)&&(a=Rp(a,{id:l,parentId:null,index:c}))}),r.sceneTree=a,t.requestSceneTreeNormalize(),t.requestInlineProjection(),Ni(r);break}case"groups:set":r.groups=o.groups;break;case"clipmasks:set":r.clipMaskGroups=Ft(o.clipMaskGroups),ir(r);break;case"clipMask:upsert":r.clipMaskGroups=rr(r.clipMaskGroups,o),ir(r);break;case"clipMask:remove":{if(!(r.clipMaskGroups??[]).some(l=>l.id===o.id))return null;let a=rr(r.clipMaskGroups,o);r.clipMaskGroups=a,ir(r);break}case"guides:set":r.guides=o.guides;break;case"guide:upsert":r.guides=Wo(r.guides,o);break;case"guide:remove":case"guide:move":{let a=Wo(r.guides,o);if(Zt(r.guides,a))return null;r.guides=a;break}case"measurements:set":r.measurements=o.measurements;break;case"measurement:upsert":r.measurements=Ko(r.measurements,o);break;case"measurement:remove":case"measurement:move":{let a=Ko(r.measurements,o);if(Zt(r.measurements,a))return null;r.measurements=a;break}case"metadata:set":r.documentMetadata=o.metadata;break;case"metadata:patch":{let a=Object.fromEntries(Object.entries({...r.documentMetadata??{},...o.patch}).filter(([l])=>!(o.removeKeys??[]).includes(l)));r.documentMetadata=a;break}case"documentScripts:set":r.documentScripts=o.documentScripts;break;case"documentScript:upsert":r.documentScripts=ct(r.documentScripts,o.documentScript,o.index);break;case"documentScript:remove":{let a=dt(r.documentScripts,o.id);if(Zt(r.documentScripts,a))return null;r.documentScripts=a;break}case"documentStyles:set":r.documentStyles=o.documentStyles;break;case"documentStyle:upsert":r.documentStyles=ct(r.documentStyles,o.documentStyle,o.index);break;case"documentStyle:remove":{let a=dt(r.documentStyles,o.id);if(Zt(r.documentStyles,a))return null;r.documentStyles=a;break}case"templateVariables:set":r.templateVariables=o.templateVariables;break;case"templateVariable:upsert":r.templateVariables=Ha(r.templateVariables,o.templateVariable,o.index);break;case"templateVariable:remove":{let a=Wa(r.templateVariables,o.name);if(Zt(r.templateVariables,a))return null;r.templateVariables=a;break}case"exportItems:set":r.exportItems=o.exportItems;break;case"exportItem:upsert":r.exportItems=ct(r.exportItems,o.exportItem,o.index);break;case"exportItem:remove":{let a=dt(r.exportItems,o.id);if(Zt(r.exportItems,a))return null;r.exportItems=a;break}case"colorGlyphLibrary:set":o.colorGlyphLibrary===null?delete r.colorGlyphLibrary:r.colorGlyphLibrary=o.colorGlyphLibrary;break;case"animation:set":r.animationTimeline=o.animationTimeline;break;case"animation:config":r.animationTimeline={duration:o.config.duration,loop:o.config.loop,playbackSpeed:o.config.playbackSpeed,tracks:Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[]};break;case"animation:clear":delete r.animationTimeline;break;case"animationTrack:upsert":r.animationTimeline={duration:typeof r.animationTimeline?.duration=="number"?r.animationTimeline.duration:0,loop:typeof r.animationTimeline?.loop=="boolean"?r.animationTimeline.loop:!1,playbackSpeed:typeof r.animationTimeline?.playbackSpeed=="number"?r.animationTimeline.playbackSpeed:1,tracks:ct(Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],o.track,o.index)};break;case"animationTrack:remove":{let a=Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],l=dt(a,o.id);if(Zt(a,l)&&!r.animationTimeline)return null;l.length>0&&r.animationTimeline?r.animationTimeline={...r.animationTimeline,tracks:l}:delete r.animationTimeline;break}case"animationKeyframe:upsert":{let a=iy(r,o.trackId);if(!a)return null;Cp(a,structuredClone(o.keyframe));break}case"animationKeyframe:remove":{let a=iy(r,o.trackId);if(!a)return null;let l=a.keyframes;if($p(a,o.keyframeId),Zt(l,a.keyframes))return null;break}case"symbols:set":{r.symbols=o.symbols;let a=o.symbols.map(c=>({...c,kind:"symbol"})),l=(r.library??[]).filter(c=>c.kind!=="symbol");r.library=[...a,...l],jr(r);break}case"customPatterns:set":r.customPatterns=o.customPatterns;{let a=new Set(o.customPatterns.map(c=>c.id)),l=(r.library??[]).filter(c=>!a.has(c.id)&&(c.kind!=="pattern"||!Zo(c)));r.library=[...l,...o.customPatterns.map(c=>Bn(c))]}jr(r);break;case"customPattern:upsert":{r.customPatterns=ct(r.customPatterns,o.customPattern,o.index);let a=Bn(o.customPattern),l=[...r.library??[]],c=l.findIndex(u=>u.id===a.id);c>=0?l[c]=a:l.push(a),r.library=l,jr(r);break}case"customPattern:remove":{let a=dt(r.customPatterns,o.id),l=dt(r.library,o.id);if(Zt(r.customPatterns,a)&&Zt(r.library,l))return null;r.customPatterns=a,r.library=l,jr(r);break}case"library:set":r.library=o.library,jr(r);break;case"library:upsert":r.library=ct(r.library,o.def,o.index),jr(r);break;case"library:remove":{let a=dt(r.library,o.id);if(Zt(r.library,a))return null;r.library=a,jr(r);break}case"rawPaintServerDefs:set":r.rawPaintServerDefs=o.rawPaintServerDefs,delete r.paintServerDefs;break;case"paintServerDefs:set":r.paintServerDefs=o.paintServerDefs,r.rawPaintServerDefs=o.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:upsert":r.paintServerDefs=ct(r.paintServerDefs,o.paintServerDef,o.index),r.rawPaintServerDefs=r.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:remove":{let a=dt(r.paintServerDefs,o.id);if(Zt(r.paintServerDefs,a))return null;r.paintServerDefs=a,r.rawPaintServerDefs=a.map(l=>l.markup);break}case"presence:cursor":case"presence:selection":break;default:{let a=o;return null}}return s}function fy(t,e,n){if(e.type==="shape:update"&&e.propTimestamps){let r=n?.type==="shape:update"?new Set(Object.keys(n.state)):new Set,i=Object.keys(e.state).filter(o=>!r.has(o));return sy(t,e.id,i)}if(e.type==="text:format"&&n?.type==="text:format"){if(!(n.updatedAt!==e.updatedAt||n.clientId!==e.clientId))return[];let i=Wr(t.shapes,e.id)?.state,o=i&&Ur(my(i,"richTextData"))?["richTextRuns","richTextData"]:["richTextRuns"];return sy(t,e.id,o)}return[]}function my(t,e){if(e in t)return t[e];let n=t.extra;return Ur(n)?n[e]:void 0}function ck(t,e){if(e in t)return!0;let n=t.extra;return Ur(n)&&e in n}function sy(t,e,n){if(n.length===0)return[];let r=Wr(t.shapes,e);if(!r)return[];let i=r.state,o=Qo(t,e),s=new Map;for(let l of n){let c=o[l];if(!c)continue;let u=s.get(c.clientId);u?u.push(l):s.set(c.clientId,[l])}let a=[];for(let[l,c]of s){let u={},d={};for(let p of c)u[p]=ck(i,p)?structuredClone(my(i,p)):null,d[p]=o[p].updatedAt;a.push({type:"shape:update",id:e,state:u,propTimestamps:d,clientId:l})}return a}function tl(t,e){let n=new el(t,!1),r=py(n,e);return n.settle(),r}function Ap(t,e){let n=new el(t,e.length>1),r=[];for(let i of e){let o=py(n,i);o&&r.push(o)}return n.settle(),r}function Np(t,e){let n=structuredClone(t);return{snapshot:n,acceptedOps:Ap(n,e)}}function gy(t,e){return Np(t,e).snapshot}function hy(t){if(!t||t.length===0||t.every(n=>n.orderKey))return t;let e=t;for(let n of new Set(t.map(r=>r.parentId)))e=ns(e,n);return cy(e)}function yy(t,e){if(!t.some(r=>r.type==="scene:place"))return t;let n=new Map((e??[]).map(r=>[r.id,r]));return t.map(r=>{if(r.type!=="scene:place")return r;let i=n.get(r.id);return{type:"scene:move",id:r.id,parentId:i?.parentId??r.parentId,index:i?.index??0,updatedAt:r.updatedAt,clientId:r.clientId}})}function Sy(t,e){if(!t.some(i=>i.type==="animationKeyframe:upsert"||i.type==="animationKeyframe:remove"))return t;let n=Array.isArray(e?.tracks)?e.tracks:[],r=[];for(let i of t){if(i.type!=="animationKeyframe:upsert"&&i.type!=="animationKeyframe:remove"){r.push(i);continue}let o=n.findIndex(s=>s.id===i.trackId);o!==-1&&r.push({type:"animationTrack:upsert",track:structuredClone(n[o]),index:o,updatedAt:i.updatedAt,clientId:i.clientId})}return r}function by(t,e){if(!t.some(r=>r.type==="text:format"))return t;let n=[];for(let r of t){if(r.type!=="text:format"){n.push(r);continue}let i=Wr(e,r.id);if(!i)continue;let o=i.state.richTextRuns;if(!Ur(o))continue;let s={richTextRuns:structuredClone(o)},a=i.state.richTextData;Ur(a)&&(s.richTextData=structuredClone(a)),n.push({type:"shape:update",id:r.id,state:s,...typeof r.updatedAt=="number"?{propTimestamps:Object.fromEntries(Object.keys(s).map(l=>[l,r.updatedAt]))}:{},...r.clientId!==void 0?{clientId:r.clientId}:{}})}return n}function vy(t,e){if(!t.some(r=>r.type==="guide:move"||r.type==="measurement:move"))return t;let n=[];for(let r of t)if(r.type==="guide:move"){let i=e.guides??[],o=i.findIndex(s=>s.id===r.id);if(o===-1)continue;n.push({type:"guide:upsert",guide:structuredClone(i[o]),index:o,updatedAt:r.updatedAt,clientId:r.clientId})}else if(r.type==="measurement:move"){let i=e.measurements??[],o=i.findIndex(s=>s.id===r.id);if(o===-1)continue;n.push({type:"measurement:upsert",measurement:structuredClone(i[o]),index:o,updatedAt:r.updatedAt,clientId:r.clientId})}else n.push(r);return n}var xy=6,ay=new Set(["templateVariables:set","templateVariable:upsert","templateVariable:remove","exportItems:set","exportItem:upsert","exportItem:remove","colorGlyphLibrary:set"]);function Iy(t){return t.some(e=>ay.has(e.type))?t.filter(e=>!ay.has(e.type)):t}function wy(t,e){if(t.length===0)return;let n=new Map;for(let o of t){let s=n.get(o.parentId)??[];s.push(o),n.set(o.parentId,s)}let r=new Set,i=o=>{if(r.has(o)||(r.add(o),o!==null&&!e.hasNode(o)))return;let s=n.get(o);if(!s)return;let a=0;for(let l of tt(s)){if(!e.hasNode(l.id))continue;let c=a++;(e.getParentId(l.id)!==o||e.getSiblingIndex(l.id)!==c)&&e.move(l.id,o,c),i(l.id)}};i(null);for(let o of n.keys())o!==null&&i(o)}var Oi="data-svgsketch-passthrough",dk=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]),uk=/^<([A-Za-z][\w:-]*)\b[^>]*>/;function ky(t){return uk.exec(t.trimStart())}function Di(t){let e=ky(t);if(!e)return null;let n=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(e[0]);return n?n[1]??n[2]:null}function pk(t){let e=ky(t);if(!e)return null;let n=e[1],r=n.lastIndexOf(":");return r>=0?n.slice(r+1):n}var fk=new RegExp(`\\s+${Oi}\\s*=\\s*(?:"[^"]*"|'[^']*')`);function rs(t){let e=t.markup.indexOf(">");if(e<0)return t;let n=t.markup.slice(0,e+1),r=fk.exec(n);if(!r)return t;let i=n.slice(0,r.index)+n.slice(r.index+r[0].length);return{...t,markup:i+t.markup.slice(e+1),passthrough:!0}}function is(t){let e=[];for(let n of t){if(typeof n!="string")continue;let r=Di(n);if(!r)continue;let i=pk(n),o=i&&dk.has(i)?i:"mask";e.push(rs({id:r,type:o,markup:n}))}return e}var rl={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."},groups:{kind:"retired",note:"Legacy hierarchy sidecar, emitted empty; parentage rides sceneTree."},clipMaskGroups:{kind:"aggregate"},documentMetadata:{kind:"aggregate"},documentScripts:{kind:"aggregate"},documentStyles:{kind:"aggregate"},templateVariables:{kind:"aggregate"},animationTimeline:{kind:"aggregate"},library:{kind:"aggregate"},rawPaintServerDefs:{kind:"stamped",note:"Derived projection stamped at serialize time: paintServerDefs.map(def => def.markup), emitted beside the typed section for legacy readers. No live state of its own; inbound-only as the legacy fallback the typed form wins over (paintServerDefsFromRawFragments lifts it)."},paintServerDefs:{kind:"aggregate"},customPatterns:{kind:"retired",note:"Deprecated v1 field, read-only inbound."},symbols:{kind:"retired",note:"Deprecated v1 field, read-only inbound."},markers:{kind:"retired",note:"Deprecated v1 field, read-only inbound."},colorGlyphLibrary:{kind:"aggregate"},exportItems:{kind:"aggregate"},unknownFields:{kind:"aggregate"}},Ry=Object.keys(rl).filter(t=>rl[t].kind==="aggregate");function Gn(t,e){return JSON.stringify(t)===JSON.stringify(e)}function ol(){return{title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"",customMetadata:{}}}function Ty(t){return{...ol(),...t??{}}}function nl(t){let e=t.paintServerDefs&&t.paintServerDefs.length>0?t.paintServerDefs:is(t.rawPaintServerDefs??[]);return{guides:structuredClone(t.guides??[]),measurements:structuredClone(t.measurements??[]),clipMaskGroups:Ft(t.clipMaskGroups??[]),documentMetadata:structuredClone(Ty(t.documentMetadata)),documentScripts:structuredClone(t.documentScripts??[]),documentStyles:structuredClone(t.documentStyles??[]),templateVariables:structuredClone(t.templateVariables??[]),animationTimeline:t.animationTimeline===void 0?null:structuredClone(t.animationTimeline),exportItems:structuredClone(t.exportItems??[]),colorGlyphLibrary:t.colorGlyphLibrary===void 0||t.colorGlyphLibrary===null?null:structuredClone(t.colorGlyphLibrary),library:structuredClone(t.library??[]),paintServerDefs:structuredClone(e),unknownFields:structuredClone(t.unknownFields??{})}}var il=["symbol","marker","linear-gradient","radial-gradient","pattern","filter"];function Mp(t){let e=t.filter(i=>i.builtIn!==!0),n=il.map(()=>[]),r=[];for(let i of e){let o=il.indexOf(i.kind);o>=0?n[o].push(i):r.push(i)}return[...n.flat(),...r]}var or=class t{graph;sections={guides:[],measurements:[],clipMaskGroups:[],documentMetadata:ol(),documentScripts:[],documentStyles:[],templateVariables:[],animationTimeline:null,exportItems:[],colorGlyphLibrary:null,library:[],paintServerDefs:[],unknownFields:{}};listeners=new Set;unsubscribeGraphStructure=null;disposed=!1;constructor(e=new tr){this.graph=e,this.unsubscribeGraphStructure=this.graph.onStructureChange((n,r)=>{this.foldGraphStructureIntoClipMaskGroups(n,r.id)})}foldGraphStructureIntoClipMaskGroups(e,n){if(this.sections.clipMaskGroups.length===0)return;let r=e==="remove"?/^structural:(clip|mask):(.+):group$/.exec(n):null,i=r?this.sections.clipMaskGroups.filter(s=>!(s.type===r[1]&&s.id===r[2])):this.sections.clipMaskGroups;i=i.map(s=>{let a=`structural:${s.type}:${s.id}`,l=this.graph.getNode(`${a}:group`);if(!l)return s;let c=this.graph.getNode(`${a}:path`),u=this.graph.getNode(`${a}:content`),d=c?this.graph.getChildren(c.id).filter(m=>m.getProp("structural")!==!0).map(m=>m.id):s.clipShapeIds,p=u?this.graph.getChildren(u.id).filter(m=>m.getProp("structural")!==!0).map(m=>m.id):s.contentShapeIds,f=this.graph.getSiblingIndex(l.id),g={...s,clipShapeIds:d,contentShapeIds:p,parentId:this.graph.getParentId(l.id),...f>=0?{siblingIndex:f}:{}};return s.clipShapeId!==void 0&&(g.clipShapeId=d[0]),g});let o=Ft(i);Gn(this.sections.clipMaskGroups,o)||(this.sections.clipMaskGroups=o,this.notify("clipMaskGroups"))}onSectionChange(e){return this.disposed?()=>{}:(this.listeners.add(e),()=>this.listeners.delete(e))}notify(e){if(!this.disposed)for(let n of[...this.listeners])n(e)}get isDisposed(){return this.disposed}get sectionListenerCount(){return this.listeners.size}getGuides(){return structuredClone(this.sections.guides)}setGuides(e){this.sections.guides=structuredClone(e),this.notify("guides")}getMeasurements(){return structuredClone(this.sections.measurements)}setMeasurements(e){this.sections.measurements=structuredClone(e),this.notify("measurements")}getDocumentMetadata(){return structuredClone(this.sections.documentMetadata)}setDocumentMetadata(e){this.sections.documentMetadata=structuredClone(Ty(e)),this.notify("documentMetadata")}getDocumentScripts(){return structuredClone(this.sections.documentScripts)}setDocumentScripts(e){this.sections.documentScripts=structuredClone(e),this.notify("documentScripts")}getDocumentStyles(){return structuredClone(this.sections.documentStyles)}setDocumentStyles(e){this.sections.documentStyles=structuredClone(e),this.notify("documentStyles")}getTemplateVariables(){return structuredClone(this.sections.templateVariables)}setTemplateVariables(e){this.sections.templateVariables=structuredClone(e),this.notify("templateVariables")}getAnimationTimeline(){return this.sections.animationTimeline===null?null:structuredClone(this.sections.animationTimeline)}setAnimationTimeline(e){this.sections.animationTimeline=e==null?null:structuredClone(e),this.notify("animationTimeline")}getExportItems(){return structuredClone(this.sections.exportItems)}setExportItems(e){this.sections.exportItems=structuredClone(e),this.notify("exportItems")}getColorGlyphLibrary(){return this.sections.colorGlyphLibrary===null?null:structuredClone(this.sections.colorGlyphLibrary)}setColorGlyphLibrary(e){this.sections.colorGlyphLibrary=e===null?null:structuredClone(e),this.notify("colorGlyphLibrary")}getLibrary(){return structuredClone(this.sections.library)}setLibrary(e){this.sections.library=structuredClone(e),this.notify("library")}upsertLibraryDef(e,n){let r=this.sections.library.findIndex(s=>s.id===e.id),i=n??(r>=0?r:void 0),o=ct(this.sections.library,structuredClone(e),i);Gn(this.sections.library,o)||(this.sections.library=o,this.notify("library"))}removeLibraryDef(e){let n=dt(this.sections.library,e);Gn(this.sections.library,n)||(this.sections.library=n,this.notify("library"))}assembleLibrary(){return Mp(this.getLibrary())}getPaintServerDefs(){return structuredClone(this.sections.paintServerDefs)}setPaintServerDefs(e){this.sections.paintServerDefs=structuredClone(e).map(n=>rs(n)),this.notify("paintServerDefs")}getClipMaskGroups(){return structuredClone(this.sections.clipMaskGroups)}setClipMaskGroups(e){this.sections.clipMaskGroups=Ft(e),this.notify("clipMaskGroups")}getClipMaskDefinition(e){let n=xn(this.sections.clipMaskGroups).get(e);return n?structuredClone(n):null}getClipMaskDefinitions(){return structuredClone(Object.fromEntries(xn(this.sections.clipMaskGroups)))}upsertClipMaskDefinition(e,n,r){let i=Qa(this.sections.clipMaskGroups,e,n,r);Gn(this.sections.clipMaskGroups,i)||(this.sections.clipMaskGroups=i,this.notify("clipMaskGroups"))}upsertClipMaskGroup(e){let n=this.sections.clipMaskGroups.findIndex(i=>i.id===e.id),r=rr(this.sections.clipMaskGroups,{type:"clipMask:upsert",clipMaskGroup:e,...n>=0?{index:n}:{}});Gn(this.sections.clipMaskGroups,r)||(this.sections.clipMaskGroups=r,this.notify("clipMaskGroups"))}unbindClipMaskGroup(e){let n=rr(this.sections.clipMaskGroups,{type:"clipMask:remove",id:e});Gn(this.sections.clipMaskGroups,n)||(this.sections.clipMaskGroups=n,this.notify("clipMaskGroups"))}removeClipMaskDefinition(e){let n=Ft(this.sections.clipMaskGroups.filter(r=>St(r)!==e));Gn(this.sections.clipMaskGroups,n)||(this.sections.clipMaskGroups=n,this.notify("clipMaskGroups"))}getUnknownFields(){return Object.keys(this.sections.unknownFields).length>0?structuredClone(this.sections.unknownFields):void 0}setUnknownFields(e){this.sections.unknownFields=structuredClone(e??{}),this.notify("unknownFields")}adoptReducerSnapshot(e){let n=this.sections,r=nl(e),i=Ry.filter(o=>!Gn(n[o],r[o]));this.sections=r;for(let o of i)this.notify(o);return i}snapshotForReducer(){let e=structuredClone(this.sections.paintServerDefs);return{schemaVersion:Tt,shapes:[],viewboxes:[],guides:structuredClone(this.sections.guides),measurements:structuredClone(this.sections.measurements),clipMaskGroups:structuredClone(this.sections.clipMaskGroups),documentMetadata:structuredClone(this.sections.documentMetadata),documentScripts:structuredClone(this.sections.documentScripts),documentStyles:structuredClone(this.sections.documentStyles),templateVariables:structuredClone(this.sections.templateVariables),...this.sections.animationTimeline===null?{}:{animationTimeline:structuredClone(this.sections.animationTimeline)},exportItems:structuredClone(this.sections.exportItems),...this.sections.colorGlyphLibrary===null?{}:{colorGlyphLibrary:structuredClone(this.sections.colorGlyphLibrary)},library:structuredClone(this.sections.library),paintServerDefs:e,rawPaintServerDefs:e.map(n=>n.markup),unknownFields:structuredClone(this.sections.unknownFields)}}applyOps(e){let n=this.snapshotForReducer(),r=[],i=new Set;for(let o of e){let s=nl(n);tl(n,o);let a=nl(n);for(let l of Ry)i.has(l)||Gn(s[l],a[l])||(i.add(l),r.push(l))}this.sections=nl(n);for(let o of r)this.notify(o);return r}loadSections(e,n){let r=i=>n===void 0||n.includes(i);r("guides")&&this.setGuides(e.guides??[]),r("measurements")&&this.setMeasurements(e.measurements??[]),r("clipMaskGroups")&&this.setClipMaskGroups(e.clipMaskGroups??[]),r("documentMetadata")&&this.setDocumentMetadata(e.documentMetadata),r("documentScripts")&&this.setDocumentScripts(e.documentScripts??[]),r("documentStyles")&&this.setDocumentStyles(e.documentStyles??[]),r("templateVariables")&&this.setTemplateVariables(e.templateVariables??[]),r("animationTimeline")&&this.setAnimationTimeline(e.animationTimeline??null),r("exportItems")&&this.setExportItems(e.exportItems??[]),r("colorGlyphLibrary")&&this.setColorGlyphLibrary(e.colorGlyphLibrary??null),r("library")&&this.setLibrary(e.library??[]),r("paintServerDefs")&&this.setPaintServerDefs(e.paintServerDefs&&e.paintServerDefs.length>0?e.paintServerDefs:is(e.rawPaintServerDefs??[])),r("unknownFields")&&this.setUnknownFields(e.unknownFields)}clearSections(){this.setClipMaskGroups([]),this.setGuides([]),this.setMeasurements([]),this.setDocumentMetadata(void 0),this.setDocumentScripts([]),this.setDocumentStyles([]),this.setTemplateVariables([]),this.setAnimationTimeline(null),this.setExportItems([]),this.setColorGlyphLibrary(null),this.setLibrary([]),this.setPaintServerDefs([]),this.setUnknownFields(void 0)}toSnapshotSections(){let e=this.getTemplateVariables(),n=this.getAnimationTimeline(),r=this.getExportItems(),i=this.getColorGlyphLibrary(),o=this.assembleLibrary(),s=this.getPaintServerDefs(),a=this.getUnknownFields();return{guides:this.getGuides(),measurements:this.getMeasurements(),clipMaskGroups:this.getClipMaskGroups(),documentMetadata:this.getDocumentMetadata(),documentScripts:this.getDocumentScripts(),documentStyles:this.getDocumentStyles(),...e.length>0?{templateVariables:e}:{},...n!==null&&n.tracks.length>0?{animationTimeline:n}:{},...r.length>0?{exportItems:r}:{},...i!==null?{colorGlyphLibrary:i}:{},...o.length>0?{library:o}:{},...s.length>0?{paintServerDefs:s}:{},...a!==void 0?{unknownFields:a}:{}}}cloneOwned(){let e=new t(this.graph.clone());return e.sections=structuredClone(this.sections),e}dispose(){this.disposed||(this.disposed=!0,this.unsubscribeGraphStructure?.(),this.unsubscribeGraphStructure=null,this.listeners.clear(),this.graph.dispose())}};var mk=1;function Op(){return`canonical-document-${mk++}`}var Kr=class t{constructor(e,n){this.model=e;this.identity=n}model;identity;disposed=!1;static empty(e=Op()){return new t(new or,e)}static own(e,n=Op()){if(e.isDisposed)throw new Error("Cannot own a disposed DocumentModel.");return new t(e,n)}get graph(){return this.model.graph}get isDisposed(){return this.disposed}assertCoherent(){if(this.model.graph!==this.graph)throw new Error("Canonical document model and graph identity diverged.");if(this.disposed!==this.model.isDisposed||this.disposed!==this.graph.isDisposed)throw new Error("Canonical document disposal state diverged.")}clone(e=Op()){if(this.disposed)throw new Error("Cannot clone a disposed canonical document.");return t.own(this.model.cloneOwned(),e)}dispose(){this.disposed||(this.disposed=!0,this.model.dispose())}},sl=class{constructor(e=Kr.empty()){this.activeDocument=e;if(e.isDisposed)throw new Error("Cannot start a document session with a disposed document.");e.assertCoherent();let n=this;this.view=Object.freeze({get current(){return n.current},get model(){return n.model},get graph(){return n.graph},get version(){return n.version},get isDisposed(){return n.isDisposed},get replacementListenerCount(){return n.replacementListenerCount},onReplacement:r=>n.onReplacement(r)})}activeDocument;listeners=new Set;replacing=!1;disposed=!1;_version=0;view;get current(){return this.activeDocument}get model(){return this.activeDocument.model}get graph(){return this.activeDocument.graph}get version(){return this._version}get isDisposed(){return this.disposed}get replacementListenerCount(){return this.listeners.size}onReplacement(e){return this.disposed?()=>{}:(this.listeners.add(e),()=>this.listeners.delete(e))}replace(e,n={}){if(this.disposed)throw new Error("Cannot replace a disposed document session.");if(this.replacing)throw new Error("Document replacement is already in progress.");if(e===this.activeDocument)throw new Error("Replacement document is already active.");if(e.isDisposed)throw new Error("Cannot install a disposed canonical document.");e.assertCoherent();let r=this.activeDocument,i=this._version,o=Object.freeze({previous:r,next:e,previousVersion:i,version:i+1});this.replacing=!0,this.activeDocument=e,this._version=o.version;try{n.commit?.(o),n.beforeNotify?.(o)}catch(a){this.activeDocument=r,this._version=i;let l=[a];try{n.rollback?.(o)}catch(c){l.push(c)}try{e.dispose()}catch(c){l.push(c)}throw this.replacing=!1,l.length>1?new AggregateError(l,"Document replacement rejection cleanup failed.",{cause:a}):a}let s=[];for(let a of[...this.listeners])try{a(o)}catch(l){s.push(l)}try{n.finalize?.(o)}catch(a){s.push(a)}try{r.dispose()}catch(a){s.push(a)}return this.replacing=!1,{event:o,postCommitErrors:s}}dispose(){if(!this.disposed){if(this.replacing)throw new Error("Cannot dispose a document session during replacement.");this.disposed=!0,this.listeners.clear(),this.activeDocument.dispose()}}};var Py=Object.freeze({linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"});function Ey(t,e,n,r,i=1e-4){if(Math.abs(t)<i&&Math.abs(e)<i&&Math.abs(n-1)<i&&Math.abs(r-1)<i)return"linear";for(let[o,s]of Object.entries(Or))if(s&&Math.abs(t-s[0])<i&&Math.abs(e-s[1])<i&&Math.abs(n-s[2])<i&&Math.abs(r-s[3])<i)return o;return null}function al(t,e,n,r){let i=Ey(t,e,n,r);return i===null?{easing:"custom-bezier",customBezier:[t,e,n,r]}:{easing:i}}function gk(t){let e=[],n=0,r="";for(let i of t)i==="("?n++:i===")"&&n--,i===","&&n===0?(e.push(r.trim()),r=""):r+=i;return(r.trim()!==""||e.length>0)&&e.push(r.trim()),e}function hk(t){switch(t){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 yk(t){let e=[];for(let i of t)i.positions.length===0?e.push({value:i.value,position:null}):(e.push({value:i.value,position:i.positions[0]}),i.positions.length===2&&e.push({value:i.value,position:i.positions[1]}));if(e.length<2)return null;e[0].position===null&&(e[0].position=0),e[e.length-1].position===null&&(e[e.length-1].position=1);let n=0;for(;n<e.length;){if(e[n].position!==null){n++;continue}let i=n;for(;i<e.length&&e[i].position===null;)i++;let o=e[n-1].position,s=e[i]?.position??1,a=i-n+1;for(let l=0;l<i-n;l++)e[n+l].position=o+(s-o)*(l+1)/a;n=i}let r=e[0].position;return e.map(i=>{let o=Math.max(r,i.position);return r=o,{value:i.value,position:o}})}function Xr(t){let e=t.trim().toLowerCase();if(!e)return null;if(e==="step-start")return{kind:"steps",count:1,position:"jump-start"};if(e==="step-end")return{kind:"steps",count:1,position:"jump-end"};if(e in Py)return{kind:"keyword",easing:Py[e]};let n=/^cubic-bezier\s*\(([^)]*)\)$/u.exec(e);if(n){let l=n[1].split(",").map(f=>Number(f.trim()));if(l.length!==4||l.some(f=>!Number.isFinite(f)))return null;let[c,u,d,p]=l;return c<0||c>1||d<0||d>1?null:{kind:"cubic-bezier",points:[c,u,d,p]}}let r=/^steps\s*\(([^)]*)\)$/u.exec(e);if(r){let l=r[1].split(",").map(d=>d.trim());if(l.length<1||l.length>2||!/^\d+$/u.test(l[0]))return null;let c=Number(l[0]);if(!Number.isInteger(c)||c<1)return null;let u=hk(l[1]??"jump-end");return!u||u==="jump-none"&&c<2?null:{kind:"steps",count:c,position:u}}let i=/^linear\s*\(([\s\S]*)\)$/u.exec(e);if(!i)return null;let o=gk(i[1]);if(o.length===0)return null;let s=[];for(let l of o){let c=l.split(/\s+/u).filter(Boolean);if(c.length===0)return null;let u=Number(c[0]);if(!Number.isFinite(u))return null;let d=[];for(let p of c.slice(1)){if(!p.endsWith("%"))return null;let f=Number(p.slice(0,-1));if(!Number.isFinite(f))return null;d.push(f/100)}if(d.length>2)return null;s.push({value:u,positions:d})}let a=yk(s);return a&&a.length>=2?{kind:"linear",points:a}:null}function Dp(t,e){switch(delete t.customBezier,delete t.linearPoints,delete t.stepsParams,e.kind){case"keyword":t.easing=e.easing;return;case"cubic-bezier":{let n=al(...e.points);t.easing=n.easing,n.customBezier&&(t.customBezier=n.customBezier);return}case"steps":t.easing="steps",t.stepsParams={count:e.count,position:e.position};return;case"linear":t.easing="linear-function",t.linearPoints=[...e.points]}}function Cy(t,e,n){let r=1-t;return 3*r*r*t*e+3*r*t*t*n+t*t*t}function $y(t,e){let n=Math.max(0,Math.min(1,t)),r=0,i=1,o=n;for(let s=0;s<24;s++){let a=Cy(o,e[0],e[2]);if(Math.abs(a-n)<=1e-8)break;a<n?r=o:i=o,o=(r+i)/2}return Cy(o,e[1],e[3])}function zp(t,e){let n=Math.max(0,Math.min(1,e));if(!t)return n;switch(t.kind){case"keyword":{let r=Or[t.easing];return r?$y(n,r):n}case"cubic-bezier":return $y(n,t.points);case"steps":{let{count:r,position:i}=t,o=Math.floor(n*r);(i==="jump-start"||i==="jump-both")&&o++;let s=i==="jump-none"?r-1:i==="jump-both"?r+1:r;return Math.max(0,Math.min(1,(o+(i==="jump-none"?-1:0))/s))}case"linear":{let r=t.points;if(n<=r[0].position)return r[0].value;for(let i=1;i<r.length;i++){if(n>r[i].position)continue;let o=r[i-1],s=r[i],a=s.position-o.position;return a<=0?s.value:o.value+(s.value-o.value)*(n-o.position)/a}return r.at(-1).value}}}function Vn(t){let e=t.trim(),n=/^(\d+):(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(e);if(n)return Number(n[1])*3600+Number(n[2])*60+Number(n[3]);let r=/^(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(e);if(r)return Number(r[1])*60+Number(r[2]);let i=/^([+-]?\d+(?:\.\d+)?)\s*(h|min|ms|s)?$/u.exec(e);if(i){let s=Number(i[1]);switch(i[2]??"s"){case"h":return s*3600;case"min":return s*60;case"ms":return s/1e3;default:return s}}let o=Number.parseFloat(e);return Number.isNaN(o)?0:o}function Ay(t,e){switch(t){case"reverse":return!0;case"alternate":return e%2===1;case"alternate-reverse":return e%2===0;default:return!1}}function _p(t){if(t.cycleDuration!==void 0)return Math.max(0,t.cycleDuration);if(t.keyframes.length<2)return 0;let e=t.keyframes[0]?.time??0,n=t.keyframes[t.keyframes.length-1]?.time??e;return Math.max(0,n-e)}function Fp(t){let e=t.keyframes[0]?.time??0;if(!t.beginTrigger)return e;if(t.beginTrigger.type!=="time")return null;let n=Number.parseFloat(t.beginTrigger.value);return Number.isFinite(n)?n:null}function Lp(t){if(t.cycleInfinite)return null;let e=Fp(t);return e===null?null:e+_p(t)*Math.max(0,t.cycleRepeats??1)}function ll(t,e,n,r,i){return t+(Ay(n,r)?e-i:i)}function Sk(t,e){let n=t.keyframes[0]?.time??0,r=Fp(t);if(r===null)return null;let i=_p(t);if(i<=0)return e>=r||t.fillBackwards?n:null;let o=t.cycleBehavior??"restart",s=e-r;if(s<0)return t.fillBackwards?ll(n,i,o,0,0):null;let a=Math.max(0,t.cycleRepeats??1),l=t.cycleInfinite??!1,c=l?1/0:i*a;if(!l&&s>=c){if(t.fill==="remove")return null;if(a<=0)return ll(n,i,o,0,0);let p=Math.floor(a),f=a-p,g=f>Number.EPSILON?p:p-1,m=f>Number.EPSILON?f*i:i;return ll(n,i,o,g,m)}let u=Math.floor(s/i),d=s-u*i;return ll(n,i,o,u,d)}function Bp(t){if(!t.fillBackwards||t.keyframes.length===0)return null;let e=t.keyframes[0].time,n=t.beginTrigger?.type==="time"?Number.parseFloat(t.beginTrigger.value):Number.NaN,r=Number.isFinite(n)?Math.max(0,n):e;if(!(r>0))return null;let o=Ay(t.cycleBehavior??"restart",0)?t.keyframes.at(-1):t.keyframes[0],s=Array.isArray(o.value)?[...o.value]:o.value;return{...t,id:`${t.id}:backwards-fill`,keyframes:[{time:0,value:s,easing:"linear"},{time:r,value:s,easing:"linear"}],beginTrigger:void 0,endTrigger:void 0,cycleDuration:r,cycleRepeats:void 0,cycleInfinite:!1,cycleBehavior:"restart",fill:"remove",fillBackwards:!1,sourceSmilId:void 0,template:void 0}}var bk=new Set(["ease","ease-in","ease-out","ease-in-out","linear","step-start","step-end"]),vk=new Set(["normal","reverse","alternate","alternate-reverse"]),xk=new Set(["none","forwards","backwards","both"]),Ik=new Set(["running","paused"]),Gp="(?:\\d+(?:\\.\\d+)?|\\.\\d+)",My=`[+-]?${Gp}`,wk=new RegExp(`^${Gp}(?:s|ms)$`,"u"),kk=new RegExp(`^${My}(?:s|ms)$`,"u"),Rk=new RegExp(`^${Gp}$`,"u");function Vp(t){switch(t.kind){case"keyword":return t.easing;case"cubic-bezier":return"custom-bezier";case"steps":return"steps";case"linear":return"linear-function"}}function os(t){if(!t)return[];let e=[],n=0,r=null,i=!1,o=0;for(let s=0;s<t.length;s++){let a=t[s];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}if(r){a===r&&(r=null);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?n++:a===")"?n=Math.max(0,n-1):a===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}function ss(t,e){let n=os(t);return n.length===0?"":n[e%n.length]}function cl(t){let n=t.trim().replace(/\w+\([^)]*\)/gu,f=>f.replace(/\s+/gu,"")).split(/\s+/u).filter(Boolean);if(n.length===0)return null;let r=0,i=0,o="linear",s=null,a="normal",l="1",c="none",u="",d=!1,p=!1;for(let f of n){if(!d&&wk.test(f)){r=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),d=!0;continue}if(d&&!p&&kk.test(f)){i=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),p=!0;continue}if(/^(?:cubic-bezier|steps|linear)\(/u.test(f)||bk.has(f)){let g=Xr(f);g&&(s=g,o=Vp(g));continue}if(vk.has(f)){a=f;continue}if(f==="infinite"){l=f;continue}if(Rk.test(f)){l=f;continue}if(xk.has(f)){c=f;continue}Ik.has(f)||u||(u=f)}return!u||r<=0?null:{name:u,duration:r,delay:i,easing:o,parsedEasing:s,direction:a,iterationCount:l,fillMode:c}}function Ny(t){let e=new RegExp(`^(${My})\\s*(s|ms)$`,"iu").exec(t.trim());if(!e)return null;let n=Number(e[1]);return e[2].toLowerCase()==="ms"?n/1e3:n}function jp(t,e,n){let r=d=>ss(e[d],n),i=Ny(r("animation-delay"));i!==null&&(t.delay=i);let o=Ny(r("animation-duration"));o!==null&&o>0&&(t.duration=o);let s=Xr(r("animation-timing-function"));s&&(t.parsedEasing=s,t.easing=Vp(s));let a=r("animation-direction");a&&(t.direction=a);let l=r("animation-iteration-count");l&&(t.iterationCount=l);let c=r("animation-fill-mode");c&&(t.fillMode=c);let u=r("animation-name");u&&u!=="none"&&(t.name=u)}function Up(t){let e=os(t["animation-name"]);if(e.length===0||e.every(r=>!r||r==="none"))return"";let n=["animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state"];return e.map((r,i)=>{let o=n.map(s=>ss(t[s],i)).filter(Boolean);return o.push(r),o.join(" ")}).join(", ")}function Hp(t){let e=t.fillMode==="forwards"||t.fillMode==="both",n=t.fillMode==="backwards"||t.fillMode==="both";return{...e?{}:{fill:"remove"},...n?{fillBackwards:!0}:{}}}function ul(t){return/[\t\n\f\r ]/u.test(t??"")}function as(t,e){if(t[e]!=="/"||t[e+1]!=="*")return e;let n=t.indexOf("*/",e+2);return n<0?t.length:n+2}function dl(t,e){let n=e;for(;n<t.length;){if(ul(t[n])){n++;continue}let r=as(t,n);if(r===n)break;n=r}return n}function zi(t){let e="";for(let n=0;n<t.length;n++){let r=t[n];if(r!=="\\"){e+=r;continue}n++;let i=t[n];if(i===void 0)return null;if(i===`
7
+ `||i==="\r"||i==="\f"){i==="\r"&&t[n+1]===`
8
+ `&&n++;continue}if(/[0-9a-f]/iu.test(i)){let o=i;for(;o.length<6&&/[0-9a-f]/iu.test(t[n+1]??"");)o+=t[++n];ul(t[n+1])&&n++;let s=Number.parseInt(o,16);e+=s===0||s>1114111||s>=55296&&s<=57343?"\uFFFD":String.fromCodePoint(s);continue}e+=i}return e}function In(t,e,n=!1){let r=[],i=0,o=null,s=!1,a=0;for(let l=0;l<t.length;l++){let c=t[l];if(o){s?s=!1:c==="\\"?s=!0:c===o&&(o=null);continue}if(c==="/"&&t[l+1]==="*"){l=Math.max(l,as(t,l)-1);continue}if(c==='"'||c==="'"){o=c;continue}if(c==="("||c==="["||c==="{")a++;else if(c===")"||c==="]"||c==="}")a=Math.max(0,a-1);else if(c===e&&a===0&&(r.push(Object.freeze({start:i,end:l})),i=l+1,n))break}return r.push(Object.freeze({start:i,end:t.length})),r}function Yr(t,e){return In(t,e,e===":").map(n=>t.slice(n.start,n.end))}function Tk(t){return!!(t&&(/[-_a-z]/iu.test(t)||t==="\\"))}function Pk(t){return!!(t&&(/[-_a-z0-9]/iu.test(t)||t==="\\"))}function Ck(t,e){let n=e;for(;n<t.length;){let r=t[n];if(r!=="\\"){if(!Pk(r))break;n++;continue}n++;let i=t[n];if(i===void 0||i===`
9
+ `||i==="\r"||i==="\f")break;if(!/[0-9a-f]/iu.test(i)){n++;continue}let o=0;for(;o<6&&/[0-9a-f]/iu.test(t[n]??"");)o++,n++;ul(t[n])&&n++}return n}function cn(t){let e=[],n=null,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(n){r?r=!1:o==="\\"?r=!0:o===n&&(n=null);continue}if(o==="/"&&t[i+1]==="*"){i=Math.max(i,as(t,i)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(!Tk(o))continue;let s=i,a=Ck(t,i);if(t[a]!=="("){i=a-1;continue}let l=a+1,c=1,u=null,d=!1,p=l;for(;p<t.length;p++){let f=t[p];if(u){d?d=!1:f==="\\"?d=!0:f===u&&(u=null);continue}if(f==="/"&&t[p+1]==="*"){p=Math.max(p,as(t,p)-1);continue}if(f==='"'||f==="'"){u=f;continue}if(f==="(")c++;else if(f===")"&&--c===0)break}if(c!==0){i=a;continue}e.push(Object.freeze({name:zi(t.slice(s,a))?.toLowerCase()??t.slice(s,a).toLowerCase(),tokenStart:s,tokenEnd:p+1,argumentsStart:l,argumentsEnd:p})),i=p}return Object.freeze(e)}function $k(t,e){if(t.slice(e,e+3).toLowerCase()!=="url"||t[e+3]!=="(")return!1;let n=t[e-1];return!n||!/[-_a-z0-9]/iu.test(n)}function wn(t){let e=[],n=null,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(n){r?r=!1:o==="\\"?r=!0:o===n&&(n=null);continue}if(o==="/"&&t[i+1]==="*"){i=Math.max(i,as(t,i)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(!$k(t,i))continue;let s=i,a=dl(t,i+4),l=t[a]==='"'||t[a]==="'"?t[a++]:null;if(a=dl(t,a),t[a]!=="#")continue;a++;let c=a,u=a,d=!1,p=!1;for(;a<t.length;a++){let g=t[a];if(p){p=!1,u=a+1;continue}if(g==="\\"){p=!0,u=a+1;continue}if(l){if(g===l){a=dl(t,a+1),d=t[a]===")";break}u=a+1;continue}if(g===")"){d=!0;break}if(ul(g)||g==="/"&&t[a+1]==="*"){a=dl(t,a),d=t[a]===")";break}u=a+1}if(!d||u<=c)continue;let f=zi(t.slice(c,u));f&&(e.push(Object.freeze({targetAuthoredId:f,tokenStart:s,tokenEnd:a+1,targetStart:c,targetEnd:u})),i=a)}return Object.freeze(e)}var Dy=String.raw`[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?`,zy="px|pt|pc|in|cm|mm|q|em|rem|%|ex|ch|vw|vh|vmin|vmax",Ek=new RegExp(String.raw`^(${Dy})\s*(${zy})?$`,"i"),Oy=new RegExp(`(${Dy})(${zy})?`,"gi");function nt(t){if(t===null||t.trim().length===0)return null;let e=Ek.exec(t.trim());if(!e)return null;let n=Number(e[1]);return Number.isFinite(n)?Object.freeze({value:n,unit:(e[2]??"").toLowerCase()}):null}function pl(t){if(!t)return Object.freeze([]);Oy.lastIndex=0;let e=[],n;for(;(n=Oy.exec(t))!==null;){let r=Number(n[1]);Number.isFinite(r)&&e.push(Object.freeze({value:r,unit:(n[2]??"").toLowerCase()}))}return Object.freeze(e)}function jn(t,e){let n=t.value;if(Number.isFinite(n))switch(t.unit.toLowerCase()){case"%":return e.percentBasis===void 0?void 0:n*e.percentBasis/100;case"vw":return e.viewportWidth===void 0?void 0:n*e.viewportWidth/100;case"vh":return e.viewportHeight===void 0?void 0:n*e.viewportHeight/100;case"vmin":return e.viewportWidth===void 0||e.viewportHeight===void 0?void 0:n*Math.min(e.viewportWidth,e.viewportHeight)/100;case"vmax":return e.viewportWidth===void 0||e.viewportHeight===void 0?void 0:n*Math.max(e.viewportWidth,e.viewportHeight)/100;case"em":return e.fontSize===void 0?void 0:n*e.fontSize;case"rem":return e.rootFontSize===void 0?void 0:n*e.rootFontSize;case"ex":return e.xHeight!==void 0?n*e.xHeight:e.fontSize===void 0?void 0:n*.5*e.fontSize;case"ch":return e.chWidth!==void 0?n*e.chWidth:e.fontSize===void 0?void 0:n*.5*e.fontSize;case"":case"px":return n;case"pt":return n*(4/3);case"pc":return n*16;case"in":return n*96;case"cm":return n*(96/2.54);case"mm":return n*(96/25.4);case"q":return n*(96/101.6);default:return}}function he(t,e){let n=nt(t);return n?jn(n,e):void 0}function Mt(t){let e=nt(t);if(!(!e||["em","rem","%","ex","ch","vw","vh","vmin","vmax"].includes(e.unit)))return jn(e,{})}var Ae=Object.freeze([1,0,0,1,0,0]);function rt(t,e,n,r,i,o){return[t,e,n,r,i,o]}function cs(t){return rt(t[0]??1,t[1]??0,t[2]??0,t[3]??1,t[4]??0,t[5]??0)}function it(t){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function Un(t){return Array.isArray(t)&&t.length>=6&&t.slice(0,6).every(Number.isFinite)}function Bt(t,e=1e-9){return Math.abs((t[0]??1)-1)<=e&&Math.abs(t[1]??0)<=e&&Math.abs(t[2]??0)<=e&&Math.abs((t[3]??1)-1)<=e&&Math.abs(t[4]??0)<=e&&Math.abs(t[5]??0)<=e}function Ak(t,e,n=1e-9){for(let r=0;r<6;r++)if(Math.abs(t[r]-e[r])>n)return!1;return!0}function ce(t,e){return rt(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5])}function Nk(t){let e=t[0]*t[3]-t[2]*t[1];if(Math.abs(e)<1e-10)return null;let n=1/e;return rt(t[3]*n,-t[1]*n,-t[2]*n,t[0]*n,(t[2]*t[5]-t[3]*t[4])*n,(t[1]*t[4]-t[0]*t[5])*n)}function Fe(t,e){return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}function ml(t,e){return{x:t[0]*e.x+t[2]*e.y,y:t[1]*e.x+t[3]*e.y}}function _e(t,e=0){return rt(1,0,0,1,t,e)}function qr(t,e=t){return rt(t,0,0,e,0,0)}function Fi(t){let e=t*Math.PI/180,n=Math.cos(e),r=Math.sin(e);return rt(n,r,-r,n,0,0)}function ds(t){return rt(1,0,Math.tan(t*Math.PI/180),1,0,0)}function us(t){return rt(1,Math.tan(t*Math.PI/180),0,1,0,0)}function Wp(t,e){return ce(ce(_e(t.x,t.y),e),_e(-t.x,-t.y))}var Mk=9,Ok=10,Dk=12,zk=13,_k=32,_y=43,Fk=44,Fy=45,Lk=46,Bk=48,Gk=57,Vk=40,jk=41,Uk=69,Hk=101,Wk=0,Kk=1,By=2,Xk=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function Yk(t){return t===_k||t===Mk||t===Ok||t===zk||t===Dk}function fl(t){return t>=Bk&&t<=Gk}function qk(t){let e=t>=65&&t<=90,n=t>=97&&t<=122;return e||n||fl(t)}function _i(t){for(;t.pos<t.src.length&&Yk(t.src.charCodeAt(t.pos));)t.pos++}function Gy(t){let e=t.pos;return _i(t),t.src.charCodeAt(t.pos)===Fk?(t.pos++,_i(t),By):t.pos>e?Kk:Wk}function Ly(t){let e=t.src,n=t.pos,r=n,i=e.charCodeAt(r);(i===_y||i===Fy)&&r++;let o=!1;for(;r<e.length&&fl(e.charCodeAt(r));)r++,o=!0;if(e.charCodeAt(r)===Lk){let l=r+1;for(;l<e.length&&fl(e.charCodeAt(l));)l++;l>r+1&&(r=l,o=!0)}if(!o)return null;let s=e.charCodeAt(r);if(s===Hk||s===Uk){let l=r+1,c=e.charCodeAt(l);(c===_y||c===Fy)&&l++;let u=l;for(;u<e.length&&fl(e.charCodeAt(u));)u++;u>l&&(r=u)}let a=Number(e.slice(n,r));return Number.isFinite(a)?(t.pos=r,a):null}function Zk(t,e){switch(t){case"matrix":return cs(e);case"translate":return _e(e[0],e[1]??0);case"scale":return qr(e[0],e[1]??e[0]);case"rotate":return e.length===3?Wp({x:e[1],y:e[2]},Fi(e[0])):Fi(e[0]);case"skewX":return ds(e[0]);case"skewY":return us(e[0]);default:return null}}function Jk(t){let e=t.src,n=t.pos;for(;t.pos<e.length&&qk(e.charCodeAt(t.pos));)t.pos++;if(t.pos===n)return null;let r=e.slice(n,t.pos),i=Xk.get(r);if(!i||(_i(t),e.charCodeAt(t.pos)!==Vk))return null;t.pos++,_i(t);let o=i[i.length-1],s=Ly(t);if(s===null)return null;let a=[s];for(;;){let l=t.pos;Gy(t);let c=Ly(t);if(c===null){t.pos=l;break}if(a.push(c),a.length>o)return null}return _i(t),e.charCodeAt(t.pos)!==jk||(t.pos++,!i.includes(a.length))?null:Zk(r,a)}function Qk(t){let e={src:t,pos:0};if(_i(e),e.pos>=t.length)return Ae;let n=Ae;for(;;){let r=Jk(e);if(r===null)return null;n=ce(n,r);let i=Gy(e);if(e.pos>=t.length)return i===By?null:n}}var e0=2048,ls=new Map;function Gt(t){if(!t)return Ae;let e=ls.get(t);if(e!==void 0)return e;let n=Qk(t),r=n===null?null:Object.freeze(n);if(ls.size>=e0){let i=ls.keys().next().value;i!==void 0&&ls.delete(i)}return ls.set(t,r),r}function Ot(t){return Gt(t)??Ae}function ps(t){let e=t[0],n=t[1],r=t[2],i=t[3],o=Math.sqrt(e*e+n*n);if(o<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(r*r+i*i),skewX:0};let s=Math.atan2(n,e),l=(e*i-n*r)/o,c=l!==0?(e*r+n*i)/(o*o):0,u=Math.atan(c),d=180/Math.PI;return{rotation:s*d,scaleX:o,scaleY:l,skewX:u*d}}function fs(t){return!Un(t)||Bt(t)?null:`matrix(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]})`}function ms(t,e){let n=t.translateX??0,r=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",o=t.rotation??0,s=t.skewX??0,a=t.skewY??0,l=t.scaleX??1,c=t.scaleY??1,u=_e(n,r);if(i)return ce(u,Ot(i));if(o===0&&s===0&&a===0&&l===1&&c===1)return u;let d=t.customPivot??e;if(!d)return u;let p=ce(ce(ce(Fi(o),qr(l,c)),ds(s)),us(a));return ce(u,Wp(d,p))}function pt(t,e){return fs(Jt(t,e))}function Jt(t,e){let n=t.transformMatrix;return Un(n)&&!Bt(n)?cs(n):ms(t,e)}function Kp(t,e){let n=t.ancestorTransform;if(!Un(n)){delete t.ancestorTransform;return}if(Bt(n)){delete t.ancestorTransform;return}let r=Un(t.transformMatrix)?cs(t.transformMatrix):ms(t,e);t.transformMatrix=it(ce(cs(n),r)),delete t.ancestorTransform}function Xp(t,e,n){let r=pt(t,{x:e,y:n});return r?`${r} translate(${e}, ${n})`:`translate(${e}, ${n})`}var t0=Object.freeze({left:0,center:50,right:100}),n0=Object.freeze({top:0,center:50,bottom:100});function ar(t,e,n){let r=nt(t);return!r||r.unit===""&&r.value!==0?null:jn(r,{...n,percentBasis:e==="x"?n.boxWidth:e==="y"?n.boxHeight:void 0})??null}function Vy(t,e,n){let r=t.trim().toLowerCase(),i=e==="horizontal"?t0:n0;if(Object.hasOwn(i,r))return{kind:"percentage",value:i[r]};let o=nt(r);if(!o||o.unit===""&&o.value!==0)return null;if(o.unit==="%")return{kind:"percentage",value:o.value};let s=jn(o,n);return s===void 0?null:{kind:"length",value:s}}function jy(t,e,n){return t.kind==="length"?e+t.value:n===void 0?null:e+t.value*n/100}function Zp(t,e={}){let n=t.trim().split(/\s+/u).filter(Boolean);if(n.length===0||n.length>3)return null;let r=0;if(n.length===3){let u=ar(n[2],"z",e);if(u===null||n[2].includes("%"))return null;r=u}let i,o;if(n.length===1){let u=n[0].toLowerCase();u==="top"||u==="bottom"?(i="center",o=n[0]):(i=n[0],o="center")}else{i=n[0],o=n[1];let u=i.toLowerCase(),d=o.toLowerCase(),p=u==="top"||u==="bottom",f=d==="left"||d==="right";p&&(f||d==="center")?[i,o]=[o,i]:u==="center"&&f&&([i,o]=[o,i])}let s=Vy(i,"horizontal",e),a=Vy(o,"vertical",e);if(!s||!a)return null;let l=jy(s,e.boxX??0,e.boxWidth),c=jy(a,e.boxY??0,e.boxHeight);return l===null||c===null?null:Object.freeze(r===0?{x:l,y:c}:{x:l,y:c,z:r})}var Sl=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),r0=new Set(["matrix3d","perspective","rotate3d","rotatex","rotatey","rotatez","scale3d","scalez","translate3d","translatez"]),i0=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(deg|grad|rad|turn)?$/iu;function Uy(t){return t.replace(/\/\*[\s\S]*?\*\//gu,"").trim()===""}function o0(t){let e=[],n="",r=0,i=null,o=!1,s=!1,a=()=>{let l=n.trim();return n="",l?(e.push(l),!0):!1};for(let l=0;l<t.length;l++){let c=t[l];if(i){n+=c,o?o=!1:c==="\\"?o=!0:c===i&&(i=null);continue}if(c==='"'||c==="'"){i=c,n+=c;continue}if(c==="/"&&t[l+1]==="*"){let u=t.indexOf("*/",l+2);if(u<0)return null;n+=" ",l=u+1;continue}if(c==="("){r++,n+=c;continue}if(c===")"){if(r===0)return null;r--,n+=c;continue}if(r===0&&c===","){if(!a())return null;s=!0;continue}if(r===0&&/\s/u.test(c)&&!s){n.trim()&&a();continue}n+=c}return r!==0||i||n.trim()===""&&s||n.trim()&&!a()?null:Object.freeze(e)}function Zy(t){if(t.trim().toLowerCase()==="none")return Object.freeze([]);let e=cn(t);if(e.length===0)return null;let n=[],r=0;for(let i of e){if(!Uy(t.slice(r,i.tokenStart)))return null;let o=o0(t.slice(i.argumentsStart,i.argumentsEnd));if(!o)return null;n.push(Object.freeze({name:i.name,args:o})),r=i.tokenEnd}return Uy(t.slice(r))?Object.freeze(n):null}function dn(t){if(t===void 0||t.trim()==="")return null;let e=Number(t);return Number.isFinite(e)?e:null}function Qt(t){if(t===void 0)return null;let e=i0.exec(t.trim());if(!e)return null;let n=Number(e[1]);if(!Number.isFinite(n)||!e[2]&&n!==0)return null;switch(e[2]?.toLowerCase()){case"grad":return n*Math.PI/200;case"rad":return n;case"turn":return n*2*Math.PI;default:return n*Math.PI/180}}function Jr(t,e){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let i=0;i<4;i++)for(let o=0;o<4;o++)n[r*4+i]+=t[r*4+o]*e[o*4+i];return n}function Qr(t,e,n){return[1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1]}function gs(t,e,n){return[t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1]}function lr(t,e,n,r){let i=Math.hypot(t,e,n);if(i===0)return r===0?Sl:null;t/=i,e/=i,n/=i;let o=Math.cos(r),s=Math.sin(r),a=1-o;return[t*t*a+o,t*e*a-n*s,t*n*a+e*s,0,e*t*a+n*s,e*e*a+o,e*n*a-t*s,0,n*t*a-e*s,n*e*a+t*s,n*n*a+o,0,0,0,0,1]}function Vt(t,...e){return e.includes(t.length)}function bl(t,e){let n=t.args;switch(t.name){case"translate":{if(!Vt(n,1,2))return null;let r=ar(n[0],"x",e),i=ar(n[1]??"0","y",e);return r===null||i===null?null:Qr(r,i,0)}case"translatex":case"translatey":case"translatez":{if(!Vt(n,1))return null;let r=t.name.at(-1),i=ar(n[0],r,e);return i===null?null:Qr(r==="x"?i:0,r==="y"?i:0,r==="z"?i:0)}case"translate3d":{if(!Vt(n,3))return null;let r=ar(n[0],"x",e),i=ar(n[1],"y",e),o=ar(n[2],"z",e);return r===null||i===null||o===null?null:Qr(r,i,o)}case"scale":{if(!Vt(n,1,2))return null;let r=dn(n[0]),i=n.length===1?r:dn(n[1]);return r===null||i===null?null:gs(r,i,1)}case"scalex":case"scaley":case"scalez":{if(!Vt(n,1))return null;let r=dn(n[0]);return r===null?null:gs(t.name==="scalex"?r:1,t.name==="scaley"?r:1,t.name==="scalez"?r:1)}case"scale3d":{if(!Vt(n,3))return null;let r=n.map(dn);return r.some(i=>i===null)?null:gs(r[0],r[1],r[2])}case"rotate":case"rotatex":case"rotatey":case"rotatez":{if(!Vt(n,1))return null;let r=Qt(n[0]);return r===null?null:t.name==="rotatex"?lr(1,0,0,r):t.name==="rotatey"?lr(0,1,0,r):lr(0,0,1,r)}case"rotate3d":{if(!Vt(n,4))return null;let r=dn(n[0]),i=dn(n[1]),o=dn(n[2]),s=Qt(n[3]);return r===null||i===null||o===null||s===null?null:lr(r,i,o,s)}case"skew":{if(!Vt(n,1,2))return null;let r=Qt(n[0]),i=Qt(n[1]??"0deg");return r===null||i===null?null:[1,Math.tan(r),0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1]}case"skewx":case"skewy":{if(!Vt(n,1))return null;let r=Qt(n[0]);return r===null?null:t.name==="skewx"?[1,Math.tan(r),0,0,0,1,0,0,0,0,1,0,0,0,0,1]:[1,0,0,0,Math.tan(r),1,0,0,0,0,1,0,0,0,0,1]}case"matrix":{if(!Vt(n,6))return null;let r=n.map(dn);return r.some(i=>i===null)?null:[r[0],r[2],0,r[4],r[1],r[3],0,r[5],0,0,1,0,0,0,0,1]}case"matrix3d":{if(!Vt(n,16))return null;let r=n.map(dn);if(r.some(o=>o===null))return null;let i=[r[0],r[4],r[8],r[12],r[1],r[5],r[9],r[13],r[2],r[6],r[10],r[14],r[3],r[7],r[11],r[15]];return i[12]===0&&i[13]===0&&i[14]===0&&i[15]===1?i:"perspective"}case"perspective":return Vt(n,1)&&ar(n[0],"z",e)!==null?"perspective":null;default:return null}}function Jy(t,e){let n=Sl;for(let r of t){let i=bl(r,e);if(!i||i==="perspective")return i;n=Jr(n,i)}return n}function Jp(t){let e=Zy(t);if(!e)return"invalid";let n=Jy(e,{boxWidth:100,boxHeight:100,viewportWidth:100,viewportHeight:100,fontSize:16,rootFontSize:16,xHeight:8,chWidth:8});return n==="perspective"?"unsupported-perspective":n===null?"invalid":null}function hl(t){return t.startsWith("translate")?"translate":t.startsWith("scale")?"scale":t.startsWith("rotate")?"rotate":t.startsWith("skew")?"skew":"matrix"}function Hy(t){let e=t.name;return e==="perspective"?null:e.startsWith("translate")?Object.freeze({name:e,args:Object.freeze(t.args.map(()=>"0px"))}):e.startsWith("scale")?Object.freeze({name:e,args:Object.freeze(t.args.map(()=>"1"))}):e==="rotate3d"?Object.freeze({name:e,args:Object.freeze(["0","0","1","0deg"])}):e.startsWith("rotate")||e.startsWith("skew")?Object.freeze({name:e,args:Object.freeze(t.args.map(()=>"0deg"))}):e==="matrix"?Object.freeze({name:e,args:Object.freeze(["1","0","0","1","0","0"])}):e==="matrix3d"?Object.freeze({name:e,args:Object.freeze(Sl.map(String))}):null}function s0(t,e){let n=[...t],r=[...e],i=Math.max(n.length,r.length);for(let o=0;o<i;o++){if(!n[o]&&r[o]){let s=Hy(r[o]);if(!s)return null;n[o]=s}if(!r[o]&&n[o]){let s=Hy(n[o]);if(!s)return null;r[o]=s}}return[n,r]}function Wy(t,e){let n=bl(t,e);return!n||n==="perspective"?null:[n[3],n[7],n[11]]}function Ky(t){let e=bl(t,{});return!e||e==="perspective"?null:[e[0],e[5],e[10]]}function Xe(t,e,n){return t+(e-t)*n}function a0(t,e,n,r){let i=hl(t.name);if(i!==hl(e.name))return null;if(i==="translate"){let o=Wy(t,r),s=Wy(e,r);return o&&s?Qr(Xe(o[0],s[0],n),Xe(o[1],s[1],n),Xe(o[2],s[2],n)):null}if(i==="scale"){let o=Ky(t),s=Ky(e);return o&&s?gs(Xe(o[0],s[0],n),Xe(o[1],s[1],n),Xe(o[2],s[2],n)):null}if(i==="rotate"&&t.name===e.name){if(t.name==="rotate3d"){let l=t.args.slice(0,3).map(dn),c=e.args.slice(0,3).map(dn),u=Qt(t.args[3]),d=Qt(e.args[3]);if(l.some(b=>b===null)||c.some(b=>b===null)||u===null||d===null)return null;let p=Math.hypot(l[0],l[1],l[2]),f=Math.hypot(c[0],c[1],c[2]);if(p===0||f===0)return null;let g=[l[0]/p,l[1]/p,l[2]/p],m=[c[0]/f,c[1]/f,c[2]/f],h=g[0]*m[0]+g[1]*m[1]+g[2]*m[2];return Math.abs(Math.abs(h)-1)>1e-10?null:lr(g[0],g[1],g[2],Xe(u,h<0?-d:d,n))}let o=Qt(t.args[0]),s=Qt(e.args[0]);if(o===null||s===null)return null;let a=Xe(o,s,n);return t.name==="rotatex"?lr(1,0,0,a):t.name==="rotatey"?lr(0,1,0,a):lr(0,0,1,a)}if(i==="skew"&&t.name===e.name&&t.args.length===e.args.length){let o=t.args.map(Qt),s=e.args.map(Qt);return o.some(a=>a===null)||s.some(a=>a===null)?null:bl({name:t.name,args:o.map((a,l)=>`${Xe(a,s[l],n)}rad`)},r)}return null}function l0(t,e,n,r){let i=s0(t,e);if(!i)return null;let o=Sl;for(let s=0;s<i[0].length;s++){let a=a0(i[0][s],i[1][s],n,r);if(!a)return null;o=Jr(o,a)}return o}function yl(t){return Math.abs(t[12])>1e-10||Math.abs(t[13])>1e-10||Math.abs(t[14])>1e-10||Math.abs(t[15]-1)>1e-10?null:rt(t[0],t[4],t[1],t[5],t[3],t[7])}function c0(t){return[t[0],t[2],0,t[4],t[1],t[3],0,t[5],0,0,1,0,0,0,0,1]}function gl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Yp(t){return Math.hypot(t[0],t[1],t[2])}function Zr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function qp(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]}function d0(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function u0(t,e,n){let r=t[0],i=e[0],o=n[0],s=t[1],a=e[1],l=n[1],c=t[2],u=e[2],d=n[2],p=r+a+d,f,g,m,h;if(p>0){let S=Math.sqrt(p+1)*2;h=S/4,f=(u-l)/S,g=(o-c)/S,m=(s-i)/S}else if(r>a&&r>d){let S=Math.sqrt(1+r-a-d)*2;h=(u-l)/S,f=S/4,g=(i+s)/S,m=(o+c)/S}else if(a>d){let S=Math.sqrt(1+a-r-d)*2;h=(o-c)/S,f=(i+s)/S,g=S/4,m=(l+u)/S}else{let S=Math.sqrt(1+d-r-a)*2;h=(s-i)/S,f=(o+c)/S,g=(l+u)/S,m=S/4}let b=Math.hypot(f,g,m,h);return[f/b,g/b,m/b,h/b]}function Xy(t){if(Math.abs(t[12])>1e-10||Math.abs(t[13])>1e-10||Math.abs(t[14])>1e-10||Math.abs(t[15]-1)>1e-10)return null;let e=[t[0],t[4],t[8]],n=[t[1],t[5],t[9]],r=[t[2],t[6],t[10]],i=Yp(e);if(i<1e-12)return null;e=Zr(e,1/i);let o=gl(e,n);n=qp(n,Zr(e,o));let s=Yp(n);if(s<1e-12)return null;n=Zr(n,1/s),o/=s;let a=gl(e,r);r=qp(r,Zr(e,a));let l=gl(n,r);r=qp(r,Zr(n,l));let c=Yp(r);return c<1e-12?null:(r=Zr(r,1/c),a/=c,l/=c,gl(e,d0(n,r))<0&&(i=-i,e=Zr(e,-1)),{translate:[t[3],t[7],t[11]],scale:[i,s,c],skew:[o,a,l],quaternion:u0(e,n,r)})}function p0(t,e,n){let r=[...e],i=t.reduce((c,u,d)=>c+u*r[d],0);if(i<0&&(r=r.map(c=>-c),i=-i),i>.9995){let c=t.map((d,p)=>Xe(d,r[p],n)),u=Math.hypot(...c);return c.map(d=>d/u)}let o=Math.acos(Math.max(-1,Math.min(1,i))),s=Math.sin(o),a=Math.sin((1-n)*o)/s,l=Math.sin(n*o)/s;return t.map((c,u)=>c*a+r[u]*l)}function f0(t){let[e,n,r,i]=t;return[1-2*(n*n+r*r),2*(e*n-r*i),2*(e*r+n*i),0,2*(e*n+r*i),1-2*(e*e+r*r),2*(n*r-e*i),0,2*(e*r-n*i),2*(n*r+e*i),1-2*(e*e+n*n),0,0,0,0,1]}function m0(t,e,n){let r=Xy(t),i=Xy(e);if(!r||!i)return null;let o=r.translate.map((u,d)=>Xe(u,i.translate[d],n)),s=r.scale.map((u,d)=>Xe(u,i.scale[d],n)),a=r.skew.map((u,d)=>Xe(u,i.skew[d],n)),l=f0(p0(r.quaternion,i.quaternion,n)),c=[1,a[0],a[1],0,0,1,a[2],0,0,0,1,0,0,0,0,1];return Jr(Jr(Qr(o[0],o[1],o[2]),Jr(l,c)),gs(s[0],s[1],s[2]))}function Yy(t){return Math.abs(t[2])<1e-10&&Math.abs(t[6])<1e-10&&Math.abs(t[8])<1e-10&&Math.abs(t[9])<1e-10&&Math.abs(t[10]-1)<1e-10&&Math.abs(t[11])<1e-10}function g0(t,e,n){let r=yl(t),i=yl(e);if(!r||!i)return null;let o=ps(r),s=ps(i),a=s.rotation;for(;a-o.rotation>180;)a-=360;for(;a-o.rotation<-180;)a+=360;let l=Xe(o.rotation,a,n)*Math.PI/180,c=Xe(o.skewX,s.skewX,n)*Math.PI/180,u=Xe(o.scaleX,s.scaleX,n),d=Xe(o.scaleY,s.scaleY,n),p=Math.cos(l),f=Math.sin(l),g=Math.tan(c);return c0(rt(p*u,f*u,p*u*g-f*d,f*u*g+p*d,Xe(r[4],i[4],n),Xe(r[5],i[5],n)))}function h0(t,e,n,r,i,o){let s=l0(t,e,i,o);return s||(Yy(n)&&Yy(r)?g0(n,r,i):m0(n,r,i))}function qy(t,e){return Jr(Jr(Qr(e.x,e.y,e.z??0),t),Qr(-e.x,-e.y,-(e.z??0)))}function sr(t){return!Number.isFinite(t)||Math.abs(t)<1e-9?0:Number(t.toFixed(10))}function y0(t){return t.every(e=>e.length===1&&(e[0].name==="rotate"||e[0].name==="rotatez"))}function S0(t,e,n){let r=new Set;for(let i of t)for(let o of i)o.name.startsWith("translate")?(o.name!=="translatey"&&o.name!=="translatez"&&r.add("translateX"),o.name!=="translatex"&&o.name!=="translatez"&&r.add("translateY")):o.name.startsWith("scale")?(o.name!=="scaley"&&o.name!=="scalez"&&r.add("scaleX"),o.name!=="scalex"&&o.name!=="scalez"&&r.add("scaleY")):o.name.startsWith("rotate")?r.add("rotation"):o.name==="skew"||o.name==="skewx"?r.add("skewX"):o.name==="skewy"?r.add("skewY"):(o.name==="matrix"||o.name==="matrix3d")&&(r.add("translateX"),r.add("translateY"),r.add("scaleX"),r.add("scaleY"),r.add("rotation"),r.add("skewX"));return e&&(r.add("translateX"),r.add("translateY"),r.add("scaleX"),r.add("scaleY"),r.add("rotation")),n.some(i=>i.skewX!==0)&&r.add("skewX"),Object.freeze([...r])}function Qp(t,e={},n=16){if(t.length===0||!Number.isInteger(n)||n<1)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let r=t.map(m=>Zy(m.transform));if(r.some(m=>m===null))return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let i=r.map(m=>Jy(m,e));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 o=r,s=i,a=e.transformOrigin,l=y0(o),c=e.retainPureRotationOrigin===!0&&l,u=l?o.map(m=>Qt(m[0].args[0])*180/Math.PI):null,d=o.some(m=>m.some(h=>r0.has(h.name)))||a!==void 0&&!c&&l||o.some((m,h)=>h>0&&m.length!==o[h-1].length)||o.some((m,h)=>h>0&&m.some((b,S)=>hl(b.name)!==hl(o[h-1][S]?.name??"matrix"))),p=[];for(let m=0;m<t.length;m++){let h=a&&!c?qy(s[m],a):s[m],b=yl(h);if(!b)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});p.push({offset:t[m].offset,matrix:b,...u?{rotation:u[m]}:{}});let S=t[m+1];if(!(!S||!d))for(let v=1;v<n;v++){let I=v/n,x=Math.max(0,Math.min(1,e.progressForInterval?.(m,I)??I)),P=h0(o[m],o[m+1],s[m],s[m+1],x,e);if(!P)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let T=a&&!c?qy(P,a):P,k=yl(T);if(!k)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});p.push({offset:t[m].offset+(S.offset-t[m].offset)*I,matrix:k,...u?{rotation:Xe(u[m],u[m+1],x)}:{}})}}let f=null,g=p.sort((m,h)=>m.offset-h.offset).map(({offset:m,matrix:h,rotation:b})=>{let S=ps(h),v=b??S.rotation;if(b===void 0&&f!==null){for(;v-f>180;)v-=360;for(;v-f<-180;)v+=360}f=v;let I=rt(...h.map(sr));return Object.freeze({offset:sr(m),matrix:I,translateX:sr(I[4]),translateY:sr(I[5]),rotation:sr(v),scaleX:sr(S.scaleX),scaleY:sr(S.scaleY),skewX:sr(S.skewX),skewY:0})});return Object.freeze({status:"projected",stops:Object.freeze(g),sampled:d,pureRotation:c,channels:S0(o,d,g)})}function ys(t,e,n=-90){let r=[],i=n*Math.PI/180;for(let o=0;o<t;o++){let s=i+o*2*Math.PI/t;r.push({x:e*Math.cos(s),y:e*Math.sin(s)})}return r}function xl(t,e,n,r=-90){let i=[],o=e*(n/100),s=r*Math.PI/180;for(let a=0;a<t*2;a++){let l=s+a*Math.PI/t,c=a%2===0?e:o;i.push({x:c*Math.cos(l),y:c*Math.sin(l)})}return i}function Il(t,e,n=0){let r=t*(e/100)/2,i=[{x:-r,y:-t},{x:r,y:-t},{x:r,y:-r},{x:t,y:-r},{x:t,y:r},{x:r,y:r},{x:r,y:t},{x:-r,y:t},{x:-r,y:r},{x:-t,y:r},{x:-t,y:-r},{x:-r,y:-r}];if(n===0)return i;let o=Math.cos(n*Math.PI/180),s=Math.sin(n*Math.PI/180);return i.map(a=>({x:a.x*o-a.y*s,y:a.x*s+a.y*o}))}function wl(t,e,n,r,i=-90){let s=t*2*(n/100),a=t*(e/100),l=a*(r/100),c=[{x:t,y:0},{x:t-s,y:-a/2},{x:t-s,y:-l/2},{x:-t,y:-l/2},{x:-t,y:l/2},{x:t-s,y:l/2},{x:t-s,y:a/2}];if(i===0)return c;let u=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(p=>({x:p.x*u-p.y*d,y:p.x*d+p.y*u}))}function kl(t,e,n,r,i=0){let o=t,s=o*(n/100),a=o*(r/100),l=a/2,c=e*Math.PI/180,u=Math.cos(c),d=Math.sin(c),p=Math.abs(u),f=Math.abs(d),g=Math.max(p,f)||1,m={x:u*(o/g),y:d*(o/g)},h={x:m.x+u*s,y:m.y+d*s},b=Math.min(a,o-l),S=-o+l+b,v=o-l-b,I={x:-o,y:-o},x={x:o,y:-o},P={x:o,y:o},T={x:-o,y:o},k;if(p>=f&&u>0){let R=Math.max(S,Math.min(v,m.y)),C={x:o,y:R-l},A={x:o,y:R+l};k=[I,x,C,h,A,P,T]}else if(p>=f&&u<=0){let R=Math.max(S,Math.min(v,m.y)),C={x:-o,y:R+l},A={x:-o,y:R-l};k=[I,x,P,T,C,h,A]}else if(d<0){let R=Math.max(S,Math.min(v,m.x)),C={x:R-l,y:-o},A={x:R+l,y:-o};k=[I,C,h,A,x,P,T]}else{let R=Math.max(S,Math.min(v,m.x)),C={x:R+l,y:o},A={x:R-l,y:o};k=[I,x,P,C,h,A,T]}if(i===0)return k;let w=Math.cos(i*Math.PI/180),$=Math.sin(i*Math.PI/180);return k.map(R=>({x:R.x*w-R.y*$,y:R.x*$+R.y*w}))}function Rl(t,e,n,r,i=0){let o=Math.max(2,Math.round(e)),s=t*(n/100),a=t*(r/100)/2,l=o+1,c=[];for(let m=0;m<l;m++){let h=m/(l-1),b=-t+h*2*t,S=0;m>0&&m<l-1&&(S=m%2===1?s:-s),c.push({x:S,y:b})}let u=[],d=[];for(let m=0;m<l;m++){if(m===0||m===l-1){u.push({...c[m]}),d.push({...c[m]});continue}let h=c[m-1],b=c[m],S=c[m+1],v=b.x-h.x,I=b.y-h.y,x=Math.hypot(v,I)||1,P=v/x,T=I/x,k=S.x-b.x,w=S.y-b.y,$=Math.hypot(k,w)||1,R=k/$,C=w/$,A=(P+R)/2,D=(T+C)/2,_=Math.hypot(A,D),O,L;_<1e-6?(O=-T,L=P):(O=-D/_,L=A/_),u.push({x:b.x-O*a,y:b.y-L*a}),d.push({x:b.x+O*a,y:b.y+L*a})}let p=[];p.push(u[0]);for(let m=1;m<l-1;m++)p.push(d[m]);p.push(u[l-1]);for(let m=l-2;m>=1;m--)p.push(u[m]);if(i===0)return p;let f=Math.cos(i*Math.PI/180),g=Math.sin(i*Math.PI/180);return p.map(m=>({x:m.x*f-m.y*g,y:m.x*g+m.y*f}))}function Tl(t,e,n,r=0){let i=t,o=Math.max(.3,Math.min(.9,e/100)),s=-i*(n/100),a={x:0,y:i},l={x:0,y:s},c={x:-i*o,y:i*.4},u={x:-i*o,y:-i},d={x:i*o,y:-i},p={x:i*o,y:i*.4},f=[a,c,u,l,d,p,a],g=r===0?f:(()=>{let x=Math.cos(r*Math.PI/180),P=Math.sin(r*Math.PI/180);return f.map(T=>({x:T.x*x-T.y*P,y:T.x*P+T.y*x}))})(),[m,h,b,S,v,I]=g;return`M ${m.x} ${m.y} C ${h.x} ${h.y} ${b.x} ${b.y} ${S.x} ${S.y} C ${v.x} ${v.y} ${I.x} ${I.y} ${m.x} ${m.y} Z`}function Pl(t,e,n,r=0){let i=Math.max(3,Math.round(e)),o=Math.max(.3,Math.min(1,n/100)),s=t,a=s*1.7,l=s*1.15,c=[];for(let T=0;T<i;T++){let w=(90+T/i*360)*Math.PI/180;c.push({x:a/2*Math.cos(w),y:-(l/2)*Math.sin(w)})}let u=.15,d=0;for(let T=0;T<i;T++){let k=c[T],w=c[(T+1)%i];d=Math.max(d,Math.hypot(w.x-k.x,w.y-k.y))}let p=d/(2*(1-u))+.001,f=Math.max(p,d*(.68+o*.35)),g=c.map(T=>{let k=T.y/(l/2);return f*(1-u*k)});function m(T){let k=c[T],w=c[(T+1)%i],$=g[T],R=g[(T+1)%i],C=w.x-k.x,A=w.y-k.y,D=Math.hypot(C,A)||1,_=($*$-R*R+D*D)/(2*D),O=Math.sqrt(Math.max(0,$*$-_*_)),L=k.x+_/D*C,re=k.y+_/D*A,ee=-A/D,F=C/D,V={x:L+ee*O,y:re+F*O},K={x:L-ee*O,y:re-F*O};return V.x*V.x+V.y*V.y>K.x*K.x+K.y*K.y?V:K}let h=[];for(let T=0;T<i;T++)h.push(m(T));let b=14,S=[];for(let T=0;T<i;T++){let k=c[T],w=g[T],$=h[(T-1+i)%i],R=h[T],C=Math.atan2($.y-k.y,$.x-k.x),D=Math.atan2(R.y-k.y,R.x-k.x)-C;D<=0&&(D+=2*Math.PI);let _=2*Math.PI-D,O=C+D/2,L=C-_/2,re={x:k.x+w*Math.cos(O),y:k.y+w*Math.sin(O)},ee={x:k.x+w*Math.cos(L),y:k.y+w*Math.sin(L)},V=re.x*re.x+re.y*re.y>ee.x*ee.x+ee.y*ee.y?D:-_;for(let K=0;K<b;K++){let X=K/b,z=C+X*V;S.push({x:k.x+w*Math.cos(z),y:k.y+w*Math.sin(z)})}}let v=0;for(let T of S){let k=Math.max(Math.abs(T.x),Math.abs(T.y));k>v&&(v=k)}if(v>0&&v!==s){let T=s/v;for(let k of S)k.x*=T,k.y*=T}let I=T=>{if(r===0)return T;let k=Math.cos(r*Math.PI/180),w=Math.sin(r*Math.PI/180);return{x:T.x*k-T.y*w,y:T.x*w+T.y*k}},x=S.map(I),P=`M ${x[0].x} ${x[0].y}`;for(let T=1;T<x.length;T++)P+=` L ${x[T].x} ${x[T].y}`;return P+=" Z",P}function un(t,e=0,n=0){if(t.length<3)return"";if(e<=0)return t.map((o,s)=>(s===0?"M":"L")+`${o.x},${o.y}`).join(" ")+" Z";let r=Math.min(e,n*.4),i="";for(let o=0;o<t.length;o++){let s=t[(o-1+t.length)%t.length],a=t[o],l=t[(o+1)%t.length],c={x:s.x-a.x,y:s.y-a.y},u=Math.hypot(c.x,c.y);c.x/=u,c.y/=u;let d={x:l.x-a.x,y:l.y-a.y},p=Math.hypot(d.x,d.y);d.x/=p,d.y/=p;let f=Math.min(r,u/2),g=Math.min(r,p/2),m={x:a.x+c.x*f,y:a.y+c.y*f},h={x:a.x+d.x*g,y:a.y+d.y*g};i+=o===0?`M${m.x},${m.y}`:` L${m.x},${m.y}`,i+=` Q${a.x},${a.y} ${h.x},${h.y}`}return i+" Z"}function Cl(t,e,n="evenodd"){let r=t*(e/100),i=n==="nonzero"?1:0;return`M ${t} 0 A ${t} ${t} 0 1 1 ${-t} 0 A ${t} ${t} 0 1 1 ${t} 0 Z M ${r} 0 A ${r} ${r} 0 1 ${i} ${-r} 0 A ${r} ${r} 0 1 ${i} ${r} 0 Z`}function $l(t,e,n,r=1,i=0){let o=t*(n/100),a=Math.round(e*36),l=e*2*Math.PI,c=(t-o/2)/l,u=i*Math.PI/180,d=[],p=[];for(let m=0;m<=a;m++){let h=m/a,b=h*l*r+u,S=c*(h*l)+o/2,v=o/2;d.push({x:(S+v*.3)*Math.cos(b),y:(S+v*.3)*Math.sin(b)}),p.push({x:Math.max(0,S-v*.3)*Math.cos(b),y:Math.max(0,S-v*.3)*Math.sin(b)})}let f=`M ${d[0].x} ${d[0].y}`;for(let m=1;m<d.length;m++)f+=` L ${d[m].x} ${d[m].y}`;let g=p[p.length-1];f+=` L ${g.x} ${g.y}`;for(let m=p.length-2;m>=0;m--)f+=` L ${p[m].x} ${p[m].y}`;return f+=" Z",f}var b0=.2;function nf(t,e,n,r=0){let i=e*(n/100),o=e,s=e-i,a=2*Math.PI/t,l=a*b0/2,c=a/4,u=r*Math.PI/180,d=[];for(let p=0;p<t;p++){let f=u+p*a;d.push({x:s*Math.cos(f),y:s*Math.sin(f)}),d.push({x:o*Math.cos(f+c-l),y:o*Math.sin(f+c-l)}),d.push({x:o*Math.cos(f+c+l),y:o*Math.sin(f+c+l)}),d.push({x:s*Math.cos(f+a/2),y:s*Math.sin(f+a/2)})}return d}function El(t,e,n,r=0,i=0,o="evenodd",s=0){let a=nf(t,e,n,s),l=Math.min(r,e*.1),c=un(a,l,e);if(i>0){let u=e*(i/100),d=o==="nonzero"?1:0;c+=` M ${u} 0 A ${u} ${u} 0 1 ${d} ${-u} 0 A ${u} ${u} 0 1 ${d} ${u} 0 Z`}return c}function Al(t,e,n,r,i,o="round",s="uniform",a){let l=Math.min(n,r)/2,c,u,d,p,f,g,m,h;if(s==="non-uniform"&&a?(c=Math.min(a.radiusTL??i,l),u=Math.min(a.radiusTR??i,l),d=Math.min(a.radiusBR??i,l),p=Math.min(a.radiusBL??i,l),f=a.shapeTL??o,g=a.shapeTR??o,m=a.shapeBR??o,h=a.shapeBL??o):(c=u=d=p=Math.min(i,l),f=g=m=h=o),!(o!=="round"||s==="non-uniform"||c>0&&f!=="round"||u>0&&g!=="round"||d>0&&m!=="round"||p>0&&h!=="round")&&c===u&&u===d&&d===p)return null;let S=`M${t+c},${e}`;return S+=` L${t+n-u},${e}`,S+=vl(g,u,t+n,e,"tr"),S+=` L${t+n},${e+r-d}`,S+=vl(m,d,t+n,e+r,"br"),S+=` L${t+p},${e+r}`,S+=vl(h,p,t,e+r,"bl"),S+=` L${t},${e+c}`,S+=vl(f,c,t,e,"tl"),S+=" Z",S}function vl(t,e,n,r,i){if(e<=0)return"";switch(t){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${n},${r+e}`;case"br":return` A${e},${e} 0 0 1 ${n-e},${r}`;case"bl":return` A${e},${e} 0 0 1 ${n},${r-e}`;case"tl":return` A${e},${e} 0 0 1 ${n+e},${r}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${n},${r+e}`;case"br":return` A${e},${e} 0 0 0 ${n-e},${r}`;case"bl":return` A${e},${e} 0 0 0 ${n},${r-e}`;case"tl":return` A${e},${e} 0 0 0 ${n+e},${r}`}break;case"bevel":switch(i){case"tr":return` L${n},${r+e}`;case"br":return` L${n-e},${r}`;case"bl":return` L${n},${r-e}`;case"tl":return` L${n+e},${r}`}break;case"notch":switch(i){case"tr":return` L${n-e},${r+e} L${n},${r+e}`;case"br":return` L${n-e},${r-e} L${n-e},${r}`;case"bl":return` L${n+e},${r-e} L${n},${r-e}`;case"tl":return` L${n+e},${r+e} L${n+e},${r}`}break}return""}function Nl(t,e,n,r,i,o={}){let s=e+r/2,a=n+i/2;switch(t){case"diamond":return`M${s},${n} L${e+r},${a} L${s},${n+i} L${e},${a} Z`;case"parallelogram":{let l=(o.slantPercent??20)/100*r;return`M${e+l},${n} L${e+r},${n} L${e+r-l},${n+i} L${e},${n+i} Z`}case"trapezoid":{let l=(o.topWidthPercent??70)/100*r,c=(r-l)/2;return`M${e+c},${n} L${e+c+l},${n} L${e+r},${n+i} L${e},${n+i} Z`}case"terminator":{let l=i/2;return`M${e+l},${n} L${e+r-l},${n} A${l},${l} 0 0 1 ${e+r-l},${n+i} L${e+l},${n+i} A${l},${l} 0 0 1 ${e+l},${n} Z`}case"cylinder":{let l=r/2,c=Math.min((o.capHeightPercent??15)/100*i,i/2);return`M${e},${n+c} A${l},${c} 0 0 1 ${e+r},${n+c} A${l},${c} 0 0 1 ${e},${n+c} L${e},${n+i-c} A${l},${c} 0 0 0 ${e+r},${n+i-c} L${e+r},${n+c} M${s-l},${n+c} A${l},${c} 0 0 0 ${s+l},${n+c}`}case"document-shape":{let l=(o.waveAmplitudePercent??15)/100*i;return`M${e},${n} L${e+r},${n} L${e+r},${n+i} C${e+r*.75},${n+i-l*2} ${s+r*.25},${n+i+l} ${s},${n+i} C${s-r*.25},${n+i-l} ${e+r*.25},${n+i+l*.5} ${e},${n+i} Z`}}}function cr(t,e,n=!1,r=.5,i){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return w0(t,n,r);case"BASIS":case"basis":return k0(t,n);case"ARC":case"arc":return i&&i.length>0?v0(t,n,i):hs(t,n,"CUBIC");case"LINEAR":case"linear":return hs(t,n,"LINEAR");case"QUADRATIC":case"quadratic":return hs(t,n,"QUADRATIC");case"CUBIC":case"cubic":return hs(t,n,"CUBIC");default:return hs(t,n)}}function v0(t,e,n){let r=`M ${t[0].x} ${t[0].y}`,i=0,o={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let s=0;s<t.length-1;s++){let a=t[s+1];if(a.isSubpathStart){if(e&&s-i>=1){let c=t[i],u=n?.[s]??o;r+=` A ${u.rx} ${u.ry} ${u.rotation} ${u.largeArc?1:0} ${u.sweep?1:0} ${c.x} ${c.y} Z`}r+=` M ${a.x} ${a.y}`,i=s+1;continue}let l=n?.[s]??o;r+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${a.x} ${a.y}`}if(e&&t.length-i>1){let s=t[i],a=n?.[t.length-1]??o;r+=` A ${a.rx} ${a.ry} ${a.rotation} ${a.largeArc?1:0} ${a.sweep?1:0} ${s.x} ${s.y} Z`}return r}function hs(t,e,n){let r=`M ${t[0].x} ${t[0].y}`,i=0,o=null,s=null;for(let a=0;a<t.length-1;a++){let l=t[a],c=t[a+1];if(c.isSubpathStart){if(e&&a-i>=1){let d=t[i];r+=ef(l,d,d.segmentType,o,s,n),r+=" Z"}r+=` M ${c.x} ${c.y}`,i=a+1,o=null,s=null;continue}r+=ef(l,c,c.segmentType,o,s,n);let u=I0(c.segmentType??n,l,c);o=u,u==="quad"?s=l.handleOut??null:s=null}if(e&&t.length-i>1){let a=t[t.length-1],l=t[i],c=(l.segmentType??n??(a.handleOut||l.handleIn?"CUBIC":"LINEAR")).toUpperCase();c==="LINEAR"||c==="HORIZONTAL"||c==="VERTICAL"||(r+=ef(a,l,l.segmentType,o,s,n)),r+=" Z"}return r}var x0=.001;function Li(t,e){return Math.abs(t-e)<x0}function I0(t,e,n){let r=(t??(e.handleOut||n.handleIn?"CUBIC":"LINEAR")).toUpperCase();return r==="CUBIC"||r==="SMOOTH_CUBIC"?"cubic":r==="QUADRATIC"||r==="SMOOTH_QUADRATIC"?"quad":null}function ef(t,e,n,r,i,o){let s=(n??o??(t.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(s==="LINEAR"||s==="HORIZONTAL"||s==="VERTICAL")return(s==="HORIZONTAL"||s==="LINEAR")&&Li(t.y,e.y)?` H ${e.x}`:(s==="VERTICAL"||s==="LINEAR")&&Li(t.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(s==="ARC"){let c=e.arcParams;return c?` A ${c.rx} ${c.ry} ${c.rotation} ${c.largeArc?1:0} ${c.sweep?1:0} ${e.x} ${e.y}`:` L ${e.x} ${e.y}`}if(s==="QUADRATIC"||s==="SMOOTH_QUADRATIC"){let c=t.handleOut??{x:(t.x+e.x)/2,y:(t.y+e.y)/2};return r==="quad"&&i&&Li(c.x,2*t.x-i.x)&&Li(c.y,2*t.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let a=t.handleOut??{x:t.x,y:t.y},l=e.handleIn??{x:e.x,y:e.y};return r==="cubic"&&t.handleIn&&t.handleOut&&Li(t.handleOut.x,2*t.x-t.handleIn.x)&&Li(t.handleOut.y,2*t.y-t.handleIn.y)?` S ${l.x} ${l.y} ${e.x} ${e.y}`:` C ${a.x} ${a.y} ${l.x} ${l.y} ${e.x} ${e.y}`}function w0(t,e,n){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";let r=n,i=e?[t[t.length-1],...t,t[0],t[1]]:[t[0],...t,t[t.length-1]],o=`M ${t[0].x} ${t[0].y}`,s=e?t.length:t.length-1;for(let a=0;a<s;a++){let l=i[a],c=i[a+1],u=i[a+2],d=i[a+3],p=Math.hypot(u.x-c.x,u.y-c.y),f=Math.hypot(c.x-l.x,c.y-l.y),g=Math.hypot(d.x-u.x,d.y-u.y),m=Math.pow(f,r),h=Math.pow(p,r),b=Math.pow(g,r),S=Math.pow(f,2*r),v=Math.pow(p,2*r),I=Math.pow(g,2*r),x,P,T,k;f<1e-8?(x=c.x,P=c.y):(x=(S*u.x-v*l.x+(2*S+3*m*h+v)*c.x)/(3*m*(m+h)),P=(S*u.y-v*l.y+(2*S+3*m*h+v)*c.y)/(3*m*(m+h))),g<1e-8?(T=u.x,k=u.y):(T=(I*c.x-v*d.x+(2*I+3*b*h+v)*u.x)/(3*b*(b+h)),k=(I*c.y-v*d.y+(2*I+3*b*h+v)*u.y)/(3*b*(b+h))),o+=` C ${x} ${P} ${T} ${k} ${u.x} ${u.y}`}return e&&(o+=" Z"),o}function k0(t,e){let n=t.length;if(n<2)return n===1?`M ${t[0].x} ${t[0].y}`:"";if(n===2)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;if(e){let o=(t[0].x+4*t[1].x+t[2].x)/6,s=(t[0].y+4*t[1].y+t[2].y)/6,a=`M ${o} ${s}`;for(let l=0;l<n;l++){let c=t[(l+1)%n],u=t[(l+2)%n],d=t[(l+3)%n];a+=tf(c,u,d)}return a+=" Z",a}let r=t,i=`M ${r[0].x} ${r[0].y}`;i+=` L ${(5*r[0].x+r[1].x)/6} ${(5*r[0].y+r[1].y)/6}`;for(let o=0;o<=n-3;o++)i+=tf(r[o],r[o+1],r[o+2]);return i+=tf(r[n-2],r[n-1],r[n-1]),i+=` L ${r[n-1].x} ${r[n-1].y}`,i}function tf(t,e,n){return` C ${(2*t.x+e.x)/3} ${(2*t.y+e.y)/3} ${(t.x+2*e.x)/3} ${(t.y+2*e.y)/3} ${(t.x+4*e.x+n.x)/6} ${(t.y+4*e.y+n.y)/6}`}function Ml(t,e,n){let r=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(n)?Math.max(1,n):4;switch(t){case"dashed":case"dotted":case"custom":return`${r} ${i}`;default:return null}}var Qy={bearing:!0,catmullRom:!0},eS={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:[]},R0=new Set(Object.keys(eS));function T0(t){return t===32||t===9||t===10||t===12||t===13}function Dl(t){return t>=48&&t<=57}function tS(t){return t>=65&&t<=90||t>=97&&t<=122}var of=class{constructor(e){this.source=e}source;position=0;get length(){return this.source.length}skipWhitespace(){for(;this.position<this.length&&T0(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,n=e,r=this.source.charCodeAt(n);(r===43||r===45)&&n++;let i=0;for(;n<this.length&&Dl(this.source.charCodeAt(n));)n++,i++;if(this.source.charCodeAt(n)===46){let a=n;n++;let l=0;for(;n<this.length&&Dl(this.source.charCodeAt(n));)n++,l++;if(l===0){if(i===0)return null;n=a}}else if(i===0)return null;let o=this.source.charCodeAt(n);if(o===101||o===69){let a=n;n++;let l=this.source.charCodeAt(n);(l===43||l===45)&&n++;let c=0;for(;n<this.length&&Dl(this.source.charCodeAt(n));)n++,c++;c===0&&(n=a)}let s=Number(this.source.slice(e,n));return Number.isFinite(s)?(this.position=n,s):null}readFlag(){let e=this.source[this.position];return e!=="0"&&e!=="1"?null:(this.position++,e==="1"?1:0)}};function nS(t,e){return R0.has(t)||(t==="B"||t==="b")&&e.bearing?!0:(t==="R"||t==="r")&&e.catmullRom===!0}function P0(t){if(!t)return!1;let e=t.charCodeAt(0);return Dl(e)||t==="+"||t==="-"||t==="."||t===","}function C0(t,e,n,r){return{code:t,offset:e.position,command:n,message:r}}function rf(t,e,n){let r=[];for(let i=0;i<e.length;i++){i>0||n?t.skipOptionalCommaWhitespace():t.skipWhitespace();let o=e[i]==="flag"?t.readFlag():t.readNumber();if(o===null)return null;r.push(o)}return r}function Ol(t,e){if(t.skipWhitespace(),t.position>=t.length)return"end";let n=t.source[t.position];return nS(n,e)?"command":P0(n)?"parameter":tS(n.charCodeAt(0))?"unsupported-command":"unexpected"}function Hn(t,e={}){let n=new of(t),r=e.extensions??{},i=[],o=!0,s=(a,l,c)=>({commands:i,error:C0(a,n,l,c)});for(;;){if(n.skipWhitespace(),n.position>=n.length)return{commands:i,error:null};let a=n.position,l=n.source[n.position];if(!nS(l,r)){let f=tS(l.charCodeAt(0))?"unsupported-command":"unexpected-content";return s(f,null,`Unexpected path content '${l}'`)}n.position++;let c=l;if(o&&c!=="M"&&c!=="m")return s("initial-moveto-required",c,"Path data must begin with moveto");if(o=!1,c==="Z"||c==="z"){i.push({type:c,params:[],offset:a});let f=Ol(n,r);if(f==="end"||f==="command")continue;return s(f==="unsupported-command"?"unsupported-command":"unexpected-content",c,"Closepath cannot be implicitly repeated")}if(c==="B"||c==="b"){let f=[];for(;;){let g=rf(n,["number"],f.length>0);if(!g){if(f.length===0)return s("missing-parameter",c,"Bearing requires at least one angle");break}f.push(g[0]);let m=Ol(n,r);if(m!=="parameter"){if(m==="end"||m==="command")break;return i.push({type:c,params:f,offset:a}),s(m==="unsupported-command"?"unsupported-command":"unexpected-content",c,"Invalid bearing command content")}}i.push({type:c,params:f,offset:a});continue}if(c==="R"||c==="r"){let f=[];for(;;){let g=rf(n,["number","number"],f.length>0);if(!g)return s("missing-parameter",c,"Catmull-Rom requires complete coordinate pairs");f.push(...g);let m=Ol(n,r);if(m!=="parameter"){if(m==="end"||m==="command")break;return s(m==="unsupported-command"?"unsupported-command":"unexpected-content",c,"Invalid Catmull-Rom command content")}}if(f.length<6)return s("missing-parameter",c,`R/r: needs at least 3 coordinate pairs, got ${f.length/2}`);i.push({type:c,params:f,offset:a});continue}let d=eS[c],p=0;for(;;){let f=rf(n,d,p>0);if(!f)return s("missing-parameter",c,`Incomplete ${c} command parameters`);let g=p>0&&(c==="M"||c==="m")?c==="M"?"L":"l":c;i.push({type:g,params:f,offset:a}),p++;let m=Ol(n,r);if(m==="end"||m==="command")break;if(m!=="parameter")return s(m==="unsupported-command"?"unsupported-command":"unexpected-content",c,`Unexpected content in ${c} command`)}}}function zl(t){return t.map(e=>e.params.length===0?e.type:`${e.type} ${e.params.join(" ")}`).join(" ")}function $0(t,e,n){let r=[...t.params];if(t.type!==t.type.toUpperCase())return r;switch(t.type){case"M":case"L":case"T":case"C":case"S":case"Q":case"R":for(let i=0;i<r.length;i+=2)r[i]+=e,r[i+1]+=n;break;case"H":r[0]+=e;break;case"V":r[0]+=n;break;case"A":r[5]+=e,r[6]+=n;break}return r}function rS(t,e,n){let r=Hn(t);return r.error?null:zl(r.commands.map((i,o)=>{let s=$0(i,e,n);return o===0&&i.type==="m"&&(s[0]+=e,s[1]+=n),{...i,params:s}}))}function iS(t,e){let n=Hn(t);if(n.error)return null;let[r,i,o,s,a,l]=e,c=[],u=0,d=0,p=0,f=0,g=(h,b)=>[r*h+o*b+a,i*h+s*b+l],m=(h,b,S)=>{c.push({type:h,params:b,offset:S})};for(let h of n.commands){let b=h.type===h.type.toLowerCase(),S=h.type.toUpperCase(),v=h.params,I=u,x=d;if(S==="A")return null;if(S==="Z"){m("Z",[],h.offset),u=p,d=f;continue}if(S==="H"){u=b?u+v[0]:v[0],m("L",g(u,d),h.offset);continue}if(S==="V"){d=b?d+v[0]:v[0],m("L",g(u,d),h.offset);continue}let P=T=>[(b?I:0)+v[T],(b?x:0)+v[T+1]];switch(S){case"M":case"L":case"T":{let T=P(0);u=T[0],d=T[1],S==="M"&&(p=u,f=d),m(S,g(u,d),h.offset);break}case"C":{let T=g(...P(0)),k=g(...P(2)),w=P(4);u=w[0],d=w[1],m("C",[...T,...k,...g(...w)],h.offset);break}case"S":case"Q":{let T=g(...P(0)),k=P(2);u=k[0],d=k[1],m(S,[...T,...g(...k)],h.offset);break}}}return zl(c)}var Bi=Math.PI*2;function E0(t,e,n,r){let i=e*e-4*t*n;if(!(i>=0))return;let o=Math.sqrt(i),s=-.5*(e+(e>=0?o:-o));if(t!==0){let a=s/t;a>0&&a<1&&r.push(a)}if(s!==0){let a=n/s;a>0&&a<1&&r.push(a)}}function A0(t,e,n,r,i){let o=1-i;return o*o*o*t+3*o*o*i*e+3*o*i*i*n+i*i*i*r}function N0(t,e,n,r){let i=1-r;return i*i*t+2*i*r*e+r*r*n}function Fl(t,e,n,r){let i=t<r?t:r,o=t>r?t:r,s=-t+3*e-3*n+r,a=2*(t-2*e+n),l=e-t,c=[];E0(s,a,l,c);for(let u of c){let d=A0(t,e,n,r,u);d<i&&(i=d),d>o&&(o=d)}return{min:i,max:o}}function Ll(t,e,n){let r=t<n?t:n,i=t>n?t:n,o=t-2*e+n;if(o!==0){let s=(t-e)/o;if(s>0&&s<1){let a=N0(t,e,n,s);a<r&&(r=a),a>i&&(i=a)}}return{min:r,max:i}}function oS(t,e,n,r){let i=t*r-e*n>=0?1:-1,o=Math.sqrt((t*t+e*e)*(n*n+r*r));if(o===0)return 0;let s=(t*n+e*r)/o;return s<-1?s=-1:s>1&&(s=1),i*Math.acos(s)}function af(t,e,n,r,i,o,s,a,l){if(t===a&&e===l||n===0||r===0)return null;let c=Math.abs(n),u=Math.abs(r),d=i%360*Math.PI/180,p=Math.cos(d),f=Math.sin(d),g=(t-a)/2,m=(e-l)/2,h=p*g+f*m,b=-f*g+p*m,S=h*h,v=b*b,I=c*c,x=u*u,P=S/I+v/x;if(P>1){let F=Math.sqrt(P);c*=F,u*=F,I=c*c,x=u*u}let T=I*v+x*S;if(T===0)return null;let k=(I*x-T)/T;k<0&&(k=0);let w=Math.sqrt(k);o===s&&(w=-w);let $=w*(c*b/u),R=w*(-(u*h)/c),C=p*$-f*R+(t+a)/2,A=f*$+p*R+(e+l)/2,D=(h-$)/c,_=(b-R)/u,O=(-h-$)/c,L=(-b-R)/u,re=oS(1,0,D,_),ee=oS(D,_,O,L);return!s&&ee>0?ee-=Bi:s&&ee<0&&(ee+=Bi),{cx:C,cy:A,rx:c,ry:u,phi:d,theta1:re,deltaTheta:ee}}function M0(t,e){let n=Math.cos(t.phi),r=Math.sin(t.phi),i=e?Fe(e,{x:t.cx,y:t.cy}):{x:t.cx,y:t.cy},o=e?ml(e,{x:t.rx*n,y:t.rx*r}):{x:t.rx*n,y:t.rx*r},s=e?ml(e,{x:-t.ry*r,y:t.ry*n}):{x:-t.ry*r,y:t.ry*n};return{cx:i.x,cy:i.y,ux:o.x,uy:o.y,vx:s.x,vy:s.y}}function O0(t,e){let n=Math.cos(e),r=Math.sin(e);return{x:t.cx+t.ux*n+t.vx*r,y:t.cy+t.uy*n+t.vy*r}}function D0(t,e,n){if(n>=0){let i=(t-e)%Bi;return i<0&&(i+=Bi),i<=n}let r=(e-t)%Bi;return r<0&&(r+=Bi),r<=-n}function lf(t,e,n,r,i,o,s,a,l,c){let u=c?Fe(c,{x:t,y:e}):{x:t,y:e},d=c?Fe(c,{x:a,y:l}):{x:a,y:l},p={minX:Math.min(u.x,d.x),minY:Math.min(u.y,d.y),maxX:Math.max(u.x,d.x),maxY:Math.max(u.y,d.y)},f=af(t,e,n,r,i,o,s,a,l);if(!f)return p;let g=M0(f,c),m=Math.atan2(g.vx,g.ux),h=Math.atan2(g.vy,g.uy),b=[m,m+Math.PI,h,h+Math.PI];for(let S of b){if(!D0(S,f.theta1,f.deltaTheta))continue;let v=O0(g,S);v.x<p.minX&&(p.minX=v.x),v.x>p.maxX&&(p.maxX=v.x),v.y<p.minY&&(p.minY=v.y),v.y>p.maxY&&(p.maxY=v.y)}return p}var sf=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 _l(t,e,n,r){let i=r?Fe(r,{x:e,y:n}):{x:e,y:n};i.x<t.minX&&(t.minX=i.x),i.x>t.maxX&&(t.maxX=i.x),i.y<t.minY&&(t.minY=i.y),i.y>t.maxY&&(t.maxY=i.y),t.any=!0}function cf(t,e){e.minX<t.minX&&(t.minX=e.minX),e.maxX>t.maxX&&(t.maxX=e.maxX),e.minY<t.minY&&(t.minY=e.minY),e.maxY>t.maxY&&(t.maxY=e.maxY),t.any=!0}function sS(t,e,n,r,i,o,s,a,l,c){let u=c?Fe(c,{x:e,y:n}):{x:e,y:n},d=c?Fe(c,{x:r,y:i}):{x:r,y:i},p=c?Fe(c,{x:o,y:s}):{x:o,y:s},f=c?Fe(c,{x:a,y:l}):{x:a,y:l},g=Fl(u.x,d.x,p.x,f.x),m=Fl(u.y,d.y,p.y,f.y);cf(t,{minX:g.min,maxX:g.max,minY:m.min,maxY:m.max})}function aS(t,e,n,r,i,o,s,a){let l=a?Fe(a,{x:e,y:n}):{x:e,y:n},c=a?Fe(a,{x:r,y:i}):{x:r,y:i},u=a?Fe(a,{x:o,y:s}):{x:o,y:s},d=Ll(l.x,c.x,u.x),p=Ll(l.y,c.y,u.y);cf(t,{minX:d.min,maxX:d.max,minY:p.min,maxY:p.max})}function en(t,e){if(!t)return null;let n=Hn(t),r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},i=0,o=0,s=0,a=0,l=0,c=0,u=null,d="",p=()=>r.any?{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}:null;for(let f of n.commands){d=f.type;let g=new sf(f.params),m=d>="a"&&d<="z";switch(d){case"M":case"m":{let h=g.readNumber(),b=g.readNumber();if(h===null||b===null)return p();i=m?i+h:h,o=m?o+b:b,s=i,a=o,_l(r,i,o,e),u=null,d=m?"l":"L";break}case"L":case"l":{let h=g.readNumber(),b=g.readNumber();if(h===null||b===null)return p();i=m?i+h:h,o=m?o+b:b,_l(r,i,o,e),u=null;break}case"H":case"h":{let h=g.readNumber();if(h===null)return p();i=m?i+h:h,_l(r,i,o,e),u=null;break}case"V":case"v":{let h=g.readNumber();if(h===null)return p();o=m?o+h:h,_l(r,i,o,e),u=null;break}case"C":case"c":{let h=g.readNumber(),b=g.readNumber(),S=g.readNumber(),v=g.readNumber(),I=g.readNumber(),x=g.readNumber();if(h===null||b===null||S===null||v===null||I===null||x===null)return p();let P=m?i+h:h,T=m?o+b:b,k=m?i+S:S,w=m?o+v:v,$=m?i+I:I,R=m?o+x:x;sS(r,i,o,P,T,k,w,$,R,e),l=k,c=w,u="cubic",i=$,o=R;break}case"S":case"s":{let h=g.readNumber(),b=g.readNumber(),S=g.readNumber(),v=g.readNumber();if(h===null||b===null||S===null||v===null)return p();let I=u==="cubic"?2*i-l:i,x=u==="cubic"?2*o-c:o,P=m?i+h:h,T=m?o+b:b,k=m?i+S:S,w=m?o+v:v;sS(r,i,o,I,x,P,T,k,w,e),l=P,c=T,u="cubic",i=k,o=w;break}case"Q":case"q":{let h=g.readNumber(),b=g.readNumber(),S=g.readNumber(),v=g.readNumber();if(h===null||b===null||S===null||v===null)return p();let I=m?i+h:h,x=m?o+b:b,P=m?i+S:S,T=m?o+v:v;aS(r,i,o,I,x,P,T,e),l=I,c=x,u="quad",i=P,o=T;break}case"T":case"t":{let h=g.readNumber(),b=g.readNumber();if(h===null||b===null)return p();let S=u==="quad"?2*i-l:i,v=u==="quad"?2*o-c:o,I=m?i+h:h,x=m?o+b:b;aS(r,i,o,S,v,I,x,e),l=S,c=v,u="quad",i=I,o=x;break}case"A":case"a":{let h=g.readNumber(),b=g.readNumber(),S=g.readNumber(),v=g.readFlag(),I=g.readFlag(),x=g.readNumber(),P=g.readNumber();if(h===null||b===null||S===null||v===null||I===null||x===null||P===null)return p();let T=m?i+x:x,k=m?o+P:P;cf(r,lf(i,o,h,b,S,v,I,T,k,e)),i=T,o=k,u=null;break}case"Z":case"z":{i=s,o=a,u=null;break}default:return p()}}return p()}function lS(t,e,n=!1,r=.5,i,o){return t.length===0?null:en(cr(t,e,n,r,i),o)}function cS(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function z0(t){let e=t.state.symbolOverrides;return!!e&&Object.keys(e).length>0}function df(t){return t===null||typeof t!="object"?JSON.stringify(t)??"null":Array.isArray(t)?`[${t.map(df).join(",")}]`:`{${Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${JSON.stringify(e)}:${df(n)}`).join(",")}}`}function _0(t){let e=new Map,n=r=>{for(let i of r)e.set(i.id,(e.get(i.id)??0)+1),Array.isArray(i.state.children)&&n(i.state.children)};return n(t),e}function dS(t,e,n){return t.map(r=>{let i=n.has(r.id)?e[r.id]:void 0,o=i?{...r.state,...i}:{...r.state},s=o.children;return Array.isArray(s)&&(o.children=dS(s,e,n)),i!==void 0||o.children!==r.state.children?{...r,state:o}:r})}function ei(t,e){let n=String(e.state.variantKey??""),r=n?t.variants?.[n]:void 0,i=r?n:"",o=r??t.shapes,s=[];n&&!r&&s.push({code:"unknown-symbol-variant",shapeId:e.id,message:`Symbol instance ${e.id} requests unknown variant ${n} from ${t.id}; the base definition is used.`});let a=e.state.symbolOverrides??{},l=Object.entries(a),c=o;if(l.length>0){let f=_0(o),g=new Set;for(let[m]of l){let h=f.get(m)??0;h===1?g.add(m):s.push({code:h>1?"ambiguous-symbol-override-target":"unresolved-symbol-override-target",shapeId:e.id,message:h>1?`Symbol instance ${e.id} override target ${m} is ambiguous in ${t.id}.`:`Symbol instance ${e.id} override target ${m} is absent from ${t.id}.`})}c=dS(o,a,g)}let u=i!==""||l.length>0,d=l.length>0?`${t.id}--ovr-${e.id}`:i?`${t.id}--${cS(i)}`:t.id,p=`${t.id}\0${i}\0${df(a)}`;return{shapes:c,requestedVariantKey:n,effectiveVariantKey:i,candidateTargetId:d,materializationKey:p,materialized:u,diagnostics:s}}function Gi(t,e=!1){let n=t.state.symbolId??"",r=t.state.variantKey??"";return e||z0(t)?`${n}--ovr-${t.id}`:r?`${n}--${cS(r)}`:n}function uS(t,e){return[...ei(t,e).shapes]}function me(t,e,n){return Object.freeze({type:t,renderer:e,resolve:n})}function F0(t){let e=t.state,n=e.x??0,r=e.y??0;return{kind:"circle",shapeType:"circle",cx:n,cy:r,r:e.radius??50,defaultPivot:{x:n,y:r}}}function L0(t){let e=t.state,n=e.cx??e.x??0,r=e.cy??e.y??0;return{kind:"ellipse",shapeType:"ellipse",cx:n,cy:r,rx:e.rx??50,ry:e.ry??30,pathLength:e.pathLength,defaultPivot:{x:n,y:r}}}function pS(t){let e=t.state,n=e,r=e.x??0,i=e.y??0,o=t.type==="square"?e.size:void 0,s=o??e.width??100,a=o??e.height??100,l=e.cornerRadius??0,c=e.rx,u=e.ry,d=c!==void 0&&c>=0?c:void 0,p=u!==void 0&&u>=0?u:void 0,f=Math.max(0,l),g=d??p??f,m=d??g,h=p??g,b=Math.min(Math.max(0,m),Math.max(0,s)/2),S=Math.min(Math.max(0,h),Math.max(0,a)/2),v=n.cornerShape??"round",I=n.cornerMode??"uniform",x=null;return(v!=="round"||I==="non-uniform")&&(x=Al(r,i,s,a,l,v,I,I==="non-uniform"?{radiusTL:n.cornerRadiusTL,radiusTR:n.cornerRadiusTR,radiusBR:n.cornerRadiusBR,radiusBL:n.cornerRadiusBL,shapeTL:n.cornerShapeTL,shapeTR:n.cornerShapeTR,shapeBR:n.cornerShapeBR,shapeBL:n.cornerShapeBL}:void 0)||null),{kind:"rectangle",shapeType:t.type,x:r,y:i,width:s,height:a,rx:b,ry:S,pathData:x,defaultPivot:{x:r+s/2,y:i+a/2}}}function B0(t){let e=t.state,n=e.x1??0,r=e.y1??0,i=e.x2??0,o=e.y2??0;return{kind:"line",shapeType:"line",x1:n,y1:r,x2:i,y2:o,boundsPolicy:e.sourceRef||e.targetRef||e.routingMode?"linked-line":"analytic",defaultPivot:{x:(n+i)/2,y:(r+o)/2}}}function G0(t){let e=t.state.textX??t.state.x??0,n=t.state.textY??t.state.y??0;return{kind:"text",shapeType:"text",x:e,y:n,boundsPolicy:"measure-text",defaultPivot:{x:e,y:n}}}function V0(t){let e=t.state,n=e.pathPoints??[],r=cr(n,e.pathCurveType??"CUBIC",e.pathClosed??!1,e.pathTension??.5,e.pathArcParams),i=n.length>0?e.customPivot??{x:n[0].x,y:n[0].y}:null;return{kind:"path",shapeType:"path",role:"spline",d:r,placement:null,fillRule:null,defaultPivot:i}}function j0(t){let e=t.state,n=e.polylinePoints??[];return{kind:"polyline",shapeType:"polyline",points:n,closed:e.polylineClosed??!1,defaultPivot:n.length>0?e.customPivot??{x:n[0].x,y:n[0].y}:null}}function Bl(t,e,n,r){let i=t.state,o=i.x??0,s=i.y??0,a=i.width??n,l=i.height??r;return{kind:"positioning-rect",shapeType:t.type,role:e,x:o,y:s,width:a,height:l,defaultPivot:{x:o+a/2,y:s+l/2}}}function tn(t,e,n=!1){let r=t.state,i=r.cx??0,o=r.cy??0,s={radius:r.radius??50,cornerRadius:r.cornerRadius??0,shiftAngle:r.shiftAngle??-90,fillRule:r.fillRule??"nonzero"};return{kind:"path",shapeType:t.type,role:"polygon",d:e(r,s),placement:{x:i,y:o},fillRule:n?s.fillRule:null,defaultPivot:{x:i,y:o}}}function Vi(t,e){let n=t.state,r=n.x??0,i=n.y??0,o=n.width??100,s=n.height??60;return{kind:"path",shapeType:e,role:"flowchart",d:Nl(e,r,i,o,s,{slantPercent:n.slantPercent,topWidthPercent:n.topWidthPercent,capHeightPercent:n.capHeightPercent,waveAmplitudePercent:n.waveAmplitudePercent}),placement:null,fillRule:null,defaultPivot:{x:r+o/2,y:i+s/2}}}function Gl(t,e){return{kind:"container",shapeType:t.type,role:e,boundsPolicy:"children",defaultPivot:null}}function U0(t){let e=t.state;return{kind:"embedded-svg",shapeType:"svg",x:e.svgX,y:e.svgY,width:e.svgWidth,height:e.svgHeight,viewBoxX:e.svgViewBoxX,viewBoxY:e.svgViewBoxY,viewBoxWidth:e.svgViewBoxWidth,viewBoxHeight:e.svgViewBoxHeight,preserveAspectRatio:e.svgPreserveAspectRatio,boundsPolicy:"children",defaultPivot:null}}function H0(t){let e=t.state;return{kind:"view",shapeType:"view",viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight,preserveAspectRatio:e.viewPreserveAspectRatio,boundsPolicy:"none",defaultPivot:null}}function W0(t){let e=t.state;return{kind:"shape-reference",shapeType:"shape-reference",targetShapeId:e.targetShapeId,offsetX:e.offsetX??0,offsetY:e.offsetY??0,width:e.width,height:e.height,boundsPolicy:"reference",defaultPivot:null}}function K0(t){let e=t.state;return{kind:"symbol-instance",shapeType:"symbol-instance",symbolId:e.symbolId??"",targetId:Gi(t),x:e.x??0,y:e.y??0,width:e.width??100,height:e.height??100,boundsPolicy:"symbol",defaultPivot:null}}var mS=Object.freeze({rectangle:me("rectangle","rectangle",pS),square:me("square","rectangle",pS),circle:me("circle","circle",F0),ellipse:me("ellipse","ellipse",L0),line:me("line","line",B0),text:me("text","text",G0),image:me("image","image",t=>Bl(t,"image",100,100)),path:me("path","path",V0),polyline:me("polyline","polyline",j0),triangle:me("triangle","polygon",t=>tn(t,(e,n)=>un(ys(3,n.radius,n.shiftAngle),n.cornerRadius,n.radius))),ngon:me("ngon","polygon",t=>tn(t,(e,n)=>un(ys(e.sides??6,n.radius,n.shiftAngle),n.cornerRadius,n.radius))),star:me("star","polygon",t=>tn(t,(e,n)=>un(xl(e.arms??5,n.radius,e.innerRadiusPercent??50,n.shiftAngle),n.cornerRadius,n.radius))),cross:me("cross","polygon",t=>tn(t,(e,n)=>un(Il(n.radius,e.armWidthPercent??40,n.shiftAngle),n.cornerRadius,n.radius))),ring:me("ring","polygon",t=>tn(t,(e,n)=>Cl(n.radius,e.innerRadiusPercent??50,n.fillRule),!0)),spiral:me("spiral","polygon",t=>tn(t,(e,n)=>$l(n.radius,e.turns??3,e.thicknessPercent??20,e.spiralDirection??1,n.shiftAngle))),gear:me("gear","polygon",t=>tn(t,(e,n)=>El(e.teeth??8,n.radius,e.toothDepthPercent??30,n.cornerRadius,e.holeRadiusPercent??0,n.fillRule,n.shiftAngle),!0)),arrow:me("arrow","polygon",t=>tn(t,(e,n)=>un(wl(n.radius,e.headWidthPercent??100,e.headLengthPercent??30,e.shaftWidthPercent??40,n.shiftAngle),n.cornerRadius,n.radius))),"symbol-instance":me("symbol-instance","symbol-instance",K0),group:me("group","container",t=>Gl(t,"group")),container:me("container","container",t=>Gl(t,"group")),cloud:me("cloud","polygon",t=>tn(t,(e,n)=>Pl(n.radius,e.cloudBumps??5,e.cloudPuffinessPercent??60,n.shiftAngle))),heart:me("heart","polygon",t=>tn(t,(e,n)=>Tl(n.radius,e.lobeRadiusPercent??50,e.cleftDepthPercent??25,n.shiftAngle))),lightning:me("lightning","polygon",t=>tn(t,(e,n)=>un(Rl(n.radius,e.boltSegments??3,e.boltJaggednessPercent??40,e.boltWidthPercent??30,n.shiftAngle),n.cornerRadius,n.radius))),speechBubble:me("speechBubble","polygon",t=>tn(t,(e,n)=>un(kl(n.radius,e.tailAngleDeg??45,e.tailLengthPercent??40,e.tailWidthPercent??25,n.shiftAngle),n.cornerRadius,n.radius))),diamond:me("diamond","flowchart",t=>Vi(t,"diamond")),parallelogram:me("parallelogram","flowchart",t=>Vi(t,"parallelogram")),trapezoid:me("trapezoid","flowchart",t=>Vi(t,"trapezoid")),terminator:me("terminator","flowchart",t=>Vi(t,"terminator")),cylinder:me("cylinder","flowchart",t=>Vi(t,"cylinder")),"document-shape":me("document-shape","flowchart",t=>Vi(t,"document-shape")),hyperlink:me("hyperlink","hyperlink",t=>Gl(t,"hyperlink")),switch:me("switch","switch",t=>Gl(t,"switch")),svg:me("svg","svg",U0),view:me("view","view",H0),"shape-reference":me("shape-reference","shape-reference",W0),video:me("video","media",t=>Bl(t,"video",320,180)),audio:me("audio","media",t=>Bl(t,"audio",320,180)),"foreign-object":me("foreign-object","foreign-object",t=>Bl(t,"foreign-object",100,100))}),X0=Object.freeze(Object.keys(mS));function gS(){return X0}function ji(t){return mS[t]}function jt(t){return ji(t.type)?.resolve(t)??null}function fS(t,e,n,r){return n<0||r<0?null:{minX:t,minY:e,maxX:t+n,maxY:e+r}}function Y0(t){if(t.length===0)return{minX:0,minY:0,maxX:0,maxY:0};let e=t[0].x,n=t[0].y,r=t[0].x,i=t[0].y;for(let o=1;o<t.length;o++){let s=t[o];s.x<e&&(e=s.x),s.x>r&&(r=s.x),s.y<n&&(n=s.y),s.y>i&&(i=s.y)}return{minX:e,minY:n,maxX:r,maxY:i}}function Ss(t,e){let n=jt(t);if(!n)return null;switch(n.kind){case"circle":return n.r<0?null:{minX:n.cx-n.r,minY:n.cy-n.r,maxX:n.cx+n.r,maxY:n.cy+n.r};case"ellipse":return n.rx<0||n.ry<0?null:{minX:n.cx-n.rx,minY:n.cy-n.ry,maxX:n.cx+n.rx,maxY:n.cy+n.ry};case"rectangle":return n.pathData?en(n.pathData):fS(n.x,n.y,n.width,n.height);case"line":return n.boundsPolicy==="linked-line"?null:{minX:Math.min(n.x1,n.x2),minY:Math.min(n.y1,n.y2),maxX:Math.max(n.x1,n.x2),maxY:Math.max(n.y1,n.y2)};case"text":return e?.measureText?.(t,n)??null;case"path":return en(n.d,n.placement?_e(n.placement.x,n.placement.y):void 0);case"polyline":return Y0(n.points);case"positioning-rect":return fS(n.x,n.y,n.width,n.height);case"container":case"embedded-svg":case"view":case"shape-reference":case"symbol-instance":return null}}function Vl(t,e){let n=Ss(t,e);return n?{x:(n.minX+n.maxX)/2,y:(n.minY+n.maxY)/2}:null}var hS=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/u,q0=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function jl(t){return(t.match(q0)??[]).map(Number).filter(Number.isFinite)}function yS(t){let e=jl(t),n=e.length-e.length%2,r=[];for(let i=0;i<n;i+=2)r.push(`${e[i]},${e[i+1]}`);return r.join(" ")}function bs(t,e){let n=jl(t),r=jl(e),i=n.length-n.length%2,o=r.length-r.length%2;if(i!==o)return null;if(i===0)return"";let s=[];for(let a=0;a<i;a+=2)s.push(`${n[a]+r[a]},${n[a+1]+r[a+1]}`);return s.join(" ")}function Ul(t){return t.additive==="sum"||t.values==null&&t.from==null&&t.to==null&&t.by!=null?"sum":"replace"}function dr(t,e,n="number"){if(n==="points"){let r=a=>yS(a.trim()),i=Ul(t)==="sum",o=e===void 0?void 0:r(e),s=a=>{if(!i||o===void 0)return[...a];let l=a.map(c=>bs(o,c));return l.every(c=>c!==null)?l:null};if(t.values){let a=t.values.split(";").map(l=>l.trim()).filter(Boolean).map(r);return a.length===0?null:s(a)}if(t.from!=null&&t.to!=null)return s([r(t.from),r(t.to)]);if(t.from!=null&&t.by!=null){let a=r(t.from),l=bs(a,r(t.by));return l===null?null:s([a,l])}if(t.to!=null&&o!==void 0){let a=r(t.to);if(!i)return[o,a];let l=bs(o,a);return l===null?null:[o,l]}if(t.by!=null&&o!==void 0){let a=bs(o,r(t.by));return a===null?null:[o,a]}return null}if(t.values){let r=t.values.split(";").map(i=>i.trim()).filter(Boolean);return r.length===0?null:r}if(t.from!=null&&t.to!=null)return[t.from.trim(),t.to.trim()];if(t.from!=null&&t.by!=null){let r=Number(t.from),i=Number(t.by);return Number.isFinite(r)&&Number.isFinite(i)?[String(r),String(r+i)]:null}if(t.to!=null&&e!==void 0)return[e.trim(),t.to.trim()];if(t.by!=null){let r=Number(t.by);return Number.isFinite(r)?["0",String(r)]:null}return null}function Hl(t){let e=t.dur?.trim();return!e||e==="indefinite"||e==="media"?0:Vn(e)}function Wn(t,e,n=t.calcMode??"linear"){if(t.keyTimes){let r=t.keyTimes.split(";").map(i=>i.trim());if(r.length===e&&r.every(i=>hS.test(i)))return r.map(Number)}return e<=1?e===1?[0]:[]:n==="discrete"?Array.from({length:e},(r,i)=>i/e):Array.from({length:e},(r,i)=>i/(e-1))}function Kn(t){return t.keySplines?t.keySplines.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let n=jl(e);return[n[0]??0,n[1]??0,n[2]??0,n[3]??0]}):[]}function uf(t){if(t.repeatCount==="indefinite")return{cycleInfinite:!0};if(t.repeatCount&&hS.test(t.repeatCount.trim())){let e=Number(t.repeatCount);if(e>1)return{cycleRepeats:Math.round(e)}}if(t.repeatDur==="indefinite")return{cycleInfinite:!0};if(t.repeatDur){let e=Vn(t.repeatDur),n=Hl(t);if(e>0&&n>0){let r=Math.max(1,Math.ceil(e/n));if(r>1)return{cycleRepeats:r}}}return{}}function pf(t){return t.fill==="freeze"?{}:{fill:"remove"}}function pn(t,e,n,r,i,o){let s=[];for(let a=0;a<t.length&&a<e.length;a++){let l=t[a].trim(),c=o==="color"||o==="path"||o==="points"||o==="numberList"||o==="discrete",u=Number(l),d={time:e[a]*r,value:c||!Number.isFinite(u)?l:u,easing:"linear"};if(a>0&&i==="spline"&&n[a-1]){let p=al(...n[a-1]);d.easing=p.easing,p.customBezier&&(d.customBezier=p.customBezier)}else a>0&&i==="discrete"&&(d.easing="steps",d.stepsParams={count:1,position:"jump-end"});s.push(d)}return s}var Z0=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu,J0=/^([A-Za-z_][\w.-]*)\.repeat\((\d+)\)\s*([+-]\s*\S+)?$/u,Q0=/^([A-Za-z_][\w.-]*)\.(begin|end)\s*([+-]\s*\S+)?$/u,ff=class{bySourceId=new Map;beginCache=new Map;resolving=new Set;constructor(e){for(let n of e)n.sourceAnimationId&&!this.bySourceId.has(n.sourceAnimationId)&&this.bySourceId.set(n.sourceAnimationId,n)}activations(e){let r=(e.attributes.begin??"0s").split(";").map(l=>l.trim()).filter(Boolean),i=r.flatMap(l=>{let c=this.resolveEntry(l);return c!==null&&Number.isFinite(c)?[{entry:l,time:c}]:[]}),o=new Map;for(let l of i)o.set(l.time,l.entry);let a=r.length>1&&e.kind!=="discard"&&e.additive!=="sum"&&o.size>1?[...o.keys()].sort((l,c)=>l-c):i.length>0?[i[0].time]:[null];return Object.freeze(a.map(l=>{let c=Object.freeze({...e.attributes,...l!==null?{begin:`${l}s`}:{}}),u=e.duration;if(e.attributes.values?.split(";").map(p=>p.trim()).filter(Boolean)?.length===1&&l!==null&&e.attributes.end){let p=this.resolveEntry(e.attributes.end.split(";")[0].trim());p!==null&&Number.isFinite(p)&&p>=l&&(u=p-l)}return Object.freeze({...e,attributes:c,duration:u})}))}resolveCandidateBegin(e){let n=this.beginCache.get(e.animationId);if(n!==void 0)return n;if(this.resolving.has(e.animationId))return null;this.resolving.add(e.animationId);let r=e.attributes.begin?.split(";")[0]?.trim()||"0s",i=this.resolveEntry(r);return this.resolving.delete(e.animationId),i!==null&&this.beginCache.set(e.animationId,i),i}resolveEntry(e){if(!e||e==="0")return 0;if(e==="indefinite")return Number.POSITIVE_INFINITY;if(Z0.test(e))return Vn(e);let n=e.match(J0);if(n){let i=this.bySourceId.get(n[1]);if(!i)return null;let o=this.resolveCandidateBegin(i);if(o===null||!Number.isFinite(o))return o;let s=Number(n[2]),a=this.repeatEventTime(i,o,s);return a===null||!Number.isFinite(a)?a:a+this.offset(n[3])}let r=e.match(Q0);if(r){let i=this.bySourceId.get(r[1]);if(!i)return null;let o=this.resolveCandidateBegin(i);if(o===null||!Number.isFinite(o))return o;let s=this.activeDuration(i),a=r[2]==="end"?s!==null?o+s:null:o;return a===null?null:a+this.offset(r[3])}return null}offset(e){return e?Vn(e.replace(/\s+/gu,"")):0}repeatEventTime(e,n,r){if(r<1||e.duration<=0)return Number.POSITIVE_INFINITY;let i=this.activeDuration(e);return i===null||r*e.duration>=i?Number.POSITIVE_INFINITY:n+r*e.duration}activeDuration(e){if(e.duration<=0)return null;let n=e.attributes.repeatCount,r=e.attributes.repeatDur,i=e.duration,o=!1;if(n==="indefinite"&&(i=Number.POSITIVE_INFINITY,o=!0),n&&n!=="indefinite"){let s=Number(n);Number.isFinite(s)&&s>0&&(i=s*e.duration,o=!0)}if(r==="indefinite")o||(i=Number.POSITIVE_INFINITY);else if(r){let s=Vn(r);Number.isFinite(s)&&s>=0&&(i=o?Math.min(i,s):s)}return i}},kn=Object.freeze({cx:{property:"x",valueType:"number",stateKey:"x"},cy:{property:"y",valueType:"number",stateKey:"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"},opacity:{property:"opacity",valueType:"number",stateKey:"opacity"},points:{property:"polylinePoints",valueType:"points",stateKey:"points"},r:{property:"radius",valueType:"number",stateKey:"radius"},rx:{property:"rx",valueType:"number",stateKey:"rx"},ry:{property:"ry",valueType:"number",stateKey:"ry"},stroke:{property:"strokeColor",valueType:"color",stateKey:"borderColor"},target:{property:"linkTarget",valueType:"discrete",stateKey:"linkTarget"},"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"},visibility:{property:"visibility",valueType:"discrete",stateKey:"visibility"},width:{property:"width",valueType:"number",stateKey:"width"},x:{property:"x",valueType:"number",stateKey:"x"},x1:{property:"x1",valueType:"number",stateKey:"x1"},x2:{property:"x2",valueType:"number",stateKey:"x2"},y:{property:"y",valueType:"number",stateKey:"y"},y1:{property:"y1",valueType:"number",stateKey:"y1"},y2:{property:"y2",valueType:"number",stateKey:"y2"}}),eR=Object.freeze({...kn,"font-size":{property:"fontSize",valueType:"number",stateKey:"fontSize"}}),tR=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function vS(t){return(t.match(tR)??[]).map(Number).filter(Number.isFinite)}function mf(t,e){let n=t?.[e];if(n!=null)return Array.isArray(n)?n.join(" "):String(n)}function xS(t){switch(t.property){case"visibility":return"visible";case"display":return"inline";case"opacity":case"fillOpacity":case"strokeOpacity":return"1";default:return}}function fn(t){let e=t.attributes.begin?.split(";")[0]?.trim();return!e||e==="0"||e==="0s"?{offset:0}:/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu.test(e)?{offset:Vn(e)}:/^[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)?(?:[+-].+)?$/u.test(e)?{offset:0,beginTrigger:{type:"event",value:e}}:{offset:0,beginTrigger:{type:"expression",value:e}}}function ti(t){let e=uf(t.attributes),n=fn(t);return{enabled:!0,cycleBehavior:"restart",...t.duration>0?{cycleDuration:t.duration}:{},...t.additive==="sum"?{additive:"sum"}:{},...e,...pf(t.attributes),...n.beginTrigger?{beginTrigger:n.beginTrigger}:{}}}function Ui(t,e){return t.map(n=>({...n,time:n.time+e}))}function IS(t,e,n,r,i){let o=t.attributeName?.toLowerCase();if(!o)return null;let s=i?.projection??kn[o]??{property:o,valueType:"discrete",stateKey:o},a=t.attributes,l=i?.underlying??mf(n,s.stateKey)??xS(s),c=dr(a,l,s.valueType);if(!c||c.length===0)return null;let u=t.kind==="set"?"discrete":a.calcMode??"linear",d=t.duration,p=fn(t);if(t.kind==="set"){let h=[{time:p.offset,value:c.at(-1),easing:"linear"}];return d>0&&t.fill==="remove"&&l!==void 0&&h.push({time:p.offset+d,value:l,easing:"linear"}),{id:`svg-animation-${r}`,shapeId:e,property:s.property,enabled:!0,...d>0?{cycleDuration:d}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"set",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:h}}if(c.length===1){let h=pn(c,[0],[],d,"discrete",s.valueType)[0]?.value;if(h===void 0)return null;let b=[{time:p.offset,value:h,easing:"linear"}];if(d>0&&t.fill==="remove"&&l!==void 0){let S=pn([l],[0],[],d,"discrete",s.valueType)[0]?.value;S!==void 0&&b.push({time:p.offset+d,value:S,easing:"linear"})}return{id:`svg-animation-${r}`,shapeId:e,property:s.property,enabled:!0,...d>0?{cycleDuration:d}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"animate",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:b}}let f=Wn(a,c.length,u),g=Kn(a),m=Ui(pn(c,f,g,d,u,s.valueType),p.offset);return m.length<2?null:{id:`svg-animation-${r}`,shapeId:e,property:s.property,...ti(t),...u!=="linear"?{calcMode:u}:{},sourceSmilElement:"animate",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:m}}var nR=Object.freeze({"stop-color":{suffix:"Color",valueType:"color"},"stop-opacity":{suffix:"Opacity",valueType:"number"},offset:{suffix:"Offset",valueType:"number"}});function rR(t,e){return e==="stop-color"?t.color:String(e==="stop-opacity"?t.opacity:t.offset)}function iR(t,e,n,r){let i=t.attributeName?.toLowerCase(),o=t.targetSourceNodeId;if(!e||!i||!o)return[];let s=nR[i];if(!s||t.kind!=="animate"&&t.kind!=="set")return[];let a=[],l=new Set;for(let c of e.candidates)c.stops.forEach((u,d)=>{if(!(u.sourceNodeId!==o&&u.correspondingSourceNodeId!==o)){for(let p of e.bindings)if(!(p.gradientSourceNodeId!==c.sourceNodeId||p.propertyName!=="fill"&&p.propertyName!=="stroke"))for(let f of wS(p.occurrenceId,n)){let g=`${p.propertyName}GradientStop${d}${s.suffix}`,m=`${f.shapeId}|${g}`;if(l.has(m))continue;l.add(m);let h=IS(t,f.shapeId,f.state,r+a.length,{projection:{property:g,valueType:s.valueType,stateKey:g},underlying:rR(u,i)});h&&a.push(h)}}});return a}function wS(t,e){let n=e.shapeBindingsForOccurrence?.(t);if(n&&n.length>0)return n;let r=e.shapeIdForOccurrence(t);return r?[{shapeId:r,shapeType:"unknown",state:e.shapeStateForOccurrence(t)}]:[]}var oR=new Set(["clip-path","display","fill","mask","opacity","visibility"]);function sR(t,e){if(t.targetStatus!=="resolved"||!t.targetOccurrenceId)return[];let n=wS(t.targetOccurrenceId,e);if(!n.some(i=>i.shapeType==="group")||t.kind==="animateTransform"||t.kind==="animateMotion"||t.kind==="discard"||oR.has(t.attributeName?.toLowerCase()??""))return n;let r=e.descendantShapeBindingsForOccurrence?.(t.targetOccurrenceId);return r&&r.length>0?r:n}function aR(t,e,n){if(t.kind!=="animate"||t.attributeName?.toLowerCase()!=="viewbox")return[];let r=e.shapeType==="svg"?"svgViewBox":e.shapeType==="view"?"viewBox":null;if(!r||t.duration<=0)return[];let i=dr(t.attributes,void 0,"numberList");if(!i||i.length<2)return[];let o=i.map(vS);if(o.some(u=>u.length<4))return[];let s=t.attributes.calcMode??"linear",a=Wn(t.attributes,o.length,s),l=Kn(t.attributes),c=fn(t);return["X","Y","Width","Height"].map((u,d)=>({id:`svg-animation-${n+d}`,shapeId:e.shapeId,property:`${r}${u}`,...ti(t),...s!=="linear"?{calcMode:s}:{},sourceSmilElement:"animate",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:Ui(pn(o.map(p=>String(p[d])),a,l,t.duration,s,"number"),c.offset)}))}var lR=Object.freeze([{cssProperty:"fill",projection:kn.fill},{cssProperty:"stroke",projection:kn.stroke},{cssProperty:"stroke-width",projection:kn["stroke-width"]},{cssProperty:"fill-opacity",projection:kn["fill-opacity"]},{cssProperty:"stroke-opacity",projection:kn["stroke-opacity"]},{cssProperty:"opacity",projection:kn.opacity},{cssProperty:"visibility",projection:kn.visibility},{cssProperty:"display",projection:kn.display}]);function SS(t,e){if(e==="number"){let n=Number.parseFloat(t);if(Number.isFinite(n))return String(n)}return t.trim().toLowerCase()}function cR(t,e,n,r){if(!t.targetOccurrenceId||t.attributeName?.toLowerCase()!=="class")return[];let i=t.kind==="set"?t.attributes.to===void 0?null:["",t.attributes.to]:dr(t.attributes,void 0,"discrete");if(!i||i.length<2||t.kind==="animate"&&t.duration<=0)return[];let o=Math.max(t.duration,.001),s=Wn(t.attributes,i.length,"discrete"),a=Kn(t.attributes),l=fn(t),c=i.map(d=>n.stylesheetValuesWithClass(t.targetOccurrenceId,d)),u=[];for(let{cssProperty:d,projection:p}of lR){let f=mf(e.state,p.stateKey)??xS(p)??"",g=c.map(h=>h[d]??f),m=SS(f,p.valueType);g.every(h=>SS(h,p.valueType)===m)||u.push({id:`svg-animation-${r+u.length}`,shapeId:e.shapeId,property:p.property,...ti(t),calcMode:"discrete",sourceSmilElement:t.kind==="set"?"set":"animate",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:Ui(pn(g,s,a,o,"discrete",p.valueType),l.offset)})}return u}function dR(t,e,n){let r=t.attributes.type?.trim().toLowerCase();if(!r)return[];let i=t.attributes,o=dr(i,void 0,"numberList");if(!o||o.length<2)return[];let s=i.calcMode??"linear",a=Wn(i,o.length,s),l=Kn(i),c=fn(t),u=ti(t),d=o.map(vS),p=(f,g,m,h)=>{let b=pn(o.map((S,v)=>{let I=g(d[v]);return Array.isArray(I)?I.join(" "):String(I)}),a,l,t.duration,s,f==="transformMatrix"?"numberList":"number").map((S,v)=>({...S,time:S.time+c.offset,value:f==="transformMatrix"?d[v].slice(0,6):S.value}));return{id:`svg-animation-${n+m}`,shapeId:e,property:f,...u,additive:t.additive,...t.additive==="replace"&&t.replacesCarrierBase?{replacesCarrierBase:!0}:{},...h?{transformOrigin:h}:{},...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:b}};if(r==="translate")return[p("translateX",f=>f[0]??0,0),p("translateY",f=>f[1]??0,1)];if(r==="scale")return[p("scaleX",f=>f[0]??1,0),p("scaleY",f=>f[1]??f[0]??1,1)];if(r==="rotate"){let f=d.find(g=>g.length>=3);return[p("rotation",g=>g[0]??0,0,f?{x:f[1],y:f[2]}:{x:0,y:0})]}return r==="skewx"||r==="skewy"?[p(r==="skewx"?"skewX":"skewY",f=>f[0]??0,0)]:r==="matrix"&&d.every(f=>f.length>=6)?[p("transformMatrix",f=>f.slice(0,6),0)]:[]}function kS(t,e,n,r){if(!t.motionPathData||t.duration<=0)return null;let i=t.attributes.keyPoints?.split(";").map(Number).filter(Number.isFinite),o=i&&i.length>=2?i:[0,1],s=t.attributes.calcMode??"paced",a=Wn(t.attributes,o.length,s),l=Kn(t.attributes),c=fn(t),u=t.attributes.rotate?.trim(),d=u===void 0?Number.NaN:Number(u),p=t.motionPathSourceNodeId?n.shapeIdForSourceNode(t.motionPathSourceNodeId):null;return{id:`svg-animation-${r}`,shapeId:e,property:"pathMotion",...ti(t),motionPath:t.motionPathData,...p?{motionPathRef:{shapeId:p,mode:"curveTemplate"}}:{},...u==="auto"||u==="auto-reverse"?{motionRotate:u}:Number.isFinite(d)?{motionRotate:d}:{},...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},...s!=="linear"&&s!=="paced"?{calcMode:s}:{},keyframes:Ui(pn(o.map(String),a,l,t.duration,s,"number"),c.offset)}}var uR=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"]),pR=new Set(["fill","stroke","stop-color","flood-color","lighting-color"]);function vs(t){return{shapeId:t.shapeId,domTargetSelector:t.selector}}function fR(t,e,n,r){let i=kS(t,e.shapeId,n,r);return i?{...i,property:"domTransformStack",additive:t.additive,...vs(e),transformFunction:"translate",transformStackIndex:0,transformBaseValue:e.baseTransform}:null}function mR(t,e,n,r){let i=t.attributes.type?.trim();if(i!=="translate"&&i!=="scale"&&i!=="rotate"&&i!=="skewX"&&i!=="skewY"&&i!=="matrix")return null;let o=dr(t.attributes,void 0,"discrete");if(!o||o.length<2||t.duration<=0)return null;let s=t.attributes.calcMode??"linear",a=Wn(t.attributes,o.length,s),l=Kn(t.attributes),c=fn(t);return{id:`svg-animation-${n}`,...vs(e),property:"domTransformStack",...ti(t),additive:t.additive,...s!=="linear"?{calcMode:s}:{},sourceSmilElement:"animateTransform",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},transformFunction:i,transformStackIndex:r,transformBaseValue:e.baseTransform,keyframes:Ui(pn(o,a,l,t.duration,s,"discrete"),c.offset)}}function gR(t,e,n){let r=t.attributeName;if(!r||t.kind!=="animate"&&t.kind!=="set")return null;let i=r.toLowerCase(),o=e.baseAttributes[r]??e.baseAttributes[i]??"",s=t.kind==="animate"&&(i==="display"||i==="visibility"),a=t.kind==="set"?"string":uR.has(i)?"number":pR.has(i)?"color":"string";if(t.kind==="set"){let m=t.attributes.to?.trim();if(m===void 0)return null;let h=fn(t),b=[{time:h.offset,value:m,easing:"linear"}];return t.duration>0&&t.fill==="remove"&&b.push({time:h.offset+t.duration,value:o,easing:"linear"}),{id:`svg-animation-${n}`,...vs(e),property:"domAttribute",enabled:!0,...t.duration>0?{cycleDuration:t.duration}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"set",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},domAttribute:r,domAttributeValueType:"string",transformBaseValue:o,keyframes:b}}let l=s||a==="string"?"discrete":a,c=dr(t.attributes,o,l);if(!c||c.length===0||t.duration<=0)return null;let u=s?"discrete":t.attributes.calcMode??"linear",d=Wn(t.attributes,c.length,u),p=Kn(t.attributes),f=fn(t),g=s?i==="display"?"domDisplay":"domVisibility":"domAttribute";return{id:`svg-animation-${n}`,...vs(e),property:g,...ti(t),calcMode:u,sourceSmilElement:"animate",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},...g==="domAttribute"?{domAttribute:r,domAttributeValueType:a}:{},transformBaseValue:o,keyframes:Ui(pn(c,d,p,t.duration,u,l),f.offset)}}function hR(t,e,n,r,i){if(t.kind==="animateMotion")return fR(t,e,n,r);if(t.kind==="animateTransform")return mR(t,e,r,i);if(t.kind==="discard"){let o=fn(t);return{id:`svg-animation-${r}`,...vs(e),property:"discard",enabled:!0,sourceSmilElement:"discard",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},transformBaseValue:e.baseAttributes.display??"",keyframes:[{time:o.offset,value:1,easing:"linear"}]}}return gR(t,e,r)}function yR(t,e,n,r,i){let o=sR(t,n);if(o.length===0&&t.targetOccurrenceId){let a=n.domTargetForOccurrence?.(t.targetOccurrenceId),l=a?hR(t,a,n,r,i):null;return l?[l]:[]}let s=[];for(let a of o){if(t.kind==="animateTransform"){s.push(...dR(t,a.shapeId,r+s.length));continue}if(t.kind==="animateMotion"){let d=kS(t,a.shapeId,n,r+s.length);d&&s.push(d);continue}if(t.kind==="discard"){let d=fn(t);s.push({id:`svg-animation-${r+s.length}`,shapeId:a.shapeId,property:"discard",enabled:!0,sourceSmilElement:"discard",...t.sourceAnimationId?{sourceSmilId:t.sourceAnimationId}:{},keyframes:[{time:d.offset,value:1,easing:"linear"}]});continue}let l=aR(t,a,r+s.length);if(l.length>0){s.push(...l);continue}let c=cR(t,a,e,r+s.length);if(c.length>0){s.push(...c);continue}let u=IS(t,a.shapeId,a.state,r+s.length);u&&s.push(u)}return s}function RS(t){let e=Number(t.iterationCount);return{enabled:!0,cycleDuration:t.duration,cycleBehavior:t.direction==="reverse"||t.direction==="alternate"||t.direction==="alternate-reverse"?t.direction:"restart",...t.iterationCount==="infinite"?{cycleInfinite:!0}:Number.isFinite(e)&&e>=0&&e!==1?{cycleRepeats:e}:{},...Hp(t)}}var SR=Object.freeze([["translateX",0],["translateY",0],["scaleX",1],["scaleY",1],["rotation",0],["skewX",0],["skewY",0]]);function bR(t,e,n,r){let i=n.shapeIdForOccurrence(t.occurrenceId);if(!i)return[];let o=e.value(t.occurrenceId,"transform-box")??"view-box",s=n.cssTransformContextForOccurrence?.(t.occurrenceId,o),a=n.shapeBindingsForOccurrence?.(t.occurrenceId)[0],l=(o==="fill-box"||o==="content-box")&&a?.state?Ss({id:a.shapeId,type:a.shapeType,state:a.state}):null,c={...l?{boxX:l.minX,boxY:l.minY,boxWidth:l.maxX-l.minX,boxHeight:l.maxY-l.minY}:{},...s??{}},u=t.keyframes.stops.flatMap(v=>{let I=v.properties.transform??v.properties["-webkit-transform"]??v.properties["-moz-transform"];return I===void 0?[]:[{offset:v.offset,raw:I,timing:v.properties["animation-timing-function"]}]});if(u.length===0)return[];let d=e.value(t.occurrenceId,"transform")??"none";u[0].offset>0&&u.unshift({offset:0,raw:d,timing:void 0}),u.at(-1).offset<1&&u.push({offset:1,raw:d,timing:void 0});let f=e.style(t.occurrenceId)?.cascadedValues["transform-origin"]?e.value(t.occurrenceId,"transform-origin")??"0 0":"0 0",g=Zp(f,c),m=Qp(u.map(({offset:v,raw:I})=>({offset:v,transform:I})),{...c,...g?{transformOrigin:g}:{},retainPureRotationOrigin:!0,progressForInterval:(v,I)=>{let x=u[v]?.timing;return zp(x?Xr(x):t.animation.parsedEasing,I)}});if(m.status!=="projected")return[];let h=m.stops.map(v=>({offset:v.offset,channels:v})),b=new Set(m.channels),S=[];for(let[v,I]of SR){if(!b.has(v))continue;let x=h.flatMap(({offset:P,channels:T})=>{if(!T)return[];let k=T[v]??I,w=u.findLastIndex($=>$.offset<P);return[TS(P,k,t.animation,m.sampled?"linear":u[Math.max(0,w)]?.timing)]});x.length<2||S.push({id:`svg-animation-${r+S.length}`,shapeId:i,property:v,...RS(t.animation),additive:v==="translateX"||v==="translateY"?"sum":"replace",replacesCarrierBase:!0,...v==="rotation"&&g&&(m.pureRotation||g.x===0&&g.y===0&&(g.z??0)===0)?{transformOrigin:{x:g.x,y:g.y}}:{},template:{name:t.animation.name},keyframes:x})}return S}function bS(t,e){let n=t.trim();if(e!=="number")return n;let r=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(?:px)?$/iu.exec(n);if(!r)return null;let i=Number(r[1]);return Number.isFinite(i)?i:null}function TS(t,e,n,r){let i={time:t*n.duration+n.delay,value:e,easing:n.easing},o=r?Xr(r):n.parsedEasing;return o&&Dp(i,o),i}function vR(t,e){if(t.length!==0){if(t[0].offset>0){let n=e();n&&t.unshift({...n,offset:0})}if(t.at(-1).offset<1){let n=e();n&&t.push({...n,offset:1})}}}function xR(t,e,n,r){let i=n.shapeIdForOccurrence(t.occurrenceId);if(!i)return[];let o=n.shapeStateForOccurrence(t.occurrenceId),s=new Set(t.keyframes.stops.flatMap(l=>Object.keys(l.properties)));s.delete("animation-timing-function"),s.delete("transform"),s.delete("-webkit-transform"),s.delete("-moz-transform");let a=[];for(let l of s){let c=eR[l];if(!c)continue;let u=t.keyframes.stops.flatMap(p=>{let f=p.properties[l];if(f===void 0)return[];let g=bS(f,c.valueType);return g===null?[]:[{offset:p.offset,value:g,timing:p.properties["animation-timing-function"]}]}),d=e.value(t.occurrenceId,l)??mf(o,c.stateKey);vR(u,()=>{if(d==null)return null;let p=bS(d,c.valueType);return p===null?null:{offset:0,value:p,timing:void 0}}),!(u.length<2)&&a.push({id:`svg-animation-${r+a.length}`,shapeId:i,property:c.property,...RS(t.animation),template:{name:t.animation.name},keyframes:u.map((p,f)=>TS(p.offset,p.value,t.animation,f===0?void 0:u[f-1].timing))})}return a}function IR(t){let e=Math.max(0,...t.keyframes.map(n=>n.time));return Lp(t)??e}function gf(t,e,n,r){let i=new ff(t.smil),o=[],s=[],a=[],l=[],c=[],u=new Map,d=new Map;for(let m of t.smil){let h=0;if(m.kind==="animateTransform"&&m.targetOccurrenceId){let b=`${m.targetOccurrenceId}|${m.sourceNodeId}`,S=u.get(b);S!==void 0?h=S:(h=d.get(m.targetOccurrenceId)??0,u.set(b,h),d.set(m.targetOccurrenceId,h+1))}for(let b of i.activations(m)){let S=iR(b,r,n,1),v=S.length>0?S:yR(b,e,n,1,h);m.kind==="animateTransform"?o.push(...v):m.kind==="animateMotion"?s.push(...v):m.kind==="set"?l.push(...v):m.kind==="discard"?c.push(...v):a.push(...v)}}let p=[],f=[];for(let m of t.css)p.push(...bR(m,e,n,1)),f.push(...xR(m,e,n,1));let g=[...o,...s,...a,...l,...c,...p,...f].map((m,h)=>({...m,id:`svg-animation-${h+1}`}));return g.length===0?null:{duration:Math.max(...g.map(IR)),loop:g.some(m=>m.cycleInfinite===!0),playbackSpeed:1,tracks:g}}function Wl(t,e){return gf(t.animations,t.styles,e,t.gradients)}var PS=["native-validation-warning","unavailable-shape-descriptor","malformed-source","missing-svg-root","invalid-svg-attribute","duplicate-svg-id","missing-svg-namespace","no-materializable-content","unsupported-svg-element","unsupported-ingest-capability","empty-hyperlink-dropped","nested-hyperlink-flattened","required-features-dropped","unresolved-reference","circular-use-reference","circular-resource-reference","use-expansion-limit-exceeded","external-effect-failed","application-rolled-back"],Hi=["native-document-open","full-snapshot-restore","svg-document-import","external-svg-paste","internal-clipboard-paste","plugin-svg-fragment","pattern-fragment","vectorized-svg-fragment"];var Is=["geometry","containers","source-order","hierarchy","root-viewport-frame","common-presentation","conditional-processing","authored-attributes","gradients","patterns","filters","paint-server-definitions","markers","symbols","use-and-linked-references","clip-definitions","mask-definitions","clip-mask-membership","smil-animation","css-animation","metadata","scripts","styles","custom-properties","views","embedded-svg","fonts","external-assets"],Xn=t=>({status:"supported",by:t}),xs=(t,e)=>({status:"diagnosed-unsupported",by:t,reason:e}),CS=(t,e)=>({status:"diagnosed-lossy",by:t,reason:e}),ur=t=>({status:"exempt",reason:t}),wR="plugin SVG result diagnostic collector",yf="pattern fragment diagnostic collector",Sf="vectorized SVG result diagnostic collector";function Te(t,e={}){return{"native-document-open":Xn("native snapshot parse and canonical restore"),"full-snapshot-restore":Xn("canonical full-snapshot restore"),"svg-document-import":Xn(t),"external-svg-paste":Xn(t),"internal-clipboard-paste":Xn("closed clipboard subgraph materializer"),"plugin-svg-fragment":e.plugin??Xn("plugin fragment plan materializer"),"pattern-fragment":e.pattern??xs(yf,"Pattern fragments retain only capabilities enrolled by the pattern tile contract."),"vectorized-svg-fragment":e.vectorized??xs(Sf,"Vectorized ingestion intentionally accepts path-oriented geometry only.")}}var Kl=t=>xs(wR,t),pr=t=>xs(yf,t),$S=t=>xs(Sf,t),Ut=t=>Xn(t),hf=t=>Xn(t),Xl={geometry:Te("SVG shape element parser",{pattern:Ut("fragment-scoped pattern shape parser"),vectorized:hf("vectorized path geometry parser")}),containers:Te("SVG structural container planner",{pattern:Ut("fragment-scoped pattern hierarchy parser")}),"source-order":Te("source document order index and SceneGraph placement",{pattern:Ut("pattern source-order materializer"),vectorized:hf("vectorized path document-order traversal")}),hierarchy:Te("source DOM hierarchy planner and SceneGraph placement",{pattern:Ut("fragment-scoped pattern hierarchy materializer")}),"root-viewport-frame":Te("root SVG frame parser and application policy",{plugin:ur("Plugin fragment framing is consumed only for bounds scaling."),pattern:ur("Pattern fragments use the explicit tile width and height as their local frame."),vectorized:CS(Sf,"Vectorized source framing is consumed only to scale path geometry into target bounds.")}),"common-presentation":Te("shared SVG presentation parser",{pattern:Ut("pattern shape presentation parser"),vectorized:hf("vectorized path presentation parser")}),"conditional-processing":Te("SVG switch and conditional-processing attribute parser",{pattern:Ut("pattern shape conditional-processing parser"),vectorized:$S("Vectorized ingestion does not preserve SVG conditional-processing branches.")}),"authored-attributes":Te("authored-attribute preservation parser",{pattern:Ut("pattern authored-attribute preservation parser")}),gradients:Te("gradient parser and library reference materializer",{pattern:Ut("fragment-scoped pattern gradient resolver")}),patterns:Te("pattern parser and library reference materializer",{pattern:Ut("fragment-scoped nested-pattern resolver")}),filters:Te("filter parser and reference materializer"),"paint-server-definitions":Te("paint-server definition collector and materializer",{pattern:Ut("fragment-scoped pattern paint-server collector")}),markers:Te("marker definition parser and reference materializer"),symbols:Te("symbol definition and instance materializer"),"use-and-linked-references":Te("use resolver and stable reference-edge materializer",{pattern:Ut("fragment-scoped linked-reference resolver")}),"clip-definitions":Te("clip definition parser and materializer",{pattern:pr("Pattern editing omits document clip definitions.")}),"mask-definitions":Te("mask definition parser and materializer",{pattern:pr("Pattern editing omits document mask definitions.")}),"clip-mask-membership":Te("clip and mask membership materializer",{pattern:pr("Pattern editing omits document clip and mask membership.")}),"smil-animation":Te("SMIL parser and animation-track materializer",{pattern:pr("Pattern editing materializes a static tile without SMIL tracks.")}),"css-animation":Te("CSS keyframe parser and animation-track materializer",{pattern:pr("Pattern editing materializes a static tile without CSS animation tracks.")}),metadata:Te("document metadata parser and field policy",{plugin:Kl("Plugin fragments preserve host document metadata."),pattern:ur("Pattern fragments have no document metadata scope."),vectorized:ur("Vectorized fragments have no document metadata scope.")}),scripts:Te("inert script partitioner and document script materializer",{plugin:Xn("inert plugin fragment script data materializer"),pattern:pr("Pattern fragments do not execute or adopt scripts."),vectorized:$S("Vectorized fragments do not execute or adopt scripts.")}),styles:Te("preserved CSS style collector and materializer",{pattern:Ut("fragment-scoped pattern style resolver")}),"custom-properties":Te("CSS custom-property collector and materializer",{pattern:Ut("fragment-scoped pattern variable resolver")}),views:Te("SVG view parser and SceneGraph materializer",{plugin:Kl("Plugin fragments do not alter document navigation views."),pattern:ur("Pattern fragments have no document navigation view scope."),vectorized:ur("Vectorized fragments have no document navigation view scope.")}),"embedded-svg":Te("embedded SVG container parser and materializer",{pattern:CS(yf,"Pattern editing flattens nested SVG content into the local tile frame.")}),fonts:Te("declared font-consent effect and approved loader",{plugin:Kl("Plugin fragments do not start an implicit external font consent flow."),pattern:pr("Pattern fragments do not start an implicit font consent flow."),vectorized:ur("Path-only vectorized fragments do not consume font resources.")}),"external-assets":Te("declared external-asset resolver with proxy policy",{plugin:Kl("Plugin fragments diagnose assets outside the enrolled security policy."),pattern:pr("Pattern fragments diagnose external assets instead of fetching them."),vectorized:ur("Path-only vectorized fragments do not consume external assets.")})};function ES(t,e){return Xl[t][e]}function AS(t=Is,e=Hi,n=Xl){if(t.length===0)throw new Error("Ingest feature roster must not be empty.");if(e.length===0)throw new Error("Ingress intent roster must not be empty.");if(new Set(t).size!==t.length)throw new Error("Ingest feature roster contains duplicate entries.");if(new Set(e).size!==e.length)throw new Error("Ingress intent roster contains duplicate entries.");for(let r of Object.keys(n))if(!t.includes(r))throw new Error(`Unknown ingest feature ${r} has a capability matrix.`);for(let r of t){let i=n[r];if(!i)throw new Error(`Ingest feature ${r} lacks a capability matrix.`);for(let o of e){let s=i[o];if(!s)throw new Error(`Ingest feature ${r} lacks intent ${o}.`);if((s.status==="exempt"?s.reason:s.by).trim().length<12)throw new Error(`Ingest feature ${o} lacks a substantive owner or reason.`);if((s.status==="diagnosed-lossy"||s.status==="diagnosed-unsupported")&&s.reason.trim().length<24)throw new Error(`Ingest feature ${o} lacks a substantive diagnostic reason.`)}for(let o of Object.keys(i))if(!e.includes(o))throw new Error(`Ingest feature ${r} has unknown intent ${o}.`)}}var Yl=1,ws="document-root:0";function NS(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return`fnv1a32:${(e>>>0).toString(16).padStart(8,"0")}`}function MS(t){let e=structuredClone(t),n=r=>{if(!(r===null||typeof r!="object"||Object.isFrozen(r))){for(let i of Object.values(r))n(i);Object.freeze(r)}};return n(e),e}function kR(t){if(t instanceof Map)return t;let e=new Map;for(let n of t)e.set(n.id,n);return e}function RR(t){if(t.kind==="marker")return t.shapes;if(t.kind!=="symbol")return[];if(!t.variants)return t.shapes;let e=[...t.shapes];for(let n of Object.values(t.variants))e.push(...n);return e}function OS(t,e,n,r){let i=kR(n),o=new Set,s=[],a=[],l=d=>{if(typeof d!="string"||!d||o.has(d))return;let p=i.get(d);p&&(p.kind!=="symbol"&&p.kind!=="marker"||(o.add(d),s.push(p)))},c=d=>{a.push(d)},u=d=>{let p=d.state;if(!p)return;l(p.symbolId),l(p.markerStart),l(p.markerMid),l(p.markerEnd);let f=p.children;if(Array.isArray(f))for(let m of f)c(m);let g=p.symbolOverrides;if(g&&typeof g=="object"&&!Array.isArray(g))for(let[m,h]of Object.entries(g))!h||typeof h!="object"||Array.isArray(h)||c({id:m,type:"symbol-override",state:h})};for(let d of t)c(d);for(let d of e)l(d);for(;;){let d=a.shift();if(d){r(d),u(d);continue}let p=s.shift();if(!p)break;for(let f of RR(p))c(f)}}var TR=[],PR=[];function Rs(t,e,n){OS(t,PR,e,n)}function ql(t,e,n){OS(TR,t,e,n)}function DS(t,e){if(!t)return;let n=t,r=n.markerStart;typeof r=="string"&&r&&e(r);let i=n.markerMid;typeof i=="string"&&i&&e(i);let o=n.markerEnd;typeof o=="string"&&o&&e(o);let s=n.startEndpoint;typeof s=="string"&&s&&s!=="none"&&e(ks(s));let a=n.endEndpoint;typeof a=="string"&&a&&a!=="none"&&e(ks(a))}function ks(t){return`line-marker-${t}`}var zS=new Set(["fillLibraryId","strokeLibraryId","markerStart","markerMid","markerEnd","symbolId"]);function _S(t,e,n){if(!t)return;let r=t,i=s=>{typeof s=="string"&&s&&n(s)};i(r.fillLibraryId),i(r.strokeLibraryId),i(r.markerStart),i(r.markerMid),i(r.markerEnd),i(r.symbolId);let o=r.filterLibraryIds;if(Array.isArray(o)&&o.length>0)for(let s of o)i(s);else Array.isArray(r.filters)&&r.filters.length>0&&n(`filter-${e}`);r.fillLibraryId||i(r.fillGradient?.id),r.strokeLibraryId||i(r.strokeGradient?.id)}function ni(t,e=[]){let n=new Set,r=new Set;return Rs(t,e,i=>{let o=i.state;if(!o)return;typeof o.markerStart=="string"&&o.markerStart&&n.add(o.markerStart),typeof o.markerMid=="string"&&o.markerMid&&n.add(o.markerMid),typeof o.markerEnd=="string"&&o.markerEnd&&n.add(o.markerEnd);let s=o.startEndpoint,a=o.endEndpoint;typeof s=="string"&&s&&s!=="none"&&!o.markerStart&&r.add(s),typeof a=="string"&&a&&a!=="none"&&!o.markerEnd&&r.add(a)}),{ids:n,legacyEndpoints:r}}function FS(t,e){let{ids:n,legacyEndpoints:r}=ni(t,e);for(let i of r)n.add(ks(i));return n}var LS=["validate","allocate-identities","document-fields","canonical-nodes","projections","references","commit","external-effects"];function CR(t){let e=t.map((o,s)=>({node:o,index:s})),n=new Set(t.map(o=>o.id)),r=new Set,i=[];for(;e.length>0;){let s=e.filter(({node:a})=>a.parentId===null||!n.has(a.parentId)||r.has(a.parentId)).sort((a,l)=>a.node.sourceOrder-l.node.sourceOrder||a.index-l.index)[0];if(!s)throw new Error("Ingestion node hierarchy contains a parent cycle.");e.splice(e.indexOf(s),1),i.push(s.node),r.add(s.node.id)}return i}var Ts=class extends Error{diagnostics;constructor(e,n,r){super(e,{cause:r}),this.name="IngestApplicationError",this.diagnostics=n}};function $R(t,e){let n=o=>o==="id"||/(?:Id|Ids)$/.test(o)||o==="shapeInsideRef"||zS.has(o),r=(o,s=!1)=>{if(s){let c=e.get(o);if(c)return c}if(o.startsWith("#")){let c=e.get(o.slice(1));if(c)return`#${c}`}let a=o.replace(/url\(\s*(['"]?)#([^'"\s)]+)\1\s*\)/g,(c,u,d)=>{let p=e.get(d);return p?`url(${u}#${p}${u})`:c});if(!a.includes("<"))return a;let l=a;for(let[c,u]of e){let d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p="(?:&quot;|&apos;|&#34;|&#39;|&#x22;|&#x27;)";l=l.replace(new RegExp(`(\\bid\\s*=\\s*["'])${d}(["'])`,"g"),`$1${u}$2`).replace(new RegExp(`(\\b(?:href|xlink:href)\\s*=\\s*["']#)${d}(["'])`,"g"),`$1${u}$2`).replace(new RegExp(`([uU][rR][lL]\\(\\s*(?:${p})?#)${d}((?:${p})?\\s*\\))`,"gu"),`$1${u}$2`)}return l},i=(o,s=!1)=>{if(Array.isArray(o)){for(let a=0;a<o.length;a++){let l=typeof o[a]=="string"?r(o[a],s):void 0;l!==void 0?o[a]=l:i(o[a],s)}return}if(!(o===null||typeof o!="object"))for(let[a,l]of Object.entries(o)){let c=n(a),u=typeof l=="string"?r(l,c):void 0;u!==void 0?o[a]=u:i(l,c)}};for(let o of t.nodes)i(o.serialized),i(o.groupPath,!0);i(t.documentFields),i(t.referenceEdges),i(t.clipMaskGroups)}function fr(t,e){if(e.injectFailureAfterStage===t)throw new Error(`Injected ingestion failure after ${t}.`)}function ER(t){let e=[],n=(i,o)=>{typeof i=="string"&&i.length>0&&e.push([i,o])},r=t.documentFields;for(let i of r.library??[])n(i.id,"library-definition");for(let i of r.paintServerDefs??[])n(i.id,"paint-server-definition");for(let i of r.documentStyles??[])n(i.id,"document-style");for(let i of r.documentScripts??[])n(i.id,"document-script");for(let i of r.animationTimeline?.tracks??[]){n(i.id,"animation-track");for(let o of i.keyframes)n(o.id,"animation-keyframe")}for(let i of t.clipMaskGroups)n(i.id,"clip-mask-group");return e}function BS(t,e,n={}){let r=e.captureRollbackState(),i=structuredClone([...t.diagnostics]),o="validate";try{if(t.planVersion!==1)throw new Error(`Unsupported ingestion plan version ${t.planVersion}.`);if(t.diagnostics.some(d=>d.severity==="error"))throw new Error("Ingestion plan contains an error diagnostic.");if(n.warningPolicy==="reject"&&t.diagnostics.some(d=>d.severity==="warning"))throw new Error("Ingestion warnings were rejected by caller policy.");fr("validate",n),o="allocate-identities";let s=structuredClone(t),a=new Map,l=e.resolvePlanIdentity?.(ws);l&&a.set(ws,l);for(let d of s.nodes){if(a.has(d.planNodeId))throw new Error(`Duplicate plan node id ${d.planNodeId}.`);a.set(d.planNodeId,s.identityMode==="preserve"?d.planNodeId:e.allocateId(d.planNodeId,d.serialized.type))}for(let[d,p]of ER(s))a.has(d)||a.set(d,s.identityMode==="preserve"?d:e.allocateId(d,p));$R(s,a);let c={idMap:a,addDiagnostic:d=>i.push(structuredClone(d))};e.preparePlan?.(s,c),fr("allocate-identities",n),o="document-fields";for(let[d,p]of Object.entries(s.documentFields)){let f=Ps(d,s.intent);f.action==="preserve-host"||f.action==="derived"||f.action==="exempt"||e.applyDocumentField(d,f,structuredClone(p),c)}fr("document-fields",n);let u=CR(s.nodes.map(d=>({planNodeId:d.planNodeId,id:a.get(d.planNodeId),type:d.serialized.type,state:structuredClone(d.serialized.state),parentId:d.parentPlanNodeId?a.get(d.parentPlanNodeId)??null:null,sourceOrder:d.sourceOrder})));o="canonical-nodes";for(let d of u)e.createCanonicalNode(d,c);if(fr("canonical-nodes",n),o="projections",e.hydrateProjection)for(let d of u)e.hydrateProjection(d,c);return fr("projections",n),o="references",e.applyReferences?.(s,c),fr("references",n),o="commit",e.commit?.(c),fr("commit",n),o="external-effects",n.authorizeExternalEffects&&e.executeExternalEffects?.(s,c),fr("external-effects",n),{value:{createdIds:u.map(d=>d.id),idMap:Object.freeze(Object.fromEntries(a))},diagnostics:i}}catch(s){o!=="validate"&&e.restoreRollbackState(r);let a={severity:"error",code:"application-rolled-back",source:t.source.kind,entrypoint:t.intent,message:`Ingestion rolled back after ${o}: ${s instanceof Error?s.message:String(s)}`};throw i.push(a),new Ts(a.message,i,s)}}var jS=require("saxes"),U="http://www.w3.org/2000/svg",Wi=class extends Error{constructor(n,r,i){super(r);this.hostId=n;this.name="SvgXmlParserHostError",this.cause=i}hostId;cause};function bf(t,e){let n=null;for(let r=e;r<t.length;r++){let i=t[r];if(n){i===n&&(n=null);continue}if(i==='"'||i==="'")n=i;else if(i===">")return r+1}return t.length}function If(t){let e=0,n=t.toLowerCase(),r=[];for(;e<t.length;){let s=t.indexOf("<",e);if(s<0)break;if(t.startsWith("<!--",s)){let m=t.indexOf("-->",s+4);if(m<0)break;e=m+3;continue}if(t.startsWith("<![CDATA[",s)){let m=t.indexOf("]]>",s+9);if(m<0)break;e=m+3;continue}if(t.startsWith("<?",s)){let m=t.indexOf("?>",s+2);if(m<0)break;e=m+2;continue}let a=bf(t,s+1),c=/^<\s*([^\s/>]+)/.exec(t.slice(s,a))?.[1]??"";if(c.split(":").at(-1)?.toLowerCase()!=="style"||t.slice(s,a).startsWith("</")){e=a;continue}let d=`</${c.toLowerCase()}`,p=n.indexOf(d,a);if(p<0)break;let f=t.slice(a,p);if(!f.includes("<")||f.includes("<![CDATA[")){e=bf(t,p+2);continue}let g=`<![CDATA[${f.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;r.push({start:a,end:p,value:g}),e=bf(t,p+2)}if(r.length===0)return t;let i="",o=0;for(let s of r)i+=t.slice(o,s.start),i+=s.value,o=s.end;return i+t.slice(o)}var AR=256,NR=64*1024,MR=32*1024*1024,wf=String.raw`[\p{L}_:][\p{L}\p{N}\p{M}_.:\-]*`,OR=new RegExp(`^${wf}$`,"u"),DR="http://www.w3.org/1999/xlink",zR=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,_R=/(?:^|;)\s*([^\s;]+?)\.(?:begin|end|repeat\(\d+\))/gu,FR=new Set(["aria-labelledby","aria-describedby"]),LR=new RegExp(String.raw`<!ENTITY\s+(?!%)(${wf})\s+(?:"([^"]*)"|'([^']*)')\s*>`,"gu"),GS=new RegExp(String.raw`&(#x[0-9A-Fa-f]+|#[0-9]+|${wf});`,"gu"),BR=Object.freeze({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});function GR(t){let e=t.startsWith("#x")?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return e===9||e===10||e===13||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111?String.fromCodePoint(e):null}function VR(t,e,n){let r=new Map;for(let a of e.matchAll(LR)){if(r.size>=AR)return;r.set(a[1],a[2]??a[3]??"")}let i=new Map,o=(a,l)=>{let c=BR[a];if(c!==void 0)return c;let u=i.get(a);if(u!==void 0)return u;let d=r.get(a);if(d===void 0||l.has(a))return null;let p=new Set(l);p.add(a);let f=!0,g=d.replace(GS,(m,h)=>{let b=h.startsWith("#")?GR(h):o(h,p);return b===null?(f=!1,""):b});return!f||g.length>NR?null:(i.set(a,g),g)};for(let a of r.keys())o(a,new Set);let s=0;for(let a of n.matchAll(GS)){let l=i.get(a[1]);if(l!==void 0&&(s+=l.length,s>MR))return}for(let[a,l]of i)t.ENTITIES[a]=l}function US(t){return t&&t.length>0?t:null}function jR(t,e){return{name:t.name,localName:t.local,prefix:t.prefix.length>0?t.prefix:null,namespaceUri:US(t.uri),value:t.value,span:e}}var kf={id:"saxes",parse(t){let e=[],n=[],r=[],i=0,o=[],s=0,a=0,l=new jS.SaxesParser({xmlns:!0,position:!0}),c=d=>{let p=n.at(-1);p?p.children.push(d):e.push(d)};l.on("error",d=>{r.push(d.message)}),l.on("opentagstart",()=>{i=t.lastIndexOf("<",Math.max(0,l.position-1)),o=[],s=l.position;let d=n.at(-1);d?d.contentOffset=i:a=i}),l.on("attribute",d=>{let p=t.indexOf(d.name,s),f=p>=0&&p<l.position?p:s;o.push({start:f,end:l.position}),s=l.position}),l.on("opentag",d=>{let p=Object.values(d.attributes).map((g,m)=>jR(g,o[m]??{start:i,end:l.position})),f={kind:"element",name:d.name,localName:d.local,prefix:d.prefix.length>0?d.prefix:null,namespaceUri:US(d.uri),attributes:p,children:[],span:{start:i,end:l.position},startOffset:i,contentOffset:l.position};c(f),n.push(f)}),l.on("closetag",()=>{let d=n.pop();if(!d)return;d.rawXml=t.slice(d.startOffset,l.position),d.span.end=l.position;let p=n.at(-1);p?p.contentOffset=l.position:a=l.position});let u=(d,p,f,g)=>{c({kind:d,value:p,span:{start:f,end:g}});let m=n.at(-1);m?m.contentOffset=g:a=g};l.on("text",d=>{let p=n.at(-1)?.contentOffset??a,f=t.lastIndexOf("<",Math.max(0,l.position-1)),g=f>=p?f:l.position;u("text",d,p,g)}),l.on("comment",d=>{let p=t.lastIndexOf("<!--",l.position),f=t.indexOf("-->",Math.max(0,p));u("comment",d,Math.max(0,p),f>=0?f+3:l.position)}),l.on("cdata",d=>{let p=t.lastIndexOf("<![CDATA[",l.position),f=t.indexOf("]]>",Math.max(0,p));u("cdata",d,Math.max(0,p),f>=0?f+3:l.position)}),l.on("processinginstruction",({target:d,body:p})=>{let f=t.lastIndexOf("<?",l.position),g=t.indexOf("?>",Math.max(0,f));u("processing-instruction",p.length>0?`${d} ${p}`:d,Math.max(0,f),g>=0?g+2:l.position)}),l.on("doctype",d=>{VR(l,d,t);let p=t.lastIndexOf("<!DOCTYPE",l.position),f=t.indexOf(">",Math.max(0,p));u("doctype",d,Math.max(0,p),f>=0?f+1:l.position)});try{l.write(t).close()}catch(d){r.push(d instanceof Error?d.message:String(d))}return r.length>0?{error:r[0]}:{nodes:e}}};function VS(t,e,n){return{severity:"error",code:e,source:t.source,entrypoint:t.entrypoint,message:n,documentPath:"/",elementName:"svg"}}function vf(t,e,n,r){return{severity:"warning",code:e,source:t.source,entrypoint:t.entrypoint,message:n,capability:"source-envelope",...r}}function xf(t,e,n){return t.attributes.find(r=>r.localName===e&&r.namespaceUri===n)??null}function Pe(t){let e=xf(t,"href",null);if(e)return{value:e.value,namespace:"svg2"};let n=xf(t,"href",DR);return n?{value:n.value,namespace:"xlink"}:null}function UR(t){let e=[...t.children].reverse(),n="";for(;e.length>0;){let r=e.pop();r.kind==="text"||r.kind==="cdata"?n+=r.value:r.kind==="element"&&e.push(...[...r.children].reverse())}return n}function HR(t,e){let n=e.filter(m=>m.kind==="element"),r=new Map(n.map(m=>[m.sourceNodeId,m])),i=new Map,o=new Map,s=new Map,a=(m,h)=>{s.set(m.sourceNodeId,h);let b=m.children.filter(v=>v.kind==="element");o.set(m.sourceNodeId,Object.freeze(b));let S=new Map;for(let v of b){i.set(v.sourceNodeId,m);let I=(S.get(v.name)??0)+1;S.set(v.name,I),a(v,`${h}/${v.name}[${I}]`)}};a(t,`/${t.name}[1]`);let l=new Map,c=[];for(let m of n){let h=xf(m,"id",null)?.value;if(h===void 0)continue;let b=l.get(h)??[],S=Object.freeze({authoredId:h,sourceNodeId:m.sourceNodeId,elementOrder:m.elementOrder,occurrenceIndex:b.length,primary:b.length===0,validXmlId:h.length>0&&!/\s/u.test(h)&&OR.test(h)});b.push(S),l.set(h,b),c.push(S)}let u=[],d=new Map,p=(m,h,b,S,v)=>{let I=l.get(S)??[],x=Object.freeze({sourceReferenceId:`reference:${u.length}`,fromSourceNodeId:m.sourceNodeId,channel:h,...v!==void 0?{attributeName:v}:{},authoredValue:b,targetAuthoredId:S,targetSourceNodeId:I[0]?.sourceNodeId??null,resolution:I.length===0?"missing":I.length===1?"resolved":"ambiguous-first"});u.push(x);let P=d.get(m.sourceNodeId)??[];P.push(x),d.set(m.sourceNodeId,P)},f=(m,h,b,S)=>{for(let v of b.matchAll(zR))p(m,h,b,v[2],S)};for(let m of n){let h=Pe(m);h?.value.startsWith("#")&&h.value.length>1&&p(m,h.namespace==="svg2"?"href":"xlink-href",h.value,h.value.slice(1),h.namespace==="svg2"?"href":"xlink:href"),m.localName.toLowerCase()==="style"&&f(m,"stylesheet-url",UR(m));for(let b of m.attributes)if(b.namespaceUri===null){if(b.localName==="style"?f(m,"inline-style-url",b.value,b.name):b.value.includes("url(")&&f(m,"presentation-url",b.value,b.name),b.localName==="begin"||b.localName==="end")for(let S of b.value.matchAll(_R))p(m,"smil-syncbase",b.value,S[1],b.name);if(FR.has(b.localName))for(let S of b.value.trim().split(/\s+/u).filter(Boolean))p(m,"idref-list",b.value,S,b.name)}}for(let m of l.values())Object.freeze(m);for(let m of d.values())Object.freeze(m);return Object.freeze(n),Object.freeze(c),Object.freeze(u),Object.freeze({elements:n,idOccurrences:c,localReferences:u,element(m){return r.get(m)??null},parent(m){return i.get(m)??null},children(m){return o.get(m)??Object.freeze([])},sourcePath(m){return s.get(m)??"/"},occurrences(m){return l.get(m)??Object.freeze([])},resolveAuthoredId(m){return l.get(m)?.[0]??null},referencesFrom(m){return d.get(m)??Object.freeze([])}})}function WR(t){let e=n=>{if(!(n===null||typeof n!="object"||Object.isFrozen(n))){for(let r of Object.values(n))e(r);Object.freeze(n)}};return e(t),t}function mn(t,e,n=kf){let r=If(t),i;try{i=n.parse(r)}catch(b){throw new Wi(n.id,`SVG XML parser host ${n.id} failed.`,b)}if(i===null||typeof i!="object"||!("error"in i)&&!("nodes"in i))throw new Wi(n.id,`SVG XML parser host ${n.id} returned no result.`);if("error"in i)return{value:null,diagnostics:[VS(e,"malformed-source",`SVG XML parsing failed: ${i.error}`)]};let o=i.nodes.find(b=>b.kind==="element"),s=o?.namespaceUri===U||o?.namespaceUri===null;if(!o||o.localName!=="svg"||!s)return{value:null,diagnostics:[VS(e,"missing-svg-root","The XML document element is not an SVG root in the SVG namespace.")]};let a=[],l=0,c=0,u=b=>{let S=l++,v=`source:${S}`;if(b.kind!=="element"){let T={kind:b.kind,sourceNodeId:v,sourceOrder:S,documentOrder:S,value:b.value,span:b.span};return a.push(T),T}let I=c++,x=[],P={kind:"element",sourceNodeId:v,sourceOrder:S,documentOrder:S,elementOrder:I,name:b.name,localName:b.localName,prefix:b.prefix,namespaceUri:b.namespaceUri,attributes:b.attributes.map(T=>({...T})),children:x,span:b.span,...b.rawXml!==void 0?{rawXml:b.rawXml}:{}};return a.push(P),x.push(...b.children.map(u)),P},d=null,p=i.nodes.map(b=>{let S=u(b);return b===o&&(d=S),S});if(!d)throw new Error("The validated SVG document element was not projected.");let f=HR(d,a),g=new Map;for(let b of f.idOccurrences){let S=g.get(b.authoredId)??[];S.push(b.sourceNodeId),g.set(b.authoredId,S)}let m=Object.freeze(Object.fromEntries([...g].map(([b,S])=>[b,Object.freeze(S)]))),h=[];o.namespaceUri===null&&h.push(vf(e,"missing-svg-namespace","The namespace-less SVG root was accepted as compatibility input; authored SVG should declare the SVG namespace.",{documentPath:"/svg[1]",elementName:"svg"}));for(let[b,S]of g){let v=f.occurrences(b);if(v.length>1&&h.push(vf(e,"duplicate-svg-id",`SVG id ${JSON.stringify(b)} occurs ${S.length} times; references resolve to the first element-order occurrence.`,{documentPath:v.map(I=>f.sourcePath(I.sourceNodeId)).join(", "),elementName:f.element(v[0].sourceNodeId)?.name??"svg",sourceId:b})),v.some(I=>!I.validXmlId)){let I=v.find(x=>!x.validXmlId);h.push(vf(e,"invalid-svg-attribute",`SVG id ${JSON.stringify(b)} is not a non-empty XML Name without whitespace; it remains available for exact first-element reference processing.`,{documentPath:f.sourcePath(I.sourceNodeId),elementName:f.element(I.sourceNodeId)?.name??"svg",sourceId:b}))}}return{value:WR({root:d,documentNodes:p,nodes:a,idIndex:m,index:f,rawSource:t,parserSource:r}),diagnostics:h}}function E(t,e){return t.attributes.find(n=>n.namespaceUri===null&&n.localName===e)?.value??null}function ot(t,e){return t.attributes.some(n=>n.namespaceUri===null&&n.localName===e)}var Zl="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",KR=new RegExp(`^\\s*(${Zl})(?:\\s*,\\s*|\\s+)(${Zl})(?:\\s*,\\s*|\\s+)(${Zl})(?:\\s*,\\s*|\\s+)(${Zl})\\s*$`);function Ue(t){let e=KR.exec(t);if(!e)return null;let[n,r,i,o]=e.slice(1).map(Number);return[n,r,i,o].every(Number.isFinite)?{x:n,y:r,width:i,height:o}:null}function XR(t){return t==="none"||/^x(Min|Mid|Max)Y(Min|Mid|Max)$/.test(t)}function Ki(t){if(t==null)return{align:"xMidYMid",meetOrSlice:"meet"};let e=t.trim().split(/\s+/).filter(Boolean);return e.length<1||e.length>2||!XR(e[0])||e.length===2&&e[1]!=="meet"&&e[1]!=="slice"?{align:"xMidYMid",meetOrSlice:"meet"}:{align:e[0],meetOrSlice:e[1]==="slice"?"slice":"meet"}}function Rf(t,e){return t==="none"?0:e==="x"?t.includes("xMax")?1:t.includes("xMid")?.5:0:t.includes("YMax")?1:t.includes("YMid")?.5:0}function HS(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function WS(t,e,n,r){return t==null?e??null:!Number.isFinite(t)||t<0?(r.push({code:"invalid-viewport-length",message:`Nested SVG ${n} ${String(t)} is invalid and falls back to auto (100%).`}),e??null):t}function Cs(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==void 0}function YR(t){let e=["viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight"],n=e.filter(i=>Cs(t,i));return n.length===0?"absent":n.length!==e.length||!e.map(i=>t[i]).every(i=>typeof i=="number"&&Number.isFinite(i))?"partial":t.viewBoxWidth<0||t.viewBoxHeight<0?"negative-invalid":t.viewBoxWidth===0||t.viewBoxHeight===0?"zero-disabled":"valid"}function qR(t,e,n){let{align:r,meetOrSlice:i}=Ki(n),o=t.width/e.viewBoxWidth,s=t.height/e.viewBoxHeight,a=t.x-e.viewBoxX*o,l=t.y-e.viewBoxY*s;if(r!=="none"){let c=i==="slice"?Math.max(o,s):Math.min(o,s),u=e.viewBoxWidth*c,d=e.viewBoxHeight*c;o=c,s=c,a=t.x+(t.width-u)*Rf(r,"x")-e.viewBoxX*c,l=t.y+(t.height-d)*Rf(r,"y")-e.viewBoxY*c}return rt(o,0,0,s,a,l)}function ri(t,e){let n=[],r=HS(t.x,0),i=HS(t.y,0),o=WS(t.width,e?.width,"width",n),s=WS(t.height,e?.height,"height",n),a=o===null||s===null?null:{x:r,y:i,width:o,height:s},l=YR(t);if((o===0||s===0)&&(l="zero-disabled"),l==="zero-disabled")return{status:l,renders:!1,frame:a,contentMatrix:null,childPercentBasis:null,diagnostics:n};if(l==="partial"?n.push({code:"invalid-viewbox",message:"Nested SVG viewBox is partial or non-finite and is ignored."}):l==="negative-invalid"&&n.push({code:"invalid-viewbox",message:"Nested SVG viewBox has a negative dimension and is ignored."}),l!=="valid")return{status:l,renders:!0,frame:a,contentMatrix:rt(1,0,0,1,r,i),childPercentBasis:a?{width:a.width,height:a.height}:null,diagnostics:n};if(!a)return n.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:n};let c={viewBoxX:t.viewBoxX,viewBoxY:t.viewBoxY,viewBoxWidth:t.viewBoxWidth,viewBoxHeight:t.viewBoxHeight};return{status:l,renders:!0,frame:a,contentMatrix:qR(a,c,t.preserveAspectRatio),childPercentBasis:{width:c.viewBoxWidth,height:c.viewBoxHeight},diagnostics:n}}function ZR(t,e){let n=Cs(t,"viewBoxWidth")&&Cs(t,"viewBoxHeight")&&!Cs(t,"viewBoxX")&&!Cs(t,"viewBoxY")?{...t,viewBoxX:0,viewBoxY:0}:t,r=ri(n,e).contentMatrix;return r&&r.every((i,o)=>i===[1,0,0,1,0,0][o])?null:r}var JR=new Set(["animate","animatetransform","animatemotion","set"]),QR="http://www.w3.org/1999/xlink";function KS(t,e){let n=E(t,"style");if(n){let r=n.replace(/\/\*[\s\S]*?\*\//g,""),i=new RegExp(`(?:^|;)\\s*${e}\\s*:\\s*([^;]*)`,"gi"),o=null,s;for(;(s=i.exec(r))!==null;)o=s[1];if(o!==null){let a=o.replace(/\s*!\s*important\s*$/i,"").trim(),l=nt(a);if(l&&l.value>=0&&(l.unit!==""||l.value===0))return a}}return E(t,e)}function eT(t,e){return{severity:"warning",code:"invalid-svg-attribute",source:t.source,entrypoint:t.entrypoint,message:e,documentPath:"/svg[1]/@viewBox",elementName:"svg",capability:"root-viewport-frame"}}function XS(t){for(let e of t.children)if(e.kind==="element"&&(e.localName.toLowerCase()==="view"||XS(e)))return!0;return!1}function tT(t,e){let n=t.attributes.find(i=>i.localName==="href"&&(i.namespaceUri===null||i.namespaceUri===QR))?.value;if(n===void 0)return!0;let r=E(e,"id");return r!==null&&n===`#${r}`}function Jl(t,e){let n=[],r=Mt(KS(t,"width")),i=Mt(KS(t,"height")),o=r!==void 0&&r>=0?r:void 0,s=i!==void 0&&i>=0?i:void 0,a=E(t,"preserveAspectRatio"),l=a&&a.trim().length>0?a.trim():void 0,c=ot(t,"viewBox"),u=E(t,"viewBox"),d=u!==null?Ue(u):null,p=d!==null&&d.width>=0&&d.height>=0?d:null;c&&!p&&n.push(eT(e,`Root SVG viewBox ${JSON.stringify(u)} is invalid per SVG 2 section 8.6 and was ignored.`));let f=t.children.some(v=>v.kind==="element"&&JR.has(v.localName.toLowerCase())&&tT(v,t)),g=p!==null||f||XS(t);if(p)return{value:{viewBoxX:p.x,viewBoxY:p.y,viewBoxWidth:p.width,viewBoxHeight:p.height,...o!==void 0?{width:o}:{},...s!==void 0?{height:s}:{},...l!==void 0?{preserveAspectRatio:l}:{},sizingMode:"explicit",targetedPasteWrapper:g},diagnostics:n};let m=o!==void 0,h=s!==void 0,b=m?o:300,S=h?s:150;return{value:{viewBoxX:0,viewBoxY:0,viewBoxWidth:b,viewBoxHeight:S,...m||h?{width:b,height:S}:{},...l!==void 0?{preserveAspectRatio:l}:{},sizingMode:m||h?"sized":"implicit",targetedPasteWrapper:g},diagnostics:n}}function nT(t){return t.localName.toLowerCase()==="view"&&(t.namespaceUri===U||t.namespaceUri===null)}function rT(t,e,n,r){let i=E(e,"id");return{severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,message:`SVG viewBox ${JSON.stringify(r)} is invalid per SVG 2 section 8.6 and the view was ignored.`,documentPath:`${t.index.sourcePath(e.sourceNodeId)}/@viewBox`,elementName:"view",...i?{sourceId:i}:{},sourceNodeId:e.sourceNodeId,capability:"views"}}function iT(t){return Object.freeze(t.state),Object.freeze(t)}function Ql(t,e){let n=[],r=[];for(let i of t.index.elements){if(!nT(i))continue;let o=E(i,"viewBox");if(o===null||o.trim().length===0)continue;let s=Ue(o);if(!s||s.width<0||s.height<0){r.push(rT(t,i,e,o));continue}let a={viewName:E(i,"id")??"",viewBoxX:s.x,viewBoxY:s.y,viewBoxWidth:s.width,viewBoxHeight:s.height},l=E(i,"preserveAspectRatio");l&&(a.viewPreserveAspectRatio=l);let c=E(i,"zoomAndPan");(c==="disable"||c==="magnify")&&(a.viewZoomAndPan=c);let u=E(i,"viewTarget");u&&(a.viewTarget=u),n.push(iT({sourceNodeId:i.sourceNodeId,elementOrder:i.elementOrder,parentSourceNodeId:t.index.parent(i.sourceNodeId)?.sourceNodeId??null,state:a}))}return{value:Object.freeze(n),diagnostics:Object.freeze(r.map(i=>Object.freeze(i)))}}function qS(t){return t.localName.toLowerCase()==="svg"&&(t.namespaceUri===U||t.namespaceUri===null)}function ZS(t,e){let n=E(t,"style");if(!n)return null;let r=null;for(let i of Yr(n,";")){let[o,...s]=Yr(i,":");if(o?.trim().toLowerCase()!==e.toLowerCase())continue;let a=s.join(":").trim(),l=/\s*!\s*important\s*$/iu.test(a),c=a.replace(/\s*!\s*important\s*$/iu,"").trim();(!r||l||!r.important)&&(r={value:c,important:l})}return r}function oT(t,e){let n=ZS(t,e);if(n){if(n.value.toLowerCase()==="auto")return{kind:"auto"};let r=nt(n.value);if(r&&r.value>=0)return{kind:"value",value:n.value}}return ot(t,e)?{kind:"value",value:E(t,e)??""}:{kind:"absent"}}function sT(t,e){let n=t.index.parent(e.sourceNodeId);for(;n;){let r=Mt(ZS(n,"font-size")?.value??null);if(r!==void 0)return r;let i=Mt(E(n,"font-size"));if(i!==void 0)return i;n=t.index.parent(n.sourceNodeId)}return 16}function JS(t,e,n,r,i){let o=E(e,"id");return{severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,message:`Embedded SVG ${r} ${JSON.stringify(i)} is invalid and was ignored.`,documentPath:`${t.index.sourcePath(e.sourceNodeId)}/@${r}`,elementName:"svg",...o?{sourceId:o}:{},sourceNodeId:e.sourceNodeId,capability:"embedded-svg"}}function YS(t){let e=t.root,n=E(e,"viewBox"),r=n===null?null:Ue(n);if(r&&r.width>=0&&r.height>=0)return{width:r.width,height:r.height};let i=a=>{let l=oT(e,a);return l.kind==="value"?Mt(l.value):void 0},o=i("width"),s=i("height");return{width:o!==void 0&&o>=0?o:300,height:s!==void 0&&s>=0?s:150}}function aT(t,e){let n=t.index.parent(e.sourceNodeId);for(;n;){if(qS(n))return n;n=t.index.parent(n.sourceNodeId)}return null}function ec(t,e,n,r,i,o){if(!ot(e,n))return;let s=E(e,n)??"",a={percentBasis:n==="x"||n==="width"?r.width:r.height,viewportWidth:r.width,viewportHeight:r.height,fontSize:sT(t,e),rootFontSize:16},l=he(s,a),c=(n==="width"||n==="height")&&(l??0)<0;if(l===void 0||c){o.push(JS(t,e,i,n,s));return}return l}function tc(t,e){let n=[],r=[],i=new Map([[t.root.sourceNodeId,YS(t)]]);for(let o of t.index.elements){if(!qS(o)||o.sourceNodeId===t.root.sourceNodeId)continue;let s=aT(t,o),a=(s&&i.get(s.sourceNodeId))??YS(t),l={},c=ec(t,o,"x",a,e,r),u=ec(t,o,"y",a,e,r),d=ec(t,o,"width",a,e,r),p=ec(t,o,"height",a,e,r);c!==void 0&&(l.svgX=c),u!==void 0&&(l.svgY=u),d!==void 0&&(l.svgWidth=d),p!==void 0&&(l.svgHeight=p);let f=E(o,"viewBox"),g=f===null?null:Ue(f),m=g&&g.width>=0&&g.height>=0?g:null;f!==null&&!m&&r.push(JS(t,o,e,"viewBox",f)),m&&(l.svgViewBoxX=m.x,l.svgViewBoxY=m.y,l.svgViewBoxWidth=m.width,l.svgViewBoxHeight=m.height),ot(o,"preserveAspectRatio")&&(l.svgPreserveAspectRatio=E(o,"preserveAspectRatio")??"");let h=d??a.width,b=p??a.height;i.set(o.sourceNodeId,{width:m?.width??h,height:m?.height??b}),Object.freeze(l),n.push(Object.freeze({sourceNodeId:o.sourceNodeId,elementOrder:o.elementOrder,parentSourceNodeId:t.index.parent(o.sourceNodeId)?.sourceNodeId??null,state:l}))}return{value:Object.freeze(n),diagnostics:Object.freeze(r.map(o=>Object.freeze(o)))}}function lT(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++){let i=t[r]-e[r];if(i!==0)return i}return t.length-e.length}function Tf(t,e){return lT(t.orderKey,e.orderKey)||t.productIndex-e.productIndex||t.occurrenceId.localeCompare(e.occurrenceId)}function cT(t,e,n){if(n.namespaceUri!==U||e.role==="definition")return null;let r=n.localName.toLowerCase();return r==="g"?"group":r==="a"?"hyperlink":r==="switch"?"switch":r!=="svg"||e.usePath.length===0&&n.sourceNodeId===t.root.sourceNodeId?null:"embedded-svg"}function QS(t,e,n,r,i,o){return Object.freeze({severity:"warning",code:i,source:r.source,entrypoint:r.entrypoint,capability:i==="empty-hyperlink-dropped"?"containers":"hierarchy",sourceId:E(n,"id")??void 0,sourceNodeId:n.sourceNodeId,occurrenceId:e.occurrenceId,elementName:n.name,documentPath:t.index.sourcePath(n.sourceNodeId),message:o})}function nc(t,e,n){let r=new Map(e.occurrences.map(h=>[h.occurrenceId,h])),i=new Map,o=new Map;for(let h of e.occurrences){let b=t.index.element(h.correspondingSourceNodeId);if(!b)throw new Error(`SVG occurrence ${h.occurrenceId} has no source element.`);i.set(h.occurrenceId,b);let S=cT(t,h,b);S&&o.set(h.occurrenceId,S)}let s=[],a=new Set;for(let h of n.materializedOccurrenceIds){if(a.has(h))continue;a.add(h);let b=r.get(h);if(!b)throw new Error(`Unknown materialized SVG occurrence ${h}.`);if(b.role==="definition")throw new Error(`Definition occurrence ${h} cannot be materialized in the scene.`);s.push(b)}s.sort(Tf);for(let h of s){let b=h.parentOccurrenceId,S=new Set;for(;b;){if(S.has(b))throw new Error(`SVG occurrence ancestry contains a cycle at ${b}.`);S.add(b);let v=r.get(b);if(!v)throw new Error(`SVG occurrence ${h.occurrenceId} has unknown parent ${b}.`);v.role==="use-carrier"&&o.set(b,"group"),b=v.parentOccurrenceId}}let l=new Set;for(let h of s){let b=h.parentOccurrenceId,S=new Set;for(;b;){if(S.has(b))throw new Error(`SVG occurrence ancestry contains a cycle at ${b}.`);S.add(b);let v=r.get(b);if(!v)throw new Error(`SVG occurrence ${h.occurrenceId} has unknown parent ${b}.`);o.has(b)&&l.add(b),b=v.parentOccurrenceId}}let c=[],u=new Set,d=[...l].map(h=>r.get(h)).sort(Tf),p=h=>{let b=h.parentOccurrenceId,S=new Set;for(;b;){if(S.has(b))return!1;S.add(b);let v=r.get(b);if(!v)return!1;if(o.get(b)==="hyperlink")return!0;b=v.parentOccurrenceId}return!1};for(let h of d){if(o.get(h.occurrenceId)==="hyperlink"&&p(h)){let S=i.get(h.occurrenceId);c.push(QS(t,h,S,n,"nested-hyperlink-flattened","Nested SVG hyperlinks are invalid; the inner hyperlink was flattened."));continue}u.add(h.occurrenceId)}for(let h of e.occurrences){if(o.get(h.occurrenceId)!=="hyperlink"||l.has(h.occurrenceId)||p(h))continue;let b=i.get(h.occurrenceId);c.push(QS(t,h,b,n,"empty-hyperlink-dropped","The SVG hyperlink has no materializable content and was dropped."))}let f=h=>{let b=h.parentOccurrenceId,S=new Set;for(;b;){if(S.has(b))throw new Error(`SVG occurrence ancestry contains a cycle at ${b}.`);if(S.add(b),u.has(b))return b;let v=r.get(b);if(!v)throw new Error(`SVG occurrence ${h.occurrenceId} has unknown parent ${b}.`);b=v.parentOccurrenceId}return null},g=d.filter(h=>u.has(h.occurrenceId)).map(h=>Object.freeze({occurrenceId:h.occurrenceId,sourceNodeId:h.correspondingSourceNodeId,kind:o.get(h.occurrenceId),parentContainerOccurrenceId:f(h),orderKey:Object.freeze([...h.orderKey])})),m=s.map(h=>Object.freeze({occurrenceId:h.occurrenceId,sourceNodeId:h.correspondingSourceNodeId,parentContainerOccurrenceId:f(h),orderKey:Object.freeze([...h.orderKey])}));return c.sort((h,b)=>{let S=h.occurrenceId?r.get(h.occurrenceId):void 0,v=b.occurrenceId?r.get(b.occurrenceId):void 0;return!S||!v?0:Tf(S,v)}),Object.freeze({value:Object.freeze({containers:Object.freeze(g),placements:Object.freeze(m)}),diagnostics:Object.freeze(c)})}var Cf="http://www.w3.org/1999/xhtml",$f="http://www.w3.org/1998/Math/MathML",tb=Object.freeze([Cf,$f]),rc=Object.freeze(["systemLanguage","requiredExtensions","requiredFeatures"]),dT=/[\t\n\f\r ]+/,uT=/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g;function Pf(t,e){return E(t,e)}function pT(t){if(t.namespaceUri!==U)return null;let e=Pf(t,"systemLanguage"),n=Pf(t,"requiredExtensions"),r=Pf(t,"requiredFeatures");return e===null&&n===null&&r===null?null:Object.freeze({sourceNodeId:t.sourceNodeId,elementName:t.localName,systemLanguage:e,requiredExtensions:n,requiredFeatures:r})}function fT(t,e,n){return Object.freeze({severity:"warning",code:"required-features-dropped",source:n.source,entrypoint:n.entrypoint,capability:"conditional-processing",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:"Dropped requiredFeatures because SVG 2 removed the feature test."})}function ic(t,e){let n=[],r=[];for(let a of t.index.elements){let l=pT(a);l&&(n.push(l),l.requiredFeatures!==null&&r.push(fT(t,a,e)))}let i=Object.freeze(n),o=new Map(i.map(a=>[a.sourceNodeId,a])),s=Object.freeze({candidates:i,condition:a=>o.get(a)??null});return Object.freeze({value:s,diagnostics:Object.freeze(r)})}function eb(t){let e=t.replace(uT,"");if(e.length===0)return null;try{return new Intl.Locale(e).toString().toLowerCase()}catch{return null}}function nb(t,e){if(t.requiredExtensions!==null){let i=t.requiredExtensions.split(dT).filter(Boolean);if(i.length===0||!i.every(o=>e.supportedExtensions.has(o)))return!1}if(t.systemLanguage===null)return!0;let n=t.systemLanguage.split(",").map(eb).filter(i=>i!==null);return n.length===0?!1:e.preferredLanguages.map(eb).filter(i=>i!==null).some(i=>n.some(o=>o===i||o.startsWith(`${i}-`)))}var mT=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol","view"]),gT=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol"]),hT=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu;function rb(t){let e=t.trim();return/^-?[_A-Za-z][\w:.-]*$/u.test(e)?e:e.replace(/[^\w:.-]+/gu,"_").replace(/^[^_A-Za-z]+/u,"")||"svg-resource"}function yT(t,e){let n=1;for(;e.has(`${t}-${n}`);)n++;let r=`${t}-${n}`;return e.add(r),r}function ib(t,e,n){let r=t.trim(),i=r.length>0?rb(r):rb(e);return t===i&&!n.has(i)||!n.has(i)?(n.add(i),i):yT(i,n)}function ob(t,e){return t.replace(hT,(n,r,i)=>{let o=e.get(i);return!o||o===i?n:`url(${r}#${o}${r})`})}function ST(t){let e=[...t.children].reverse(),n="";for(;e.length>0;){let r=e.pop();r.kind==="text"||r.kind==="cdata"?n+=r.value:r.kind==="element"&&e.push(...[...r.children].reverse())}return n}function bT(t,e){switch(t.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 e?"hrefTarget":"other"}}function vT(t){for(let e of t.resourceIds)Object.freeze(e);for(let e of t.generatedIds)Object.freeze(e);for(let e of t.rewrites)Object.freeze(e);return Object.freeze(t.elementOrder),Object.freeze(t.resourceIds),Object.freeze(t.generatedIds),Object.freeze(t.sourceIdToLiveId),Object.freeze(t.rewrites),Object.freeze(t)}function oc(t,e={}){let n=t.index.elements,r=g=>{let m=t.index.parent(g.sourceNodeId);for(;m;){if(m.localName.toLowerCase()==="defs")return!0;m=t.index.parent(m.sourceNodeId)}return!1},i=new Set;for(let g of n)E(g,"id")!==null&&(mT.has(g.localName.toLowerCase())||r(g))&&i.add(g.sourceNodeId);for(let g of t.index.localReferences)g.channel!=="href"&&g.channel!=="xlink-href"||g.targetSourceNodeId&&i.add(g.targetSourceNodeId);let o=new Set(e.claimedIds??[]),s=[],a=new Map;for(let g of n){if(!i.has(g.sourceNodeId))continue;let m=E(g,"id");if(m===null)continue;let h=bT(g,r(g)),b=ib(m,h,o);a.has(m)||a.set(m,b),s.push({sourceNodeId:g.sourceNodeId,authoredId:m,sourceId:m.length>0?m:b,liveId:b,kind:h,restoreSourceId:b!==m&&gT.has(g.localName.toLowerCase())})}let l=new Set(s.map(g=>g.sourceNodeId));for(let g of n){if(l.has(g.sourceNodeId))continue;let m=E(g,"id");m!==null&&m!==""&&o.add(m)}let c=[],u=new Set,d=0;for(let g of n){if(g.namespaceUri!=="http://www.w3.org/2000/svg")continue;let m=g.localName.toLowerCase();if(!["animate","animatemotion","animatetransform","discard","set"].includes(m)||Pe(g))continue;let h=t.index.parent(g.sourceNodeId);if(!h||u.has(h.sourceNodeId))continue;let b=h,S=!1;for(;b;){if(b.namespaceUri==="http://www.w3.org/2000/svg"&&["clippath","mask"].includes(b.localName.toLowerCase())){S=!0;break}b=t.index.parent(b.sourceNodeId)}if(!S||E(h,"id"))continue;let I=`svgsketch-smil-target-${d++}`,x=ib(I,"other",o);u.add(h.sourceNodeId),c.push({sourceNodeId:h.sourceNodeId,liveId:x,reason:"clip-mask-animation-target"})}let p=[];for(let g of n){if(g.localName.toLowerCase()==="style"){let h=ST(g),b=ob(h,a);b!==h&&p.push({sourceNodeId:g.sourceNodeId,target:"text-content",value:b})}let m=Pe(g);for(let h of g.attributes){if(h.localName==="id"&&h.namespaceUri===null||h.name==="data-source-id")continue;let b=h.value;if((m?.namespace==="svg2"?h.localName==="href"&&h.namespaceUri===null:m?.namespace==="xlink"?h.localName==="href"&&h.namespaceUri!==null:!1)&&b.startsWith("#")){let v=a.get(b.slice(1));v&&v!==b.slice(1)&&(b=`#${v}`)}else h.namespaceUri===null&&b.includes("url(")&&(b=ob(b,a));b!==h.value&&p.push({sourceNodeId:g.sourceNodeId,target:"attribute",name:h.name,value:b})}}let f=Object.fromEntries(a);return vT({elementOrder:n.map(g=>g.sourceNodeId),resourceIds:s,generatedIds:c,sourceIdToLiveId:f,rewrites:p,liveIdForSourceId(g){return a.get(g)}})}var Ce=t=>({authority:"core",by:t}),Ef={geometry:Ce("ingest/svg-leaf-geometry.ts"),containers:Ce("ingest/svg-container-hierarchy.ts"),"source-order":Ce("ingest/svg-source.ts and ingest/svg-use-occurrences.ts"),hierarchy:Ce("ingest/svg-container-hierarchy.ts"),"root-viewport-frame":Ce("ingest/root-frame.ts"),"common-presentation":Ce("ingest/svg-style-cascade.ts and svg-property-semantics.ts"),"conditional-processing":Ce("ingest/svg-conditional-processing.ts"),"authored-attributes":Ce("ingest/svg-authored-attributes.ts"),gradients:Ce("ingest/svg-gradients.ts"),patterns:Ce("ingest/svg-patterns.ts"),filters:Ce("ingest/svg-filters.ts"),"paint-server-definitions":Ce("ingest/svg-paint-server-definitions.ts"),markers:Ce("ingest/svg-markers.ts"),symbols:Ce("ingest/svg-symbol-uses.ts"),"use-and-linked-references":Ce("ingest/svg-use-occurrences.ts and ingest/svg-symbol-uses.ts"),"clip-definitions":Ce("ingest/svg-clip-masks.ts"),"mask-definitions":Ce("ingest/svg-clip-masks.ts"),"clip-mask-membership":Ce("ingest/svg-clip-masks.ts"),"smil-animation":Ce("ingest/svg-animations.ts and smil-value-syntax.ts"),"css-animation":Ce("ingest/svg-animations.ts and css-animation-syntax.ts"),metadata:Ce("ingest/svg-metadata.ts"),scripts:Ce("ingest/svg-scripts.ts"),styles:Ce("ingest/svg-style-cascade.ts"),"custom-properties":Ce("ingest/svg-style-cascade.ts custom-property environments"),views:Ce("ingest/svg-views.ts"),"embedded-svg":Ce("ingest/svg-embedded-frames.ts"),fonts:Ce("ingest/svg-external-effects.ts"),"external-assets":Ce("ingest/svg-external-effects.ts")};function sb(t=Is,e=Ef){if(t.length===0)throw new Error("SVG import capability roster must not be empty.");if(new Set(t).size!==t.length)throw new Error("SVG import capability roster contains duplicate features.");let n=new Set(t);for(let r of t){let i=e[r];if(!i)throw new Error(`${r} lacks an SVG import parser owner.`);if(i.authority!=="core")throw new Error(`${r} retains retired editor parser authority.`);if(i.by.trim().length<8)throw new Error(`${r} lacks a substantive SVG import parser owner.`)}for(let r of Object.keys(e))if(!n.has(r))throw new Error(`Unknown SVG import capability ${r}.`)}var xT=64,IT=1e5,sc="http://www.w3.org/2000/svg",wT=new Set(["circle","ellipse","line","path","polygon","polyline","rect","text"]);function ab(t,e){return t===void 0||!Number.isFinite(t)?e:Math.max(1,Math.floor(t))}var Af=new Set(["defs","clippath","mask","marker","pattern","lineargradient","radialgradient","filter","symbol"]);function kT(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++){let i=t[r]-e[r];if(i!==0)return i}return t.length-e.length}function RT(t,e){return kT(t.orderKey,e.orderKey)||t.productIndex-e.productIndex||t.occurrenceId.localeCompare(e.occurrenceId)}function lb(t,e,n){let r=e.map(i=>i.sourceReferenceId).join("/");return`occurrence:${r?`${r}/`:""}${t}:${n}`}function TT(t,e){let n=Pe(e);if(!n?.value.startsWith("#")||n.value.length<=1)return null;let r=n.namespace==="svg2"?"href":"xlink-href";return t.index.referencesFrom(e.sourceNodeId).find(i=>i.channel===r&&i.authoredValue===n.value)??null}function PT(t,e){let n=Pe(e);if(!n||n.value.length===0||n.value==="#")return Object.freeze({useSourceNodeId:e.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"empty"});if(!n.value.startsWith("#"))return Object.freeze({useSourceNodeId:e.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"external"});let r=TT(t,e),i=r?.targetSourceNodeId?t.index.element(r.targetSourceNodeId):null;return!r||!i?Object.freeze({useSourceNodeId:e.sourceNodeId,sourceReferenceId:r?.sourceReferenceId??null,targetSourceNodeId:null,status:"missing"}):i.namespaceUri!==sc?Object.freeze({useSourceNodeId:e.sourceNodeId,sourceReferenceId:r.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"invalid"}):Object.freeze({useSourceNodeId:e.sourceNodeId,sourceReferenceId:r.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"resolved"})}function CT(t,e){let n=e;for(;n&&n!==t.root;){if(Af.has(n.localName.toLowerCase()))return!0;n=t.index.parent(n.sourceNodeId)}return!1}function Xi(t){return t.namespaceUri===sc&&t.localName.toLowerCase()==="use"}function $T(t,e){let n=new Map;for(let v of t.index.idOccurrences){let I=t.index.element(v.sourceNodeId);I&&n.set(I.sourceNodeId,I)}let r=new Map;for(let v of n.keys())r.set(v,new Set);for(let v of t.index.elements){if(v.namespaceUri!==sc||v.localName.toLowerCase()!=="use")continue;let I=e.get(v.sourceNodeId);if(I?.status!=="resolved"||!I.targetSourceNodeId||!n.has(I.targetSourceNodeId))continue;let x=v;for(;x;)n.has(x.sourceNodeId)&&r.get(x.sourceNodeId)?.add(I.targetSourceNodeId),x=t.index.parent(x.sourceNodeId)}let i=(v,I)=>(n.get(v)?.elementOrder??0)-(n.get(I)?.elementOrder??0),o=[...n.keys()].sort(i),s=new Map(o.map(v=>[v,[...r.get(v)??[]].sort(i)])),a=new Map(o.map(v=>[v,[]]));for(let[v,I]of s)for(let x of I)a.get(x)?.push(v);for(let v of a.values())v.sort(i);let l=[],c=new Set;for(let v of o){if(c.has(v))continue;c.add(v);let I=[{sourceNodeId:v,targetIndex:0}];for(;I.length>0;){let x=I[I.length-1],T=(s.get(x.sourceNodeId)??[])[x.targetIndex];if(T!==void 0){x.targetIndex++,c.has(T)||(c.add(T),I.push({sourceNodeId:T,targetIndex:0}));continue}l.push(x.sourceNodeId),I.pop()}}let u=[],d=new Set;for(let v=l.length-1;v>=0;v--){let I=l[v];if(d.has(I))continue;let x=[],P=[I];for(d.add(I);P.length>0;){let T=P.pop();x.push(T);let k=a.get(T)??[];for(let w=k.length-1;w>=0;w--){let $=k[w];d.has($)||(d.add($),P.push($))}}x.sort(i),u.push(x)}let p=new Map;u.forEach((v,I)=>{v.forEach(x=>p.set(x,I))});let f=u.map(()=>new Set);for(let[v,I]of r){let x=p.get(v);for(let P of I){let T=p.get(P);x!==T&&f[x].add(T)}}let g=u.map(v=>n.get(v[0])?.elementOrder??Number.MAX_SAFE_INTEGER),m=(v,I)=>g[v]-g[I],h=u.map((v,I)=>I).sort(m),b=[],S=new Set;for(let v of h){if(S.has(v))continue;S.add(v);let I=[{componentIndex:v,dependencyIndex:0,dependencies:[...f[v]].sort(m)}];for(;I.length>0;){let x=I[I.length-1],P=x.dependencies[x.dependencyIndex];if(P!==void 0){x.dependencyIndex++,S.has(P)||(S.add(P),I.push({componentIndex:P,dependencyIndex:0,dependencies:[...f[P]].sort(m)}));continue}b.push(x.componentIndex),I.pop()}}return b.map(v=>{let I=u[v],x=I.length>1||(r.get(I[0])?.has(I[0])??!1);return Object.freeze({componentId:`definition-component:${I[0]}`,memberSourceNodeIds:Object.freeze([...I]),circular:x})})}function Yi(t,e,n,r,i){return Object.freeze({severity:"warning",code:e,source:t.source,entrypoint:t.entrypoint,capability:"use-and-linked-references",sourceId:E(r,"id")??void 0,sourceNodeId:r.sourceNodeId,occurrenceId:i,elementName:r.name,message:n})}function ac(t,e){let n=ab(e.maxDepth,xT),r=ab(e.maxOccurrences,IT),i=t.index.elements.filter(k=>k.namespaceUri===sc&&k.localName.toLowerCase()==="use").map(k=>PT(t,k)),o=new Map(i.map(k=>[k.useSourceNodeId,k])),s=[],a=new Map,l=new Map,c=[],u=[],d=[],p=new Map,f=new Set;for(let k of e.resourceRoots??[]){let w=`${k.capability}\0${k.sourceNodeId}`;if(f.has(w))continue;f.add(w);let $=t.index.element(k.sourceNodeId),R=[];if($&&k.capability==="clip-path")for(let A of t.index.children($.sourceNodeId)){if(!Xi(A))continue;let D=o.get(A.sourceNodeId),_=D?.targetSourceNodeId?t.index.element(D.targetSourceNodeId):null;(D?.status!=="resolved"||!_||!wT.has(_.localName.toLowerCase()))&&(R.push(A.sourceNodeId),u.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,capability:"clip-definitions",sourceId:E($,"id")??void 0,sourceNodeId:A.sourceNodeId,elementName:A.name,documentPath:t.index.sourcePath(A.sourceNodeId),message:"A clipPath child use must directly reference a path, text, or basic shape. The clipPath is ignored."})))}let C=Object.freeze({resourceRootSourceNodeId:k.sourceNodeId,capability:k.capability,status:R.length===0?"valid":"invalid",invalidUseSourceNodeIds:Object.freeze(R)});d.push(C),p.has(k.sourceNodeId)||p.set(k.sourceNodeId,C)}let g=new Set,m=0,h=!1,b=(k,w,$,R,C)=>{let A=lb(k.sourceNodeId,w,0),D=a.get(A);if(D)return D;let _=Object.freeze({occurrenceId:A,correspondingSourceNodeId:k.sourceNodeId,usePath:Object.freeze(w.map(O=>Object.freeze({...O}))),role:C,parentOccurrenceId:$,orderKey:Object.freeze([...R]),productIndex:0});return s.push(_),a.set(A,_),w.length===0?l.set(k.sourceNodeId,_):m++,_};for(let k of t.index.elements){let w=t.index.parent(k.sourceNodeId),$=w?lb(w.sourceNodeId,[],0):null,R=Xi(k)?"use-carrier":CT(t,k)?"definition":"source";b(k,[],$,[k.elementOrder],R)}let S=(k,w)=>{h||(h=!0,u.push(Yi(e,"use-expansion-limit-exceeded",`SVG use expansion exceeded depth ${n} or ${r} shadow occurrences.`,k,w.occurrenceId)))},v=(k,w,$)=>{if(g.has(w.occurrenceId))return;g.add(w.occurrenceId);let R=Pe(k),C=o.get(k.sourceNodeId);if(!C||C.status==="empty"){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:null,status:"empty"}),u.push(Yi(e,"unresolved-reference","The SVG use element has no local target.",k,w.occurrenceId));return}if(C.status==="external"){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:null,status:"external"}),u.push(Yi(e,"unresolved-reference",`External SVG use target "${R?.value??""}" is not materialized by local import.`,k,w.occurrenceId));return}if(C.status==="missing"){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:null,status:"missing"}),u.push(Yi(e,"unresolved-reference",`SVG use target "${R?.value??""}" does not exist.`,k,w.occurrenceId));return}if(C.status==="invalid"){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:C.targetSourceNodeId,status:"invalid"}),u.push(Yi(e,"unresolved-reference",`SVG use target "${R?.value??""}" is outside the SVG namespace.`,k,w.occurrenceId));return}let A=C.targetSourceNodeId?t.index.element(C.targetSourceNodeId):null;if(!A||!C.sourceReferenceId)return;let D={sourceReferenceId:C.sourceReferenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:A.sourceNodeId},_=[...w.usePath,D];if($.has(A.sourceNodeId)){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:A.sourceNodeId,status:"circular"}),u.push(Yi(e,"circular-use-reference",`SVG use target "${R?.value??""}" closes a circular shadow-tree reference.`,k,w.occurrenceId));return}if(_.length>n||m>=r){c.push({useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:A.sourceNodeId,status:"limit"}),S(k,w);return}let O={useOccurrenceId:w.occurrenceId,useSourceNodeId:k.sourceNodeId,targetSourceNodeId:A.sourceNodeId,status:"resolved"};c.push(O);let L=()=>{O.status="limit",S(k,w)},re=new Set($),ee=(F,V,K)=>{if(m>=r){L();return}re.add(F.sourceNodeId);let X=Xi(F)?"use-carrier":"shadow-instance",z=b(F,_,V,K,X);if(Xi(F))v(F,z,re);else if(!Af.has(F.localName.toLowerCase())||F.localName.toLowerCase()==="symbol"){for(let G of t.index.children(F.sourceNodeId))if(ee(G,z.occurrenceId,[...K,G.elementOrder]),m>=r){L();break}}re.delete(F.sourceNodeId)};ee(A,w.occurrenceId,[...w.orderKey,A.elementOrder])},I=(k,w)=>{if(Af.has(k.localName.toLowerCase()))return;let $=new Set(w);$.add(k.sourceNodeId);let R=l.get(k.sourceNodeId);if(Xi(k)){v(k,R,w);return}for(let C of t.index.children(k.sourceNodeId))I(C,$)};I(t.root,new Set);let x=(k,w)=>{let $=new Set(w);$.add(k.sourceNodeId);let R=l.get(k.sourceNodeId);if(Xi(k)){v(k,R,w);return}for(let C of t.index.children(k.sourceNodeId))x(C,$)};for(let k of e.resourceRoots??[]){if(p.get(k.sourceNodeId)?.status==="invalid")continue;let $=t.index.element(k.sourceNodeId);if(!$)continue;let R=new Set,C=t.index.parent($.sourceNodeId);for(;C;)R.add(C.sourceNodeId),C=t.index.parent(C.sourceNodeId);x($,R)}s.sort(RT);let P=c.map(k=>Object.freeze({...k})),T=$T(t,o);return Object.freeze(i),Object.freeze(s),Object.freeze(P),Object.freeze(T),Object.freeze(d),Object.freeze(u),Object.freeze({occurrences:s,sourceResolutions:i,resolutions:P,definitionComponents:T,resourcePolicies:d,diagnostics:u,occurrence(k){return a.get(k)??null},direct(k){return l.get(k)??null},sourceResolution(k){return o.get(k)??null},resourcePolicy(k){return p.get(k)??null}})}var H="all-svg-elements",cb=[["alignment-baseline",!1,"auto",H],["baseline-shift",!1,"0",H],["clip",!1,"auto",H],["clip-path",!1,"none",H],["clip-rule",!0,"nonzero",H],["color",!0,"black",H],["color-interpolation",!0,"sRGB",H],["color-interpolation-filters",!0,"linearRGB",H],["cursor",!0,"auto",H],["direction",!0,"ltr",H],["display",!1,"inline",H],["dominant-baseline",!0,"auto",H],["fill",!0,"black",H],["fill-opacity",!0,"1",H],["fill-rule",!0,"nonzero",H],["filter",!1,"none",H],["flood-color",!1,"black",H],["flood-opacity",!1,"1",H],["font-family",!0,"serif",H],["font-feature-settings",!0,"normal",H],["font-kerning",!0,"auto",H],["font-size",!0,"medium",H],["font-size-adjust",!0,"none",H],["font-stretch",!0,"normal",H],["font-style",!0,"normal",H],["font-variant",!0,"normal",H],["font-variant-caps",!0,"normal",H],["font-variant-east-asian",!0,"normal",H],["font-variant-ligatures",!0,"normal",H],["font-variant-numeric",!0,"normal",H],["font-variant-position",!0,"normal",H],["font-weight",!0,"normal",H],["image-rendering",!0,"auto",H],["letter-spacing",!0,"normal",H],["lighting-color",!1,"white",H],["line-height",!0,"normal",H],["marker-end",!0,"none",H],["marker-mid",!0,"none",H],["marker-start",!0,"none",H],["mask",!1,"none",H],["mask-image",!1,"none",H],["opacity",!1,"1",H],["overflow",!1,"visible",H],["paint-order",!0,"normal",H],["pointer-events",!0,"auto",H],["shape-rendering",!0,"auto",H],["stop-color",!1,"black",H],["stop-opacity",!1,"1",H],["stroke",!0,"none",H],["stroke-dasharray",!0,"none",H],["stroke-dashoffset",!0,"0",H],["stroke-linecap",!0,"butt",H],["stroke-linejoin",!0,"miter",H],["stroke-miterlimit",!0,"4",H],["stroke-opacity",!0,"1",H],["stroke-width",!0,"1px",H],["text-anchor",!0,"start",H],["text-decoration",!1,"none",H],["text-rendering",!0,"auto",H],["text-transform",!0,"none","none"],["transform",!1,"none",H],["transform-box",!1,"view-box","none"],["transform-origin",!1,"50% 50%",H],["unicode-bidi",!1,"normal",H],["vector-effect",!1,"none",H],["visibility",!0,"visible",H],["word-spacing",!0,"normal",H],["writing-mode",!0,"horizontal-tb",H]],ET=new Map(cb.map(([t,e,n,r="none"])=>[t,Object.freeze({name:t,inherited:e,initialValue:n,presentationAttribute:r})])),$s=Object.freeze(cb.filter(t=>(t[3]??"none")!=="none").map(t=>t[0]));function mr(t){return ET.get(t.toLowerCase())??null}function lc(t){return(mr(t)?.presentationAttribute??"none")!=="none"}var pb=new Set(["circle","ellipse","image","line","path","polygon","polyline","rect","text"]),AT=new Set([...pb,"a","g","use"]),NT=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),MT=new Set(["clippath","filter","marker","mask","pattern"]),OT=new Set(["defs"]),db=new Set([...NT,"flowregion"]),DT=new Set(["class","clip-path","color","display","fill","fill-opacity","fill-rule","filter","mask","opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","visibility"]),zT=new Set(["data-shape-id","height","href","id","style","transform","width","x","xlink:href","xmlns","xmlns:xlink","y"]),_T=["animation","transition","-moz-animation","-moz-transition","-o-animation","-o-transition","-webkit-animation","-webkit-transition"],FT=new Set(["height","id","preserveaspectratio","refx","refy","viewbox","width","x","y"]);function qi(t){return t.localName.toLowerCase()}function fb(t,e){let n=[],r=new Set,i=t.index.parent(e.sourceNodeId);for(;i&&!r.has(i.sourceNodeId);)r.add(i.sourceNodeId),n.push(i),i=t.index.parent(i.sourceNodeId);return n}function dc(t,e,n){return fb(t,e).some(r=>n.has(qi(r)))}function LT(t,e){let n=qi(e);return dc(t,e,OT)?n==="symbol"||n==="g"||n==="use"||pb.has(n):!1}function ub(t){let e=t.toLowerCase();return _T.some(n=>e===n||e.startsWith(`${n}-`))}function BT(t){let e={};for(let n of["x","y","width","height"])ot(t,n)&&(e[n]=E(t,n)??"");return Object.keys(e).length===0?null:Object.freeze(e)}function GT(t,e,n,r){let i=e;for(;i&&qi(i)!=="svg";)i=t.index.parent(i.sourceNodeId);let o=i?Ue(E(i,"viewBox")??""):null,s=i?he(E(i,"width"),{}):void 0,a=i?he(E(i,"height"),{}):void 0,l=o?.width??s,c=o?.height??a,u=he(n.value(r,"font-size"),{viewportWidth:l,viewportHeight:c,percentBasis:16,fontSize:16,rootFontSize:16});return{viewportWidth:l,viewportHeight:c,fontSize:u??16,rootFontSize:16}}function VT(t,e){for(let n of fb(t,e))switch(qi(n)){case"pattern":return E(n,"patternContentUnits")==="objectBoundingBox";case"clippath":return E(n,"clipPathUnits")==="objectBoundingBox";case"mask":return E(n,"maskContentUnits")==="objectBoundingBox";default:break}return!1}function cc(t,e){if(t===null||t.trim()===""||t.trim().toLowerCase()==="auto")return e;let n=nt(t);return n?n.unit==="%"?n.value/100:n.unit===""?n.value:e:e}function jT(t,e,n,r){let i=VT(t,e),o=GT(t,e,r,n),s=E(e,"x"),a=E(e,"y"),l=i?cc(s,0):he(s,{...o,percentBasis:o.viewportWidth})??0,c=i?cc(a,0):he(a,{...o,percentBasis:o.viewportHeight})??0,u=E(e,"width"),d=E(e,"height"),p=u===null||u.trim()===""||u.trim().toLowerCase()==="auto"?null:i?cc(u,0):he(u,{...o,percentBasis:o.viewportWidth})??null,f=d===null||d.trim()===""||d.trim().toLowerCase()==="auto"?null:i?cc(d,0):he(d,{...o,percentBasis:o.viewportHeight})??null;return Object.freeze({authored:BT(e),x:l,y:c,width:p,height:f})}function UT(t,e,n){let r=E(t,"transform"),i=n.style(e)?.cascadedValues.transform?.value??null,o=r??i;if(o===null||o.trim()===""||o.trim().toLowerCase()==="none")return Object.freeze({authored:o,matrix:rt(1,0,0,1,0,0),valid:!0,pureTranslation:!0});let s=Gt(o),a=s!==null&&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;return Object.freeze({authored:o,matrix:s,valid:s!==null,pureTranslation:a})}function HT(t,e,n){let r={};for(let s of t.attributes){let a=s.name;zT.has(a)||s.value===""||ub(a)||(r[a]=s.value)}let i=n.style(e.occurrenceId);for(let[s,a]of Object.entries(i?.cascadedValues??{}))s==="transform"||ub(s)||(r[s]=a.value);let o=e.parentOccurrenceId?n.style(e.parentOccurrenceId):null;for(let[s,a]of Object.entries(i?.resolvedValues??{})){if(r[s]!==void 0||!mr(s)?.inherited||o?.resolvedValues[s]!==a)continue;o.cascadedValues[s]&&(r[s]=a)}return Object.freeze(r)}function WT(t){let e={};for(let n of t.attributes)n.name==="xmlns"||n.prefix==="xmlns"||n.namespaceUri===null&&FT.has(n.localName.toLowerCase())||(e[n.name]=n.value);return Object.freeze(e)}function KT(t,e){return t.find(n=>n.memberSourceNodeIds.includes(e))??null}function XT(t,e,n,r,i,o){let s=i.get(`${n.occurrenceId}\0${r.sourceNodeId}`);if(!s)return null;let a=KT(e.definitionComponents,r.sourceNodeId),l=o(s.occurrenceId),c=E(r,"viewBox");return Object.freeze({sourceNodeId:r.sourceNodeId,sourceId:E(r,"id"),defKind:qi(r)==="symbol"?"symbol":"group",productKey:`symbol-product:${r.sourceNodeId}:${n.occurrenceId}`,productUseOccurrenceId:n.occurrenceId,productRootOccurrenceId:s.occurrenceId,contentOccurrenceIds:Object.freeze(l),componentId:a?.componentId??null,circular:a?.circular??!1,viewBox:c,parsedViewBox:c===null?null:Ue(c),preserveAspectRatio:E(r,"preserveAspectRatio"),x:E(r,"x"),y:E(r,"y"),width:E(r,"width"),height:E(r,"height"),refX:E(r,"refX"),refY:E(r,"refY"),rootAttributes:WT(r)})}function YT(t,e,n,r,i,o){if(r.usePath.length!==0||!i.valid||!i.pureTranslation||!AT.has(qi(n))||dc(t,e,db)||dc(t,n,db))return!1;for(let s of DT)if(ot(e,s)||o.style(r.occurrenceId)?.cascadedValues[s])return!1;return!0}function uc(t,e,n,r){let i=new Map,o=new Map;for(let f of e.occurrences){if(!f.parentOccurrenceId)continue;let g=`${f.parentOccurrenceId}\0${f.correspondingSourceNodeId}`;i.has(g)||i.set(g,f);let m=o.get(f.parentOccurrenceId)??[];m.push(f),o.set(f.parentOccurrenceId,m)}let s=new Map,a=f=>{let g=s.get(f);if(g)return g;let m=[],h=[...o.get(f)??[]].reverse(),b=new Set;for(;h.length>0;){let v=h.pop();if(b.has(v.occurrenceId))continue;b.add(v.occurrenceId),m.push(v.occurrenceId);let I=o.get(v.occurrenceId)??[];for(let x=I.length-1;x>=0;x--)h.push(I[x])}let S=Object.freeze(m);return s.set(f,S),S},l=[],c=[],u=new Map,d=new Map;for(let f of e.resolutions){let g=e.occurrence(f.useOccurrenceId),m=t.index.element(f.useSourceNodeId);if(!g||!m||m.namespaceUri!==U)continue;let h=f.targetSourceNodeId?t.index.element(f.targetSourceNodeId):null,b=jT(t,m,g.occurrenceId,n),S=UT(m,g.occurrenceId,n),v=HT(m,g,n),I=f.status==="resolved"?"flattened":f.status,x=null;if(f.status==="resolved"&&h){let T=dc(t,m,MT);if(!T&&LT(t,h)){let k=XT(t,e,g,h,i,a);k&&(l.push(k),u.set(k.productKey,k),x=k.productKey,I="symbol-instance")}else!T&&YT(t,m,h,g,S,n)&&(I="linked-reference")}let P=Object.freeze({useOccurrenceId:g.occurrenceId,useSourceNodeId:m.sourceNodeId,targetSourceNodeId:h?.sourceNodeId??null,targetElementName:h?.name??null,status:I,definitionProductKey:x,geometry:b,presentation:v,transform:S,orderKey:Object.freeze([...g.orderKey])});c.push(P),d.set(P.useOccurrenceId,P)}Object.freeze(l),Object.freeze(c);let p=Object.freeze([]);return Object.freeze({definitions:l,uses:c,diagnostics:p,definition(f){return u.get(f)??null},use(f){return d.get(f)??null}})}var qT=new Map([["lineargradient","gradient"],["radialgradient","gradient"],["pattern","pattern"],["filter","filter"],["marker","marker"],["clippath","clip-path"],["mask","mask"]]),mb=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"]]),ZT=new Set(["animate","set"]),JT=new Set(["clippath","defs","desc","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]);function gb(t){return!t||t.namespaceUri!==U?null:qT.get(t.localName.toLowerCase())??null}function hb(t,e,n){if(!n||n.namespaceUri!==U)return!1;let r=n.localName.toLowerCase();return t==="paint"||t==="smil-animated-resource"&&["fill","stroke"].includes(e??"")?r==="lineargradient"||r==="radialgradient"||r==="pattern":t==="filter"||t==="smil-animated-resource"&&e==="filter"?r==="filter":t==="marker"||t==="smil-animated-resource"&&e?.startsWith("marker")?r==="marker":t==="clip-path"||t==="smil-animated-resource"&&e==="clip-path"?r==="clippath":t==="mask-image"||t==="smil-animated-resource"&&(e==="mask"||e==="mask-image")?r==="mask":t==="gradient-template"?r==="lineargradient"||r==="radialgradient":t==="pattern-template"?r==="pattern":t==="filter-image"}function QT(t){let e=[...t.children].reverse(),n="";for(;e.length>0;){let r=e.pop();r.kind==="text"||r.kind==="cdata"?n+=r.value:r.kind==="element"&&e.push(...[...r.children].reverse())}return n}function yb(t,e){let n=e;for(;n;){if(gb(n))return n;n=t.index.parent(n.sourceNodeId)}return null}function Sb(t,e,n){if(!n)return"consumer";if(e.sourceNodeId===n.sourceNodeId)return"resource-product";let r=e;for(;r&&r.sourceNodeId!==n.sourceNodeId;){if(JT.has(r.localName.toLowerCase()))return"parked";r=t.index.parent(r.sourceNodeId)}return r?"resource-product":"parked"}function eP(t){let e=[];for(let n of In(t,";")){let r=t.slice(n.start,n.end),i=In(r,":",!0);if(i.length<2)continue;let o=r.slice(i[0].start,i[0].end).trim().toLowerCase();if(!o)continue;let s=n.start+i[1].start,a=n.end;for(;s<a&&/\s/u.test(t[s]);)s++;for(;a>s&&/\s/u.test(t[a-1]);)a--;s!==a&&e.push({propertyName:o,valueStart:s,valueEnd:a})}return e}function bb(t,e,n,r,i,o){let s=t.index.referencesFrom(e.sourceNodeId).find(a=>o.has(a.sourceReferenceId)||a.targetAuthoredId!==n||a.authoredValue!==r?!1:i===null||a.attributeName===i);return s&&o.add(s.sourceReferenceId),s??null}function tP(t,e,n){return(t.get(e)?.elementOrder??Number.MAX_SAFE_INTEGER)-(t.get(n)?.elementOrder??Number.MAX_SAFE_INTEGER)}function nP(t,e,n){let r=(S,v)=>tP(n,S,v),i=[...t].sort(r),o=new Map(i.map(S=>[S,[...e.get(S)??[]].sort(r)])),s=new Map(i.map(S=>[S,[]]));for(let[S,v]of o)for(let I of v)s.get(I)?.push(S);for(let S of s.values())S.sort(r);let a=[],l=new Set;for(let S of i){if(l.has(S))continue;l.add(S);let v=[{nodeId:S,targetIndex:0}];for(;v.length>0;){let I=v[v.length-1],x=o.get(I.nodeId)?.[I.targetIndex];x!==void 0?(I.targetIndex++,l.has(x)||(l.add(x),v.push({nodeId:x,targetIndex:0}))):(a.push(I.nodeId),v.pop())}}let c=[],u=new Set;for(let S=a.length-1;S>=0;S--){let v=a[S];if(u.has(v))continue;let I=[],x=[v];for(u.add(v);x.length>0;){let P=x.pop();I.push(P);let T=s.get(P)??[];for(let k=T.length-1;k>=0;k--){let w=T[k];u.has(w)||(u.add(w),x.push(w))}}I.sort(r),c.push(I)}let d=new Map;c.forEach((S,v)=>{S.forEach(I=>d.set(I,v))});let p=c.map(()=>new Set);for(let[S,v]of e){let I=d.get(S);if(I!==void 0)for(let x of v){let P=d.get(x);P!==void 0&&I!==P&&p[I].add(P)}}let f=c.map(S=>n.get(S[0])?.elementOrder??Number.MAX_SAFE_INTEGER),g=(S,v)=>f[S]-f[v],m=c.map((S,v)=>v).sort(g),h=[],b=new Set;for(let S of m){if(b.has(S))continue;b.add(S);let v=[{component:S,dependencyIndex:0,dependencies:[...p[S]].sort(g)}];for(;v.length>0;){let I=v[v.length-1],x=I.dependencies[I.dependencyIndex];x!==void 0?(I.dependencyIndex++,b.has(x)||(b.add(x),v.push({component:x,dependencyIndex:0,dependencies:[...p[x]].sort(g)}))):(h.push(I.component),v.pop())}}return h.map(S=>{let v=c[S];return Object.freeze({componentId:`resource-component:${v[0]}`,memberSourceNodeIds:Object.freeze([...v]),circular:v.length>1||(e.get(v[0])?.has(v[0])??!1)})})}function vb(t,e){let n=t.index.occurrences(e),r=n[0]?.sourceNodeId??null;return{targetSourceNodeId:r,target:r?t.index.element(r):null,resolution:n.length===0?"missing":n.length===1?"resolved":"ambiguous-first"}}function pc(t,e,n,r,i,o,s,a,l,c=n.length,u=null){let d=l??mb.get(r);if(!d)return[];let p=yb(t,e);return wn(n.slice(s,c)).map((f,g)=>{let m=vb(t,f.targetAuthoredId);return{sourceReferenceId:(i==="authored-direct"?bb(t,e,f.targetAuthoredId,n,o,a):null)?.sourceReferenceId??null,fromSourceNodeId:e.sourceNodeId,occurrenceId:u,containingResourceSourceNodeId:p?.sourceNodeId??null,participation:Sb(t,e,p),binding:i,kind:d,propertyName:r,attributeName:o,authoredValue:n,propertyValue:n.slice(s,c),tokenIndex:g,tokenStart:s+f.targetStart,tokenEnd:s+f.targetEnd,targetAuthoredId:f.targetAuthoredId,targetSourceNodeId:m.targetSourceNodeId,targetElementName:m.target?.localName??null,resolution:m.resolution,validity:m.resolution==="missing"?"missing":hb(d,r,m.target)?"valid":"invalid-target",componentId:null}})}function Nf(t,e,n,r){let i=Pe(e);if(!i||!i.value.startsWith("#")||i.value.length<=1)return null;let o=i.value.slice(1),s=vb(t,o),a=i.namespace==="svg2"?"href":"xlink:href",l=bb(t,e,o,i.value,a,r),c=yb(t,e);return{sourceReferenceId:l?.sourceReferenceId??null,fromSourceNodeId:e.sourceNodeId,occurrenceId:null,containingResourceSourceNodeId:c?.sourceNodeId??null,participation:Sb(t,e,c),binding:"authored-direct",kind:n,propertyName:null,attributeName:a,authoredValue:i.value,propertyValue:i.value,tokenIndex:0,tokenStart:1,tokenEnd:i.value.length,targetAuthoredId:o,targetSourceNodeId:s.targetSourceNodeId,targetElementName:s.target?.localName??null,resolution:s.resolution,validity:s.resolution==="missing"?"missing":hb(n,null,s.target)?"valid":"invalid-target",componentId:null}}function Mf(t){let e=t.trim().toLowerCase();return mb.has(e)?e:null}function rP(t,e){let n=[];for(let r of t.index.elements){if(r.namespaceUri!==U)continue;let i=r.localName.toLowerCase();if(i==="lineargradient"||i==="radialgradient"){let o=Nf(t,r,"gradient-template",e);o&&n.push(o)}else if(i==="pattern"){let o=Nf(t,r,"pattern-template",e);o&&n.push(o)}else if(i==="feimage"){let o=Nf(t,r,"filter-image",e);o&&n.push(o)}if(ZT.has(i)){let o=Mf(E(r,"attributeName")??"");if(o)for(let s of["values","from","to","by"]){let a=r.attributes.find(l=>l.namespaceUri===null&&l.localName===s);a&&n.push(...pc(t,r,a.value,o,"authored-direct",a.name,0,e,"smil-animated-resource"))}continue}for(let o of r.attributes){if(o.namespaceUri!==null)continue;if(o.localName==="style"){for(let a of eP(o.value)){let l=Mf(a.propertyName);l&&n.push(...pc(t,r,o.value,l,"authored-direct",o.name,a.valueStart,e,void 0,a.valueEnd))}continue}let s=Mf(o.localName);s&&n.push(...pc(t,r,o.value,s,"authored-direct",o.name,0,e))}}return n}function iP(t,e,n){return e.flatMap(r=>{let i=t.index.element(r.fromSourceNodeId);if(!i)throw new Error(`Applied SVG resource declaration references unknown source node ${r.fromSourceNodeId}.`);return pc(t,i,r.value,r.propertyName,"applied-css",null,0,n,void 0,r.value.length,r.occurrenceId??null)})}function oP(t){let e=[];for(let n of t.index.elements){if(n.namespaceUri!==U||n.localName.toLowerCase()!=="style")continue;let r=QT(n);wn(r).forEach((i,o)=>{e.push(Object.freeze({styleSourceNodeId:n.sourceNodeId,authoredValue:r,tokenIndex:o,tokenStart:i.targetStart,tokenEnd:i.targetEnd,targetAuthoredId:i.targetAuthoredId}))})}return e}function sP(t,e,n){if(t.validity==="valid")return null;let r=t.validity==="circular",i=t.validity==="missing";return Object.freeze({severity:"warning",code:r?"circular-resource-reference":"unresolved-reference",source:e.source,entrypoint:e.entrypoint,capability:t.kind,sourceNodeId:t.fromSourceNodeId,sourceId:n?E(n,"id")??void 0:void 0,elementName:n?.name,message:r?`Circular ${t.kind} reference to #${t.targetAuthoredId} is invalid.`:i?`${t.kind} reference #${t.targetAuthoredId} is unresolved.`:`${t.kind} reference #${t.targetAuthoredId} targets an invalid ${t.targetElementName??"element"}.`})}function fc(t,e){let n=new Map(t.index.elements.map(x=>[x.sourceNodeId,x])),r=t.index.elements.flatMap(x=>{let P=gb(x);return P?[Object.freeze({sourceNodeId:x.sourceNodeId,kind:P,authoredId:E(x,"id")})]:[]}),i=new Set(r.map(x=>x.sourceNodeId)),o=new Set,s=[...rP(t,o),...iP(t,e.appliedDeclarations??[],o)],a=new Map(r.map(x=>[x.sourceNodeId,new Set]));for(let x of s)x.validity==="valid"&&x.participation==="resource-product"&&x.containingResourceSourceNodeId&&x.targetSourceNodeId&&i.has(x.targetSourceNodeId)&&a.get(x.containingResourceSourceNodeId)?.add(x.targetSourceNodeId);let l=nP(r.map(x=>x.sourceNodeId),a,n),c=new Map;for(let x of l)for(let P of x.memberSourceNodeIds)c.set(P,x);let u=s.map((x,P)=>{let T=x.containingResourceSourceNodeId?c.get(x.containingResourceSourceNodeId):void 0,k=x.targetSourceNodeId?c.get(x.targetSourceNodeId):void 0,w=!!(x.validity==="valid"&&T?.circular&&T===k);return Object.freeze({resourceReferenceId:`resource-reference:${P}`,...x,validity:w?"circular":x.validity,componentId:T?.componentId??null})}),d=new Map;for(let x of u){let P=d.get(x.fromSourceNodeId)??[];P.push(x),d.set(x.fromSourceNodeId,P)}let p=u.flatMap(x=>{let P=sP(x,e,n.get(x.fromSourceNodeId)??null);return P?[P]:[]}),f=new Map;for(let x of p){if(!x.sourceNodeId)continue;let P=f.get(x.sourceNodeId)??[];P.push(x),f.set(x.sourceNodeId,P)}let g=new Map(u.map(x=>[x.resourceReferenceId,x])),m=new Map;for(let x of u){if(!x.containingResourceSourceNodeId||x.participation!=="resource-product")continue;let P=m.get(x.containingResourceSourceNodeId)??[];P.push(x),m.set(x.containingResourceSourceNodeId,P)}let h=x=>x.validity==="valid"||x.validity==="circular",b=x=>Object.freeze([...new Set(x.flatMap(P=>f.get(P.fromSourceNodeId)??[]))]),S=x=>{let P=x.map(z=>{let G=g.get(z.resourceReferenceId);if(!G)throw new Error(`SVG resource edge ${z.resourceReferenceId} does not belong to this dependency plan.`);return G}),T=new Set,k=new Set,w=new Set,$=new Map,R=[],C=[],A=new Map,D=z=>{if(T.add(z.resourceReferenceId),!(!h(z)||!z.targetSourceNodeId)){if(i.has(z.targetSourceNodeId)){if(k.has(z.targetSourceNodeId))return;k.add(z.targetSourceNodeId),$.set(z.targetSourceNodeId,z.resourceReferenceId),R.push(z.targetSourceNodeId);return}z.kind!=="filter-image"||w.has(z.targetSourceNodeId)||(w.add(z.targetSourceNodeId),$.set(z.targetSourceNodeId,z.resourceReferenceId),C.push(z.targetSourceNodeId))}};for(P.forEach(D);R.length>0||C.length>0;){for(;R.length>0;){let z=R.shift();for(let G of m.get(z)??[])D(G)}for(;C.length>0;){let z=C.shift(),G=[],q=[z],te=new Set;for(;q.length>0;){let ie=q.pop();if(!te.has(ie)){te.add(ie);for(let J of d.get(ie)??[])J.containingResourceSourceNodeId===null&&(G.push(J),D(J));q.push(...t.index.children(ie).map(J=>J.sourceNodeId))}}A.set(z,G)}}let _=[],O=new Set,L=new Set,re=z=>{!h(z)||!z.targetSourceNodeId||(k.has(z.targetSourceNodeId)?ee(z.targetSourceNodeId):w.has(z.targetSourceNodeId)&&F(z.targetSourceNodeId))},ee=z=>{let G=`resource:${z}`;if(!(O.has(G)||L.has(G))){L.add(G);for(let q of m.get(z)??[])re(q);L.delete(G),O.add(G),_.push(Object.freeze({sourceNodeId:z,role:"resource",viaResourceReferenceId:$.get(z)??null}))}},F=z=>{let G=`fragment:${z}`;if(!(O.has(G)||L.has(G))){L.add(G);for(let q of A.get(z)??[])re(q);L.delete(G),O.add(G),_.push(Object.freeze({sourceNodeId:z,role:"referenced-fragment",viaResourceReferenceId:$.get(z)??null}))}};for(let z of P)re(z);let V=u.filter(z=>T.has(z.resourceReferenceId)),K=_.flatMap(z=>z.role==="resource"?[z.sourceNodeId]:[]),X=l.filter(z=>z.memberSourceNodeIds.some(G=>k.has(G)));return Object.freeze({edges:Object.freeze(V),components:Object.freeze(X),resourceSourceNodeIds:Object.freeze(K),materializations:Object.freeze(_),diagnostics:b(V)})};for(let x of d.values())Object.freeze(x);Object.freeze(r),Object.freeze(u),Object.freeze(l),Object.freeze(p);let v=Object.freeze(oP(t));return Object.freeze({resources:r,edges:u,unboundStylesheetReferences:v,components:l,diagnostics:p,direct(x){return d.get(x)??Object.freeze([])},closureFromEdges(x){return S(x)},resolvePropertyValue(x,P,T){return Object.freeze((d.get(x)??[]).filter(k=>k.propertyName===P&&k.propertyValue===T))},templateChain(x){let P=[],T=new Set,k=x;for(;k&&!T.has(k);){T.add(k);let w=(d.get(k)??[]).find($=>$.fromSourceNodeId===k&&($.kind==="gradient-template"||$.kind==="pattern-template"));if(!w||(P.push(w),!w.targetSourceNodeId||!i.has(w.targetSourceNodeId)||w.validity==="missing"||w.validity==="invalid-target"))break;k=w.targetSourceNodeId}return Object.freeze(P)},closure(x){let P=x.map(O=>n.get(O)).filter(O=>!!O),T=new Set(P.filter(O=>i.has(O.sourceNodeId)).map(O=>O.sourceNodeId)),k=new Set;for(let O of P){let L=[O];for(;L.length>0;){let re=L.pop();k.has(re.sourceNodeId)||(k.add(re.sourceNodeId),L.push(...t.index.children(re.sourceNodeId)))}}let w=new Set;for(let O of k){i.has(O)&&!T.has(O)&&w.add(O);for(let L of d.get(O)??[])L.validity==="valid"&&L.targetSourceNodeId&&i.has(L.targetSourceNodeId)&&!T.has(L.targetSourceNodeId)&&w.add(L.targetSourceNodeId)}let $=[...T,...w];for(;$.length>0;){let O=$.pop();for(let L of a.get(O)??[])T.has(L)||w.has(L)||(w.add(L),$.push(L))}let R=l.filter(O=>O.memberSourceNodeIds.some(L=>w.has(L))),C=R.flatMap(O=>O.memberSourceNodeIds.filter(L=>w.has(L))),A=new Set([...T,...w]),D=u.filter(O=>k.has(O.fromSourceNodeId)||O.containingResourceSourceNodeId!==null&&A.has(O.containingResourceSourceNodeId)),_=[...new Set(D.flatMap(O=>f.get(O.fromSourceNodeId)??[]))];return Object.freeze({edges:Object.freeze(D),components:Object.freeze(R),resourceSourceNodeIds:Object.freeze(C),materializations:Object.freeze(C.map(O=>Object.freeze({sourceNodeId:O,role:"resource",viaResourceReferenceId:null}))),diagnostics:Object.freeze(_)})}})}function xb(t,e,n){let r=e.flatMap(s=>{let a=n.get(s.resourceReferenceId);if(a===void 0)return[];if(s.authoredValue!==t)throw new Error(`Resource edge ${s.resourceReferenceId} does not belong to the supplied value.`);return[{start:s.tokenStart,end:s.tokenEnd,replacement:a}]});r.sort((s,a)=>a.start-s.start||a.end-s.end);let i=t,o=t.length;for(let s of r){if(s.start<0||s.end<s.start||s.end>o)throw new Error("Overlapping or invalid SVG resource reference rewrite spans.");i=`${i.slice(0,s.start)}${s.replacement}${i.slice(s.end)}`,o=s.start}return i}var aP="http://www.w3.org/2000/xmlns/",lP="http://www.w3.org/XML/1998/namespace",Ib="http://www.w3.org/1999/xlink",cP=new Set(["class","id","lang","role","tabindex","xml:base","xml:lang","xml:space"]),dP=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"]),uP=new Set(["crossorigin","decoding","href","preserveaspectratio","refx","refy","requiredextensions","requiredfeatures","systemlanguage","target","type","viewbox","zoomandpan"]);function pP(t,e,n,r){let i=e.toLowerCase(),o=n.toLowerCase();return r===aP||i==="xmlns"||i.startsWith("xmlns:")?"namespace":r!==null&&r!==lP&&r!==Ib||t!==U&&t!==null?"foreign":cP.has(i)?"metadata":i.startsWith("aria-")?"aria":i.startsWith("data-")?"data":/^on[a-z]/u.test(i)?"event-handler":rc.some(s=>s.toLowerCase()===i)?"conditional":i==="style"?"style":r===null&&lc(i)?"presentation":r===null&&dP.has(o)?"geometry":r===Ib||r===null&&uP.has(o)?"element-specific":"passthrough"}function mc(t){let e=t.index.elements.flatMap(i=>i.attributes.map((o,s)=>Object.freeze({sourceNodeId:i.sourceNodeId,attributeOrder:s,name:o.name,localName:o.localName,prefix:o.prefix,namespaceUri:o.namespaceUri,value:o.value,span:o.span,classification:pP(i.namespaceUri,o.name,o.localName,o.namespaceUri)}))),n=Object.freeze(e),r=new Map;for(let i of n){let o=r.get(i.sourceNodeId)??[];o.push(i),r.set(i.sourceNodeId,o)}for(let[i,o]of r)r.set(i,Object.freeze(o));return Object.freeze({attributes:n,forElement:i=>r.get(i)??Object.freeze([])})}var Pb=require("css-select"),bt=require("css-what"),ii=require("css-tree");var Cb="\0svgsketch-element-namespace",Df="\0svgsketch-attribute-namespace\0",fP=new Set(["clip-path","mask","mask-image","filter","fill","stroke","marker","marker-start","marker-mid","marker-end"]),$b=new Set(["inherit","initial","unset","revert","revert-layer"]),Ji=Object.freeze({a:0,b:0,c:0});function Rn(t){return t?.children?.toArray()??[]}function hr(t){return typeof t=="string"?t:t?(0,ii.generate)(t):""}function zf(t,e){let n=Math.max(t.length,e.length);for(let r=0;r<n;r++){let i=(t[r]??-1)-(e[r]??-1);if(i!==0)return i}return 0}function Eb(t,e){return t.a-e.a||t.b-e.b||t.c-e.c}function Zi(t,e){return{a:t.a+e.a,b:t.b+e.b,c:t.c+e.c}}function Es(t){return t.reduce((e,n)=>Eb(n,e)>0?n:e,Ji)}function _f(t){let e=Ji;for(let n of t){if(n.type===bt.SelectorType.Tag||n.type===bt.SelectorType.PseudoElement){e=Zi(e,{a:0,b:0,c:1});continue}if(n.type===bt.SelectorType.Attribute){let i=n.name==="id"&&n.action===bt.AttributeAction.Equals&&n.ignoreCase==="quirks";e=Zi(e,i?{a:1,b:0,c:0}:{a:0,b:1,c:0});continue}if(n.type!==bt.SelectorType.Pseudo)continue;let r=n.name.toLowerCase();if(r!=="where"){if((r==="is"||r==="not"||r==="has")&&Array.isArray(n.data)){e=Zi(e,Es(n.data.map(i=>_f(i))));continue}if((r==="nth-child"||r==="nth-last-child")&&typeof n.data=="string"){let i=Ji,o=/\bof\s+(.+)$/iu.exec(n.data);if(o)try{i=Es((0,bt.parse)(o[1]).map(_f))}catch{i=Ji}e=Zi(Zi(e,{a:0,b:1,c:0}),i);continue}e=Zi(e,{a:0,b:1,c:0})}}return e}function mP(t){return{type:bt.SelectorType.Attribute,name:Cb,action:bt.AttributeAction.Equals,value:t,namespace:null,ignoreCase:!1}}function wb(t,e){if(t==="")return"";let n=e.get(t);if(n===void 0)throw new Error(`Unknown CSS namespace prefix ${t}.`);return n}function Ab(t,e){let n=[];for(let r of t){if(r.type===bt.SelectorType.Tag||r.type===bt.SelectorType.Universal){let i={...r,namespace:null};n.push(i);let o=r.namespace??(e.has("")?"":null);o!==null&&o!=="*"&&n.push(mP(wb(o,e)));continue}if(r.type===bt.SelectorType.Attribute&&r.namespace!==null){if(r.namespace==="*")throw new Error("Wildcard attribute namespaces require an explicit namespace prefix.");let i=wb(r.namespace,e);n.push({...r,name:`${Df}${i}\0${r.name}`,namespace:null});continue}if(r.type===bt.SelectorType.Pseudo&&Array.isArray(r.data)&&["is","where","not","has"].includes(r.name.toLowerCase())){n.push({...r,data:r.data.map(i=>Ab(i,e))});continue}n.push({...r})}return n}function gP(t){return t.children.filter(e=>e.kind!=="element").map(e=>e.value).join("")}function hP(t,e){let n=new Map;for(let o of e.occurrences){let s=t.index.element(o.correspondingSourceNodeId);s&&n.set(o.occurrenceId,{kind:"element",occurrence:o,element:s,parent:null,children:[]})}let r=[];for(let o of n.values()){let s=o.occurrence.parentOccurrenceId?n.get(o.occurrence.parentOccurrenceId)??null:null;o.parent=s,s?s.children.push(o):r.push(o);for(let a of o.element.children)a.kind!=="element"&&o.children.push({kind:"text",value:a.value,parent:o})}let i=(o,s)=>o.kind==="text"||s.kind==="text"?o.kind===s.kind?0:o.kind==="text"?1:-1:zf(o.occurrence.orderKey,s.occurrence.orderKey);for(let o of n.values())o.children.sort(i);return r.sort((o,s)=>zf(o.occurrence.orderKey,s.occurrence.orderKey)),{roots:Object.freeze(r),byOccurrenceId:n}}function Nb(t){return t.kind==="text"?t.value:t.children.map(Nb).join("")}function hc(t){return t.kind==="text"?[]:[t,...t.children.flatMap(hc)]}function yP(t){let e=new Set(t);return t.filter(n=>{let r=n.parent;for(;r;){if(e.has(r))return!1;r=r.parent}return!0})}function kb(t,e){if(e===Cb)return t.element.namespaceUri??"";if(e.startsWith(Df)){let[n,r]=e.slice(Df.length).split("\0");return t.element.attributes.find(i=>(i.namespaceUri??"")===n&&i.localName===r)?.value}return t.attributeOverrides&&Object.prototype.hasOwnProperty.call(t.attributeOverrides,e)?t.attributeOverrides?.[e]??void 0:t.element.attributes.find(n=>n.namespaceUri===null&&n.localName===e)?.value}function SP(t){return{adapter:{isTag:n=>n.kind==="element",existsOne:(n,r)=>r.some(i=>hc(i).some(n)),getAttributeValue:kb,getChildren:n=>n.kind==="element"?n.children:[],getName:n=>n.element.localName,getParent:n=>n.parent,getSiblings:n=>n.parent?.children??[n],prevElementSibling:n=>{let r=n.parent?.children??[],i=r.indexOf(n);for(let o=i-1;o>=0;o--)if(r[o].kind==="element")return r[o];return null},getText:Nb,hasAttrib:(n,r)=>kb(n,r)!==void 0,removeSubsets:yP,findAll:(n,r)=>r.flatMap(hc).filter(n),findOne:(n,r)=>r.flatMap(hc).find(n)??null,equals:(n,r)=>n===r,isHovered:n=>t.evaluateStatefulPseudo?.(n.occurrence.occurrenceId,"hover")===!0,isVisited:n=>t.evaluateStatefulPseudo?.(n.occurrence.occurrenceId,"visited")===!0,isActive:n=>t.evaluateStatefulPseudo?.(n.occurrence.occurrenceId,"active")===!0},xmlMode:!0,lowerCaseAttributeNames:!1,lowerCaseTags:!1,cacheResults:!0}}function bP(t,e,n){try{let i=(0,bt.parse)(t).map(o=>{let s=Ab(o,e),a=(0,Pb.compile)([s],n);return Object.freeze({matches:l=>a(l),specificity:Object.freeze(_f(o))})});return Object.freeze(i)}catch{return null}}function vP(t){let e=[],n=0,r=null,i=!1,o=0,s=a=>{let l=t.slice(n,a).trim();l&&e.push(l)};for(let a=0;a<t.length;a++){let l=t[a];if(r){i?i=!1:l==="\\"?i=!0:l===r&&(r=null);continue}if(l==='"'||l==="'"){r=l;continue}l==="("?o++:l===")"?o=Math.max(0,o-1):o===0&&(/[\t\n\f\r ]/u.test(l)||l==="/")&&(s(a),l==="/"&&e.push("/"),n=a+1)}return s(t.length),e}function xP(t){let e=vP(t),n=/^(?:xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller|(?:\d*\.)?\d+(?:%|[a-z]+))$/iu,r=e.findIndex(d=>n.test(d));if(r<0)return null;let i="normal",o="normal",s="normal",a="normal";for(let d of e.slice(0,r)){let p=d.toLowerCase();p==="italic"||p==="oblique"?i=d:p==="small-caps"?o=d:p==="bold"||p==="bolder"||p==="lighter"||/^\d{1,4}$/u.test(p)?s=d:/^(?:ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded)$/u.test(p)&&(a=d)}let l=r+1,c="normal";e[l]==="/"&&(c=e[l+1]??"normal",l+=2);let u=e.slice(l).join(" ").trim();return u?Object.freeze({"font-style":i,"font-variant":o,"font-weight":s,"font-stretch":a,"font-size":e[r],"line-height":c,"font-family":u}):null}function IP(t){let e=t.propertyName;if(e==="marker")return["marker-start","marker-mid","marker-end"].map(n=>({...t,propertyName:n}));if(e==="font"){let n=xP(t.value);return n?Object.entries(n).map(([r,i])=>({...t,propertyName:r,value:i,authoredValue:i})):[]}return e==="all"&&$b.has(t.value.toLowerCase())?$s.map(n=>({...t,propertyName:n})):[t]}function wP(t,e){let n=e.trim().toLowerCase();if(t==="color-interpolation")return n==="auto"||n==="srgb"||n==="linearrgb";if(t!=="clip-path")return!1;if($b.has(n)||n==="none")return!0;let r="(?: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+${r})?|${r}(?:\\s+${i})?)$`,"iu").test(e.trim())}function Lf(t){let e;try{e=(0,ii.parse)(t,{context:"declarationList",positions:!0})}catch{return{declarations:Object.freeze([]),raw:Object.freeze({})}}let n=[],r={};for(let[i,o]of Rn(e).entries()){if(o.type!=="Declaration"||typeof o.property!="string"||!o.value)continue;let s=o.property,a=s.startsWith("--")?s:s.toLowerCase(),l=typeof o.value!="string"&&o.value.loc?t.slice(o.value.loc.start.offset,o.value.loc.end.offset).trim():hr(o.value).trim();r[a]=l;let c=a.startsWith("--"),u=/(?:^|[^-_a-z0-9])var\(/iu.test(l);if(!(c||u||ii.lexer.matchProperty(a,o.value).matched||wP(a,l)))continue;let p={propertyName:a,authoredPropertyName:s,value:l,authoredValue:l,important:!!o.important,order:i};n.push(...IP(p))}return{declarations:Object.freeze(n),raw:Object.freeze(r)}}function Mb(t){if(!t)return Object.freeze({values:Object.freeze({}),importantProperties:Object.freeze([])});let e=Lf(t),n=new Map;for(let o of e.declarations)n.get(o.propertyName)?.important&&!o.important||n.set(o.propertyName,o);let r={...e.raw},i=[];for(let[o,s]of n)r[o]=s.value,s.important&&i.push(o);return Object.freeze({values:Object.freeze(r),importantProperties:Object.freeze(i)})}function gc(t,e){let n=Lf(t),r=n.declarations.map((i,o)=>Object.freeze({...i,declarationId:`${e.ruleId??e.sourceNodeId}:${e.origin}:${i.order}:${o}`,sourceNodeId:e.sourceNodeId,origin:e.origin,sourceOrder:Object.freeze([...e.sourceOrder,i.order,o]),ruleId:e.ruleId,layerRank:e.layerRank}));return{templates:Object.freeze(r),raw:n.raw}}function Of(t,e,n){return Object.freeze({declarationId:t.declarationId,sourceNodeId:t.sourceNodeId,occurrenceId:e,propertyName:t.propertyName,authoredPropertyName:t.authoredPropertyName,value:t.value,authoredValue:t.authoredValue,important:t.important,origin:t.origin,specificity:Object.freeze({...n}),sourceOrder:t.sourceOrder,ruleId:t.ruleId})}function kP(t){let e=Rn(t.prelude);if(e.length===0)return null;let n=e[e.length-1],r=(n.type==="Url"||n.type==="String")&&typeof n.value=="string"?n.value:null;if(r===null)return null;let i=e[0];return{prefix:e.length>1&&i.type==="Identifier"&&typeof i.name=="string"?i.name:"",uri:r}}function RP(t){return hr(t.prelude).split(",").map(e=>e.trim()).filter(Boolean)}var TP=new Set(["default","inherit","initial","none","revert","revert-layer","unset"]);function PP(t){let e=Rn(t.prelude);if(e.length!==1)return null;let n=e[0];return n.type==="String"&&typeof n.value=="string"?n.value===""?null:n.value:n.type!=="Identifier"||typeof n.name!="string"||TP.has(n.name.toLowerCase())?null:n.name}function CP(t){let e=t.trim().toLowerCase();if(e==="from")return 0;if(e==="to")return 1;let n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/iu.exec(e);if(!n)return null;let r=Number(n[1]);return Number.isFinite(r)&&r>=0&&r<=100?r/100:null}function $P(t){return t.important?!1:t.propertyName==="animation-timing-function"||t.propertyName!=="animation"&&!t.propertyName.startsWith("animation-")}function EP(t,e,n){let r=PP(t);if(!r||!t.block)return null;let i=`${e.sourceNodeId}:keyframes:${n}`,o=new Map;for(let[a,l]of Rn(t.block).entries()){if(l.type!=="Rule"||!l.prelude||!l.block)continue;let c=hr(l.prelude).split(",").map(CP).filter(p=>p!==null);if(c.length===0)continue;let u=Rn(l.block).filter(p=>p.type==="Declaration").map(p=>hr(p)).join(";"),d=Lf(u).declarations.filter($P);for(let p of c){let f=o.get(p)??new Map;for(let[g,m]of d.entries())f.set(m.propertyName,Object.freeze({declarationId:`${i}:${a}:${m.order}:${g}`,propertyName:m.propertyName,authoredPropertyName:m.authoredPropertyName,value:m.value,authoredValue:m.authoredValue,sourceOrder:Object.freeze([n,a,m.order,g])}));o.set(p,f)}}let s=[...o.entries()].sort(([a],[l])=>a-l).map(([a,l])=>Object.freeze({offset:a,declarations:Object.freeze([...l.values()]),properties:Ff([...l].map(([c,u])=>[c,u.value]))}));return Object.freeze({keyframesId:i,stylesheetSourceNodeId:e.sourceNodeId,name:r,sourceOrder:n,stops:Object.freeze(s)})}function AP(t,e,n,r){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:t.source,entrypoint:t.entrypoint,capability:"styles",sourceNodeId:e.sourceNodeId,sourceId:E(e,"id")??void 0,elementName:e.name,documentPath:n.index.sourcePath(e.sourceNodeId),message:r})}function Rb(t,e){return t.matchesMedia(e)===!0}function NP(t,e){return t.supportsCondition(e)===!0}function Tb(t,e,n){let r=Number(t.declaration.important)-Number(e.declaration.important);if(r!==0)return r;let i=l=>l.declaration.important?l.layerRank===null?-1:n-l.layerRank:l.layerRank===null?n+1:l.layerRank,o=i(t)-i(e);if(o!==0)return o;let s=t.originRank-e.originRank;return s!==0?s:Eb(t.declaration.specificity,e.declaration.specificity)||zf(t.declaration.sourceOrder,e.declaration.sourceOrder)}function MP(t){let e=null,n=!1,r=0;for(let i=0;i<t.length;i++){let o=t[i];if(e){n?n=!1:o==="\\"?n=!0:o===e&&(e=null);continue}if(o==='"'||o==="'")e=o;else if(o==="(")r++;else if(o===")")r=Math.max(0,r-1);else if(o===","&&r===0)return i}return-1}function gr(t,e,n=new Set){let r=cn(t);if(r.length===0)return t.trim();let i=t;for(let o of[...r].reverse()){let s=t.slice(o.argumentsStart,o.argumentsEnd),a;if(o.name==="var"){let l=MP(s),c=(l<0?s:s.slice(0,l)).trim(),u=l<0?null:s.slice(l+1).trim();if(!c.startsWith("--")||n.has(c))a=u?gr(u,e,n):null;else{let d=e[c];if(d===void 0)a=u?gr(u,e,n):null;else{let p=new Set(n);p.add(c),a=gr(d,e,p),a===null&&u&&(a=gr(u,e,n))}}}else{let l=gr(s,e,n);a=l===null?null:`${t.slice(o.tokenStart,o.argumentsStart)}${l})`}if(a===null)return null;i=`${i.slice(0,o.tokenStart)}${a}${i.slice(o.tokenEnd)}`}return i.trim()}function Ff(t){return Object.freeze(Object.fromEntries(t))}function yc(t,e,n){let r=[],i=hP(t,e),o=SP(n.environment),s=[],a=[],l=[],c=[],u=new Map,d=0,p=0,f=0,g=w=>{let $=u.get(w);if($!==void 0)return $;let R=u.size;return u.set(w,R),R},m=(w,$,R,C)=>{for(let A of w){if(A.type==="Atrule"){let K=A.name?.toLowerCase();if(K==="keyframes"){let X=EP(A,$,f++);X&&(l.push(X),$.keyframesIds.push(X.keyframesId));continue}if(K==="namespace"){let X=kP(A);X&&R.set(X.prefix,X.uri);continue}if(K==="layer"){let X=RP(A);if(!A.block){for(let q of X)g(q);continue}let z=X[0]??`__anonymous_${d++}`,G=C?`${C}.${z}`:z;g(G),m(Rn(A.block),$,new Map(R),G);continue}if(K==="media"){let X=hr(A.prelude).trim();A.block&&Rb(n.environment,X)&&m(Rn(A.block),$,new Map(R),C);continue}if(K==="supports"){let X=hr(A.prelude).trim();A.block&&NP(n.environment,X)&&m(Rn(A.block),$,new Map(R),C);continue}continue}if(A.type!=="Rule"||!A.prelude||!A.block)continue;let D=hr(A.prelude).trim(),_=bP(D,R,o);if(!_)continue;let O=`${$.sourceNodeId}:rule:${p}`,L=Rn(A.block).filter(K=>K.type==="Declaration").map(K=>hr(K)).join(";"),re=C===null?null:g(C),ee=gc(L,{sourceNodeId:$.sourceNodeId,origin:"stylesheet",ruleId:O,sourceOrder:[$.sourceNodeId===t.root.sourceNodeId?-1:p,p],layerRank:re}),F=ee.templates.map(K=>Of(K,"",Es(_.map(X=>X.specificity)))),V=Object.freeze({ruleId:O,stylesheetSourceNodeId:$.sourceNodeId,selectorText:D,specificities:Object.freeze(_.map(K=>K.specificity)),layer:C,declarations:Object.freeze(F)});a.push(V),c.push(Object.freeze({plan:V,selectors:_,templates:ee.templates})),$.ruleIds.push(O),p++}};for(let w of t.index.elements){if(w.namespaceUri!==U||w.localName.toLowerCase()!=="style")continue;let $=gP(w),R=E(w,"type"),C=E(w,"media"),A=R===null||R.trim()===""||R.trim().toLowerCase()==="text/css",D=C===null||C.trim()===""||Rb(n.environment,C),_=[],O=[],L={sourceNodeId:w.sourceNodeId,authoredText:$,id:E(w,"id"),type:R,media:C,title:E(w,"title"),applicable:A&&D,ruleIds:_,keyframesIds:O};if(s.push(L),!L.applicable){Object.freeze(_),Object.freeze(O),Object.freeze(L);continue}try{let re=(0,ii.parse)($,{positions:!0});m(Rn(re),L,new Map,null)}catch{r.push(AP(n,w,t,"The SVG style element contains malformed CSS."))}Object.freeze(_),Object.freeze(O),Object.freeze(L)}let h=new Map;for(let w of l)h.set(w.name,w);let b=new Map,S=new Map,v=w=>{let $=b.get(w.occurrence.occurrenceId);if($)return $;let R=w.parent?v(w.parent):null,C=new Map,A=[],D=[],_=(z,G,q)=>{let te=Of(z,w.occurrence.occurrenceId,G);A.push(te);let ie=C.get(te.propertyName)??[];ie.push({declaration:te,layerRank:z.layerRank,originRank:q}),C.set(te.propertyName,ie)};for(let[z,G]of w.element.attributes.entries()){if(G.namespaceUri!==null||!mr(G.localName))continue;let q={sourceNodeId:w.element.sourceNodeId,origin:"presentation",ruleId:null,sourceOrder:[w.element.elementOrder,-2,z],layerRank:null},te=gc(`${G.localName}:${G.value}`,q).templates,ie=G.localName==="font-size"?nt(G.value):null;te.length===0&&ie?.unit===""&&ie.value>=0&&(te=gc(`font-size:${ie.value}px`,q).templates.map(J=>Object.freeze({...J,value:G.value,authoredValue:G.value})));for(let J of te)J.important||_(J,Ji,0)}for(let z of c){let G=z.selectors.filter(te=>te.matches(w));if(G.length===0)continue;D.push(z.plan.ruleId);let q=Es(G.map(te=>te.specificity));for(let te of z.templates)_(te,q,1)}let O=E(w.element,"style");if(O!==null){let z=gc(O,{sourceNodeId:w.element.sourceNodeId,origin:"style-attribute",ruleId:null,sourceOrder:[w.element.elementOrder,Number.MAX_SAFE_INTEGER],layerRank:null});S.set(w.occurrence.occurrenceId,z.raw);for(let G of z.templates)_(G,Ji,2)}let L=new Map,re=new Map;for(let[z,G]of C){G.sort((te,ie)=>Tb(te,ie,u.size)),L.set(z,G[G.length-1].declaration);let q=G.filter(te=>te.declaration.origin==="stylesheet");q.length>0&&re.set(z,q[q.length-1].declaration)}let ee={...R?.customProperties??{}};for(let[z,G]of L){if(!z.startsWith("--"))continue;let q=G.value.trim().toLowerCase();q==="inherit"||q==="unset"?R?.customProperties[z]===void 0?delete ee[z]:ee[z]=R.customProperties[z]:q==="initial"||q==="revert"||q==="revert-layer"?delete ee[z]:ee[z]=G.value}let F={},V={},K=new Set([...$s,...[...L.keys()].filter(z=>!z.startsWith("--"))]);for(let z of K){let G=mr(z),q=L.get(z),te=R?.resolvedValues[z],ie=G?.initialValue,J;if(q){let Le=q.value.trim().toLowerCase();Le==="inherit"?J=te??ie:Le==="initial"||Le==="revert"||Le==="revert-layer"?J=ie:Le==="unset"?J=G?.inherited?te??ie:ie:J=q.value}else G?.inherited?J=te??ie:J=ie;if(J===void 0)continue;F[z]=J;let ke=gr(J,ee);ke===null&&(ke=G?.inherited?te??ie??null:ie??null),ke!==null&&(ke.trim().toLowerCase()==="currentcolor"&&(ke=z==="color"?R?.resolvedValues.color??"black":V.color??R?.resolvedValues.color??"black"),V[z]=ke)}let X=Object.freeze({occurrenceId:w.occurrence.occurrenceId,correspondingSourceNodeId:w.occurrence.correspondingSourceNodeId,matchedRuleIds:Object.freeze(D),declarations:Object.freeze(A),cascadedValues:Ff(L),stylesheetCascadedValues:Ff(re),specifiedValues:Object.freeze(F),resolvedValues:Object.freeze(V),customProperties:Object.freeze(ee),inlineDeclarations:S.get(w.occurrence.occurrenceId)??Object.freeze({})});return b.set(w.occurrence.occurrenceId,X),X};for(let w of i.byOccurrenceId.values())v(w);let I=Object.freeze(e.occurrences.map(w=>b.get(w.occurrenceId)).filter(w=>w!==void 0)),x=new Map;for(let w of e.occurrences){if(w.usePath.length!==0)continue;let $=b.get(w.occurrenceId);$&&x.set(w.correspondingSourceNodeId,$)}let P=[];for(let w of I)for(let[$,R]of Object.entries(w.resolvedValues)){if(!fP.has($)||!R.toLowerCase().includes("url("))continue;let C=w.cascadedValues[$];P.push(Object.freeze({fromSourceNodeId:w.correspondingSourceNodeId,occurrenceId:w.occurrenceId,propertyName:$,value:R,origin:C?C.origin==="style-attribute"?"inline-style":"matched-stylesheet":"inherited-stylesheet"}))}let T=(w,$)=>{let R=i.byOccurrenceId.get(w);if(!R)return Object.freeze({});let C={...R,attributeOverrides:Object.freeze({class:$})},A=new Map;for(let F of c){let V=F.selectors.filter(X=>X.matches(C));if(V.length===0)continue;let K=Es(V.map(X=>X.specificity));for(let X of F.templates){let z=Of(X,w,K),G=A.get(z.propertyName)??[];G.push({declaration:z,layerRank:X.layerRank,originRank:1}),A.set(z.propertyName,G)}}let D=new Map;for(let[F,V]of A)V.sort((K,X)=>Tb(K,X,u.size)),D.set(F,V[V.length-1].declaration);let _=R.parent?b.get(R.parent.occurrence.occurrenceId):null,O={..._?.customProperties??{}};for(let[F,V]of D){if(!F.startsWith("--"))continue;let K=V.value.trim().toLowerCase();if(K==="inherit"||K==="unset"){let X=_?.customProperties[F];X===void 0?delete O[F]:O[F]=X}else K==="initial"||K==="revert"||K==="revert-layer"?delete O[F]:O[F]=V.value}let L={},re=D.get("color"),ee=re?gr(re.value,O):_?.resolvedValues.color??"black";for(let[F,V]of D){if(F.startsWith("--"))continue;let K=gr(V.value,O);K!==null&&(K.trim().toLowerCase()==="currentcolor"&&(K=ee??"black"),L[F]=K)}return Object.freeze(L)},k=Object.freeze({stylesheets:Object.freeze(s),rules:Object.freeze(a),keyframes:Object.freeze(l),elements:I,appliedResourceDeclarations:Object.freeze(P),keyframesRule:w=>h.get(w)??null,ownStyle:w=>x.get(w)??null,style:w=>b.get(w)??null,value:(w,$)=>b.get(w)?.resolvedValues[$.toLowerCase()]??null,stylesheetValuesWithClass:T});return Object.freeze({value:k,diagnostics:Object.freeze(r)})}function Bf(t,e,n,r,i,o){if(n<=0||r<=0)return null;if(i<=0||o<=0)return`M${t},${e}h${n}v${r}h${-n}Z`;let s=t+n,a=e+r;return`M${t+i},${e}H${s-i}A${i},${o} 0 0 1 ${s},${e+o}V${a-o}A${i},${o} 0 0 1 ${s-i},${a}H${t+i}A${i},${o} 0 0 1 ${t},${a-o}V${e+o}A${i},${o} 0 0 1 ${t+i},${e}Z`}function Ob(t,e,n,r){return n<=0||r<=0?null:`M${t+n},${e}A${n},${r} 0 0 1 ${t},${e+r}A${n},${r} 0 0 1 ${t-n},${e}A${n},${r} 0 0 1 ${t},${e-r}A${n},${r} 0 0 1 ${t+n},${e}Z`}function Sc(t){let e=t.state;if(typeof e.d=="string")return e.d;let n=jt(t);if(!n)return null;switch(n.kind){case"path":return n.d||null;case"rectangle":return n.pathData??Bf(n.x,n.y,n.width,n.height,n.rx,n.ry);case"circle":return Ob(n.cx,n.cy,n.r,n.r);case"ellipse":return Ob(n.cx,n.cy,n.rx,n.ry);case"line":return`M${n.x1},${n.y1}L${n.x2},${n.y2}`;case"polyline":{if(n.points.length<2||n.points.some(i=>!Number.isFinite(i.x)||!Number.isFinite(i.y)))return null;let r=n.points.map((i,o)=>`${o===0?"M":"L"}${i.x},${i.y}`).join("");return n.closed?`${r}Z`:r}default:return null}}var OP=new Map([["animate","animate"],["animatetransform","animateTransform"],["animatemotion","animateMotion"],["set","set"],["discard","discard"]]);function DP(t){return Object.freeze(Object.fromEntries(t.attributes.map(e=>[e.name,e.value])))}function zP(t,e){return t.usePath.length!==e.usePath.length?!1:t.usePath.every((n,r)=>n.sourceReferenceId===e.usePath[r]?.sourceReferenceId)}function _P(t,e,n){return t.occurrences.find(r=>r.correspondingSourceNodeId===n&&zP(r,e))??t.direct(n)}function FP(t,e,n,r){let i=Pe(n);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 o=i.value.slice(1),s=t.index.resolveAuthoredId(o);if(!s)return{status:"missing",sourceNodeId:null,occurrenceId:null};let a=t.index.element(s.sourceNodeId);if(!a||a.namespaceUri!==U&&a.namespaceUri!==null)return{status:"invalid",sourceNodeId:s.sourceNodeId,occurrenceId:null};let l=_P(e,r,a.sourceNodeId);return{status:l?"resolved":"missing",sourceNodeId:a.sourceNodeId,occurrenceId:l?.occurrenceId??null}}function LP(t,e,n){let r=n.parentOccurrenceId?e.occurrence(n.parentOccurrenceId):null,i=r?t.index.element(r.correspondingSourceNodeId):null;return i?.localName.toLowerCase()==="textpath"&&r?.parentOccurrenceId&&(r=e.occurrence(r.parentOccurrenceId),i=r?t.index.element(r.correspondingSourceNodeId):null),i&&r?{status:"resolved",sourceNodeId:i.sourceNodeId,occurrenceId:r.occurrenceId}:{status:"missing",sourceNodeId:null,occurrenceId:null}}function BP(t,e,n,r){let i=t.index.children(n.sourceNodeId).find(d=>(d.namespaceUri===U||d.namespaceUri===null)&&d.localName.toLowerCase()==="mpath");if(!i)return{sourceNodeId:null,data:E(n,"path")};let o=Pe(i);if(!o?.value.startsWith("#")||o.value.length<=1)return{sourceNodeId:null,data:null};let s=t.index.resolveAuthoredId(o.value.slice(1)),a=s?t.index.element(s.sourceNodeId):null;if(!a)return{sourceNodeId:s?.sourceNodeId??null,data:null};if(a.localName.toLowerCase()==="path")return{sourceNodeId:a.sourceNodeId,data:E(a,"d")};let l=e.direct(a.sourceNodeId),c=l?r?.candidate(l.occurrenceId):null;if(!c||c.status!=="materialized"||!c.canonicalType)return{sourceNodeId:a.sourceNodeId,data:null};let u={id:c.occurrenceId,type:c.canonicalType,state:c.state};return{sourceNodeId:a.sourceNodeId,data:Sc(u)}}function GP(t,e,n,r){let i=[];for(let o of e.occurrences){let s=t.index.element(o.correspondingSourceNodeId);if(!s||s.namespaceUri!==U&&s.namespaceUri!==null)continue;let a=OP.get(s.localName.toLowerCase());if(!a)continue;let l=FP(t,e,s,o)??LP(t,e,o),c=DP(s),u={values:c.values,from:c.from,to:c.to,by:c.by,additive:c.additive,dur:c.dur,keyTimes:c.keyTimes,calcMode:c.calcMode,keySplines:c.keySplines,repeatCount:c.repeatCount,repeatDur:c.repeatDur,fill:c.fill},d=a==="animateMotion"?BP(t,e,s,r):null,p=l.sourceNodeId?t.index.element(l.sourceNodeId):null,f=(l.occurrenceId?n.style(l.occurrenceId)?.cascadedValues.transform?.value:void 0)??(p?E(p,"transform"):null),g=Ul(u);i.push(Object.freeze({animationId:`smil:${o.occurrenceId}`,sourceNodeId:s.sourceNodeId,occurrenceId:o.occurrenceId,kind:a,sourceAnimationId:E(s,"id"),targetStatus:l.status,targetSourceNodeId:l.sourceNodeId,targetOccurrenceId:l.occurrenceId,attributeName:E(s,"attributeName"),attributes:c,duration:Hl(u),additive:g,...a==="animateTransform"&&g==="replace"&&f!==null&&f.trim().toLowerCase()!=="none"?{replacesCarrierBase:!0}:{},fill:c.fill==="freeze"?"freeze":"remove",motionPathSourceNodeId:d?.sourceNodeId??null,motionPathData:d?.data??null}))}return Object.freeze(i)}function VP(t){let e=t.parsedEasing?Object.freeze({...t.parsedEasing,..."points"in t.parsedEasing?{points:Object.freeze([...t.parsedEasing.points])}:{}}):null;return Object.freeze({...t,parsedEasing:e})}function jP(t){let e=[];for(let n of t.elements){let r=n.resolvedValues,i=r.animation||Up(r);if(i)for(let[o,s]of os(i).entries()){let a=cl(s);if(!a){let c=ss(r["animation-name"],o);c&&c!=="none"&&(a=cl(`${s} ${c}`))}if(!a)continue;jp(a,r,o);let l=t.keyframesRule(a.name);!l||l.stops.length===0||e.push(Object.freeze({animationId:`css:${n.occurrenceId}:${o}`,sourceNodeId:n.correspondingSourceNodeId,occurrenceId:n.occurrenceId,animationIndex:o,animation:VP(a),keyframes:l}))}}return Object.freeze(e)}function Db(t){let e=new Map;for(let n of t){let r=e.get(n.occurrenceId)??[];r.push(n),e.set(n.occurrenceId,r)}for(let n of e.values())Object.freeze(n);return e}function bc(t,e,n,r){let i=GP(t,e,n,r.leafGeometry),o=jP(n),s=i.filter(u=>u.targetStatus!=="resolved").map(u=>{let d=t.index.element(u.sourceNodeId);return Object.freeze({severity:"warning",code:"unresolved-reference",source:r.source,entrypoint:r.entrypoint,capability:"smil-animation",sourceId:u.sourceAnimationId??void 0,sourceNodeId:u.sourceNodeId,occurrenceId:u.occurrenceId,elementName:d?.name,documentPath:t.index.sourcePath(u.sourceNodeId),message:`The SVG animation target is ${u.targetStatus} and cannot be materialized.`})});for(let u of o)for(let d of u.keyframes.stops){let p=d.properties.transform??d.properties["-webkit-transform"]??d.properties["-moz-transform"];if(p===void 0)continue;let f=Jp(p);f&&s.push(Object.freeze({severity:"warning",code:f==="unsupported-perspective"?"unsupported-ingest-capability":"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"css-animation",sourceNodeId:u.sourceNodeId,occurrenceId:u.occurrenceId,documentPath:t.index.sourcePath(u.sourceNodeId),message:f==="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 a=Db(i),l=Db(o),c=Object.freeze({smil:i,css:o,smilForOccurrence:u=>a.get(u)??Object.freeze([]),cssForOccurrence:u=>l.get(u)??Object.freeze([])});return Object.freeze({value:c,diagnostics:Object.freeze(s)})}var UP=new Set(["circle","ellipse","flowroot","foreignobject","image","line","path","polygon","polyline","rect","text"]),HP=Object.freeze({});function Vf(t){if(Array.isArray(t))return Object.freeze(t.map(Vf));if(t&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Vf(r);return Object.freeze(e)}return t}function WP(t){return Vf(t)}function KP(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++){let i=t[r]-e[r];if(i!==0)return i}return t.length-e.length}function XP(t,e){return KP(t.orderKey,e.orderKey)||t.productIndex-e.productIndex||t.occurrenceId.localeCompare(e.occurrenceId)}function YP(t,e,n,r,i){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"geometry",sourceId:E(n,"id")??void 0,sourceNodeId:n.sourceNodeId,occurrenceId:e.occurrenceId,elementName:n.name,documentPath:t.index.sourcePath(n.sourceNodeId),message:i})}function De(t,e,n,r,i={}){return Object.freeze({occurrenceId:t.occurrenceId,sourceNodeId:e.sourceNodeId,sourceId:E(e,"id"),elementName:e.localName,canonicalType:n,status:r,state:Object.keys(i).length===0?HP:WP(i)})}function oi(t,e,n,r){let i=t.style(e.occurrenceId);return i?.cascadedValues[r]?i.resolvedValues[r]??i.specifiedValues[r]??null:E(n,r)}function qP(t,e,n){let r=t.value(e.occurrenceId,"font-size");if(!r||r==="medium")return n.rootFontSize;let i=he(r,{percentBasis:n.rootFontSize,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.rootFontSize,rootFontSize:n.rootFontSize});return i!==void 0&&i>=0?i:n.rootFontSize}function jf(t,e,n){return{percentBasis:t==="x"?n.viewport.width:t==="y"?n.viewport.height:Math.hypot(n.viewport.width,n.viewport.height)/Math.SQRT2,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:e,rootFontSize:n.rootFontSize}}function Uf(t){if(t===null)return null;let e=/\S+/.exec(t.trim());return e?e[0].replace(/,$/,""):null}function Gf(t,e,n,r,i,o,s){return he(Uf(oi(t,e,n,r)),jf(i,o,s))}function Fb(t){if(t===null||t.trim()==="")return;let e=Number(t.trim());return Number.isFinite(e)?e:void 0}function ZP(t){if(!t)return{points:[],odd:!1};let n=(t.match(/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/g)??[]).map(Number).filter(Number.isFinite),r=n.length%2!==0,i=[];for(let o=0;o+1<n.length;o+=2)i.push({x:n[o],y:n[o+1]});return{points:i,odd:r}}function JP(t){let e=E(t,"transform");if(!e||e.trim()==="")return{rotation:0};let n=Ot(e);return Bt(n)?{rotation:0}:{transformMatrix:it(n)}}function Tn(t,e,n,r){let i=t.type===t.type.toLowerCase();return[t.params[e]+(i?n:0),t.params[e+1]+(i?r:0)]}function Lb(t){let e=[],n=0,r=0,i=0,o=0,s=0,a=0,l="",c=!1,u=!1;for(let d of t){let p=d.type.toUpperCase(),f=d.type===d.type.toLowerCase(),g=l.toUpperCase()==="Z",m=e.length;if(!(p==="B"||p==="R")){if(p==="Z"){n=i,r=o,c=!0,u||=e.length>1,l=d.type;continue}if(p==="M"){let[h,b]=Tn(d,0,n,r),S={x:h,y:b,pointType:"corner"};e.length>0&&(S.isSubpathStart=!0),e.push(S),n=i=h,r=o=b,l=d.type;continue}if(p==="H")n=d.params[0]+(f?n:0),e.push({x:n,y:r,pointType:"corner",segmentType:"HORIZONTAL"}),u=!0;else if(p==="V")r=d.params[0]+(f?r:0),e.push({x:n,y:r,pointType:"corner",segmentType:"VERTICAL"}),u=!0;else if(p==="L")[n,r]=Tn(d,0,n,r),e.push({x:n,y:r,pointType:"corner"}),u=!0;else if(p==="C"){let h=n,b=r,[S,v]=Tn(d,0,h,b),[I,x]=Tn(d,2,h,b),[P,T]=Tn(d,4,h,b),k=e.at(-1);k&&(k.pointType="smooth",k.handleOut={x:S,y:v}),e.push({x:P,y:T,handleIn:{x:I,y:x},pointType:"smooth"}),n=P,r=T,s=I,a=x,u=!0}else if(p==="S"){let h=n,b=r,[S,v]=Tn(d,0,h,b),[I,x]=Tn(d,2,h,b),P=e.at(-1);P&&(P.pointType="smooth",P.handleOut=/^[CcSs]$/.test(l)?{x:2*h-s,y:2*b-a}:{x:h,y:b}),e.push({x:I,y:x,handleIn:{x:S,y:v},pointType:"smooth",segmentType:"SMOOTH_CUBIC"}),n=I,r=x,s=S,a=v,u=!0}else if(p==="Q"||p==="T"){let h=n,b=r,S=p==="T",[v,I]=S?/^[QqTt]$/.test(l)?[2*h-s,2*b-a]:[h,b]:Tn(d,0,h,b),[x,P]=Tn(d,S?0:2,h,b),T=e.at(-1);T&&(T.pointType="smooth",T.handleOut={x:v,y:I});let k={x,y:P,pointType:"smooth",segmentType:S?"SMOOTH_QUADRATIC":"QUADRATIC"};e.push(k),n=x,r=P,s=v,a=I,u=!0}else if(p==="A"){let h=n,b=r,[S,v]=Tn(d,5,h,b),I=Math.abs(d.params[0]),x=Math.abs(d.params[1]),P={x:S,y:v,pointType:"corner"};I!==0&&x!==0&&(S!==n||v!==r)&&(P.segmentType="ARC",P.arcParams={rx:I,ry:x,rotation:d.params[2],largeArc:d.params[3]===1,sweep:d.params[4]===1}),(S!==n||v!==r)&&(e.push(P),u=!0),n=S,r=v}g&&e.length>m&&(e[m].isSubpathStart=!0),l=d.type}}return{points:e,closed:c,drawn:u}}function QP(t){return t.replace(/[\t\n\r ]+/g," ").trim()}function Bb(t){let e=[];for(let n of t.children)if(n.kind==="text"||n.kind==="cdata"){let r=QP(n.value);r&&e.push(r)}else if(n.kind==="element"){let r=Bb(n);r&&e.push(r)}return e.join(" ")}function eC(t,e){return t.usePath.length!==e.usePath.length?!1:t.usePath.every((n,r)=>n.sourceReferenceId===e.usePath[r]?.sourceReferenceId)}function tC(t,e,n){return t.occurrences.find(r=>r.correspondingSourceNodeId===n&&eC(r,e))??t.direct(n)}function nC(t,e){let n=e;for(;n;){let r=n.attributes.find(i=>i.prefix==="xml"&&i.localName==="space")?.value;if(r)return r;n=t.index.parent(n.sourceNodeId)}return null}function rC(t,e,n,r){let i=r.style(n.occurrenceId)?.cascadedValues["white-space"]?r.value(n.occurrenceId,"white-space"):null;return i==="pre"||i==="pre-wrap"||i==="pre-line"?{mode:"preserve-newlines",authored:i}:nC(t,e)==="preserve"?{mode:"preserve-spaces",authored:null}:{mode:"collapse",authored:i==="normal"?"normal":null}}function xc(t,e){return e==="preserve-newlines"?t.replace(/\r\n?/g,`
10
+ `):e==="preserve-spaces"?t.replace(/\r?\n[ \t\r]*/g,""):t.replace(/[ \t\r\n]+/g," ")}function As(t,e){return t.children.map(n=>n.kind==="text"||n.kind==="cdata"?xc(n.value,e):n.kind==="element"?As(n,e):"").join("")}function iC(t,e,n){let r=e;for(;r&&r.sourceNodeId!==t.root.sourceNodeId;){if(r.localName.toLowerCase()==="svg"){let i=Ue(E(r,"viewBox")??"");if(i&&i.width>0&&i.height>0)return{width:i.width,height:i.height}}r=t.index.parent(r.sourceNodeId)}return n.viewport}function Wf(t,e,n){return t.attributes.find(r=>r.prefix===e&&r.localName===n)?.value??null}function vt(t,e,n,r,i,o=r*.5){let s=pl(t).at(0);if(s)return jn(s,{percentBasis:e==="x"?n.width:n.height,viewportWidth:n.width,viewportHeight:n.height,fontSize:r,rootFontSize:i,xHeight:o})}function oC(t,e,n,r,i,o){let s=t.children.filter(S=>S.kind==="element"&&S.localName.toLowerCase()==="tspan"),a=S=>xc(S,e);if(s.length===0){let S=a(As(t,e));e==="collapse"&&(S=S.replace(/ {2,}/g," ").replace(/^ +| +$/g,""));let v=S.split(`
11
+ `).map(I=>({text:I,x:0,dy:0}));return{text:S,lines:v,linePositions:null}}let l=.001,c=vt(E(t,"x"),"x",n,r,i,o)??0,u=vt(E(t,"y"),"y",n,r,i,o)??null,d=[],p=!1,f=(S,v)=>{if(e!=="collapse")return S;let I=S.replace(/ {2,}/g," ");return v&&(I=I.replace(/^ +/,"")),I.replace(/ +$/,"")},g=(S,v,I,x)=>{if(!S)return;let P=I===null?0:(vt(I,"x",n,r,i,o)??c)-c,T=e==="preserve-newlines"?S.split(`
12
+ `):[S];for(let k=0;k<T.length;k++){let w=T[k],$=k>0,R=k===0&&v||$;!w&&!$||(R&&p?d.push({text:w,x:k===0?P:0,dy:k===0?x:0}):p?d[d.length-1].text+=w:d.push({text:w,x:k===0?P:0,dy:0}),w&&(p=!0))}},m=S=>{let v=E(S,"x");if(Wf(S,"sodipodi","role")==="line"){let T=vt(E(S,"y"),"y",n,r,i,o),k=T!==void 0&&u!==null&&Math.abs(T-u)>.5?T-u:0;return{brk:!0,x:v,dy:k}}let x=E(S,"dy");if(x!==null){let T=vt(x,"y",n,r,i,o)??0;if(T>l||T<-l&&v!==null)return{brk:!0,x:v,dy:T}}let P=vt(E(S,"y"),"y",n,r,i,o);if(P!==void 0&&u!==null&&Math.abs(P-u)>.5)return{brk:!0,x:v,dy:P-u};if(v!==null&&p){let T=vt(v,"x",n,r,i,o);if(T!==void 0&&T<=c+.5)return{brk:!0,x:v,dy:0}}return{brk:!1,x:null,dy:0}},h=(S,v)=>{let I=!1;for(let x of S.children){if(x.kind==="text"||x.kind==="cdata"){let $=a(x.value);if(!$)continue;if(e!=="preserve-newlines"&&/^ +$/.test($)){if(p&&d.length>0){let C=d[d.length-1].text;e==="collapse"?C.endsWith(" ")||(d[d.length-1].text+=" "):d[d.length-1].text+=$}continue}let R=v.active&&!I;g($,R,R?v.x:null,R?v.dy:0),I=!0;continue}if(x.kind!=="element"||x.localName.toLowerCase()!=="tspan")continue;let P=m(x),T=vt(E(x,"y"),"y",n,r,i,o);T!==void 0&&(u=T);let k={active:v.active&&!I||P.brk,x:P.brk?P.x:v.active&&!I?v.x:null,dy:P.brk?P.dy:v.active&&!I?v.dy:0};x.children.some($=>$.kind==="element"&&$.localName.toLowerCase()==="tspan")?h(x,k):g(a(As(x,e)),k.active,k.x,k.dy),I=!0}};h(t,{active:!1,x:null,dy:0});for(let S=0;S<d.length;S++)d[S].text=f(d[S].text,S===0);let b=d.some((S,v)=>v>0&&Math.abs(S.dy)>l||Math.abs(S.x)>l)?d.map(S=>({x:S.x,dy:S.dy})):null;return{text:d.map(S=>S.text).join(`
13
+ `),lines:d,linePositions:b}}function Gb(t){return t&&t.split(",").map(n=>n.trim().replace(/^['"]|['"]$/g,"").trim()).filter(Boolean).join(", ")||null}function sC(t,e,n,r,i,o){let s=Qi(t,e,n,"font-size"),a=Mt(s);return a!==void 0&&a>=0?a:r}function zb(t,e,n,r){let i=n;for(;i;){if(t.style(i.occurrenceId)?.cascadedValues[r])return!0;i=i.parentOccurrenceId?e.occurrence(i.parentOccurrenceId)??void 0:void 0}return!1}function Qi(t,e,n,r){let i=E(n,r),o=t.style(e.occurrenceId),s=o?.cascadedValues[r];return s?o?.specifiedValues[r]??s.value:i!==null?i:o?.resolvedValues[r]??null}function Vb(t){if(!t)return 400;if(t==="normal"||t==="bold")return t;let e=Number(t);return Number.isFinite(e)?e:400}function aC(t){let e=Vb(t);return e===400||e==="normal"?"normal":e===700||e==="bold"?"bold":e}function _b(t,e,n){let r=k=>e?t.value(e.occurrenceId,k):null,i=r("text-decoration")?.toLowerCase()??"",o=Gb(r("font-family"))??"Arial",s=r("font-style"),a=s==="italic"||s==="oblique"?s:"normal",l=r("line-height"),c=l?Number(l):NaN,u=r("fill"),d=(k,w)=>Mt(r(k))??w,p=r("font-variant")??"",f=r("baseline-shift"),g=f?Mt(f):void 0,m=f==="baseline"||f==="super"||f==="sub"?f:g??"baseline",h=r("dominant-baseline"),b=new Set(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),S=r("writing-mode"),v=S==="tb"||S==="tb-rl"?"vertical-rl":S==="lr"||S==="lr-tb"||S==="rl"||S==="rl-tb"?"horizontal-tb":S,I=r("direction"),x=r("unicode-bidi"),P=r("text-anchor"),T=r("text-transform");return{..._r,textDecoration:{underline:i.includes("underline"),strikethrough:i.includes("line-through"),overline:i.includes("overline")},fontVariationSettings:{},fontFamily:o,fontSize:n,fontWeight:aC(r("font-weight")),fontStyle:a,fontVariant:p,fontVariantLigatures:r("font-variant-ligatures")??"",fontVariantPosition:r("font-variant-position")??"",fontVariantCaps:r("font-variant-caps")??"",fontVariantNumeric:r("font-variant-numeric")??"",fontVariantEastAsian:r("font-variant-east-asian")??"",fill:!u||u.toLowerCase()==="black"?"#000000":u,stroke:r("stroke")??"none",lineHeight:Number.isFinite(c)?c:1.2,textTransform:T==="capitalize"||T==="uppercase"||T==="lowercase"?T:"none",baselineShift:m,dominantBaseline:b.has(h)?h:"auto",writingMode:v==="vertical-rl"||v==="vertical-lr"?v:"horizontal-tb",whiteSpace:r("white-space")==="pre"||r("white-space")==="pre-wrap"||r("white-space")==="pre-line"||r("white-space")==="nowrap"||r("white-space")==="break-spaces"?r("white-space"):"normal",direction:I==="rtl"?"rtl":"ltr",unicodeBidi:x==="embed"||x==="bidi-override"||x==="isolate"||x==="isolate-override"||x==="plaintext"?x:"normal",textAnchor:P==="middle"||P==="end"?P:"start",letterSpacing:d("letter-spacing",0),wordSpacing:d("word-spacing",0),fillOpacity:Number(r("fill-opacity")??1),strokeWidth:d("stroke-width",0),strokeOpacity:Number(r("stroke-opacity")??1)}}function lC(t,e,n,r,i,o){let s=t.style(e.occurrenceId)?.cascadedValues["font-size"];if(!s)return n;let a=s.value.trim().toLowerCase();if(a==="inherit"||a==="unset")return n;if(a==="initial"||a==="revert"||a==="revert-layer"||a==="medium")return o;let l=t.value(e.occurrenceId,"font-size"),c=he(l,{percentBasis:n,viewportWidth:i.width,viewportHeight:i.height,fontSize:n,rootFontSize:o,xHeight:r});return c!==void 0&&c>=0?c:n}function cC(t,e,n,r,i){let o=i?.measureXHeight(t.fontFamily,e);return o!==void 0&&Number.isFinite(o)&&o>=0?o:n>0?r*(e/n):e*.5}function dC(t){return Hf(t).filter(e=>e.localName.toLowerCase()==="tspan"&&!e.children.some(n=>n.kind==="element"&&n.localName.toLowerCase()==="tspan"))}function vc(t,e,n,r,i,o){return t?pl(t).map(s=>({value:jn(s,{percentBasis:e==="x"?n.width:n.height,viewportWidth:n.width,viewportHeight:n.height,fontSize:r,rootFontSize:i,xHeight:o})??null,raw:s.unit===""||s.unit==="px"?null:`${s.value}${s.unit}`})):[]}function uC(t){if(!t)return[];let e=t.trim().split(/[\s,]+/).filter(Boolean),n=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;return e.every(r=>n.test(r))?e.map(Number):[]}function pC(t,e,n,r,i,o,s){let a=dC(t),l=a.length>0?a:[t],c=Array.from(e,()=>({x:null,y:null,dx:0,dy:0,rotate:0})),u=0,d=!1;for(let p of l){let f=xc(As(p,n),n),g=a.length>0?Math.max(u,e.indexOf(f,u)):0,m=vc(E(p,"dx"),"x",r,i,o,s),h=vc(E(p,"dy"),"y",r,i,o,s),b=vc(E(p,"x"),"x",r,i,o,s),S=vc(E(p,"y"),"y",r,i,o,s),v=uC(E(p,"rotate")),I=v.at(-1)??0,x=m.length>1||h.length>1||b.length>1||S.length>1||v.length>1,P=Wf(p,"sodipodi","role")==="line",T=h[0]?.value,k=a.length>0&&!x&&(P||T!=null&&(T>.001||T<-.001&&E(p,"x")!==null));for(let w=0;w<f.length&&g+w<c.length;w++){let $=c[g+w],R=a.length===0,C=k?null:R?w>0?b[w]?.value??null:null:x?b[w]?.value??null:w===0?b[0]?.value??null:null,A=k?null:R?w>0?S[w]?.value??null:null:x?S[w]?.value??null:w===0?S[0]?.value??null:null,D=k?0:x?m[w]?.value??0:w===0?m[0]?.value??0:0,_=k?0:x?h[w]?.value??0:w===0?h[0]?.value??0:0,O=v[w]??I;Object.assign($,{x:C,y:A,dx:D,dy:_,rotate:O});let L={},re=R&&w===0?null:x?b[w]?.raw:w===0?b[0]?.raw:null,ee=R&&w===0?null:x?S[w]?.raw:w===0?S[0]?.raw:null,F=x?m[w]?.raw:w===0?m[0]?.raw:null,V=x?h[w]?.raw:w===0?h[0]?.raw:null;!k&&re&&(L.x=re),!k&&ee&&(L.y=ee),!k&&F&&(L.dx=F),!k&&V&&(L.dy=V),Object.keys(L).length>0&&($.raw=L),(C!==null||A!==null||D!==0||_!==0||O!==0)&&(d=!0)}u=Math.max(u,g+f.length)}return d?c:null}function fC(t,e,n){let r=e.children.find(m=>m.kind==="element"&&m.localName.toLowerCase()==="textpath");if(!r)return{isTextPath:!1};let i={isTextPath:!1},o=E(r,"side");o==="right"&&(i.textPathSide=o);let s=E(r,"method");(s==="align"||s==="stretch")&&(i.textPathMethod=s);let a=E(r,"spacing");(a==="auto"||a==="exact")&&(i.textPathSpacing=a);let l=E(r,"startOffset");if(l){let m=Number.parseFloat(l);Number.isFinite(m)&&(i.textPathStartOffset=m,i.textPathStartOffsetUnit=l.trim().endsWith("%")?"%":"user")}let c=E(r,"lengthAdjust");(c==="spacing"||c==="spacingAndGlyphs")&&(i.textPathLengthAdjust=c);let u=E(r,"textLength");if(u){let m=Number.parseFloat(u);Number.isFinite(m)&&m>=0&&(i.textPathLength=m,i.textPathLengthUnit=u.trim().endsWith("%")?"%":"user")}let d=E(r,"path");d&&(i.textPathInlineFormat="path-attr");let p=null;if(!d){let m=Pe(r)?.value;if(!m){let h=r.children.find(b=>b.kind==="element"&&b.localName.toLowerCase()==="mpath");m=h?Pe(h)?.value:void 0}if(m?.startsWith("#")){i.textPathImportRefId=m.slice(1);let h=t.index.resolveAuthoredId(m.slice(1));p=h?t.index.element(h.sourceNodeId):null,d=p?E(p,"d"):null}}if(!d)return i;let f=Lb(Hn(d).commands);if(f.points.length<2)return i;i.isTextPath=!0,i.textPathPoints=f.points;let g=Fb(p?E(p,"pathLength"):null);return g!==void 0&&g>=0&&(i.textPathPathLength=g),i.x=-n/2,i.y=-n/2,i}function mC(t,e,n,r,i,o,s,a,l,c,u,d){if(!t.children.some(k=>k.kind==="element"&&k.localName.toLowerCase()==="tspan"))return null;let f=_b(r,e,s),g=[{segments:[]}],m=!1,h=!1,b=vt(E(t,"y"),"y",l,s,c,u)??null,S=vt(E(t,"x"),"x",l,s,c,u)??0,v=k=>xc(k,o),I=(k,w,$)=>{if(!k)return;let R=o==="preserve-newlines"?k.split(`
14
+ `):[k];for(let C=0;C<R.length;C++){let A=R[C],D=C>0;if(!A&&!D)continue;let _={text:A,style:$i(f,w)};(C===0&&$||D)&&m?g.push({segments:[_]}):g[g.length-1].segments.push(_),A&&(m=!0),Fn(w,f)||(h=!0)}},x=(k,w,$)=>{if(Wf(k,"sodipodi","role")==="line")return!0;let R=E(k,"x"),C=E(k,"dy");if(C!==null){let D=vt(C,"y",l,w,c,$)??0;if(D>.001||D<-.001&&R!==null)return!0}let A=vt(E(k,"y"),"y",l,w,c,$);if(A!==void 0&&b!==null&&Math.abs(A-b)>.5)return!0;if(R!==null&&m){let D=vt(R,"x",l,w,c,$);if(D!==void 0&&D<=S+.5)return!0}return!1},P=(k,w,$,R,C)=>{let A=!1;for(let D of k.children){if(D.kind==="text"||D.kind==="cdata"){let X=v(D.value);if(!X)continue;if(o!=="preserve-newlines"&&/^ +$/.test(X)){if(m){let z=g.at(-1)?.segments.at(-1);z&&(o==="collapse"?z.text.endsWith(" ")||(z.text+=" "):z.text+=X)}continue}I(X,w,$&&!A),A=!0;continue}if(D.kind!=="element"||D.localName.toLowerCase()!=="tspan")continue;let _=tC(n,e,D.sourceNodeId),O=_?lC(r,_,R,C,l,c):R,L=_?_b(r,_,O):w,re=cC(L,O,R,C,d),ee=x(D,O,re),F=vt(E(D,"y"),"y",l,O,c,re);F!==void 0&&(b=F);let V=$&&!A||ee;D.children.some(X=>X.kind==="element"&&X.localName.toLowerCase()==="tspan")?P(D,L,V,O,re):I(v(As(D,o)),L,V),A=!0}};if(P(t,f,!1,s,u),o==="collapse")for(let k=0;k<g.length;k++){let w=g[k],$=!1;for(let C of w.segments)C.text=C.text.replace(/ {2,}/g," "),$&&C.text.startsWith(" ")&&(C.text=C.text.slice(1)),$=C.text.endsWith(" ");if(k===0){let C=w.segments.find(A=>A.text.length>0);C&&(C.text=C.text.replace(/^ +/,""))}let R=[...w.segments].reverse().find(C=>C.text.length>0);R&&(R.text=R.text.replace(/ +$/,"")),w.segments=w.segments.filter(C=>C.text.length>0)}return!h||g.map(k=>k.segments.map(w=>w.text).join("")).join(`
15
+ `)!==i?null:{lines:g,baseStyle:f,lineHeight:a}}function Hf(t){let e=[],n=r=>{for(let i of r)i.kind==="element"&&(e.push(i),n(i.children))};return n(t.children),e}function gC(t,e){let n=t.index.parent(e.sourceNodeId);for(;n;){if(n.localName.toLowerCase()==="flowroot")return!0;n=t.index.parent(n.sourceNodeId)}return!1}var hC=[["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 yC(t,e,n){let r={},i=T=>Qi(t,e,n,T);for(let[T,k]of hC){let w=i(k);w&&w.trim()&&(r[T]=w.trim())}let o=i("text-decoration")??i("text-decoration-line");if(o&&o!=="none"){let T=o.toLowerCase();r.textDecoration={underline:T.includes("underline"),strikethrough:T.includes("line-through"),overline:T.includes("overline")}}let s=i("text-anchor"),a=i("text-align");s==="middle"||s==="end"?r.textAnchor=s:a==="center"?r.textAnchor="middle":a==="end"||a==="right"?r.textAnchor="end":(a==="justify"||s==="start")&&(r.textAnchor="start");let l=T=>{let k=i(T);if(k!=="normal")return Mt(k)},c=l("letter-spacing");c!==void 0&&(r.letterSpacing=c);let u=l("word-spacing");u!==void 0&&(r.wordSpacing=u);let d=i("text-transform");d&&(r.textTransform=d.trim());let p=i("baseline-shift");p&&(r.baselineShift=p.trim());let f=i("dominant-baseline");f&&(r.dominantBaseline=f.trim());let g=i("writing-mode");g&&(r.writingMode=g==="tb"||g==="tb-rl"?"vertical-rl":g==="vertical-lr"?"vertical-lr":"horizontal-tb");let m=Number.parseFloat(i("inline-size")??"");Number.isFinite(m)&&m>0&&(r.inlineSize=m);let b=i("shape-inside")?.match(/url\(\s*#([^)]+)\s*\)/)?.[1];b&&(r.shapeInsideImportRefId=b);let S=Number.parseFloat(i("shape-padding")??"");Number.isFinite(S)&&S>0&&(r.shapePadding=S);let v=i("overflow-wrap");(v==="break-word"||v==="anywhere")&&(r.overflowWrap=v);let I=i("direction");(I==="ltr"||I==="rtl")&&(r.textDirection=I);let x=i("unicode-bidi");(x==="normal"||x==="embed"||x==="bidi-override"||x==="isolate"||x==="isolate-override"||x==="plaintext")&&(r.unicodeBidi=x);let P=i("font-variation-settings");if(P&&P!=="normal"){let T={};for(let k of P.split(",")){let w=k.trim().match(/^['"](\w{4})['"]\s+([\d.eE+-]+)$/);if(!w)continue;let $=Number(w[2]);Number.isFinite($)&&(T[w[1]]=$)}Object.keys(T).length>0&&(r.fontVariationSettings=T)}return r}function SC(t,e,n,r,i,o,s){let a=n.localName.toLowerCase(),l=qP(i,e,o),c=(g,m)=>Gf(i,e,n,g,m,l,o),u=g=>{s.push(YP(t,e,n,o,g))},d=JP(n),p=Fb(E(n,"pathLength")),f=g=>(p===void 0||(p<0?u("Path length must not be negative."):g.pathLength=p),g);if(a==="rect"){let g=c("x","x")??0,m=c("y","y")??0,h=c("width","x")??0,b=c("height","y")??0;if(h<0||b<0)return u("Rectangle width and height must not be negative."),De(e,n,null,"invalid");if(h===0||b===0)return De(e,n,null,"empty");let S=c("rx","x"),v=c("ry","y");(S!==void 0&&S<0||v!==void 0&&v<0)&&u("Rectangle corner radii must not be negative.");let I=S!==void 0&&S>=0,x=v!==void 0&&v>=0,P=Math.min(I?S:x?v:0,h/2),T=Math.min(x?v:I?S:0,b/2),k=f({x:g,y:m,width:h,height:b,rx:P,ry:T,cornerRadius:0});(P>0||T>0)&&Math.abs(P-T)<=1e-6&&(k.cornerRadius=P),Object.assign(k,d);let w=n.children.some(R=>R.kind==="element"&&["animate","set"].includes(R.localName.toLowerCase())&&["x","y","width","height","rx","ry"].includes(E(R,"attributeName")??"")),$=Math.abs(h-b)<=1e-6&&Math.abs(P-T)<=1e-6&&!w?"square":"rectangle";return De(e,n,$,"materialized",k)}if(a==="circle"){let g=c("cx","x")??0,m=c("cy","y")??0,h=c("r","radius")??0;return h<0?(u("Circle radius must not be negative."),De(e,n,null,"invalid")):h===0?De(e,n,null,"empty"):De(e,n,"circle","materialized",f({x:g,y:m,radius:h,...d}))}if(a==="ellipse"){let g=c("cx","x")??0,m=c("cy","y")??0,h=c("rx","x"),b=c("ry","y");(h!==void 0&&h<0||b!==void 0&&b<0)&&u("Ellipse radii must not be negative.");let S=h!==void 0&&h>=0,v=b!==void 0&&b>=0,I=S?h:v?b:0,x=v?b:S?h:0;return I===0||x===0?De(e,n,null,"empty"):Math.abs(I-x)<=1e-6?De(e,n,"circle","materialized",f({x:g,y:m,radius:I,...d})):De(e,n,"ellipse","materialized",f({x:g,y:m,rx:I,ry:x,...d}))}if(a==="line"){let g={x1:c("x1","x")??0,y1:c("y1","y")??0,x2:c("x2","x")??0,y2:c("y2","y")??0};return f(g),Object.assign(g,d),De(e,n,"line","materialized",g)}if(a==="polyline"||a==="polygon"){let g=ZP(E(n,"points"));if(g.odd&&u("The final unpaired polygon coordinate was ignored."),g.points.length===0)return De(e,n,"polyline","materialized",f({x:0,y:0,width:0,height:0,polylinePoints:[],polylineClosed:a==="polygon",...d}));let m=g.points.map(v=>v.x),h=g.points.map(v=>v.y),b=Math.min(...m),S=Math.min(...h);return De(e,n,"polyline","materialized",f({x:b,y:S,width:Math.max(...m)-b,height:Math.max(...h)-S,polylinePoints:g.points,polylineClosed:a==="polygon",...d}))}if(a==="path"){let g=oi(i,e,n,"d")??"",m=/^path\(\s*(["'])([\s\S]*)\1\s*\)$/i.exec(g.trim()),h=m?m[2]:g;if(!h||h.trim().toLowerCase()==="none"){let $=n.children.find(R=>R.kind==="element"&&["animate","set"].includes(R.localName.toLowerCase())&&E(R,"attributeName")==="d");$&&(h=E($,"from")??E($,"to")??"")}let b=Hn(h);b.error&&u(`Invalid path data: ${b.error.message}.`);let S=Lb(b.commands),v=["marker","marker-start","marker-mid","marker-end"].some($=>{let R=oi(i,e,n,$)?.trim().toLowerCase();return R!=null&&R!==""&&R!=="none"}),I=oi(i,e,n,"stroke-linecap")?.trim(),x=oi(i,e,n,"stroke")?.trim().toLowerCase(),P=Gf(i,e,n,"stroke-width","radius",l,o),T=(I==="round"||I==="square")&&x!==void 0&&x!==null&&x!==""&&x!=="none"&&(P??1)>0;if(!S.drawn&&!(S.points.length>0&&(v||T)))return De(e,n,null,"empty");let k=en(h);if(!k)return De(e,n,null,"empty");let w={x:k.minX,y:k.minY,width:k.maxX-k.minX,height:k.maxY-k.minY};return f(w),w.pathPoints=S.points,w.pathClosed=S.closed,w.pathCurveType=S.points.some($=>$.segmentType)?"mixed":S.points.some($=>$.handleIn||$.handleOut)?"cubic":"linear",w.pathTension=.5,Object.assign(w,d),De(e,n,"path","materialized",w)}if(a==="text"){let g=iC(t,n,o),m=rC(t,n,e,i),h=sC(i,e,n,l,g,o.rootFontSize),b=zb(i,r,e,"font-family")?Gb(Qi(i,e,n,"font-family"))??"Inter, sans-serif":"Inter, sans-serif",S=o.textMetricsHost?.measureXHeight(b,h),v=S!==void 0&&Number.isFinite(S)&&S>=0?S:h*.5,I=oC(n,m.mode,g,h,o.rootFontSize,v),x=I.text,P=zb(i,r,e,"font-weight")?Vb(Qi(i,e,n,"font-weight")):400,T=Qi(i,e,n,"font-style")??"normal",k=Qi(i,e,n,"line-height"),w=k?Mt(k)??Number(k):NaN,$=Number.isFinite(w)?w:1.2,R=vt(Uf(oi(i,e,n,"x")),"x",g,h,o.rootFontSize,v)??0,C=vt(Uf(oi(i,e,n,"y")),"y",g,h,o.rootFontSize,v)??0,A={x:R,y:C,textX:R,textY:C,text:x,fontSize:h,fontFamily:b,fontWeight:P,fontStyle:T,lineHeight:$,useRichText:!1,isTextPath:!1};Object.assign(A,yC(i,e,n)),I.linePositions&&(A.linePositions=I.linePositions),m.authored&&m.authored!=="normal"&&(A.whiteSpace=m.authored);let D=pC(n,x,m.mode,g,h,o.rootFontSize,v);D&&(A.charOffsets=D);let _=D?null:mC(n,e,r,i,x,m.mode,h,$,g,o.rootFontSize,v,o.textMetricsHost);_&&(A.useRichText=!0,A.richTextData=_);let O=Gf(i,e,n,"textLength","x",l,o);O!==void 0&&O>=0&&(A.textLength=O);let L=E(n,"lengthAdjust");return(L==="spacing"||L==="spacingAndGlyphs")&&(A.lengthAdjust=L),Object.assign(A,fC(t,n,h)),Object.assign(A,d),De(e,n,"text","materialized",A)}if(a==="flowroot"){let g=Hf(n).filter(S=>S.localName.toLowerCase()==="flowpara").map(Bb);if(g.every(S=>S.length===0))return De(e,n,null,"empty");let m=Hf(n).find(S=>["rect","circle","ellipse","path"].includes(S.localName.toLowerCase())),h=0,b=0;return m?.localName.toLowerCase()==="rect"&&(h=he(E(m,"x"),jf("x",l,o))??0,b=he(E(m,"y"),jf("y",l,o))??0),De(e,n,"text","materialized",{x:h,y:b+l,text:g.join(`
16
+ `),fontSize:l,fontFamily:"Inter, sans-serif",fontWeight:400,fontStyle:"normal",lineHeight:1.2,useRichText:!1,isTextPath:!1,...d})}if(a==="image"){let g=c("x","x")??0,m=c("y","y")??0,h=c("width","x"),b=c("height","y"),S=Pe(n)?.value??"";if(!S||h===void 0||b===void 0)return De(e,n,null,"empty");if(h<0||b<0)return u("Image width and height must not be negative."),De(e,n,null,"invalid");if(h===0||b===0)return De(e,n,null,"empty");let v={x:g,y:m,width:h,height:b,...d};v.preserveAspectRatio=E(n,"data-preserve-aspect-ratio")!=="false";let I=E(n,"preserveAspectRatio")?.trim();return I&&I!=="none"&&(v.specPreserveAspectRatio=I),v.href=S,De(e,n,"image","materialized",v)}if(a==="foreignobject"){let g=c("x","x")??0,m=c("y","y")??0,h=c("width","x")??0,b=c("height","y")??0;if(h<0||b<0)return u("Foreign-object width and height must not be negative."),De(e,n,null,"invalid");if(h===0||b===0)return De(e,n,null,"empty");let S=n.rawXml??"",v=S.indexOf(">"),I=S.lastIndexOf("</"),x=v>=0&&I>v?S.slice(v+1,I):"";return De(e,n,"foreign-object","materialized",{x:g,y:m,width:h,height:b,rawContent:x,...d})}return De(e,n,null,"deferred")}function Ic(t,e,n,r){let i=[],o=[],s=new Set,a=[...e.occurrences].sort(XP);for(let u of a){if(s.has(u.occurrenceId))throw new Error(`Duplicate SVG geometry occurrence ${u.occurrenceId}.`);s.add(u.occurrenceId);let d=t.index.element(u.correspondingSourceNodeId);if(!d)throw new Error(`SVG occurrence ${u.occurrenceId} has no source element.`);if(!(d.namespaceUri===U||t.root.namespaceUri===null&&d.namespaceUri===null))continue;let f=d.localName.toLowerCase();UP.has(f)&&(f!=="flowroot"&&gC(t,d)||o.push(SC(t,u,d,e,n,r,i)))}let l=new Map(o.map(u=>[u.occurrenceId,u])),c=Object.freeze({candidates:Object.freeze(o),candidate(u){return l.get(u)??null}});return Object.freeze({value:c,diagnostics:Object.freeze(i)})}var jb={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 eo(t){let e=jb[t.trim().toLowerCase()];return e===void 0?null:{r:e>>16&255,g:e>>8&255,b:e&255}}function wc(t){return jb[t.trim().toLowerCase()]!==void 0}var Rc={color:"css-rgba",angle:"linear"},Ns={color:"legacy-rgb",angle:"shortest-arc"};function Ie(t,e,n){return t+(e-t)*n}function Xf(t,e,n,r){if(r==="linear")return Ie(t,e,n);let i=((e-t)%360+540)%360-180;return t+i*n}function bC(t){let e=t.trim().toLowerCase();if(e==="transparent"||e==="none")return{r:0,g:0,b:0,a:0};if(t.startsWith("#")){let i=t.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 n=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?/);if(n)return{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10),a:n[4]!==void 0?parseFloat(n[4]):1};let r=eo(e);return r?{...r,a:1}:null}function Yb(t){if(!t)return null;let e=t.trim();if(e.startsWith("#")){if(e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1};if(e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}}let n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10),a:1}:null}function Ms(t,e=Rc.color){return e==="css-rgba"?bC(t):Yb(t)}function vC(t,e=Rc.color){if(!t)return!1;if(e==="legacy-rgb")return Yb(t)!==null;if(t.startsWith("#")||t.startsWith("rgb"))return!0;let n=t.trim().toLowerCase();return n==="transparent"||n==="none"?!0:wc(n)}function Ub(t,e,n){let r=i=>Math.round(Math.max(0,Math.min(255,i))).toString(16).padStart(2,"0");return`#${r(t)}${r(e)}${r(n)}`}function Yf(t,e,n,r=Rc.color){let i=Ms(t,r),o=Ms(e,r);if(!i||!o)return n<.5?t:e;if(r==="legacy-rgb")return Ub(Ie(i.r,o.r,n),Ie(i.g,o.g,n),Ie(i.b,o.b,n));let s=i.a===0?o.r:i.r,a=i.a===0?o.g:i.g,l=i.a===0?o.b:i.b,c=o.a===0?i.r:o.r,u=o.a===0?i.g:o.g,d=o.a===0?i.b:o.b,p=Ie(s,c,n),f=Ie(a,u,n),g=Ie(l,d,n),m=Ie(i.a,o.a,n);return m>=.999?Ub(p,f,g):`rgba(${Math.round(p)}, ${Math.round(f)}, ${Math.round(g)}, ${Math.round(m*1e3)/1e3})`}var qb="[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?",Hb=/[MLHVCSQTAZmlhvcsqtaz]/g;function to(t){return t.match(new RegExp(qb,"g"))}function xC(t){return(to(t)??[]).map(Number)}function Zb(t,e,n){let r=to(t),i=to(e);if(!r||!i||r.length!==i.length)return t;let o=r.map(Number),s=i.map(Number),a=0;return t.replace(new RegExp(qb,"g"),()=>{let l=Ie(o[a],s[a],n);return a++,String(Math.round(l*1e3)/1e3)})}function Jb(t,e){let n=t.match(Hb)??[],r=e.match(Hb)??[];return n.length!==r.length?!1:n.every((i,o)=>i===r[o])}function IC(t,e,n){return n<=0?t:n>=1?e:Jb(t,e)?Zb(t,e,n):n<.5?t:e}function wC(t,e,n){if(n<=0)return t;if(n>=1)return e;let r=to(t),i=to(e);return!r||!i||r.length!==i.length?n<.5?t:e:Zb(t,e,n)}function kC(t,e,n){if(n<=0)return t;if(n>=1)return e;let r=c=>{let u=c.trim().toLowerCase();if(!u||u==="none")return null;let d=(to(c)??[]).map(Number);return d.length===0||d.some(p=>!Number.isFinite(p)||p<0)?null:d},i=r(t),o=r(e);if(!i||!o)return n<.5?t:e;let s=(c,u)=>u===0?c:s(u,c%u),a=i.length*o.length/s(i.length,o.length),l=[];for(let c=0;c<a;c++)l.push(String(Ie(i[c%i.length],o[c%o.length],n)));return l.join(" ")}function Yn(t){return Array.isArray(t)&&t.every(e=>typeof e=="number"&&Number.isFinite(e))}function kc(t,e,n){return t.map((r,i)=>Ie(r,e[i],n))}function Qb(t,e,n){return t.length!==e.length?n<.5?t:e:t.map((r,i)=>({x:Ie(r.x,e[i].x,n),y:Ie(r.y,e[i].y,n)}))}function ev(t,e,n){return t.length!==e.length?n<.5?t:e:t.map((r,i)=>{let o=e[i],s={...r,x:Ie(r.x,o.x,n),y:Ie(r.y,o.y,n)};return r.handleIn&&o.handleIn&&(s.handleIn={x:Ie(r.handleIn.x,o.handleIn.x,n),y:Ie(r.handleIn.y,o.handleIn.y,n)}),r.handleOut&&o.handleOut&&(s.handleOut={x:Ie(r.handleOut.x,o.handleOut.x,n),y:Ie(r.handleOut.y,o.handleOut.y,n)}),s})}function tv(t,e,n,r=Ns.angle){return t.length!==e.length?n<.5?t:e:t.map((i,o)=>{let s=e[o],a={...i},l=(c,u)=>c==null||u==null?c??u??null:Ie(c,u,n);return("x"in i||"x"in s)&&(a.x=l(i.x,s.x)),("y"in i||"y"in s)&&(a.y=l(i.y,s.y)),typeof i.dx=="number"&&typeof s.dx=="number"&&(a.dx=Ie(i.dx,s.dx,n)),typeof i.dy=="number"&&typeof s.dy=="number"&&(a.dy=Ie(i.dy,s.dy,n)),typeof i.rotate=="number"&&typeof s.rotate=="number"&&(a.rotate=Xf(i.rotate,s.rotate,n,r)),a})}function Kf(t){if(typeof t!="object"||t===null)return!1;let e=t;return(e.type==="linear-gradient"||e.type==="radial-gradient")&&Array.isArray(e.stops)}function nv(t,e,n,r=Ns.color){if(t.type!==e.type||t.stops.length!==e.stops.length)return null;let i=t.stops.map((s,a)=>({offset:Ie(s.offset,e.stops[a].offset,n),color:Yf(s.color,e.stops[a].color,n,r),opacity:Ie(s.opacity,e.stops[a].opacity,n)})),o={...t,stops:i};for(let s of Object.keys(e)){if(s==="stops"||s==="type"||s==="id"||s==="sourceId")continue;let a=t[s],l=e[s];typeof a=="number"&&typeof l=="number"&&(o[s]=Ie(a,l,n))}return o}function Wb(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.x!="number"||typeof e.y!="number"?!1:Object.keys(e).every(n=>n==="x"||n==="y")}function Kb(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function rv(t,e,n){let r={...t},i=new Set([...Object.keys(t),...Object.keys(e)]);for(let o of i){let s=t[o],a=e[o];typeof s=="number"&&typeof a=="number"?r[o]=Ie(s,a,n):Yn(s)&&Yn(a)&&s.length===a.length?r[o]=kc(s,a,n):r[o]=n<.5?s:a}return r}var RC=new Set(["fillColor","borderColor"]),TC=new Set(["polylinePoints"]),PC=new Set(["pathPoints","textPathPoints"]),CC=new Set(["rotation","shiftAngle","skewX","skewY"]),$C=new Set(["customPivot"]),Xb=[1,0,0,1,0,0];function EC(t,e,n,r){if(!($C.has(t)&&(e==null||n==null))){if(t==="children"&&Array.isArray(e)&&Array.isArray(n))return iv(e,n,r);if(t==="transformMatrix"){let i=Yn(e)?e:e==null&&Yn(n)?Xb:null,o=Yn(n)?n:n==null&&Yn(e)?Xb:null;if(i&&o&&i.length===o.length)return kc(i,o,r)}if(!(e==null&&n==null)){if(e==null)return n;if(n==null)return e;if(RC.has(t)&&typeof e=="string"&&typeof n=="string")return Yf(e,n,r,Ns.color);if(CC.has(t)&&typeof e=="number"&&typeof n=="number")return Xf(e,n,r,Ns.angle);if(typeof e=="number"&&typeof n=="number")return Ie(e,n,r);if(typeof e=="string"&&typeof n=="string"){let i=parseFloat(e),o=parseFloat(n);return Number.isFinite(i)&&Number.isFinite(o)&&String(i)===e&&String(o)===n?String(Ie(i,o,r)):r<.5?e:n}if(Yn(e)&&Yn(n)&&e.length===n.length)return kc(e,n,r);if(TC.has(t)&&Array.isArray(e)&&Array.isArray(n))return Qb(e,n,r);if(PC.has(t)&&Array.isArray(e)&&Array.isArray(n))return ev(e,n,r);if(t==="charOffsets"&&Array.isArray(e)&&Array.isArray(n))return tv(e,n,r);if((t==="fillGradient"||t==="strokeGradient")&&Kf(e)&&Kf(n)){let i=nv(e,n,r);if(i)return i}return Wb(e)&&Wb(n)?{x:Ie(e.x,n.x,r),y:Ie(e.y,n.y,r)}:Kb(e)&&Kb(n)?rv(e,n,r):r<.5?e:n}}}function AC(t,e,n){let r={...t},i=new Set([...Object.keys(t),...Object.keys(e)]);for(let o of i)r[o]=EC(o,t[o],e[o],n);return r}function iv(t,e,n){let r=Math.max(0,Math.min(1,n)),i=new Map(t.map(l=>[l.id,l])),o=new Map(e.map(l=>[l.id,l])),s=[],a=new Set;for(let l of e){let c=i.get(l.id);if(c&&c.type===l.type)a.add(l.id),s.push({...l,state:AC(c.state,l.state,r)});else{let u=l.state.opacity??1;s.push({...l,state:{...l.state,opacity:u*r}})}}for(let l of t){if(a.has(l.id))continue;let c=l.state.opacity??1,u=o.has(l.id)?ov(l,"__variant_from__"):l;s.push({...u,state:{...u.state,opacity:c*(1-r)}})}return s}function ov(t,e){let n=t.state.children;return{...t,id:`${e}${t.id}`,state:{...t.state,...Array.isArray(n)?{children:n.map(r=>ov(r,e))}:{}}}}function NC(t,e,n,r,i,o,s,a){if(t!=="mask"||e||n!=="userSpaceOnUse"||r.length!==1||!Bt(s))return!1;let l=r[0],c=i.candidate(l.occurrenceId);if(!c||c.status!=="materialized"||c.canonicalType!=="rectangle"&&c.canonicalType!=="square")return!1;let u=c.state;if(u.transformMatrix!==void 0||u.rawTransform!==void 0)return!1;let d=Ms(o.value(l.occurrenceId,"fill")??"black");if(!d||d.r!==255||d.g!==255||d.b!==255||d.a!==1)return!1;let p=Number(o.value(l.occurrenceId,"fill-opacity")??1),f=Number(o.value(l.occurrenceId,"opacity")??1);if(p!==1||f!==1)return!1;let g=Number(u.x??0),m=Number(u.y??0),h=Number(u.width??u.size),b=Number(u.height??u.size),S=(v,I)=>Math.abs(v-I)<=1e-9;return S(g,0)&&S(m,0)&&S(h,a.viewport.width)&&S(b,a.viewport.height)}var Jf=new Set(["animate","animatemotion","animatetransform","set"]),Pc=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),av=new Set(["a","g","switch","use"]),Qf=new Set(["desc","metadata","title"]),MC=new Set([...Jf,...Qf,"circle","ellipse","line","path","polygon","polyline","rect","text","use"]);function Os(t){if(!t||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(let e of Object.values(t))Os(e);return Object.freeze(t)}function lv(t){if(t.namespaceUri!==U)return null;let e=t.localName.toLowerCase();return e==="clippath"?"clip":e==="mask"?"mask":null}function Ds(t,e,n,r,i){let o=lv(e)??"clip";return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:o==="clip"?"clip-definitions":"mask-definitions",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:`${e.name} ${r} value ${i} is invalid and uses its initial value.`})}function qf(t,e,n,r,i,o){let s=E(e,i);return s===null||s===""?o:s==="userSpaceOnUse"||s==="objectBoundingBox"?s:(r.push(Ds(t,e,n,i,s)),o)}function Zf(t,e,n,r,i,o,s,a,l){let c=r.value(n.occurrenceId,s)??E(e,s);if(c===null||c.trim()==="")return l;let u=c.trim();return a.includes(u)?u:(o.push(Ds(t,e,i,s,c)),l)}function OC(t,e,n,r){let i={x:E(e,"x"),y:E(e,"y"),width:E(e,"width"),height:E(e,"height")},{x:o,y:s,width:a,height:l}=i;if([o,s,a,l].every(d=>d===null))return null;let c={x:"-10%",y:"-10%",width:"120%",height:"120%"},u=Object.fromEntries(Object.entries(i).map(([d,p])=>p===null?[d,c[d]]:nt(p)?[d,p]:(r.push(Ds(t,e,n,d,p)),[d,c[d]])));return Object.freeze({x:u.x,y:u.y,width:u.width,height:u.height})}function sv(t){let e=nt(t);return!!(e&&e.value<=0)}function cv(t,e,n){let r=t.parentOccurrenceId,i=new Set;for(;r;){if(r===e.occurrenceId)return!0;if(i.has(r))return!1;i.add(r),r=n.get(r)?.parentOccurrenceId??null}return!1}function dv(t,e,n){let r=t.index.parent(e);for(;r&&r.sourceNodeId!==n;){if(Pc.has(r.localName.toLowerCase()))return!0;r=t.index.parent(r.sourceNodeId)}return r===null}function em(t,e,n){let r=new Map(n.map(i=>[i.occurrenceId,i]));return n.filter(i=>cv(i,e,r)?!(i.usePath.length===0&&dv(t,i.correspondingSourceNodeId,e.correspondingSourceNodeId)):!1)}function tm(t,e,n,r){let i=t,o=new Set;for(;i&&i.occurrenceId!==e.occurrenceId;){if(o.has(i.occurrenceId)||(o.add(i.occurrenceId),r.value(i.occurrenceId,"display")==="none"))return!1;let s=r.value(i.occurrenceId,"visibility");if(s==="hidden"||s==="collapse")return!1;i=i.parentOccurrenceId?n.get(i.parentOccurrenceId):void 0}return i?.occurrenceId===e.occurrenceId}function DC(t,e,n,r,i){let o=n.occurrences,s=new Map(r.candidates.map(c=>[c.occurrenceId,c])),a=new Set(n.resolutions.map(c=>c.useOccurrenceId)),l=new Map(o.map(c=>[c.occurrenceId,c]));for(let c of em(t,e,o)){if(!tm(c,e,l,i))continue;let u=t.index.element(c.correspondingSourceNodeId);if(!u)return!0;let d=u.localName.toLowerCase();if(Jf.has(d)||d==="style"||d==="script"||["clip-path","mask","filter"].some(f=>(i.value(c.occurrenceId,f)??"").includes("url(")))return!0;if(Qf.has(d))continue;if(av.has(d)){if(d!=="use")continue;return a.has(c.occurrenceId),!0}if(Pc.has(d)){if(c.usePath.length>0)return!0;continue}let p=s.get(c.occurrenceId);if(!p||p.status==="deferred")return!0}return!1}function zC(t,e,n,r,i){let o=new Map(r.candidates.map(c=>[c.occurrenceId,c])),s=new Set(n.resolutions.map(c=>c.useOccurrenceId)),a=new Map(n.occurrences.map(c=>[c.occurrenceId,c])),l=!1;for(let c of em(t,e,n.occurrences)){if(!tm(c,e,a,i))continue;let u=t.index.element(c.correspondingSourceNodeId);if(!u)return!1;let d=u.localName.toLowerCase();if(Qf.has(d))continue;if(Jf.has(d)||d==="style"||d==="script"||["clip-path","mask","filter"].some(f=>(i.value(c.occurrenceId,f)??"").includes("url(")))return!1;if(d==="use"){if(c.parentOccurrenceId!==e.occurrenceId||c.usePath.length>0||E(u,"id")!==null||!s.has(c.occurrenceId))return!1;l=!0;continue}if(av.has(d)||Pc.has(d))return!1;let p=o.get(c.occurrenceId);if(!p||p.status!=="materialized")return!1}return l}function _C(t,e,n,r){let i=E(e,"transform");if(!i)return Ae;let o=Gt(i);return o||(r.push(Ds(t,e,n,"transform",i)),Ae)}function FC(t,e,n,r,i,o,s){let a=lv(e);if(!a)return null;let l=n.direct(e.sourceNodeId);if(!l)throw new Error(`SVG ${e.name} ${e.sourceNodeId} has no occurrence.`);let c=new Map(n.occurrences.map(C=>[C.occurrenceId,C])),u=i.candidates.flatMap(C=>{let A=c.get(C.occurrenceId);return!A||!cv(A,l,c)||A.usePath.length===0&&dv(t,C.sourceNodeId,e.sourceNodeId)||!tm(A,l,c,r)?[]:C.status==="materialized"?[A]:[]}),d=a==="clip"&&n.resourcePolicy(e.sourceNodeId)?.status==="invalid",p=a==="clip"&&t.index.children(e.sourceNodeId).some(C=>!MC.has(C.localName.toLowerCase()));if(p&&s.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:o.source,entrypoint:o.entrypoint,capability:"clip-definitions",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:"A clipPath may directly contain only paths, text, basic shapes, use, animation, and descriptive elements."})),t.index.elements.some(C=>{if(C.namespaceUri!==U||C.localName.toLowerCase()!=="use")return!1;let A=t.index.parent(C.sourceNodeId);for(;A&&A.sourceNodeId!==e.sourceNodeId;){if(Pc.has(A.localName.toLowerCase()))return!1;A=t.index.parent(A.sourceNodeId)}return A?.sourceNodeId===e.sourceNodeId})&&n.resourcePolicy(e.sourceNodeId)===null)throw new Error(`SVG ${e.name} ${e.sourceNodeId} requires a matching use resource-root plan.`);let g=a==="mask"?OC(t,e,o,s):null,m=!!(g&&(sv(g.width)||sv(g.height))),h=DC(t,l,n,i,r),b=h&&!zC(t,l,n,i,r)?[]:u,S=d||p?"invalid":m||!h&&u.length===0?"empty":"materialized",v=a==="clip"?qf(t,e,o,s,"clipPathUnits","userSpaceOnUse"):null,I=a==="clip"?Zf(t,e,l,r,o,s,"clip-rule",["nonzero","evenodd"],"nonzero"):null,x=a==="mask"?qf(t,e,o,s,"maskUnits","objectBoundingBox"):null,P=a==="mask"?qf(t,e,o,s,"maskContentUnits","userSpaceOnUse"):null,T=a==="mask"?Zf(t,e,l,r,o,s,"mask-type",["luminance","alpha"],"luminance"):null,k=_C(t,e,o,s),w=Os({sourceNodeId:e.sourceNodeId,sourceId:E(e,"id"),type:a,status:S,representation:h?"raw":"decomposed",identity:NC(a,h,P,u,i,r,k,o),clipPathUnits:v,clipRule:I,maskUnits:x,maskContentUnits:P,maskType:T,region:g,geometrySourceNodeIds:Object.freeze(h?[]:u.map(C=>C.correspondingSourceNodeId)),rawDefinition:h?e.rawXml??"":null}),$=new Map,R=new Map;for(let C of em(t,l,n.occurrences)){let A=t.index.element(C.correspondingSourceNodeId);if(A){if(!$.has(A.sourceNodeId)){let D=E(A,"transform");if(!D)$.set(A.sourceNodeId,Ae);else{let _=Gt(D);_?$.set(A.sourceNodeId,_):(s.push(Ds(t,A,o,"transform",D)),$.set(A.sourceNodeId,Ae))}}a==="clip"&&R.set(C.occurrenceId,Zf(t,A,C,r,o,s,"clip-rule",["nonzero","evenodd"],w.clipRule??"nonzero"))}}return Object.freeze({definition:w,element:e,occurrence:l,rootTransform:k,transformBySourceNodeId:$,clipRuleByOccurrenceId:R,geometryOccurrences:Object.freeze(b)})}function LC(t){return t.edges.filter(e=>e.binding==="applied-css"&&e.participation==="consumer"&&(e.kind==="clip-path"&&e.propertyName==="clip-path"||e.kind==="mask-image"&&(e.propertyName==="mask"||e.propertyName==="mask-image")))}function BC(t,e,n){let r=t.occurrenceId??e.direct(t.fromSourceNodeId)?.occurrenceId;if(!r)return null;let i=t.propertyName==="clip-path"?"clip":"mask",o=t.targetSourceNodeId?n.get(t.targetSourceNodeId):void 0,s=t.validity==="valid"&&o?.definition.type===i&&o.definition.status!=="invalid";return Object.freeze({bindingId:`clip-mask-binding:${t.resourceReferenceId}:${r}`,resourceReferenceId:t.resourceReferenceId,consumerOccurrenceId:r,consumerSourceNodeId:t.fromSourceNodeId,propertyName:t.propertyName==="clip-path"?"clip-path":"mask",authoredValue:t.propertyValue,targetAuthoredId:t.targetAuthoredId,targetSourceNodeId:t.targetSourceNodeId,definitionSourceNodeId:s?t.targetSourceNodeId??null:null,status:s?"materialized":"invalid-reference"})}function GC(t){return ce(_e(t.x,t.y),qr(t.width,t.height))}function VC(t,e){let r=(t.definition.type==="clip"?t.definition.clipPathUnits:t.definition.maskContentUnits)==="objectBoundingBox"?GC(e):Ae;return ce(r,t.rootTransform)}function Tc(t,e,n,r,i){let o=n==="x"||n==="width",s=o?r.width:r.height,a=n==="x"?r.x:n==="y"?r.y:0;if(!nt(t))return null;if(e==="objectBoundingBox"){let u=he(t,{percentBasis:1,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return u===void 0?null:a+u*s}let c=he(t,{percentBasis:o?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return c===void 0?null:c}function jC(t,e,n){if(!t.region||!t.maskUnits)return null;let r=Tc(t.region.x,t.maskUnits,"x",e,n),i=Tc(t.region.y,t.maskUnits,"y",e,n),o=Tc(t.region.width,t.maskUnits,"width",e,n),s=Tc(t.region.height,t.maskUnits,"height",e,n);return r===null||i===null||o===null||s===null?null:Object.freeze({x:r,y:i,width:o,height:s})}function UC(t,e,n,r,i){let o=new Map(r.occurrences.map(d=>[d.occurrenceId,d])),s=[],a=n.parentOccurrenceId,l=new Set;for(;a&&a!==e.occurrence.occurrenceId&&!l.has(a);){l.add(a);let d=o.get(a);if(!d)break;s.push(d),a=d.parentOccurrenceId}let c=Ae,u=e.definition.type==="clip"?e.definition.clipPathUnits:e.definition.maskContentUnits;for(let d of s.reverse()){let p=t.index.element(d.correspondingSourceNodeId);if(p&&(c=ce(c,e.transformBySourceNodeId.get(p.sourceNodeId)??Ae),p.localName.toLowerCase()==="use")){let f=u==="objectBoundingBox"?1:i.viewport.width,g=u==="objectBoundingBox"?1:i.viewport.height,m=he(E(p,"x"),{percentBasis:f,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0,h=he(E(p,"y"),{percentBasis:g,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0;c=ce(c,_e(m,h))}}return c}function Cc(t,e,n,r,i,o){let s=[],a=t.index.elements.flatMap(m=>{let h=FC(t,m,e,n,i,o,s);return h?[h]:[]}),l=new Map(a.map(m=>[m.definition.sourceNodeId,m])),c=LC(r).flatMap(m=>{let h=BC(m,e,l);return h?[h]:[]}),u=new Map;for(let m of c){let h=`${m.consumerOccurrenceId}\0${m.propertyName}`,b=u.get(h)??[];b.push(m),u.set(h,b)}let d=new Map([...u].map(([m,h])=>[m,Object.freeze(h)])),p=Object.freeze(a.map(m=>m.definition)),f=Object.freeze(c),g=Os({definitions:p,bindings:f,definition(m){return l.get(m)?.definition??null},bindingsFor(m,h){return d.get(`${m}\0${h}`)??[]},binding(m,h,b){let S=d.get(`${m}\0${h}`)??[];return b===void 0?S[0]??null:S.find(v=>v.resourceReferenceId===b)??null},resolve(m,h){let b=m.definitionSourceNodeId?l.get(m.definitionSourceNodeId):void 0;if(!b||m.status!=="materialized")return Os({status:"invalid-reference",contentMatrix:null,region:null,geometrySourceNodeIds:[],geometryPlacements:[],rawDefinition:null});let S=VC(b,h.consumerObjectBounds),v=(b.definition.clipPathUnits==="objectBoundingBox"||b.definition.maskContentUnits==="objectBoundingBox"||b.definition.maskUnits==="objectBoundingBox")&&(h.consumerObjectBounds.width===0||h.consumerObjectBounds.height===0),I=b.definition.status==="empty"||v,x=(I?[]:b.geometryOccurrences).map(P=>Object.freeze({occurrenceId:P.occurrenceId,sourceNodeId:P.correspondingSourceNodeId,matrix:ce(S,UC(t,b,P,e,o)),clipRule:b.definition.type==="clip"?b.clipRuleByOccurrenceId.get(P.occurrenceId)??b.definition.clipRule??"nonzero":null}));return Os({status:I?"empty":m.status,contentMatrix:S,region:jC(b.definition,h.consumerObjectBounds,o),geometrySourceNodeIds:I?[]:b.definition.geometrySourceNodeIds,geometryPlacements:x,rawDefinition:b.definition.rawDefinition})}});return Object.freeze({value:g,diagnostics:Object.freeze(s)})}var HC=new Set(["id","viewbox","preserveaspectratio","refx","refy","markerwidth","markerheight","markerunits","orient"]),WC=new Set(["a","circle","ellipse","foreignobject","g","image","line","path","polygon","polyline","rect","svg","switch","text","use"]),KC=new Set(["animate","animatemotion","animatetransform","set"]),XC="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",YC=new RegExp(`^(${XC})(deg|grad|rad|turn)?$`,"i");function qC(t,e){let n=Math.min(t.length,e.length);for(let r=0;r<n;r++){let i=t[r]-e[r];if(i!==0)return i}return t.length-e.length}function ZC(t,e){return qC(t.orderKey,e.orderKey)||t.productIndex-e.productIndex||t.occurrenceId.localeCompare(e.occurrenceId)}function no(t,e,n,r,i,o){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"markers",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:`Marker ${r} value ${i} ${o}.`})}function JC(t){let e=YC.exec(t.trim());if(!e)return null;let n=Number(e[1]);if(!Number.isFinite(n))return null;switch((e[2]??"deg").toLowerCase()){case"deg":return n;case"grad":return n*.9;case"rad":return n*180/Math.PI;case"turn":return n*360;default:return null}}function QC(t){let e=t.trim().split(/\s+/).filter(Boolean);if(e.length<1||e.length>2)return!1;let n=Ki(t);return e[0]!==n.align?!1:e.length===1||e[1]==="meet"||e[1]==="slice"}function e$(t,e){let n=E(e,"data-ssk-marker-name");if(n!==null)return n;let r=t??"marker";return r.replace(/^marker[-_]?/i,"").replace(/[-_]/g," ")||r}function t$(t){let e={};for(let n of t.attributes)n.name==="xmlns"||n.prefix==="xmlns"||n.namespaceUri===null&&HC.has(n.localName.toLowerCase())||(e[n.name]=n.value);return Object.freeze(e)}function n$(t,e,n){let r=t.parentOccurrenceId,i=new Set;for(;r;){if(r===e)return!0;if(i.has(r))return!1;i.add(r),r=n.get(r)?.parentOccurrenceId??null}return!1}function r$(t,e,n){let r=new Map(e.occurrences.map(u=>[u.occurrenceId,u])),i=e.occurrences.filter(u=>n$(u,n.occurrenceId,r)).sort(ZC),o=new Set,s=[],a=[],l=u=>{let d=u.parentOccurrenceId;for(;d&&d!==n.occurrenceId&&!o.has(d);)d=r.get(d)?.parentOccurrenceId??null;return d===n.occurrenceId?null:d},c=u=>{if(u.usePath.length>0)return!1;let d=u.parentOccurrenceId;for(;d&&d!==n.occurrenceId;){let p=r.get(d);if(!p)return!1;if(t.index.element(p.correspondingSourceNodeId)?.localName.toLowerCase()==="defs")return!0;d=p.parentOccurrenceId}return!1};for(let u of i){let d=t.index.element(u.correspondingSourceNodeId);if(!d||d.namespaceUri!==U)continue;let p=d.localName.toLowerCase();if(KC.has(p)){a.push(Object.freeze({occurrenceId:u.occurrenceId,sourceNodeId:u.correspondingSourceNodeId,parentOccurrenceId:l(u),elementName:d.name,orderKey:Object.freeze([...u.orderKey])}));continue}if(!WC.has(p)||c(u))continue;let f=l(u);o.add(u.occurrenceId),s.push(Object.freeze({occurrenceId:u.occurrenceId,sourceNodeId:u.correspondingSourceNodeId,parentOccurrenceId:f,elementName:d.name,orderKey:Object.freeze([...u.orderKey])}))}return{content:Object.freeze(s),animations:Object.freeze(a)}}function $c(t,e,n,r,i){let o=[],s=new Map,a=[],l=r.resources.filter(u=>u.kind==="marker").sort((u,d)=>{let p=t.index.element(u.sourceNodeId)?.elementOrder??0,f=t.index.element(d.sourceNodeId)?.elementOrder??0;return p-f});for(let u of l){let d=t.index.element(u.sourceNodeId);if(!d||d.namespaceUri!==U)continue;let p=e.occurrences.find(q=>q.correspondingSourceNodeId===u.sourceNodeId&&q.usePath.length===0);if(!p)continue;let f=E(d,"id"),g=n.style(p.occurrenceId),m=he(g?.resolvedValues["font-size"]??null,{fontSize:i.rootFontSize,rootFontSize:i.rootFontSize,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height}),h=m&&m>0?m:i.rootFontSize,b=E(d,"viewBox"),S=b===null?null:Ue(b),v=!1,I=!1;b!==null&&(!S||S.width<0||S.height<0?(v=!0,o.push(no(t,d,i,"viewBox",b,"is not a valid four-number viewBox with non-negative dimensions"))):(S.width===0||S.height===0)&&(I=!0));let x=E(d,"preserveAspectRatio");x!==null&&!QC(x)&&(v=!0,o.push(no(t,d,i,"preserveAspectRatio",x,"does not match the SVG preserveAspectRatio grammar")));let P={},T=q=>{let te=E(d,q);return te!==null&&(P[q]=te),te},k=T("markerWidth"),w=T("markerHeight"),$=q=>({percentBasis:q==="width"?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,fontSize:h,rootFontSize:i.rootFontSize}),R=(q,te,ie)=>{if(te===null)return 3;let J=he(te,$(ie));return J===void 0||J<0?(v=!0,o.push(no(t,d,i,q,te,J===void 0?"is not a resolvable length":"must not be negative")),3):(J===0&&(I=!0),J)},C=R("markerWidth",k,"width"),A=R("markerHeight",w,"height"),D={width:S?.width??C,height:S?.height??A},_=q=>{let te=T(q);if(te===null)return 0;let ie=te.trim(),J=q==="refX"?D.width:D.height;if(q==="refX"){if(ie==="left")return 0;if(ie==="center")return J/2;if(ie==="right")return J}else{if(ie==="top")return 0;if(ie==="center")return J/2;if(ie==="bottom")return J}let ke=he(te,{...$(q==="refX"?"width":"height"),percentBasis:J});return ke!==void 0?ke:(v=!0,o.push(no(t,d,i,q,te,"is not a valid marker reference length or keyword")),0)},O=_("refX"),L=_("refY"),re=T("markerUnits"),ee="strokeWidth";re==="userSpaceOnUse"?ee="userSpaceOnUse":re!==null&&re!=="strokeWidth"&&(v=!0,o.push(no(t,d,i,"markerUnits",re,"must be strokeWidth or userSpaceOnUse")));let F=T("orient"),V=0;if(F==="auto"||F==="auto-start-reverse")V=F;else if(F!==null){let q=JC(F);q===null?(v=!0,o.push(no(t,d,i,"orient",F,"is not an orientation keyword, number, or angle"))):V=q}let K=E(d,"overflow"),X=K==="visible"||K==="hidden"?K:void 0,z=r$(t,e,p),G=Object.freeze({sourceNodeId:d.sourceNodeId,sourceId:f,name:e$(f,d),status:v?"invalid":I?"empty":"materialized",...b!==null?{viewBox:b}:{},...x!==null?{preserveAspectRatio:x}:{},refX:O,refY:L,markerWidth:C,markerHeight:A,markerUnits:ee,orient:V,...X?{overflow:X}:{},authoredGeometry:Object.freeze(P),rootAttributes:t$(d),content:z.content,animations:z.animations});s.set(G.sourceNodeId,G),a.push(G)}let c=Object.freeze({candidates:Object.freeze(a),candidate:u=>s.get(u)??null});return Object.freeze({value:c,diagnostics:Object.freeze(o)})}var hv=["x1","y1","x2","y2"],i$=["cx","cy","r","fx","fy","fr"],uv=Object.freeze({x1:0,y1:0,x2:1,y2:0});function Fs(t){return t.namespaceUri!==U?null:t.localName.toLowerCase()==="lineargradient"?"linear-gradient":t.localName.toLowerCase()==="radialgradient"?"radial-gradient":null}function yr(t,e,n,r,i,o){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"gradients",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:`Gradient ${r} value ${i} ${o}.`})}function o$(t,e,n){let r=[n],i=new Set([n.sourceNodeId]);for(let o of e.templateChain(n.sourceNodeId)){if(o.validity!=="valid"||!o.targetSourceNodeId||i.has(o.targetSourceNodeId))break;let s=t.index.element(o.targetSourceNodeId);if(!s||!Fs(s))break;i.add(s.sourceNodeId),r.push(s)}return r}function pv(t,e,n){for(let r of t){if(n&&Fs(r)!==n)continue;let i=E(r,e);if(i!==null)return i}return null}function fv(t,e,n){for(let r of t){if(n&&Fs(r)!==n)continue;let i=E(r,e);if(i!==null)return Object.freeze({raw:i,ownerSourceNodeId:r.sourceNodeId})}return null}function s$(t,e,n,r){let i=t.direct(n.sourceNodeId);return i?e.value(i.occurrenceId,r):null}function yv(t,e,n,r){let i=t.direct(n.sourceNodeId),o=i?e.style(i.occurrenceId):null;return o?.cascadedValues[r]?o.resolvedValues[r]??o.specifiedValues[r]??null:E(n,r)}function nm(t){let e=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u.exec(t.trim());if(!e)return null;let n=Number(e[1]);return Number.isFinite(n)?e[2]?n/100:n:null}function mv(t,e,n,r){let i=s$(t,e,n,"font-size"),o=he(i,{percentBasis:r.rootFontSize,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.rootFontSize,rootFontSize:r.rootFontSize});return o!==void 0&&o>0?o:r.rootFontSize}function zs(t,e,n,r){if(e==="objectBoundingBox")return nm(t);let i=n==="x"?r.viewport.width:n==="y"?r.viewport.height:Math.hypot(r.viewport.width,r.viewport.height)/Math.SQRT2;return he(t,{percentBasis:i,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.fontSize,rootFontSize:r.rootFontSize})??null}function _s(t){return t==="r"||t==="fr"?"radius":t.endsWith("x")||t==="x1"||t==="x2"||t==="cx"||t==="fx"?"x":"y"}function rm(t,e){let n={};if(t.type==="linear-gradient"){for(let i of hv){let o=t.authoredGeometry[i];n[i]=o===void 0?uv[i]:zs(o,t.gradientUnits,_s(i),e)??uv[i]}return Object.freeze(n)}let r=Object.freeze({cx:.5,cy:.5,r:.5,fr:0});for(let i of["cx","cy","r","fr"]){let o=t.authoredGeometry[i];n[i]=o===void 0?r[i]:zs(o,t.gradientUnits,_s(i),e)??r[i]}for(let i of["fx","fy"]){let o=t.authoredGeometry[i],s=i==="fx"?n.cx:n.cy;n[i]=o===void 0?s:zs(o,t.gradientUnits,_s(i),e)??s}return Object.freeze(n)}function gv(t){return t.children.filter(e=>e.kind==="element"&&e.namespaceUri===U&&e.localName.toLowerCase()==="stop")}function a$(t,e,n,r,i,o){let s=e.find(f=>gv(f).length>0)??null,a=s?gv(s):[],l=[],c=0,u=e[0],d=n.direct(u.sourceNodeId),p=d?r.value(d.occurrenceId,"color"):null;for(let f of a){let g=E(f,"offset")??"0",m=nm(g);m===null&&o.push(yr(t,f,i,"offset",g,"is not a number or percentage"));let h=Math.min(1,Math.max(0,m??0)),b=Math.max(c,h);c=b;let S=n.direct(f.sourceNodeId),v=S?r.style(S.occurrenceId):null,I=(v?.cascadedValues["stop-color"]?v.specifiedValues["stop-color"]??v.resolvedValues["stop-color"]:E(f,"stop-color"))??"black",x=I.trim().toLowerCase(),P=/(?:^|[^-_a-z0-9])var\(/iu.test(I),T=x==="currentcolor"?p??"black":P?I:v?.resolvedValues["stop-color"]??I,k=yv(n,r,f,"stop-opacity")??"1",w=nm(k);w===null&&o.push(yr(t,f,i,"stop-opacity",k,"is not a number or percentage"));let $=Math.min(1,Math.max(0,w??1));T.trim().toLowerCase()==="transparent"&&(T="black",$=0),l.push(Object.freeze({occurrenceId:s?.sourceNodeId===u.sourceNodeId&&S?S.occurrenceId:`gradient-stop:${d?.occurrenceId??u.sourceNodeId}:${f.sourceNodeId}`,sourceNodeId:f.sourceNodeId,correspondingSourceNodeId:f.sourceNodeId,hostGradientSourceNodeId:u.sourceNodeId,offsetAuthored:E(f,"offset"),offset:b,color:T,opacity:$}))}return Object.freeze(l)}function l$(t,e,n,r,i,o,s){let a=Fs(e),l=o$(t,i,e),c=E(e,"id"),u=n.direct(e.sourceNodeId)?.occurrenceId??e.sourceNodeId,d=pv(l,"gradientUnits"),p=!1,f="objectBoundingBox";d==="userSpaceOnUse"?f="userSpaceOnUse":d!==null&&d!=="objectBoundingBox"&&s.push(yr(t,e,o,"gradientUnits",d,"must be objectBoundingBox or userSpaceOnUse"));let g=pv(l,"spreadMethod"),m="pad";g==="reflect"||g==="repeat"?m=g:g!==null&&g!=="pad"&&s.push(yr(t,e,o,"spreadMethod",g,"must be pad, reflect, or repeat"));let h=yv(n,r,e,"color-interpolation"),b="sRGB";h==="auto"||h==="linearRGB"?b=h:h!==null&&h!=="sRGB"&&s.push(yr(t,e,o,"color-interpolation",h,"must be auto, sRGB, or linearRGB"));let S={},v={},I=a==="linear-gradient"?hv:i$;for(let R of I){let C=fv(l,R,a);if(!C)continue;S[R]=C.raw;let A=zs(C.raw,f,_s(R),{viewport:o.viewport,fontSize:mv(n,r,e,o),rootFontSize:o.rootFontSize});v[R]=Object.freeze({...C,validity:A===null?"invalid":"valid"})}let x=fv(l,"gradientTransform"),P=x?.raw??null,T=Gt(P??"");x&&(S.gradientTransform=x.raw,v.gradientTransform=Object.freeze({...x,validity:T===null?"invalid":"valid"}),T===null&&s.push(yr(t,e,o,"gradientTransform",x.raw,"does not match the SVG transform-list grammar")));for(let[R,C]of Object.entries(v))R==="gradientTransform"||C.validity==="valid"||s.push(yr(t,e,o,R,C.raw,"is not a valid gradient coordinate"));if(a==="radial-gradient")for(let R of["r","fr"]){let C=v[R];if(!C||C.validity!=="valid")continue;let A=zs(C.raw,f,_s(R),{viewport:o.viewport,fontSize:mv(n,r,e,o),rootFontSize:o.rootFontSize});A!==null&&A<0&&(p=!0,s.push(yr(t,e,o,R,C.raw,"must not be negative")))}let k=a$(t,l,n,r,o,s),w=Object.freeze(it(T??[1,0,0,1,0,0])),$=v.gradientTransform??null;return Object.freeze({occurrenceId:u,sourceNodeId:e.sourceNodeId,sourceId:c,type:a,status:p?"invalid":k.length===0?"empty":"materialized",gradientUnits:f,spreadMethod:m,colorInterpolation:b,authoredGeometry:Object.freeze(S),geometryValues:Object.freeze(v),transform:Object.freeze({authored:$,matrix:w}),stops:k,templateSourceNodeIds:Object.freeze(l.map(R=>R.sourceNodeId))})}function c$(t,e){let n=t.edges.flatMap(r=>{if(r.binding!=="applied-css"||!r.occurrenceId||r.propertyName!=="fill"&&r.propertyName!=="stroke")return[];let i=r.targetSourceNodeId?e.get(r.targetSourceNodeId):void 0,o=wn(r.propertyValue)[r.tokenIndex],s=o?r.propertyValue.slice(o.tokenEnd).trim():"",a=o?!s||s.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:s}):Object.freeze({kind:"unresolved",authoredValue:r.propertyValue}),l=r.validity==="missing"||r.validity==="invalid-target"?"invalid-reference":i?i.status:"other-paint-server";return[Object.freeze({resourceReferenceId:r.resourceReferenceId,occurrenceId:r.occurrenceId,sourceNodeId:r.fromSourceNodeId,correspondingSourceNodeId:r.fromSourceNodeId,propertyName:r.propertyName,authoredValue:r.propertyValue,gradientSourceNodeId:i?.sourceNodeId??null,status:l,fallback:a})]});return Object.freeze(n)}function Ec(t,e,n,r,i){let o=[],s=r.resources.filter(d=>d.kind==="gradient").map(d=>t.index.element(d.sourceNodeId)).filter(d=>!!(d&&Fs(d))).sort((d,p)=>d.elementOrder-p.elementOrder).map(d=>l$(t,d,e,n,r,i,o)),a=new Map(s.map(d=>[d.sourceNodeId,d])),l=c$(r,a),c=new Map;for(let d of l){let p=c.get(d.occurrenceId)??[];p.push(d),c.set(d.occurrenceId,p)}for(let d of c.values())Object.freeze(d);let u=Object.freeze({candidates:Object.freeze(s),bindings:l,candidate:d=>a.get(d)??null,bindingsFor:d=>c.get(d)??Object.freeze([]),binding:(d,p,f)=>(c.get(d)??[]).find(g=>g.propertyName===p&&(f===void 0||g.resourceReferenceId===f))??null,resolveGeometry:(d,p)=>{let f=d.gradientSourceNodeId?a.get(d.gradientSourceNodeId):null;return f?rm(f,p):null}});return Object.freeze({value:u,diagnostics:Object.freeze(o)})}var d$=["x","y","width","height"],u$=new Set(["desc","metadata","title"]),p$=new Set(["defs","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]),f$=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u,m$=/^(?:none|x(?:Min|Mid|Max)Y(?:Min|Mid|Max))(?:\s+(?:meet|slice))?$/u;function Sv(t){return!!(t&&t.namespaceUri===U&&t.localName.toLowerCase()==="pattern")}function bv(t){let e=f$.exec(t.trim());if(!e)return null;let n=Number(e[1]);return Number.isFinite(n)?e[2]?n/100:n:null}function g$(t){if(t===null)return Object.freeze({value:"xMidYMid meet",valid:!0});let e=t.trim().replace(/\s+/gu," "),n=m$.test(e),r=Ki(n?e:null);return Object.freeze({value:`${r.align}${r.align==="none"&&!e.includes(" ")?"":` ${r.meetOrSlice}`}`,valid:n})}function si(t,e,n,r,i,o){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"patterns",sourceId:E(e,"id")??void 0,sourceNodeId:e.sourceNodeId,elementName:e.name,documentPath:t.index.sourcePath(e.sourceNodeId),message:`Pattern ${r} value ${i} ${o}.`})}function h$(t,e,n){let r=[n],i=new Set([n.sourceNodeId]);for(let o of e.templateChain(n.sourceNodeId)){if(o.validity!=="valid"||!o.targetSourceNodeId||i.has(o.targetSourceNodeId))break;let s=t.index.element(o.targetSourceNodeId);if(!Sv(s))break;i.add(s.sourceNodeId),r.push(s)}return Object.freeze(r)}function ro(t,e){for(let n of t){let r=E(n,e);if(r!==null)return Object.freeze({raw:r,ownerSourceNodeId:n.sourceNodeId})}return null}function y$(t){return t.children.filter(e=>e.kind==="element"&&!u$.has(e.localName.toLowerCase()))}function S$(t){return t.find(e=>y$(e).length>0)??null}function b$(t,e,n){let r=t;for(;r;){if(r.occurrenceId===e)return!0;r=r.parentOccurrenceId?n.get(r.parentOccurrenceId):void 0}return!1}function v$(t,e,n,r){let i=e;for(;i&&i.correspondingSourceNodeId!==n;){let o=t.index.element(i.correspondingSourceNodeId);if(o&&p$.has(o.localName.toLowerCase())&&!(o.localName.toLowerCase()==="symbol"&&i.usePath.length>0))return!1;i=i.parentOccurrenceId?r.get(i.parentOccurrenceId):void 0}return!!i}function x$(t,e,n,r){if(!r)return Object.freeze([]);let i=e.direct(r.sourceNodeId);if(!i)return Object.freeze([]);let o=new Map(e.occurrences.map(c=>[c.occurrenceId,c])),s=e.occurrences.filter(c=>c.occurrenceId!==i.occurrenceId&&b$(c,i.occurrenceId,o)&&v$(t,c,r.sourceNodeId,o)),a=new Set(s.map(c=>c.occurrenceId)),l=new Map(s.map(c=>[c.occurrenceId,`pattern-content:${n.sourceNodeId}:${c.occurrenceId}`]));return Object.freeze(s.map(c=>Object.freeze({occurrenceId:l.get(c.occurrenceId),sourceOccurrenceId:c.occurrenceId,sourceNodeId:c.correspondingSourceNodeId,correspondingSourceNodeId:c.correspondingSourceNodeId,hostPatternSourceNodeId:n.sourceNodeId,parentOccurrenceId:c.parentOccurrenceId&&a.has(c.parentOccurrenceId)?l.get(c.parentOccurrenceId)??null:null,role:c.role,shadow:c.usePath.length>0,orderKey:Object.freeze([...c.orderKey])})))}function I$(t,e,n){if(!e)return Object.freeze([]);let r=new Set(n.map(o=>o.sourceOccurrenceId)),i=new Set(n.map(o=>o.correspondingSourceNodeId));return Object.freeze(t.edges.filter(o=>o.participation==="resource-product"&&o.containingResourceSourceNodeId===e.sourceNodeId&&(o.occurrenceId!==null&&r.has(o.occurrenceId)||i.has(o.fromSourceNodeId))&&o.kind!=="pattern-template"))}function w$(t,e){if(e.length===0)return Object.freeze([]);let n=new Map(t.resources.map(r=>[r.sourceNodeId,r]));return Object.freeze(t.closureFromEdges(e).materializations.map(r=>{let i=n.get(r.sourceNodeId);return Object.freeze({sourceNodeId:r.sourceNodeId,sourceId:i?.authoredId??null,kind:i?.kind??"referenced-fragment",viaResourceReferenceId:r.viaResourceReferenceId})}))}function k$(t,e,n,r){return e==="objectBoundingBox"?bv(t)===null?"invalid":"valid":he(t,{percentBasis:n==="x"?r.viewport.width:r.viewport.height,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.rootFontSize,rootFontSize:r.rootFontSize})===void 0?"invalid":"valid"}function io(t,e,n,r,i){return t===void 0?i:e==="objectBoundingBox"?bv(t)??i:he(t,{percentBasis:n==="x"?r.viewport.width:r.viewport.height,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.fontSize,rootFontSize:r.rootFontSize})??i}function im(t,e){if(t.status!=="materialized")return null;let n=io(t.values.x?.raw,t.patternUnits,"x",e,0),r=io(t.values.y?.raw,t.patternUnits,"y",e,0),i=io(t.values.width?.raw,t.patternUnits,"x",e,0),o=io(t.values.height?.raw,t.patternUnits,"y",e,0);return t.patternUnits==="userSpaceOnUse"?Object.freeze({x:n,y:r,width:i,height:o}):Object.freeze({x:e.objectBounds.x+n*e.objectBounds.width,y:e.objectBounds.y+r*e.objectBounds.height,width:i*e.objectBounds.width,height:o*e.objectBounds.height})}function R$(t,e,n,r,i,o){let s=h$(t,r,e),a=E(e,"id"),l=n.direct(e.sourceNodeId)?.occurrenceId??e.sourceNodeId,c=ro(s,"patternUnits"),u="objectBoundingBox";c?.raw==="userSpaceOnUse"?u="userSpaceOnUse":c&&c.raw!=="objectBoundingBox"&&o.push(si(t,e,i,"patternUnits",c.raw,"must be objectBoundingBox or userSpaceOnUse"));let d=ro(s,"patternContentUnits"),p="userSpaceOnUse";d?.raw==="objectBoundingBox"?p="objectBoundingBox":d&&d.raw!=="userSpaceOnUse"&&o.push(si(t,e,i,"patternContentUnits",d.raw,"must be objectBoundingBox or userSpaceOnUse"));let f=!1,g={};for(let F of d$){let V=ro(s,F);if(!V)continue;let K=k$(V.raw,u,F==="x"||F==="width"?"x":"y",i);g[F]=Object.freeze({...V,validity:K}),K==="invalid"&&o.push(si(t,e,i,F,V.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},h=io(g.width?.raw,u,"x",m,0),b=io(g.height?.raw,u,"y",m,0);for(let[F,V]of[["width",h],["height",b]])g[F]?.validity==="valid"&&V<0&&(f=!0,o.push(si(t,e,i,F,g[F].raw,"must not be negative")));let S=ro(s,"patternTransform"),v=S?Gt(S.raw):[1,0,0,1,0,0],I=v===null?"invalid":"valid";S&&I==="invalid"&&o.push(si(t,e,i,"patternTransform",S.raw,"does not match the SVG transform-list grammar"));let x=Object.freeze({raw:S?.raw??null,ownerSourceNodeId:S?.ownerSourceNodeId??null,matrix:Object.freeze(it(v??[1,0,0,1,0,0])),validity:I}),P=ro(s,"viewBox"),T=P?Ue(P.raw):null,k="valid";P&&(!T||T.width<0||T.height<0)&&(k="invalid",o.push(si(t,e,i,"viewBox",P.raw,"must be four numbers with non-negative width and height")));let w=P?Object.freeze({...P,validity:k}):null,$=T&&k==="valid"?Object.freeze([T.x,T.y,T.width,T.height]):null,R=ro(s,"preserveAspectRatio"),C=g$(R?.raw??null);R&&!C.valid&&o.push(si(t,e,i,"preserveAspectRatio",R.raw,"does not match the preserveAspectRatio grammar"));let A=R?Object.freeze({...R,validity:C.valid?"valid":"invalid"}):null,D=S$(s),_=x$(t,n,e,D),O=I$(r,D,_),L=w$(r,O),re=!!($&&($[2]===0||$[3]===0)),ee=f?"invalid":!D||h===0||b===0||re?"empty":"materialized";return Object.freeze({occurrenceId:l,sourceNodeId:e.sourceNodeId,sourceId:a,status:ee,patternUnits:u,patternContentUnits:p,values:Object.freeze(g),transform:x,viewBox:$,viewBoxAuthored:w,preserveAspectRatio:C.value,preserveAspectRatioAuthored:A,templateSourceNodeIds:Object.freeze(s.map(F=>F.sourceNodeId)),contentProviderSourceNodeId:D?.sourceNodeId??null,contentOccurrences:_,contentOccurrenceIds:Object.freeze(_.map(F=>F.occurrenceId)),resources:L})}function T$(t,e){return Object.freeze(t.edges.flatMap(n=>{if(n.binding!=="applied-css"||!n.occurrenceId||n.propertyName!=="fill"&&n.propertyName!=="stroke")return[];let r=n.targetSourceNodeId?e.get(n.targetSourceNodeId):void 0,i=wn(n.propertyValue)[n.tokenIndex],o=i?n.propertyValue.slice(i.tokenEnd).trim():"",s=i?!o||o.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:o}):Object.freeze({kind:"unresolved",authoredValue:n.propertyValue}),a=n.validity==="missing"||n.validity==="invalid-target"?"invalid-reference":r?r.status:"other-paint-server";return[Object.freeze({resourceReferenceId:n.resourceReferenceId,consumerOccurrenceId:n.occurrenceId,occurrenceId:n.occurrenceId,sourceNodeId:n.fromSourceNodeId,correspondingSourceNodeId:n.fromSourceNodeId,propertyName:n.propertyName,authoredValue:n.propertyValue,patternSourceNodeId:r?.sourceNodeId??null,status:a,fallback:s})]}))}function Ac(t,e,n,r,i){let o=[],s=r.resources.filter(d=>d.kind==="pattern").map(d=>t.index.element(d.sourceNodeId)).filter(Sv).sort((d,p)=>d.elementOrder-p.elementOrder).map(d=>R$(t,d,e,r,i,o)),a=new Map(s.map(d=>[d.sourceNodeId,d])),l=T$(r,a),c=new Map;for(let d of l){let p=c.get(d.occurrenceId)??[];p.push(d),c.set(d.occurrenceId,p)}for(let d of c.values())Object.freeze(d);let u=Object.freeze({candidates:Object.freeze(s),bindings:l,candidate:d=>a.get(d)??null,bindingsFor:d=>c.get(d)??Object.freeze([]),binding:(d,p,f)=>(c.get(d)??[]).find(g=>g.propertyName===p&&(f===void 0||g.resourceReferenceId===f))??null,resolveTile:(d,p)=>{let f=d.patternSourceNodeId?a.get(d.patternSourceNodeId):null;return f?im(f,p):null}});return Object.freeze({value:u,diagnostics:Object.freeze(o)})}var vv=new Map([["clippath","clipPath"],["filter","filter"],["lineargradient","linearGradient"],["mask","mask"],["pattern","pattern"],["radialgradient","radialGradient"],["symbol","symbol"]]),P$=new Set(["clipPathUnits","filterUnits","gradientUnits","maskContentUnits","maskUnits","patternContentUnits","patternUnits","primitiveUnits","spreadMethod"]);function C$(t,e){let n=new Set(e.attributes.filter(o=>o.prefix==="xmlns").map(o=>o.name)),r=new Map,i=t.index.parent(e.sourceNodeId);for(;i;){for(let o of i.attributes)o.prefix==="xmlns"&&(n.has(o.name)||r.has(o.name)||r.set(o.name,o));i=t.index.parent(i.sourceNodeId)}return Object.freeze([...r.values()])}function om(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Nc(t){return om(t).replaceAll('"',"&quot;")}function $$(t){switch(t.kind){case"text":return om(t.value);case"comment":return`<!--${t.value}-->`;case"cdata":return`<![CDATA[${t.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${t.value}?>`;case"doctype":return`<!DOCTYPE ${t.value}>`}}function xv(t,e,n=[],r=!1){if(t.namespaceUri===U&&t.localName.toLowerCase()==="script"||r&&t.namespaceUri===U&&["animate","animatemotion","animatetransform","discard","set"].includes(t.localName.toLowerCase())&&!Pe(t))return"";let i=e.identifierBySourceNodeId.get(t.sourceNodeId),o=e.generatedIdBySourceNodeId.get(t.sourceNodeId),s=e.attributeRewrites.get(t.sourceNodeId),a=[],l=!1,c=!1;for(let g of n)a.push(`${g.name}="${Nc(g.value)}"`);for(let g of t.attributes){if(/^on/iu.test(g.name))continue;g.name==="data-source-id"&&(l=!0),g.localName==="id"&&g.namespaceUri===null&&(c=!0);let m=g.localName==="id"&&g.namespaceUri===null&&i?i.liveId:g.localName==="id"&&g.namespaceUri===null&&o?o:s?.get(g.name)??g.value;m===""&&P$.has(g.name)||a.push(`${g.name}="${Nc(m)}"`)}i?.restoreSourceId&&!l&&a.push(`data-source-id="${Nc(i.sourceId)}"`),o&&!c&&a.push(`id="${Nc(o)}"`);let u=`<${t.name}${a.length>0?` ${a.join(" ")}`:""}`,d=e.textRewrites.get(t.sourceNodeId),p=d!==void 0?om(d):t.children.map(g=>g.kind==="element"?xv(g,e,[],r):$$(g)).join(""),f=/\/\s*>\s*$/u.test(t.rawXml??"");return p.length===0&&f?`${u}/>`:`${u}>${p}</${t.name}>`}function E$(t){let e=new Map(t.resourceIds.map(i=>[i.sourceNodeId,i])),n=new Map,r=new Map;for(let i of t.rewrites){if(i.target==="text-content"){r.set(i.sourceNodeId,i.value);continue}if(!i.name)continue;let o=n.get(i.sourceNodeId)??new Map;o.set(i.name,i.value),n.set(i.sourceNodeId,o)}return{identifierBySourceNodeId:e,attributeRewrites:new Map([...n].map(([i,o])=>[i,o])),textRewrites:r,generatedIdBySourceNodeId:new Map(t.generatedIds.map(({sourceNodeId:i,liveId:o})=>[i,o]))}}function Iv(t,e){let n=t.index.parent(e);for(;n;){if(n.namespaceUri===U&&n.localName.toLowerCase()==="defs")return!0;n=t.index.parent(n.sourceNodeId)}return!1}function A$(t){return t.definition.definitionChildIds&&Object.freeze(t.definition.definitionChildIds),t.definition.sourceDefinitionChildIds&&Object.freeze(t.definition.sourceDefinitionChildIds),Object.freeze(t.definition),Object.freeze(t)}function wv(t,e,n){if(e.namespaceUri!==U||e.localName.toLowerCase()!=="g"||!Iv(t,e.sourceNodeId))return null;let r=e.children.filter(o=>o.kind==="element");if(r.length===0)return null;let i=[];for(let o of r){if(o.namespaceUri!==U)return null;let s=vv.get(o.localName.toLowerCase()),a=wv(t,o,n);if(!s&&!a)return null;let l=n.identifierBySourceNodeId.get(o.sourceNodeId);if(!l)return null;i.push({sourceId:l.liveId,destinationId:l.liveId})}return i}function Mc(t,e,n){let r=[],i=E$(e),o=[];for(let c of t.index.elements){if(c.namespaceUri!==U)continue;let u=vv.get(c.localName.toLowerCase()),d=wv(t,c,i);if(!u&&!d)continue;let p=E(c,"id");if(!p)continue;let f=i.identifierBySourceNodeId.get(c.sourceNodeId);if(!f){r.push({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,message:`Definition ${p} has no destination identifier assignment.`,documentPath:t.index.sourcePath(c.sourceNodeId),elementName:c.name,sourceId:p,sourceNodeId:c.sourceNodeId,capability:"paint-server-definitions"});continue}let g={id:f.liveId,type:u??c.localName,...d?{role:"referenced-fragment",definitionChildIds:d.map(m=>m.destinationId),sourceDefinitionChildIds:d.map(m=>m.sourceId)}:{},markup:xv(c,i,C$(t,c),u==="clipPath"||u==="mask"),passthrough:!0};o.push(A$({sourceNodeId:c.sourceNodeId,sourceId:p,destinationId:f.liveId,type:u??c.localName,insideDefs:Iv(t,c.sourceNodeId),definition:g}))}let s=Object.freeze(o),a=new Map(s.map(c=>[c.sourceNodeId,c])),l=Object.freeze({candidates:s,candidate:c=>a.get(c)??null,definitions:(c=new Set)=>Object.freeze(s.filter(u=>!c.has(u.sourceNodeId)).map(u=>u.definition))});return Object.freeze({value:l,diagnostics:Object.freeze(r)})}var Oc=Object.freeze({x:"-10%",y:"-10%",width:"120%",height:"120%"}),N$=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,M$=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(%)?$/u,O$=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(deg|grad|rad|turn)?$/iu,Tv=new Set(["animate","animatemotion","animatetransform","set"]),D$=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 li(t){if(!t||typeof t!="object"&&typeof t!="function"||Object.isFrozen(t))return t;for(let e of Object.values(t))li(e);return Object.freeze(t)}function Sr(t){return t.children.filter(e=>e.kind==="element")}function kv(t){let e="",n=[...t.children].reverse();for(;n.length>0;){let r=n.pop();r.kind==="text"||r.kind==="cdata"?e+=r.value:r.kind==="element"&&n.push(...[...r.children].reverse())}return e}function sm(t){return(t.rawXml??"").replace(/\s+xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gu,"").replace(/\s+xmlns=""/gu,"")}function qn(t){if(t===null||!N$.test(t.trim()))return;let e=Number(t.trim());return Number.isFinite(e)?e:void 0}function ai(t,e){let n=E(t,e);return n===null?void 0:n}function zc(t,e,n=""){return`${t}:${e}${n}`}function Dc(t,e,n,r){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:t.source,entrypoint:t.entrypoint,capability:"filters",sourceNodeId:n.sourceNodeId,sourceId:E(n,"id")??void 0,occurrenceId:r,elementName:n.name,message:e})}function z$(t){let e=[...Sr(t)];for(;e.length>0;){let n=e.pop();if(n.namespaceUri===U&&n.localName.toLowerCase()==="script")return!0;e.push(...Sr(n))}return!1}function Rv(t,e,n){let r=e.direct(t.sourceNodeId);return r?n.value(r.occurrenceId,"display"):E(t,"display")}function _$(t,e,n,r){if(Rv(e,n,r)?.trim().toLowerCase()==="none")return!0;let i=t.index.parent(e.sourceNodeId);for(;i;){if(i.namespaceUri===U&&i.localName.toLowerCase()==="defs"&&Rv(i,n,r)?.trim().toLowerCase()==="none")return!0;i=t.index.parent(i.sourceNodeId)}return!1}function F$(t){let e=E(t,"color-interpolation-filters"),n=E(t,"filterUnits"),r=E(t,"primitiveUnits");return{colorInterpolation:e==="auto"||e==="sRGB"||e==="linearRGB"?e:"linearRGB",filterUnits:n==="userSpaceOnUse"||n==="objectBoundingBox"?n:"objectBoundingBox",primitiveUnits:r==="userSpaceOnUse"||r==="objectBoundingBox"?r:"userSpaceOnUse",region:Object.freeze({x:E(t,"x")??Oc.x,y:E(t,"y")??Oc.y,width:E(t,"width")??Oc.width,height:E(t,"height")??Oc.height})}}function Pv(t,e){let n=ai(e,"x"),r=ai(e,"y"),i=ai(e,"width"),o=ai(e,"height");n!==void 0&&(t.x=n),r!==void 0&&(t.y=r),i!==void 0&&(t.width=i),o!==void 0&&(t.height=o);let s=E(e,"filterUnits");(s==="userSpaceOnUse"||s==="objectBoundingBox")&&(t.filterUnits=s);let a=E(e,"primitiveUnits");(a==="userSpaceOnUse"||a==="objectBoundingBox")&&(t.primitiveUnits=a);let l=E(e,"color-interpolation-filters");(l==="auto"||l==="sRGB"||l==="linearRGB")&&(t.type==="raw-svg"?t.colorInterpolationFilters=l:t.filterColorInterpolation=l);let c=ai(e,"flood-color"),u=ai(e,"flood-opacity"),d=ai(e,"lighting-color");c!==void 0&&(t.floodColor=c),u!==void 0&&(t.floodOpacity=u),d!==void 0&&(t.lightingColor=d)}function L$(t){return Sr(t).filter(e=>Tv.has(e.localName.toLowerCase())).map(sm).filter(Boolean)}function xt(t,e,n){let r={id:zc(e,t.sourceNodeId),type:e};for(let l of["in","result","x","y","width","height"]){let c=E(t,l);c!==null&&(r[l]=c)}let i=E(t,"color-interpolation-filters");(i==="auto"||i==="sRGB"||i==="linearRGB")&&(r.colorInterpolationFilters=i);let o=new Set(["in","result","x","y","width","height","color-interpolation-filters"]),s={};for(let l of t.attributes)o.has(l.name)||n.has(l.name)||(s[l.name]=l.value);Object.keys(s).length>0&&(r.unknownAttrs=s);let a=L$(t);return a.length>0&&(r.animations=a),r}function B$(t){let e=E(t,"type");if(e==="identity")return{type:e};if(e==="table"||e==="discrete"){let r=(E(t,"tableValues")??"").trim().split(/[\s,]+/u).filter(Boolean).map(i=>qn(i));return r.some(i=>i===void 0)?void 0:{type:e,tableValues:r}}if(e==="linear"){let n={type:e},r=qn(E(t,"slope")),i=qn(E(t,"intercept"));return r!==void 0&&(n.slope=r),i!==void 0&&(n.intercept=i),n}if(e==="gamma"){let n={type:e},r=qn(E(t,"amplitude")),i=qn(E(t,"exponent")),o=qn(E(t,"offset"));return r!==void 0&&(n.amplitude=r),i!==void 0&&(n.exponent=i),o!==void 0&&(n.offset=o),n}}function G$(t){let e={},n=t.localName.toLowerCase(),r=n==="fedistantlight"?["azimuth","elevation"]:n==="fepointlight"?["x","y","z"]:n==="fespotlight"?["x","y","z","pointsAtX","pointsAtY","pointsAtZ","specularExponent","limitingConeAngle"]:null;if(r){for(let i of r){let o=qn(E(t,i));o!==void 0&&(e[i]=o)}return n==="fedistantlight"?{kind:"feDistantLight",...e}:n==="fepointlight"?{kind:"fePointLight",...e}:{kind:"feSpotLight",...e}}}function Ht(t,e,n,r=n){let i=qn(E(e,n));i!==void 0&&(t[r]=i)}function st(t,e,n,r=n){let i=E(e,n);i!==null&&(t[r]=i)}function V$(t){let e=t.localName.toLowerCase();switch(e){case"feblend":{let n=xt(t,"feBlend",new Set(["in2","mode","no-composite"]));st(n,t,"in2");let r=E(t,"mode");return r&&D$.has(r)&&(n.mode=r),ot(t,"no-composite")&&(n.noComposite=!0),n}case"fecolormatrix":{let n=xt(t,"feColorMatrix",new Set(["type","values"])),r=E(t,"type");return(r==="matrix"||r==="saturate"||r==="hueRotate"||r==="luminanceToAlpha")&&(n.matrixType=r),st(n,t,"values"),n}case"fecomponenttransfer":{let n=xt(t,"feComponentTransfer",new Set);for(let r of Sr(t)){let i=B$(r),o=r.localName.toLowerCase();o==="fefuncr"&&i?n.funcR=i:o==="fefuncg"&&i?n.funcG=i:o==="fefuncb"&&i?n.funcB=i:o==="fefunca"&&i&&(n.funcA=i)}return n}case"fecomposite":{let n=xt(t,"feComposite",new Set(["in2","operator","k1","k2","k3","k4"]));st(n,t,"in2");let r=E(t,"operator");(r==="over"||r==="in"||r==="out"||r==="atop"||r==="xor"||r==="lighter"||r==="arithmetic")&&(n.operator=r);for(let i of["k1","k2","k3","k4"])Ht(n,t,i);return n}case"feconvolvematrix":{let r=xt(t,"feConvolveMatrix",new Set(["order","kernelMatrix","divisor","bias","targetX","targetY","edgeMode","kernelUnitLength","preserveAlpha"]));st(r,t,"order"),st(r,t,"kernelMatrix");for(let s of["divisor","bias","targetX","targetY"])Ht(r,t,s);let i=E(t,"edgeMode");(i==="duplicate"||i==="wrap"||i==="none")&&(r.edgeMode=i),st(r,t,"kernelUnitLength");let o=E(t,"preserveAlpha");return o!==null&&(r.preserveAlpha=o==="true"),r}case"fediffuselighting":case"fespecularlighting":{let n=e==="fediffuselighting",i=xt(t,n?"feDiffuseLighting":"feSpecularLighting",new Set(["surfaceScale","diffuseConstant","specularConstant","specularExponent","kernelUnitLength","lighting-color"]));Ht(i,t,"surfaceScale"),n?Ht(i,t,"diffuseConstant"):(Ht(i,t,"specularConstant"),Ht(i,t,"specularExponent")),st(i,t,"kernelUnitLength"),st(i,t,"lighting-color","lightingColor");for(let o of Sr(t)){let s=G$(o);if(s){i.lightSource=s;break}}return i}case"fedisplacementmap":{let n=xt(t,"feDisplacementMap",new Set(["in2","scale","xChannelSelector","yChannelSelector"]));st(n,t,"in2"),Ht(n,t,"scale");for(let r of["xChannelSelector","yChannelSelector"]){let i=E(t,r);(i==="R"||i==="G"||i==="B"||i==="A")&&(n[r]=i)}return n}case"fedropshadow":{let n=xt(t,"feDropShadow",new Set(["dx","dy","stdDeviation","flood-color","flood-opacity"]));return Ht(n,t,"dx"),Ht(n,t,"dy"),st(n,t,"stdDeviation"),st(n,t,"flood-color","floodColor"),st(n,t,"flood-opacity","floodOpacity"),n}case"feflood":{let n=xt(t,"feFlood",new Set(["flood-color","flood-opacity"]));return st(n,t,"flood-color","floodColor"),st(n,t,"flood-opacity","floodOpacity"),n}case"fegaussianblur":{let n=xt(t,"feGaussianBlur",new Set(["stdDeviation","edgeMode"]));st(n,t,"stdDeviation");let r=E(t,"edgeMode");return(r==="duplicate"||r==="wrap"||r==="none")&&(n.edgeMode=r),n}case"feimage":{let n=xt(t,"feImage",new Set(["href","xlink:href","preserveAspectRatio","crossorigin"])),r=Pe(t);r?.namespace==="svg2"?n.href=r.value:r?.namespace==="xlink"&&(n.xlinkHref=r.value),st(n,t,"preserveAspectRatio");let i=E(t,"crossorigin");return(i==="anonymous"||i==="use-credentials")&&(n.crossorigin=i),n}case"femerge":{let n=xt(t,"feMerge",new Set);return n.nodes=Sr(t).filter(r=>r.localName.toLowerCase()==="femergenode").map(r=>{let i=E(r,"in");return i===null?{}:{in:i}}),n}case"femorphology":{let n=xt(t,"feMorphology",new Set(["operator","radius"])),r=E(t,"operator");return(r==="erode"||r==="dilate")&&(n.operator=r),st(n,t,"radius"),n}case"feoffset":{let n=xt(t,"feOffset",new Set(["dx","dy"]));return Ht(n,t,"dx"),Ht(n,t,"dy"),n}case"fetile":return xt(t,"feTile",new Set);case"feturbulence":{let n=xt(t,"feTurbulence",new Set(["baseFrequency","numOctaves","seed","stitchTiles","type"]));st(n,t,"baseFrequency"),Ht(n,t,"numOctaves"),Ht(n,t,"seed");let r=E(t,"stitchTiles");(r==="stitch"||r==="noStitch")&&(n.stitchTiles=r);let i=E(t,"type");return(i==="fractalNoise"||i==="turbulence")&&(n.turbulenceType=i),n}default:return null}}function j$(t){let e=[],n="",r=0;for(let i of t)i==="("?r++:i===")"&&r--,/\s/u.test(i)&&r===0?(n&&e.push(n),n=""):n+=i;return n&&e.push(n),e}function nn(t,e){return(t===void 0?void 0:qn(t))??e}function U$(t,e){let n=j$(t);if(n.length<2)return null;let r=n[0],i=n[1]==="1",o={id:zc(r,e,":preset"),enabled:i};switch(r){case"hue-rotate":return{...o,type:r,angle:nn(n[2],0)};case"sepia":case"grayscale":case"saturate":case"invert":case"brightness":case"contrast":return{...o,type:r,amount:nn(n[2],1)};case"duotone":return{...o,type:r,shadowColor:n[2]??"#000000",highlightColor:n[3]??"#ffffff"};case"inner-shadow":return{...o,type:r,offsetX:nn(n[2],0),offsetY:nn(n[3],0),blurRadius:nn(n[4],0),choke:nn(n[5],0),color:n[6]??"rgba(0,0,0,0.5)",opacity:1};case"drop-shadow":return{...o,type:r,offsetX:nn(n[2],0),offsetY:nn(n[3],0),blurRadius:nn(n[4],0),spread:nn(n[5],0),color:n[6]??"rgba(0,0,0,0.5)",opacity:1};case"gaussian-blur":{let s=nn(n[2],0);return{...o,type:r,blurX:s,blurY:nn(n[3],s),linked:n[3]===void 0,quality:"normal"}}default:return null}}function H$(t,e){let n={id:zc("raw-svg",t.sourceNodeId),type:"raw-svg",enabled:!0,svgContent:Sr(t).map(sm).filter(Boolean).join(`
17
+ `)};return Pv(n,t),e&&(n.display="none"),n}function W$(t){let e={id:zc("svg-primitive-chain",t.sourceNodeId),type:"svg-primitive-chain",enabled:!0,primitives:[]};Pv(e,t);let n=[];for(let r of Sr(t)){let i=r.localName.toLowerCase();if(i==="title")e.filterTitle=kv(r);else if(i==="desc")e.filterDescription=kv(r);else if(Tv.has(i))n.push(sm(r));else{let o=V$(r);o&&e.primitives.push(o)}}return n.length>0&&(e.filterAnimations=n),e}function K$(t,e,n,r,i,o){let s=F$(e),a=e.attributes.find(m=>m.localName==="preset"&&m.prefix==="bx")?.value,l=_$(t,e,n,r),c=E(e,"filterUnits"),u=E(e,"primitiveUnits"),d=E(e,"color-interpolation-filters");c!==null&&c!=="userSpaceOnUse"&&c!=="objectBoundingBox"&&o.push(Dc(i,`Invalid filterUnits value "${c}" uses its initial value.`,e)),u!==null&&u!=="userSpaceOnUse"&&u!=="objectBoundingBox"&&o.push(Dc(i,`Invalid primitiveUnits value "${u}" uses its initial value.`,e)),d!==null&&d!=="auto"&&d!=="sRGB"&&d!=="linearRGB"&&o.push(Dc(i,`Invalid color-interpolation-filters value "${d}" uses its initial value.`,e));let p=a?U$(a,e.sourceNodeId):l||z$(e)?H$(e,l):W$(e),f=Object.freeze(p?[p]:[]),g=p?.type==="svg-primitive-chain"&&p.primitives.length===0;return li({sourceNodeId:e.sourceNodeId,sourceId:E(e,"id"),status:p?g?"empty":"materialized":"invalid",filters:f,...s})}function X$(t,e){let n=M$.exec(t.trim());if(!n)return null;let r=Number(n[1]);return!Number.isFinite(r)||r<0?null:n[2]?r/100:r}function Y$(t){let e=O$.exec(t.trim());if(!e)return null;let n=Number(e[1]);if(!Number.isFinite(n))return null;switch((e[2]??"deg").toLowerCase()){case"turn":return n*360;case"rad":return n*180/Math.PI;case"grad":return n*.9;default:return n}}function q$(t){let e=[],n="",r=null,i=!1,o=0;for(let s of t){if(r){n+=s,i?i=!1:s==="\\"?i=!0:s===r&&(r=null);continue}s==='"'||s==="'"?(r=s,n+=s):s==="("?(o++,n+=s):s===")"?(o--,n+=s):/\s/u.test(s)&&o===0?(n&&e.push(n),n=""):n+=s}return n&&e.push(n),e}function Z$(t,e){if(t.toLowerCase()==="currentcolor")return e??"#000000";if(/^#[\da-f]{3,8}$/iu.test(t)||/^rgba?\(/iu.test(t))return t;let n=eo(t);return n?`rgb(${n.r}, ${n.g}, ${n.b})`:null}function J$(t,e,n,r,i,o){if(t==="brightness"||t==="contrast"||t==="grayscale"||t==="invert"||t==="opacity"||t==="saturate"||t==="sepia"){let l=X$(e,1);return l===null?null:{id:n,type:t,enabled:!0,amount:l}}if(t==="hue-rotate"){let l=Y$(e);return l===null?null:{id:n,type:t,enabled:!0,angle:l}}if(t==="blur"){let l=he(e.trim(),{fontSize:i,rootFontSize:o.rootFontSize??16,viewportWidth:o.viewport?.width,viewportHeight:o.viewport?.height});return l===void 0||l<0||e.trim().endsWith("%")?null:{id:n,type:"gaussian-blur",enabled:!0,blurX:l,blurY:l,linked:!0,quality:"normal"}}if(t!=="drop-shadow")return null;let s=[],a=null;for(let l of q$(e.trim())){let c=he(l,{fontSize:i,rootFontSize:o.rootFontSize??16,viewportWidth:o.viewport?.width,viewportHeight:o.viewport?.height});if(c!==void 0&&!l.endsWith("%"))s.push(c);else{let u=Z$(l,r);if(!u||a!==null)return null;a=u}}return s.length<2||s.length>3||(s[2]??0)<0?null:{id:n,type:"drop-shadow",enabled:!0,offsetX:s[0],offsetY:s[1],blurRadius:s[2]??0,spread:0,color:a??r??"#000000",opacity:1}}function Q$(t,e,n){let r=t.resolvePropertyValue(e.correspondingSourceNodeId,"filter",n),i=r.filter(o=>o.occurrenceId===e.occurrenceId);return i.length>0?i:r.filter(o=>o.occurrenceId===null)}function eE(t){let e=t.trim();return e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e.startsWith("#")&&e.length>1?e.slice(1):null}function tE(t,e){let n=0;for(let r of e){if(t.slice(n,r.tokenStart).replace(/\/\*[\s\S]*?\*\//gu,"").trim())return!1;n=r.tokenEnd}return t.slice(n).replace(/\/\*[\s\S]*?\*\//gu,"").trim().length===0}function nE(t,e,n,r,i,o,s,a){let l=[],c=Q$(r,t,e),u=0,d=!1,p=he(n.value(t.occurrenceId,"font-size"),{fontSize:o.rootFontSize??16,rootFontSize:o.rootFontSize??16,viewportWidth:o.viewport?.width,viewportHeight:o.viewport?.height})??o.rootFontSize??16,f=n.value(t.occurrenceId,"color"),g=cn(e);tE(e,g)||(d=!0);for(let[b,S]of g.entries()){let v=`filter-operation:${t.occurrenceId}:${b}`,I=e.slice(S.tokenStart,S.tokenEnd);if(S.name!=="url"){let $=J$(S.name,e.slice(S.argumentsStart,S.argumentsEnd),v,f,p,o),R=$?"materialized":"invalid-reference";$||(d=!0,s.push(Dc(o,`Invalid or unsupported CSS filter function "${I}".`,a,t.occurrenceId))),l.push(Object.freeze({operationId:v,kind:"function",authoredValue:I,filter:$,filterSourceNodeId:null,status:R}));continue}let P=eE(e.slice(S.argumentsStart,S.argumentsEnd))===null?void 0:c[u++],T=P?.targetSourceNodeId?i.get(P.targetSourceNodeId):null,w=P?.validity==="valid"&&T?T.status==="empty"?"empty":T.status==="materialized"?"materialized":"invalid-reference":"invalid-reference";w==="invalid-reference"&&(d=!0),l.push(li({operationId:v,kind:"reference",authoredValue:I,filter:w==="materialized"?T?.filters[0]??null:null,filterSourceNodeId:P?.targetSourceNodeId??null,status:w}))}let h=e.trim().toLowerCase()==="none"?"none":d||l.length===0?"invalid-reference":"materialized";return li({consumerOccurrenceId:t.occurrenceId,consumerSourceNodeId:t.correspondingSourceNodeId,authoredValue:e,status:h,operations:Object.freeze(l)})}function _c(t,e,n,r,i){let o=[],s=r.resources.filter(d=>d.kind==="filter").map(d=>t.index.element(d.sourceNodeId)).filter(d=>!!d).map(d=>K$(t,d,e,n,i,o)),a=new Map(s.map(d=>[d.sourceNodeId,d])),l=[];for(let d of e.occurrences){let p=t.index.element(d.correspondingSourceNodeId);if(!p)continue;let f=n.value(d.occurrenceId,"filter");f&&l.push(nE(d,f,n,r,a,i,o,p))}let c=new Map(l.map(d=>[d.consumerOccurrenceId,d]));li(s),li(l),li(o);let u=Object.freeze({candidates:s,bindings:l,diagnostics:o,candidate(d){return a.get(d)??null},binding(d){return c.get(d)??null}});return Object.freeze({value:u,diagnostics:o})}var rE="application/ecmascript",iE="http://www.w3.org/1999/xlink",oE=Object.freeze([]);function sE(t){let e="",n=[...t.children].reverse();for(;n.length>0;){let r=n.pop();r.kind==="text"||r.kind==="cdata"?e+=r.value:r.kind==="element"&&n.push(...[...r.children].reverse())}return e}function aE(t,e){let n=t.attributes[e];return n.namespaceUri===iE&&n.localName==="href"?!0:n.namespaceUri!==null?!1:["id","type","href","crossorigin","async","defer"].includes(n.localName)}function lE(t){let e=t.attributes.filter((n,r)=>!aE(t,r)).map(n=>[n.name,n.value]);return e.length>0?Object.freeze(Object.fromEntries(e)):void 0}function cE(t,e){return!e||e.sourceNodeId===t.root.sourceNodeId||e.namespaceUri===U&&["defs","metadata"].includes(e.localName.toLowerCase())?"document":"element"}function dE(t){let e=Pe(t)?.value,n=e!==void 0&&e.length>0,r=E(t,"type")||rE,i=E(t,"crossorigin"),o=E(t,"id")||void 0,s=lE(t);return Object.freeze({id:`script:${t.sourceNodeId}`,...o?{svgId:o}:{},source:n?"external":"inline",content:n?"":sE(t),...n?{href:e}:{},type:r,...i==="anonymous"||i==="use-credentials"?{crossorigin:i}:{},...ot(t,"async")?{async:!0}:{},...ot(t,"defer")?{defer:!0}:{},...s?{customAttrs:s}:{}})}function Fc(t,e){let n=[],r=t.index.elements.filter(c=>c.namespaceUri===U&&c.localName.toLowerCase()==="script").map(c=>{let u=t.index.parent(c.sourceNodeId);return Object.freeze({sourceNodeId:c.sourceNodeId,parentSourceNodeId:u?.sourceNodeId??null,scope:cE(t,u),script:dE(c)})}),i=Object.freeze(r.filter(c=>c.scope==="document")),o=Object.freeze(r.filter(c=>c.scope==="element")),s=new Map(r.map(c=>[c.sourceNodeId,c])),a=new Map;for(let c of o){if(!c.parentSourceNodeId)continue;let u=a.get(c.parentSourceNodeId)??[];a.set(c.parentSourceNodeId,Object.freeze([...u,c]))}Object.freeze(r),Object.freeze(n);let l=Object.freeze({candidates:r,documentScripts:i,elementScripts:o,candidate(c){return s.get(c)??null},forParent(c){return a.get(c)??oE}});return Object.freeze({value:l,diagnostics:n})}function Pn(t){if(!t)return"";let e=t.replace(/[^A-Za-z0-9_.-]/g,"_");return e&&!/^[A-Za-z_]/.test(e)&&(e=`_${e}`),e}function uE(t){let e=t.state?.children;return Array.isArray(e)?e:[]}function Cv(t,e,n="shapes"){let r=new Set,i=(o,s)=>{r.has(o)||(r.add(o),e(o,s),uE(o).forEach((a,l)=>i(a,`${s}.children[${l}]`)),r.delete(o))};t.forEach((o,s)=>i(o,`${n}[${s}]`))}function pE(t){let e=[],n=new Set,r=i=>{if(!(i===null||typeof i!="object"||n.has(i))){if(n.add(i),Array.isArray(i)){let o=i.filter(s=>!!(s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.type=="string"&&"state"in s));o.length===i.length&&o.length>0?e.push(o):i.forEach(r);return}Object.values(i).forEach(r)}};return r(t),e}function fE(t){return t.definitionId??`${t.type}-${t.id}`}function mE(t,e){return{severity:"warning",code:"duplicate-svg-id",source:"native-document",entrypoint:"full-snapshot-restore",capability:"destination-identity",sourceId:t,documentPath:e[0]?.documentPath,message:`SVG destination id "${t}" has ${e.length} canonical owners.`}}function gE(t,e={}){let n=[],r=new Map,i=new Set,o=[],s=f=>{if(!f.id)return;let g=`${f.channel}\0${f.ownerKey}\0${f.id}`;if(i.has(g))return;i.add(g);let m=Object.freeze({...f});n.push(m);let h=r.get(f.id)??[];h.push(m),r.set(f.id,h)},a=(f,g)=>{let m=f.state??{},h=m.metadata;if(typeof h?.name=="string"){let b=Pn(h.name);b&&s({id:b,ownerKey:`shape:${f.id}:metadata`,channel:"shape-authored",documentPath:g})}f.type==="view"&&typeof m.viewName=="string"&&m.viewName&&s({id:Pn(m.viewName),ownerKey:`view:${f.id}`,channel:"view",documentPath:g}),f.type==="text"&&m.isTextPath===!0&&m.textPathPoints&&s({id:`text-path-${f.id}`,ownerKey:`shape:${f.id}:text-path`,channel:"shape-generated",documentPath:g}),m.displayMode==="motionOnly"&&s({id:f.id,ownerKey:`shape:${f.id}:motion-path`,channel:"shape-generated",documentPath:g}),Array.isArray(m.filters)&&m.filters.length>0&&s({id:`filter-${f.id}`,ownerKey:`shape:${f.id}:filter`,channel:"shape-generated",documentPath:g}),typeof h?.rawMetadata=="string"&&l(h.rawMetadata,`shape:${f.id}:metadata`,void 0,g)},l=(f,g,m,h)=>{let b=`<svg xmlns="${U}">${f}</svg>`,S=mn(b,{source:"native-document",entrypoint:"full-snapshot-restore"},e.parserHost);if(o.push(...S.diagnostics),!S.value)return;let v=new Map;for(let I of S.value.index.elements.slice(1)){let x=E(I,"id");if(!x||S.value.index.parent(I.sourceNodeId)===S.value.root&&m===x)continue;let T=v.get(x)??0;v.set(x,T+1),s({id:x,ownerKey:`${g}#${x}${T>0?`@${T}`:""}`,channel:"verbatim-fragment"})}},c=new Map;Cv(t.shapes??[],(f,g)=>{c.has(f.id)||c.set(f.id,f),a(f,g)});for(let f of c.values()){let g=f.state??{},m=[f.type==="text"?g.shapeInsideRef:void 0,f.type==="shape-reference"?g.targetShapeId:void 0];for(let h of m){if(typeof h!="string")continue;let b=c.get(h),S=b?.state?.metadata?.name;b&&(typeof S!="string"||Pn(S).length===0)&&s({id:b.id,ownerKey:`shape:${b.id}:reference-target`,channel:"shape-generated",documentPath:`shape:${b.id}`})}}typeof t.documentMetadata?.rawMetadata=="string"&&l(t.documentMetadata.rawMetadata,"document:metadata",void 0,"documentMetadata");for(let f of t.documentStyles??[])f.svgId&&s({id:f.svgId,ownerKey:`style:${f.id}`,channel:"document-style",documentPath:"documentStyles"});for(let f of t.documentScripts??[])f.svgId&&s({id:f.svgId,ownerKey:`script:${f.id}`,channel:"document-script",documentPath:"documentScripts"});for(let f of t.animationTimeline?.tracks??[])f.sourceSmilId&&s({id:f.sourceSmilId,ownerKey:`animation:${f.id}`,channel:"animation",documentPath:"animationTimeline"});let u=(f,g,m)=>{let h=g?`libraryFurniture[${m}]`:`library[${m}]`;s({id:f.id,ownerKey:`library:${f.id}`,channel:"library-runtime",documentPath:h}),f.sourceId&&s({id:f.sourceId,ownerKey:`library:${f.id}:source`,channel:"library-source-alias",documentPath:h}),pE(f).forEach((b,S)=>Cv(b,a,`${h}.shapeForest[${S}]`))};(t.library??[]).forEach((f,g)=>u(f,!1,g)),(e.libraryFurniture??[]).forEach((f,g)=>u(f,!0,g));for(let[f,g]of(t.paintServerDefs??[]).entries())s({id:g.id,ownerKey:`paint-server:${g.id}`,channel:"paint-server",documentPath:`paintServerDefs[${f}]`}),l(g.markup,`paint-server:${g.id}`,g.id,`paintServerDefs[${f}].markup`);for(let[f,g]of(t.clipMaskGroups??[]).entries()){let m=fE(g);s({id:m,ownerKey:`clip-mask:${g.id}`,channel:"clip-mask-definition",documentPath:`clipMaskGroups[${f}]`}),g.rawDefinition&&l(g.rawDefinition,`clip-mask:${g.id}`,m,`clipMaskGroups[${f}].rawDefinition`)}for(let f of e.platformReservations??[])s(f);for(let f of r.values())Object.freeze(f);Object.freeze(n);let d=Object.freeze({owners:n,has(f){return r.has(f)},firstOwner(f){return r.get(f)?.[0]??null},ownersOf(f){return r.get(f)??Object.freeze([])}}),p=[...r.entries()].filter(([,f])=>f.length>1).map(([f,g])=>mE(f,g));return{value:d,diagnostics:Object.freeze([...o,...p])}}function hE(t){let e=new Set(t.owners.map(s=>s.id)),n=new Map,r=[],i=new Map;return Object.freeze({allocate:s=>{let a=n.get(s.requestKey);if(a)return a;let l=s.preferredId,c=Pn(l??""),u=Pn(s.fallbackBase)||"svg-resource",d=c||u,p=e.has(d)?t.firstOwner(d):null,f=d;if(e.has(f)){let m=i.get(d)??1;for(;e.has(`${d}-${m}`);)m++;f=`${d}-${m}`,i.set(d,m+1)}e.add(f);let g=Object.freeze({requestKey:s.requestKey,...l!==void 0?{authoredId:l}:{},destinationId:f,...p?{collisionOwner:p}:{}});return n.set(s.requestKey,g),r.push(g),g},assignment(s){return n.get(s)??null},has(s){return e.has(s)},snapshot(){return Object.freeze([...r])}})}function Ls(t,e,n,r){let i=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/10);switch(t){case"stripes":return[{tag:"rect",attrs:{width:r?.strokeWidth!=null?Math.max(.01,Math.min(1,r.strokeWidth))*e:e/2,height:e,fill:n}}];case"dots":{let o=r?.dotRadius!=null?Math.max(.05,Math.min(.45,r.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*o,fill:n}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:n,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:n}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:n}}];case"diagonal":{let o=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:n,"stroke-width":o}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:n,"stroke-width":i}}];case"zigzag":{let o=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.amplitude)):.25,s=e*o;return[{tag:"path",attrs:{d:`M 0 ${s} L ${e/4} 0 L ${e/2} ${s} L ${e*3/4} 0 L ${e} ${s}`,fill:"none",stroke:n,"stroke-width":i}}]}case"waves":{let o=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.amplitude)):.25,s=e*o,a=e/2;return[{tag:"path",attrs:{d:`M 0 ${a} Q ${e/4} ${a-s} ${e/2} ${a} T ${e} ${a}`,fill:"none",stroke:n,"stroke-width":i}}]}case"triangles":{let o=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${o} L 0 ${o} Z`,fill:"none",stroke:n,"stroke-width":i}}]}case"hexagons":{let o=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${o*.5} L ${e*.75} ${o} L ${e*.25} ${o} L 0 ${o*.5} Z`,fill:"none",stroke:n,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:n,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:n,"stroke-width":i}}];case"bricks":{let o=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:n,"stroke-width":o}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:n,"stroke-width":o}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:n,"stroke-width":o}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${e/2} ${e/2} L 0 ${e} M ${e/2} ${e/2} L ${e} 0 M ${e/2} ${e/2} L ${e} ${e}`,fill:"none",stroke:n,"stroke-width":i}}];default:return[]}}function yE(t){let e=Object.entries(t.attrs).map(([n,r])=>` ${n}="${r}"`).join("");return`<${t.tag}${e}/>`}function Lc(t,e,n,r,i){let o=10*e,s="";s+=`<rect width="${o}" height="${o}" fill="${r}"/>`;let a=Ls(t,o,n,i);for(let l of a)s+=yE(l);return{svgContent:s,width:o,height:o}}function oe(t,e,n){n==null||n===""||t.push([e,n])}function am(t){return(t.stops??[]).map(e=>{let n=[["offset",`${e.offset*100}%`],["stop-color",e.color]];return e.opacity!==void 0&&e.opacity<1&&n.push(["stop-opacity",e.opacity]),{attributes:n}})}function SE(t){let e=Object.entries(t.attrs).map(([n,r])=>` ${n}="${de(String(r))}"`).join("");return`<${t.tag}${e}/>`}function Bc(t,e){let n=[["id",t]];if(e.svgContent!=null){let l=e.authoredGeometry??{};return oe(n,"patternUnits",e.patternUnits??"userSpaceOnUse"),oe(n,"patternContentUnits",e.patternContentUnits),oe(n,"x",l.x??e.x),oe(n,"y",l.y??e.y),oe(n,"width",l.width??e.width??10),oe(n,"height",l.height??e.height??10),oe(n,"viewBox",e.viewBox),oe(n,"preserveAspectRatio",e.preserveAspectRatio),oe(n,"patternTransform",e.patternTransform),{attributes:n,content:e.svgContent}}let r=10*(e.scale??1),i=e.color||"#000000",o=e.backgroundColor||"#ffffff";oe(n,"patternUnits","userSpaceOnUse"),oe(n,"width",r),oe(n,"height",r),e.rotation&&oe(n,"patternTransform",`rotate(${e.rotation})`);let s=`<rect width="${de(String(r))}" height="${de(String(r))}" fill="${de(o)}"/>`,a=Ls(e.patternType,r,i).map(SE).join("");return{attributes:n,content:`${s}${a}`}}function Gc(t,e){let n=e.gradientUnits==="userSpaceOnUse",r=s=>n?String(s):`${s*100}%`,i=e.authoredGeometry??{},o=[["id",t]];return n&&oe(o,"gradientUnits","userSpaceOnUse"),oe(o,"x1",i.x1??r(e.x1)),oe(o,"y1",i.y1??r(e.y1)),oe(o,"x2",i.x2??r(e.x2)),oe(o,"y2",i.y2??r(e.y2)),oe(o,"spreadMethod",e.spreadMethod),e.colorInterpolation&&e.colorInterpolation!=="sRGB"&&oe(o,"color-interpolation",e.colorInterpolation),oe(o,"gradientTransform",i.gradientTransform??fs(e.gradientTransform)),{element:"linearGradient",attributes:o,stops:am(e)}}function Vc(t,e){let n=e.gradientUnits==="userSpaceOnUse",r=a=>n?String(a):`${a*100}%`,i=e.authoredGeometry??{},o=[["id",t]];if(n&&oe(o,"gradientUnits","userSpaceOnUse"),oe(o,"cx",i.cx??r(e.cx)),oe(o,"cy",i.cy??r(e.cy)),oe(o,"fx",i.fx??r(e.fx)),oe(o,"fy",i.fy??r(e.fy)),oe(o,"r",i.r??r(e.r)),(i.fr!==void 0||e.fr!==void 0&&e.fr>0)&&oe(o,"fr",i.fr??r(e.fr??0)),oe(o,"spreadMethod",e.spreadMethod),e.colorInterpolation&&e.colorInterpolation!=="sRGB"&&oe(o,"color-interpolation",e.colorInterpolation),i.gradientTransform!==void 0||e.gradientTransform!==void 0)oe(o,"gradientTransform",i.gradientTransform??fs(e.gradientTransform));else{let a=e.ry!==void 0&&e.ry!==e.r,l=!!e.rotation;if(!a&&!l)return{element:"radialGradient",attributes:o,stops:am(e)};let c=e.cx??(n?0:.5),u=e.cy??(n?0:.5),d=[`translate(${c}, ${u})`];l&&d.push(`rotate(${e.rotation})`),a&&e.ry!==0&&d.push(`scale(1, ${e.ry/e.r})`),d.push(`translate(${-c}, ${-u})`),oe(o,"gradientTransform",d.join(" "))}return{element:"radialGradient",attributes:o,stops:am(e)}}function lm(t){return t.some(e=>e.type==="gaussian-blur"||e.type==="motion-blur"||e.type==="drop-shadow"||e.type==="inner-shadow"||e.type==="glow"||e.type==="inner-glow"||e.type==="outline"||e.type==="morphology"||e.type==="warp"||e.type==="svg-primitive-chain"&&e.primitives.some(n=>n.type==="feGaussianBlur"||n.type==="feDropShadow"||n.type==="feOffset"||n.type==="feMorphology"||n.type==="feDisplacementMap"||n.type==="feTurbulence"))}function jc(t,e,n={}){let r=e.filter(p=>p.enabled);if(r.length===0)return null;let i=r.find(p=>p.type==="raw-svg");if(i){let p=[["id",t]];return oe(p,"x",n.x??i.x),oe(p,"y",n.y??i.y),oe(p,"width",n.width??i.width),oe(p,"height",n.height??i.height),oe(p,"filterUnits",n.filterUnits??i.filterUnits),oe(p,"primitiveUnits",n.primitiveUnits??i.primitiveUnits),oe(p,"color-interpolation-filters",n.colorInterpolation&&n.colorInterpolation!=="auto"?n.colorInterpolation:i.colorInterpolationFilters),oe(p,"flood-color",i.floodColor),oe(p,"flood-opacity",i.floodOpacity),oe(p,"lighting-color",i.lightingColor),oe(p,"display",i.display),{kind:"raw",attributes:p,content:i.svgContent}}let o=r.find(p=>p.type==="svg-primitive-chain");if(o)return{kind:"primitive-chain",attributes:[],chain:{...o,x:n.x??o.x,y:n.y??o.y,width:n.width??o.width,height:n.height??o.height,filterUnits:n.filterUnits??o.filterUnits,primitiveUnits:n.primitiveUnits??o.primitiveUnits,filterColorInterpolation:n.colorInterpolation&&n.colorInterpolation!=="auto"?n.colorInterpolation:o.filterColorInterpolation}};let s=r.some(p=>p.type==="gaussian-blur"&&p.quality==="high"||p.type==="motion-blur"&&p.quality==="high"),a=lm(r),l=a?s?"-200%":"-100%":"-10%",c=a?s?"500%":"300%":"120%",u=n.primitiveUnits??"userSpaceOnUse",d=[["id",t]];return oe(d,"x",n.x??l),oe(d,"y",n.y??l),oe(d,"width",n.width??c),oe(d,"height",n.height??c),oe(d,"filterUnits",n.filterUnits??"objectBoundingBox"),oe(d,"primitiveUnits",u),n.colorInterpolation&&n.colorInterpolation!=="auto"&&oe(d,"color-interpolation-filters",n.colorInterpolation),{kind:"generated",attributes:d,filters:r,primitiveUnits:u}}function y(t,e){return e==null||e===""?"":` ${t}="${de(String(e))}"`}function Hc(t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16)/255,g:parseInt(e[2],16)/255,b:parseInt(e[3],16)/255}:{r:0,g:0,b:0}}function bE(t,e,n){let{offsetX:r,offsetY:i,blurRadius:o,spread:s,color:a,opacity:l}=t,c="";if(s===0)c+=`<feDropShadow${y("in",e)}${y("dx",r)}${y("dy",i)}${y("stdDeviation",o/2)}${y("flood-color",a)}${y("flood-opacity",l)}${y("result",`${n}_shadow`)}/>`,c+=`<feMerge${y("result",n)}><feMergeNode${y("in",`${n}_shadow`)}/><feMergeNode${y("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${y("in",e)}${y("type","matrix")}${y("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${y("result",`${n}_alpha`)}/>`;let u=s>0?"dilate":"erode",d=Math.abs(s);c+=`<feMorphology${y("in",`${n}_alpha`)}${y("operator",u)}${y("radius",d)}${y("result",`${n}_spread`)}/>`,c+=`<feGaussianBlur${y("in",`${n}_spread`)}${y("stdDeviation",o/2)}${y("result",`${n}_blur`)}/>`,c+=`<feOffset${y("in",`${n}_blur`)}${y("dx",r)}${y("dy",i)}${y("result",`${n}_offset`)}/>`,c+=`<feFlood${y("flood-color",a)}${y("flood-opacity",l)}${y("result",`${n}_color`)}/>`,c+=`<feComposite${y("in",`${n}_color`)}${y("in2",`${n}_offset`)}${y("operator","in")}${y("result",`${n}_shadow`)}/>`,c+=`<feMerge${y("result",n)}><feMergeNode${y("in",`${n}_shadow`)}/><feMergeNode${y("in",e)}/></feMerge>`}return c}function vE(t,e,n){let{offsetX:r,offsetY:i,blurRadius:o,choke:s,color:a,opacity:l}=t,c=o*(1-s/100),u="";return u+=`<feColorMatrix${y("in",e)}${y("type","matrix")}${y("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${y("result",`${n}_alpha`)}/>`,u+=`<feComponentTransfer${y("in",`${n}_alpha`)}${y("result",`${n}_inverted`)}><feFuncA${y("type","table")}${y("tableValues","1 0")}/></feComponentTransfer>`,u+=`<feGaussianBlur${y("in",`${n}_inverted`)}${y("stdDeviation",c/2)}${y("result",`${n}_blur`)}/>`,u+=`<feOffset${y("in",`${n}_blur`)}${y("dx",r)}${y("dy",i)}${y("result",`${n}_offset`)}/>`,u+=`<feFlood${y("flood-color",a)}${y("flood-opacity",l)}${y("result",`${n}_color`)}/>`,u+=`<feComposite${y("in",`${n}_color`)}${y("in2",`${n}_offset`)}${y("operator","in")}${y("result",`${n}_coloredShadow`)}/>`,u+=`<feComposite${y("in",`${n}_coloredShadow`)}${y("in2",`${n}_alpha`)}${y("operator","in")}${y("result",`${n}_innerShadow`)}/>`,u+=`<feComposite${y("in",`${n}_innerShadow`)}${y("in2",e)}${y("operator","over")}${y("result",n)}/>`,u}function xE(t,e,n){let{blurX:r,blurY:i}=t;return r===0&&i===0?we(e,n):`<feGaussianBlur${y("in",e)}${y("stdDeviation",`${r/2} ${i/2}`)}${y("result",n)}/>`}function IE(t,e,n){let{distance:r,angle:i}=t;if(r===0)return we(e,n);let o=i*Math.PI/180,s=Math.abs(Math.cos(o)*r),a=Math.abs(Math.sin(o)*r);return`<feGaussianBlur${y("in",e)}${y("stdDeviation",`${s/2} ${a/2}`)}${y("result",n)}/>`}function $v(t,e,n){let{x:r,y:i,z:o,color:s,surfaceScale:a,diffuseConstant:l,specularConstant:c,specularExponent:u}=t,d="";return d+=`<feDiffuseLighting${y("in","SourceAlpha")}${y("surfaceScale",a)}${y("diffuseConstant",l)}${y("lighting-color",s)}${y("result",`${n}_diffuse`)}>`,d+=`<fePointLight${y("x",r)}${y("y",i)}${y("z",o)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${y("in","SourceAlpha")}${y("surfaceScale",a)}${y("specularConstant",c)}${y("specularExponent",u)}${y("lighting-color",s)}${y("result",`${n}_specular`)}>`,d+=`<fePointLight${y("x",r)}${y("y",i)}${y("z",o)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${y("in",e)}${y("in2",`${n}_diffuse`)}${y("operator","arithmetic")}${y("k1",1)}${y("k2",0)}${y("k3",0)}${y("k4",0)}${y("result",`${n}_lit`)}/>`,d+=`<feComposite${y("in",`${n}_specular`)}${y("in2",`${n}_lit`)}${y("operator","arithmetic")}${y("k1",0)}${y("k2",1)}${y("k3",1)}${y("k4",0)}${y("result",n)}/>`,d}function Ev(t,e,n){let{x:r,y:i,z:o,pointsAtX:s,pointsAtY:a,pointsAtZ:l,coneAngle:c,color:u,surfaceScale:d,specularConstant:p,specularExponent:f}=t,g="";return g+=`<feSpecularLighting${y("in","SourceAlpha")}${y("surfaceScale",d)}${y("specularConstant",p)}${y("specularExponent",f)}${y("lighting-color",u)}${y("result",`${n}_specular`)}>`,g+=`<feSpotLight${y("x",r)}${y("y",i)}${y("z",o)}${y("pointsAtX",s)}${y("pointsAtY",a)}${y("pointsAtZ",l)}${y("limitingConeAngle",c)}/>`,g+="</feSpecularLighting>",g+=`<feComposite${y("in",`${n}_specular`)}${y("in2","SourceAlpha")}${y("operator","in")}${y("result",`${n}_clipped`)}/>`,g+=`<feComposite${y("in",`${n}_clipped`)}${y("in2",e)}${y("operator","arithmetic")}${y("k1",0)}${y("k2",1)}${y("k3",1)}${y("k4",0)}${y("result",n)}/>`,g}function Av(t){switch(t.kind){case"point":return`<fePointLight${y("x",t.x)}${y("y",t.y)}${y("z",t.z)}/>`;case"spot":{let e=`<feSpotLight${y("x",t.x)}${y("y",t.y)}${y("z",t.z)}${y("pointsAtX",t.pointsAtX)}${y("pointsAtY",t.pointsAtY)}${y("pointsAtZ",t.pointsAtZ)}`;return t.limitingConeAngle!==void 0&&(e+=y("limitingConeAngle",t.limitingConeAngle)),t.specularExponent!==void 0&&(e+=y("specularExponent",t.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${y("azimuth",t.azimuth)}${y("elevation",t.elevation)}/>`}}function wE(t,e,n){return`<feDiffuseLighting${y("in",e)}${y("surfaceScale",t.surfaceScale)}${y("diffuseConstant",t.diffuseConstant)}${y("lighting-color",t.color)}${y("result",n)}>`+Av(t.lightSource)+"</feDiffuseLighting>"}function kE(t,e,n){return`<feSpecularLighting${y("in",e)}${y("surfaceScale",t.surfaceScale)}${y("specularConstant",t.specularConstant)}${y("specularExponent",t.specularExponent)}${y("lighting-color",t.color)}${y("result",n)}>`+Av(t.lightSource)+"</feSpecularLighting>"}function RE(t,e,n){let{width:r,color:i,opacity:o,position:s}=t,a="";if(s==="inside")a+=`<feMorphology${y("in","SourceAlpha")}${y("operator","erode")}${y("radius",r)}${y("result",`${n}_eroded`)}/>`,a+=`<feComposite${y("in","SourceAlpha")}${y("in2",`${n}_eroded`)}${y("operator","out")}${y("result",`${n}_outlineAlpha`)}/>`,a+=`<feFlood${y("flood-color",i)}${y("flood-opacity",o)}${y("result",`${n}_color`)}/>`,a+=`<feComposite${y("in",`${n}_color`)}${y("in2",`${n}_outlineAlpha`)}${y("operator","in")}${y("result",`${n}_outline`)}/>`,a+=`<feComposite${y("in",`${n}_outline`)}${y("in2",e)}${y("operator","over")}${y("result",n)}/>`;else{let l=s==="outside"?r:r/2;a+=`<feMorphology${y("in","SourceAlpha")}${y("operator","dilate")}${y("radius",l)}${y("result",`${n}_dilated`)}/>`,a+=`<feComposite${y("in",`${n}_dilated`)}${y("in2","SourceAlpha")}${y("operator","out")}${y("result",`${n}_outlineAlpha`)}/>`,a+=`<feFlood${y("flood-color",i)}${y("flood-opacity",o)}${y("result",`${n}_color`)}/>`,a+=`<feComposite${y("in",`${n}_color`)}${y("in2",`${n}_outlineAlpha`)}${y("operator","in")}${y("result",`${n}_outline`)}/>`,a+=`<feMerge${y("result",n)}><feMergeNode${y("in",`${n}_outline`)}/><feMergeNode${y("in",e)}/></feMerge>`}return a}function TE(t,e,n){let{amount:r}=t;if(r===0)return we(e,n);let i=1+4*r,o=-r,s=[0,o,0,o,i,o,0,o,0].join(" ");return`<feConvolveMatrix${y("in",e)}${y("order","3")}${y("kernelMatrix",s)}${y("divisor","1")}${y("bias","0")}${y("preserveAlpha","true")}${y("edgeMode","duplicate")}${y("result",n)}/>`}function PE(t,e,n){let{blockSize:r}=t;if(r<=1)return we(e,n);let i=r/2,o="";return o+=`<feMorphology${y("in",e)}${y("operator","erode")}${y("radius",i)}${y("result",`${n}_eroded`)}/>`,o+=`<feMorphology${y("in",`${n}_eroded`)}${y("operator","dilate")}${y("radius",i)}${y("result",n)}/>`,o}function CE(t,e,n){let{scale:r,frequency:i,octaves:o,warpType:s}=t;if(r===0)return we(e,n);let a="";return a+=`<feTurbulence${y("type",s)}${y("baseFrequency",i)}${y("numOctaves",o)}${y("seed",0)}${y("result",`${n}_turbulence`)}/>`,a+=`<feDisplacementMap${y("in",e)}${y("in2",`${n}_turbulence`)}${y("scale",r)}${y("xChannelSelector","R")}${y("yChannelSelector","G")}${y("result",n)}/>`,a}function $E(t,e,n){let{operator:r,radiusX:i,radiusY:o}=t;return i===0&&o===0?we(e,n):`<feMorphology${y("in",e)}${y("operator",r)}${y("radius",`${i} ${o}`)}${y("result",n)}/>`}function EE(t,e,n){let{levels:r}=t;if(r<2)return we(e,n);let i=[];for(let a=0;a<r;a++)i.push(a/(r-1));let o=i.join(" "),s=`<feComponentTransfer${y("in",e)}${y("result",n)}>`;return s+=`<feFuncR${y("type","discrete")}${y("tableValues",o)}/>`,s+=`<feFuncG${y("type","discrete")}${y("tableValues",o)}/>`,s+=`<feFuncB${y("type","discrete")}${y("tableValues",o)}/>`,s+="</feComponentTransfer>",s}function AE(t,e,n){let{levels:r,contrast:i}=t;if(r<2)return we(e,n);let o=[];for(let l=0;l<r;l++){let c=l/(r-1),u=c;i!==1&&(u=.5+(c-.5)*i,u=Math.max(0,Math.min(1,u))),o.push(u)}let s=o.join(" "),a=`<feComponentTransfer${y("in",e)}${y("result",n)}>`;return a+=`<feFuncR${y("type","table")}${y("tableValues",s)}/>`,a+=`<feFuncG${y("type","table")}${y("tableValues",s)}/>`,a+=`<feFuncB${y("type","table")}${y("tableValues",s)}/>`,a+="</feComponentTransfer>",a}function NE(t,e,n){let{radius:r}=t;if(r===0)return we(e,n);let i="";return i+=`<feGaussianBlur${y("in","SourceAlpha")}${y("stdDeviation",r)}${y("result",`${n}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${y("in",`${n}_blurredAlpha`)}${y("result",`${n}_thresholdAlpha`)}><feFuncA${y("type","linear")}${y("slope",20)}${y("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${y("in",e)}${y("in2",`${n}_thresholdAlpha`)}${y("operator","in")}${y("result",n)}/>`,i}function ME(t,e,n){let{amount:r}=t;if(r===0)return we(e,n);let i=1-r;return`<feColorMatrix${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("type","saturate")}${y("values",i)}${y("result",n)}/>`}function OE(t,e,n){let{red:r,green:i,blue:o}=t;if(r===1&&i===1&&o===1)return we(e,n);let s=`<feComponentTransfer${y("in",e)}${y("result",n)}>`;return s+=`<feFuncR${y("type","linear")}${y("slope",r)}${y("intercept",0)}/>`,s+=`<feFuncG${y("type","linear")}${y("slope",i)}${y("intercept",0)}/>`,s+=`<feFuncB${y("type","linear")}${y("slope",o)}${y("intercept",0)}/>`,s+="</feComponentTransfer>",s}function DE(t,e,n){let{amount:r}=t;if(r===1)return we(e,n);let i=`<feComponentTransfer${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("result",n)}>`;return i+=`<feFuncR${y("type","linear")}${y("slope",r)}${y("intercept",0)}/>`,i+=`<feFuncG${y("type","linear")}${y("slope",r)}${y("intercept",0)}/>`,i+=`<feFuncB${y("type","linear")}${y("slope",r)}${y("intercept",0)}/>`,i+="</feComponentTransfer>",i}function zE(t,e,n){let{amount:r}=t;if(r===1)return we(e,n);let i=.5*(1-r),o=`<feComponentTransfer${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("result",n)}>`;return o+=`<feFuncR${y("type","linear")}${y("slope",r)}${y("intercept",i)}/>`,o+=`<feFuncG${y("type","linear")}${y("slope",r)}${y("intercept",i)}/>`,o+=`<feFuncB${y("type","linear")}${y("slope",r)}${y("intercept",i)}/>`,o+="</feComponentTransfer>",o}function _E(t,e,n){let{amount:r}=t;if(r===1)return we(e,n);let i=`<feComponentTransfer${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("result",n)}>`;return i+=`<feFuncA${y("type","linear")}${y("slope",r)}${y("intercept",0)}/>`,i+="</feComponentTransfer>",i}function FE(t,e,n){let{amount:r}=t;if(r===0)return we(e,n);let i=r,o=1-r,s=`${i} ${o}`,a=`<feComponentTransfer${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("result",n)}>`;return a+=`<feFuncR${y("type","table")}${y("tableValues",s)}/>`,a+=`<feFuncG${y("type","table")}${y("tableValues",s)}/>`,a+=`<feFuncB${y("type","table")}${y("tableValues",s)}/>`,a+="</feComponentTransfer>",a}function LE(t,e,n){let{angle:r}=t;return r===0||r===360?we(e,n):`<feColorMatrix${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("type","hueRotate")}${y("values",r)}${y("result",n)}/>`}function BE(t,e,n){let{amount:r}=t;return r===1?we(e,n):`<feColorMatrix${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("type","saturate")}${y("values",r)}${y("result",n)}/>`}function GE(t,e,n){let{threshold:r}=t,i="";if(i+=`<feColorMatrix${y("in",e)}${y("type","saturate")}${y("values",0)}${y("result",`${n}_gray`)}/>`,r===.5)i+=`<feComponentTransfer${y("in",`${n}_gray`)}${y("result",n)}>`,i+=`<feFuncR${y("type","discrete")}${y("tableValues","0 1")}/>`,i+=`<feFuncG${y("type","discrete")}${y("tableValues","0 1")}/>`,i+=`<feFuncB${y("type","discrete")}${y("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let s=[];for(let l=0;l<256;l++)s.push(l/255<r?0:1);let a=s.join(" ");i+=`<feComponentTransfer${y("in",`${n}_gray`)}${y("result",n)}>`,i+=`<feFuncR${y("type","table")}${y("tableValues",a)}/>`,i+=`<feFuncG${y("type","table")}${y("tableValues",a)}/>`,i+=`<feFuncB${y("type","table")}${y("tableValues",a)}/>`,i+="</feComponentTransfer>"}return i}function VE(t,e,n){let{amount:r}=t;if(r===0)return we(e,n);let i=[.393,.769,.189,0,0],o=[.349,.686,.168,0,0],s=[.272,.534,.131,0,0],a=[1,0,0,0,0],l=[0,1,0,0,0],c=[0,0,1,0,0],u=(m,h)=>m.map((b,S)=>b*(1-r)+h[S]*r),d=u(a,i),p=u(l,o),f=u(c,s),g=[...d,...p,...f,0,0,0,1,0].join(" ");return`<feColorMatrix${y("color-interpolation-filters","sRGB")}${y("in",e)}${y("type","matrix")}${y("values",g)}${y("result",n)}/>`}function jE(t,e,n){let{shadowColor:r,highlightColor:i}=t,o=Hc(r),s=Hc(i),a="";return a+=`<feColorMatrix${y("in",e)}${y("type","saturate")}${y("values",0)}${y("result",`${n}_gray`)}/>`,a+=`<feComponentTransfer${y("in",`${n}_gray`)}${y("result",n)}>`,a+=`<feFuncR${y("type","table")}${y("tableValues",`${o.r} ${s.r}`)}/>`,a+=`<feFuncG${y("type","table")}${y("tableValues",`${o.g} ${s.g}`)}/>`,a+=`<feFuncB${y("type","table")}${y("tableValues",`${o.b} ${s.b}`)}/>`,a+="</feComponentTransfer>",a}function UE(t,e,n){let{intensity:r}=t;if(r===0)return we(e,n);let i="";i+=`<feComponentTransfer${y("in",e)}${y("result",`${n}_invert`)}>`,i+=`<feFuncR${y("type","table")}${y("tableValues","1 0")}/>`,i+=`<feFuncG${y("type","table")}${y("tableValues","1 0")}/>`,i+=`<feFuncB${y("type","table")}${y("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${y("in",`${n}_invert`)}${y("type","saturate")}${y("values",0)}${y("result",`${n}_gray`)}/>`;let o=[.1,.1,.1,0,0],s=[.3,.4,.3,0,0],a=[.5,.5,.8,0,0],l=[1,0,0,0,0],c=[0,1,0,0,0],u=[0,0,1,0,0],d=(h,b)=>h.map((S,v)=>S*(1-r)+b[v]*r),p=d(l,o),f=d(c,s),g=d(u,a),m=[...p,...f,...g,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${y("in",`${n}_gray`)}${y("type","matrix")}${y("values",m)}${y("result",n)}/>`,i}function HE(t,e,n){let{amount:r,scale:i}=t;if(r===0)return we(e,n);let o=1/i,s="";return s+=`<feTurbulence${y("type","fractalNoise")}${y("baseFrequency",o)}${y("numOctaves",3)}${y("seed",0)}${y("result",`${n}_noise`)}/>`,s+=`<feColorMatrix${y("in",`${n}_noise`)}${y("type","saturate")}${y("values",0)}${y("result",`${n}_noiseGray`)}/>`,s+=`<feBlend${y("in",e)}${y("in2",`${n}_noiseGray`)}${y("mode","overlay")}${y("result",`${n}_blended`)}/>`,s+=`<feComposite${y("in",`${n}_blended`)}${y("in2",e)}${y("operator","arithmetic")}${y("k1",0)}${y("k2",r)}${y("k3",1-r)}${y("k4",0)}${y("result",`${n}_amt`)}/>`,s+=`<feComposite${y("in",`${n}_amt`)}${y("in2",e)}${y("operator","in")}${y("result",n)}/>`,s}function WE(t,e,n){let{strength:r,angle:i}=t;if(r===0)return we(e,n);let o=i*Math.PI/180,s=Math.cos(o),a=Math.sin(o),l=r,c=[-(l*(s+a)),-(l*a),l*(-s+a),-(l*s),1,l*s,l*(s-a),l*a,l*(s+a)].join(" ");return`<feConvolveMatrix${y("in",e)}${y("order","3 3")}${y("kernelMatrix",c)}${y("divisor",1)}${y("bias",.5)}${y("preserveAlpha","true")}${y("result",n)}/>`}function KE(t,e,n){let{amount:r,size:i}=t;if(r===0)return we(e,n);let o=.5/i,s="";return s+=`<feTurbulence${y("type","fractalNoise")}${y("baseFrequency",`${o} ${o}`)}${y("numOctaves",5)}${y("seed",0)}${y("stitchTiles","stitch")}${y("result",`${n}_grain`)}/>`,s+=`<feColorMatrix${y("in",`${n}_grain`)}${y("type","saturate")}${y("values",0)}${y("result",`${n}_grainGray`)}/>`,s+=`<feBlend${y("in",e)}${y("in2",`${n}_grainGray`)}${y("mode","soft-light")}${y("result",`${n}_blended`)}/>`,s+=`<feComposite${y("in",`${n}_blended`)}${y("in2",e)}${y("operator","arithmetic")}${y("k1",0)}${y("k2",r)}${y("k3",1-r)}${y("k4",0)}${y("result",`${n}_amt`)}/>`,s+=`<feComposite${y("in",`${n}_amt`)}${y("in2",e)}${y("operator","in")}${y("result",n)}/>`,s}function XE(t,e,n){let{wetness:r,turbulence:i}=t;if(r===0&&i===0)return we(e,n);let o="";return o+=`<feTurbulence${y("type","fractalNoise")}${y("baseFrequency",.02+i*.03)}${y("numOctaves",4)}${y("seed",42)}${y("result",`${n}_turb`)}/>`,o+=`<feDisplacementMap${y("in",e)}${y("in2",`${n}_turb`)}${y("scale",r*15)}${y("xChannelSelector","R")}${y("yChannelSelector","G")}${y("result",`${n}_disp`)}/>`,o+=`<feGaussianBlur${y("in",`${n}_disp`)}${y("stdDeviation",r*2)}${y("result",`${n}_blur`)}/>`,o+=`<feBlend${y("in",`${n}_blur`)}${y("in2",e)}${y("mode","multiply")}${y("result",n)}/>`,o}function YE(t,e,n){let{thickness:r,texture:i}=t;if(r===0&&i===0)return we(e,n);let o="";o+=`<feTurbulence${y("type","turbulence")}${y("baseFrequency",.03+i*.02)}${y("numOctaves",3)}${y("seed",1e3)}${y("result",`${n}_brush`)}/>`;let s=Math.max(3,8-Math.floor(r*5)),a=Array.from({length:s+1},(l,c)=>c/s).join(" ");o+=`<feComponentTransfer${y("in",e)}${y("result",`${n}_poster`)}>`;for(let l of["R","G","B"])o+=`<feFunc${l}${y("type","discrete")}${y("tableValues",a)}/>`;return o+="</feComponentTransfer>",o+=`<feDisplacementMap${y("in",`${n}_poster`)}${y("in2",`${n}_brush`)}${y("scale",i*4)}${y("xChannelSelector","R")}${y("yChannelSelector","G")}${y("result",`${n}_disp`)}/>`,o+=`<feMorphology${y("in",`${n}_disp`)}${y("operator","dilate")}${y("radius",r*.5)}${y("result",`${n}_thick`)}/>`,o+=`<feComposite${y("in",`${n}_thick`)}${y("in2",e)}${y("operator","in")}${y("result",n)}/>`,o}function qE(t,e,n){let{spread:r,edges:i}=t;if(r===0&&i===0)return we(e,n);let o="";return o+=`<feTurbulence${y("type","fractalNoise")}${y("baseFrequency",.01+i*.02)}${y("numOctaves",5)}${y("seed",1100)}${y("result",`${n}_ink`)}/>`,o+=`<feMorphology${y("in",e)}${y("operator","dilate")}${y("radius",r*3)}${y("result",`${n}_dilate`)}/>`,o+=`<feDisplacementMap${y("in",`${n}_dilate`)}${y("in2",`${n}_ink`)}${y("scale",i*10)}${y("xChannelSelector","R")}${y("yChannelSelector","G")}${y("result",`${n}_disp`)}/>`,o+=`<feGaussianBlur${y("in",`${n}_disp`)}${y("stdDeviation",r*.5)}${y("result",n)}/>`,o}function ZE(t,e,n){let{wrinkles:r,shine:i}=t;if(r===0&&i===0)return we(e,n);let o="";return o+=`<feTurbulence${y("type","turbulence")}${y("baseFrequency",.02)}${y("numOctaves",4)}${y("seed",1200)}${y("result",`${n}_wrinkle`)}/>`,o+=`<feDisplacementMap${y("in",e)}${y("in2",`${n}_wrinkle`)}${y("scale",r*15)}${y("xChannelSelector","R")}${y("yChannelSelector","G")}${y("result",`${n}_disp`)}/>`,o+=`<feSpecularLighting${y("in",`${n}_wrinkle`)}${y("surfaceScale",r*2)}${y("specularConstant",i*1.5)}${y("specularExponent",20)}${y("result",`${n}_sheen`)}>`,o+=`<feDistantLight${y("azimuth",45)}${y("elevation",60)}/>`,o+="</feSpecularLighting>",o+=`<feBlend${y("in",`${n}_disp`)}${y("in2",`${n}_sheen`)}${y("mode","screen")}${y("result",`${n}_blend`)}/>`,o+=`<feComposite${y("in",`${n}_blend`)}${y("in2",e)}${y("operator","in")}${y("result",n)}/>`,o}function JE(t,e,n){let{density:r,size:i}=t;if(r===0)return we(e,n);let o="",s=1-r;o+=`<feTurbulence${y("type","turbulence")}${y("baseFrequency",.1/i)}${y("numOctaves",1)}${y("seed",1400)}${y("result",`${n}_hole`)}/>`,o+=`<feComponentTransfer${y("in",`${n}_hole`)}${y("result",`${n}_thresh`)}>`;for(let a of["R","G","B","A"])o+=`<feFunc${a}${y("type","linear")}${y("slope",10)}${y("intercept",-s*10+5)}/>`;o+="</feComponentTransfer>",o+=`<feComponentTransfer${y("in",`${n}_thresh`)}${y("result",`${n}_clamp`)}>`;for(let a of["R","G","B","A"])o+=`<feFunc${a}${y("type","table")}${y("tableValues","0 0 1 1")}/>`;return o+="</feComponentTransfer>",o+=`<feComposite${y("in",e)}${y("in2",`${n}_clamp`)}${y("operator","in")}${y("result",n)}/>`,o}function QE(t,e,n){let{color:r,radius:i,intensity:o}=t;if(o===0||i===0)return we(e,n);let{r:s,g:a,b:l}=Hc(r),c="";return c+=`<feColorMatrix${y("in",e)}${y("type","matrix")}${y("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${y("result",`${n}_alpha`)}/>`,c+=`<feGaussianBlur${y("in",`${n}_alpha`)}${y("stdDeviation",i/2)}${y("result",`${n}_blur`)}/>`,c+=`<feColorMatrix${y("in",`${n}_blur`)}${y("type","matrix")}${y("values",`0 0 0 0 ${s} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${o} 0`)}${y("result",`${n}_color`)}/>`,c+=`<feMerge${y("result",n)}><feMergeNode${y("in",`${n}_color`)}/><feMergeNode${y("in",e)}/></feMerge>`,c}function eA(t,e,n){let{color:r,radius:i,intensity:o}=t;if(o===0||i===0)return we(e,n);let{r:s,g:a,b:l}=Hc(r),c="";return c+=`<feColorMatrix${y("in",e)}${y("type","matrix")}${y("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${y("result",`${n}_alpha`)}/>`,c+=`<feMorphology${y("in",`${n}_alpha`)}${y("operator","erode")}${y("radius",i/4)}${y("result",`${n}_erode`)}/>`,c+=`<feComposite${y("in",`${n}_alpha`)}${y("in2",`${n}_erode`)}${y("operator","out")}${y("result",`${n}_edge`)}/>`,c+=`<feGaussianBlur${y("in",`${n}_edge`)}${y("stdDeviation",i/3)}${y("result",`${n}_blur`)}/>`,c+=`<feColorMatrix${y("in",`${n}_blur`)}${y("type","matrix")}${y("values",`0 0 0 0 ${s} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${o*2} 0`)}${y("result",`${n}_color`)}/>`,c+=`<feComposite${y("in",`${n}_color`)}${y("in2",`${n}_alpha`)}${y("operator","in")}${y("result",`${n}_clipped`)}/>`,c+=`<feComposite${y("in",`${n}_clipped`)}${y("in2",e)}${y("operator","over")}${y("result",n)}/>`,c}function we(t,e){return`<feMerge${y("result",e)}><feMergeNode${y("in",t)}/></feMerge>`}function Wc(t){switch(t.type){case"feBlend":return tA(t);case"feColorMatrix":return nA(t);case"feComponentTransfer":return rA(t);case"feComposite":return iA(t);case"feConvolveMatrix":return oA(t);case"feDiffuseLighting":return sA(t);case"feSpecularLighting":return aA(t);case"feDisplacementMap":return lA(t);case"feDropShadow":return cA(t);case"feFlood":return dA(t);case"feGaussianBlur":return uA(t);case"feImage":return pA(t);case"feMerge":return fA(t);case"feMorphology":return mA(t);case"feOffset":return gA(t);case"feTile":return hA(t);case"feTurbulence":return yA(t)}}function ft(t){let e="";if(e+=y("in",t.in),e+=y("x",t.x),e+=y("y",t.y),e+=y("width",t.width),e+=y("height",t.height),e+=y("color-interpolation-filters",t.colorInterpolationFilters),e+=y("result",t.result),t.unknownAttrs){let n=Object.keys(t.unknownAttrs).sort();for(let r of n)e+=y(r,t.unknownAttrs[r])}return e}function mt(t){return t.animations&&t.animations.length>0?t.animations.join(""):""}function tA(t){let e=`<feBlend${ft(t)}${y("in2",t.in2)}${y("mode",t.mode)}`;t.noComposite&&(e+=' no-composite="no-composite"');let n=mt(t);return n?`${e}>${n}</feBlend>`:`${e}/>`}function nA(t){let e=`<feColorMatrix${ft(t)}${y("type",t.matrixType)}${y("values",t.values)}`,n=mt(t);return n?`${e}>${n}</feColorMatrix>`:`${e}/>`}function Uc(t,e){if(!e)return"";let n=`feFunc${t}`;switch(e.type){case"identity":return`<${n} type="identity"/>`;case"table":case"discrete":return`<${n} type="${e.type}"${y("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${n} type="linear"${y("slope",e.slope)}${y("intercept",e.intercept)}/>`;case"gamma":return`<${n} type="gamma"${y("amplitude",e.amplitude)}${y("exponent",e.exponent)}${y("offset",e.offset)}/>`}}function rA(t){let e="";return e+=Uc("R",t.funcR),e+=Uc("G",t.funcG),e+=Uc("B",t.funcB),e+=Uc("A",t.funcA),e+=mt(t),`<feComponentTransfer${ft(t)}>${e}</feComponentTransfer>`}function iA(t){let e=`<feComposite${ft(t)}${y("in2",t.in2)}${y("operator",t.operator)}`;t.operator==="arithmetic"&&(e+=y("k1",t.k1),e+=y("k2",t.k2),e+=y("k3",t.k3),e+=y("k4",t.k4));let n=mt(t);return n?`${e}>${n}</feComposite>`:`${e}/>`}function oA(t){let e=`<feConvolveMatrix${ft(t)}`;e+=y("order",t.order),e+=y("kernelMatrix",t.kernelMatrix),e+=y("divisor",t.divisor),e+=y("bias",t.bias),e+=y("targetX",t.targetX),e+=y("targetY",t.targetY),e+=y("edgeMode",t.edgeMode),e+=y("kernelUnitLength",t.kernelUnitLength),t.preserveAlpha!==void 0&&(e+=y("preserveAlpha",t.preserveAlpha?"true":"false"));let n=mt(t);return n?`${e}>${n}</feConvolveMatrix>`:`${e}/>`}function Nv(t){switch(t.kind){case"feDistantLight":return`<feDistantLight${y("azimuth",t.azimuth)}${y("elevation",t.elevation)}/>`;case"fePointLight":return`<fePointLight${y("x",t.x)}${y("y",t.y)}${y("z",t.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${y("x",t.x)}${y("y",t.y)}${y("z",t.z)}${y("pointsAtX",t.pointsAtX)}${y("pointsAtY",t.pointsAtY)}${y("pointsAtZ",t.pointsAtZ)}`;return e+=y("specularExponent",t.specularExponent),e+=y("limitingConeAngle",t.limitingConeAngle),e+"/>"}}}function sA(t){let e=`<feDiffuseLighting${ft(t)}`;e+=y("surfaceScale",t.surfaceScale),e+=y("diffuseConstant",t.diffuseConstant),e+=y("kernelUnitLength",t.kernelUnitLength),e+=y("lighting-color",t.lightingColor);let n="";return t.lightSource&&(n+=Nv(t.lightSource)),n+=mt(t),`${e}>${n}</feDiffuseLighting>`}function aA(t){let e=`<feSpecularLighting${ft(t)}`;e+=y("surfaceScale",t.surfaceScale),e+=y("specularConstant",t.specularConstant),e+=y("specularExponent",t.specularExponent),e+=y("kernelUnitLength",t.kernelUnitLength),e+=y("lighting-color",t.lightingColor);let n="";return t.lightSource&&(n+=Nv(t.lightSource)),n+=mt(t),`${e}>${n}</feSpecularLighting>`}function lA(t){let e=`<feDisplacementMap${ft(t)}`;e+=y("in2",t.in2),e+=y("scale",t.scale),e+=y("xChannelSelector",t.xChannelSelector),e+=y("yChannelSelector",t.yChannelSelector);let n=mt(t);return n?`${e}>${n}</feDisplacementMap>`:`${e}/>`}function cA(t){let e=`<feDropShadow${ft(t)}`;e+=y("dx",t.dx),e+=y("dy",t.dy),e+=y("stdDeviation",t.stdDeviation),e+=y("flood-color",t.floodColor),e+=y("flood-opacity",t.floodOpacity);let n=mt(t);return n?`${e}>${n}</feDropShadow>`:`${e}/>`}function dA(t){let e=`<feFlood${ft(t)}${y("flood-color",t.floodColor)}${y("flood-opacity",t.floodOpacity)}`,n=mt(t);return n?`${e}>${n}</feFlood>`:`${e}/>`}function uA(t){let e=`<feGaussianBlur${ft(t)}${y("stdDeviation",t.stdDeviation)}${y("edgeMode",t.edgeMode)}`,n=mt(t);return n?`${e}>${n}</feGaussianBlur>`:`${e}/>`}function pA(t){let e=`<feImage${ft(t)}`;t.href!==void 0?e+=y("href",t.href):t.xlinkHref!==void 0&&(e+=y("xlink:href",t.xlinkHref)),e+=y("preserveAspectRatio",t.preserveAspectRatio),e+=y("crossorigin",t.crossorigin);let n=mt(t);return n?`${e}>${n}</feImage>`:`${e}/>`}function fA(t){let e="";for(let n of t.nodes)e+=`<feMergeNode${y("in",n.in)}/>`;return e+=mt(t),`<feMerge${ft(t)}>${e}</feMerge>`}function mA(t){let e=`<feMorphology${ft(t)}${y("operator",t.operator)}${y("radius",t.radius)}`,n=mt(t);return n?`${e}>${n}</feMorphology>`:`${e}/>`}function gA(t){let e=`<feOffset${ft(t)}${y("dx",t.dx)}${y("dy",t.dy)}`,n=mt(t);return n?`${e}>${n}</feOffset>`:`${e}/>`}function hA(t){let e=`<feTile${ft(t)}`,n=mt(t);return n?`${e}>${n}</feTile>`:`${e}/>`}function yA(t){let e=`<feTurbulence${ft(t)}`;e+=y("baseFrequency",t.baseFrequency),e+=y("numOctaves",t.numOctaves),e+=y("seed",t.seed),e+=y("stitchTiles",t.stitchTiles),e+=y("type",t.turbulenceType);let n=mt(t);return n?`${e}>${n}</feTurbulence>`:`${e}/>`}function cm(t,e){let n=`<filter${y("id",t)}`;n+=y("x",e.x),n+=y("y",e.y),n+=y("width",e.width),n+=y("height",e.height),n+=y("filterUnits",e.filterUnits),n+=y("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(n+=y("color-interpolation-filters",e.filterColorInterpolation)),n+=y("flood-color",e.floodColor),n+=y("flood-opacity",e.floodOpacity),n+=y("lighting-color",e.lightingColor),n+=">",e.filterTitle&&(n+=`<title>${de(e.filterTitle)}</title>`),e.filterDescription&&(n+=`<desc>${de(e.filterDescription)}</desc>`);for(let r of e.primitives)n+=Wc(r);if(e.filterAnimations)for(let r of e.filterAnimations)n+=r;return n+="</filter>",n}function dm(t,e,n,r){switch(t.type){case"drop-shadow":return bE(t,e,n);case"inner-shadow":return vE(t,e,n);case"gaussian-blur":return xE(t,e,n);case"motion-blur":return IE(t,e,n);case"point-light":{let i=t;return $v(r?{...i,x:i.x+r.x,y:i.y+r.y}:i,e,n)}case"spot-light":{let i=t;return Ev(r?{...i,x:i.x+r.x,y:i.y+r.y,pointsAtX:i.pointsAtX+r.x,pointsAtY:i.pointsAtY+r.y}:i,e,n)}case"diffuse-lighting":return wE(t,e,n);case"specular-lighting":return kE(t,e,n);case"outline":return RE(t,e,n);case"sharpen":return TE(t,e,n);case"pixelate":return PE(t,e,n);case"warp":return CE(t,e,n);case"morphology":return $E(t,e,n);case"contouring-discrete":return EE(t,e,n);case"contouring-table":return AE(t,e,n);case"round-edges":return NE(t,e,n);case"grayscale":return ME(t,e,n);case"channel-painter":return OE(t,e,n);case"brightness":return DE(t,e,n);case"contrast":return zE(t,e,n);case"opacity":return _E(t,e,n);case"invert":return FE(t,e,n);case"hue-rotate":return LE(t,e,n);case"saturate":return BE(t,e,n);case"black-and-white":return GE(t,e,n);case"sepia":return VE(t,e,n);case"duotone":return jE(t,e,n);case"xray":return UE(t,e,n);case"noise":return HE(t,e,n);case"emboss":return WE(t,e,n);case"film-grain":return KE(t,e,n);case"watercolor":return XE(t,e,n);case"gouache":return YE(t,e,n);case"ink-blot":return qE(t,e,n);case"crumpled-plastic":return ZE(t,e,n);case"riddled":return JE(t,e,n);case"glow":return QE(t,e,n);case"inner-glow":return eA(t,e,n);case"raw-svg":return t.svgContent;case"svg-primitive-chain":return t.primitives.map(Wc).join("");default:return we(e,n)}}function Bs(t,e,n={}){let r=jc(t,e,n);if(!r)return"";if(r.kind==="primitive-chain")return cm(t,r.chain);let i=r.attributes.map(([l,c])=>y(l,c)).join("");if(r.kind==="raw")return`<filter${i}>${r.content}</filter>`;let o="",s="SourceGraphic",a=0;for(let l of r.filters){let c=`result${a++}`;o+=dm(l,s,c),s=c}return`<filter${i}>${o}</filter>`}function Mv(t){let e="",n=new Set;for(let r of t){let i=r.state.filters;if(!i||i.length===0)continue;let o=i.filter(c=>c.enabled);if(o.length===0)continue;let s=r.state.filterLibraryIds,a=Array.isArray(s)&&s.length>0?s[0]:`filter-${r.id}`;if(n.has(a))continue;n.add(a);let l=r.state;e+=Bs(a,o,{colorInterpolation:l.filterColorInterpolation,filterUnits:l.filterUnits,primitiveUnits:l.primitiveUnits,x:l.filterX,y:l.filterY,width:l.filterWidth,height:l.filterHeight})}return e}function Gs(t,e,n){return!e||e.length===0||e.filter(i=>i.enabled).length===0?null:Array.isArray(n)&&n.length>0?n.map(i=>`url(#${de(i)})`).join(" "):`url(#filter-${de(t)})`}function Ov(t,e,n){let r=Gs(t,e,n);return r===null?"":` filter="${r}"`}var pe=(t,e,n={})=>({channel:"attribute",name:t,value:e,...n}),um=/^[A-Za-z_][\w:.-]*$/,Kc=(t,e)=>({channel:"style",name:t,value:e});function ze(t){return typeof t=="string"?t:null}function br(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function Yc(t,e){let n=t(e);if(n!==void 0)return n;let r=t("extra");return r&&typeof r=="object"?r[e]:void 0}function qc(t){let e=ze(t("fillType"));if(e)return e;let n=t("fillGradient");return n&&typeof n=="object"?"r"in n?"radial-gradient":"linear-gradient":Yc(t,"linearGradient")?"linear-gradient":Yc(t,"radialGradient")?"radial-gradient":"solid"}function Zc(t){return t("fillGradient")??Yc(t,"linearGradient")??Yc(t,"radialGradient")}function _v(t){if(!t||typeof t!="object")return;let e=t.id;return typeof e=="string"&&e.length>0?e:void 0}function Fv(t,e){let n=qc(t),r=ze(t("fillLibraryId"))??_v(Zc(t)),i=n==="pattern"?`pattern-fill-${e}`:`gradient-fill-${e}`;return`url(#${r??i})`}function Lv(t,e){let n=ze(t("strokeType"))??"solid",r=ze(t("strokeLibraryId"))??_v(t("strokeGradient")),i=n==="pattern"?`pattern-stroke-${e}`:`gradient-stroke-${e}`;return`url(#${r??i})`}function Dv(t,e){let n=ze(t(`${e}Type`))??(e==="fill"?qc(t):"solid"),r=e==="fill"?Zc(t):t("strokeGradient");if(t(e==="fill"?"inheritFill":"inheritStroke")===!0&&n==="solid"&&!r||n==="none")return null;let i=br(t(`${e}Opacity`))??1,o=r&&typeof r=="object"?br(r.opacity)??1:1,s=i*o;return s<1?s:t(e==="fill"?"preserveFillOpacity":"preserveStrokeOpacity")===!0?1:null}function SA(t){let e=ze(t("strokeDasharray"));return e||Ml(ze(t("lineStyle"))??"solid",br(t("dashLength"))??8,br(t("gapLength"))??4)}function zv(t){if(!ze(t("strokeDasharray"))&&ze(t("lineStyle"))==="dotted")return"round";let n=ze(t("strokeLinecap"));return n&&n!=="butt"?n:null}function Xc(t,e,n={}){if(!t||typeof t!="object"||Array.isArray(t))return[];let r=[];for(let[i,o]of Object.entries(t))typeof o=="string"&&(e==="attribute"&&!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(i)||r.push({channel:e,name:i,value:o,...n}));return r}var Vs=[{id:"fill",keys:["fillColor","fillType","fillGradient","fillLibraryId","inheritFill"],project:(t,e)=>{let n=qc(t);return t("inheritFill")===!0&&n==="solid"&&!Zc(t)?[pe("fill",null)]:n==="none"?[pe("fill","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[pe("fill",Fv(t,e.shapeId))]:[pe("fill",ze(t("fillColor"))??"#000000")]}},{id:"element-opacity",keys:["opacity"],project:t=>{let e=br(t("opacity"));return[pe("opacity",e!==null&&e<1?e:null)]}},{id:"fill-opacity",keys:["fillOpacity","preserveFillOpacity","fillType","fillGradient","inheritFill"],project:t=>[pe("fill-opacity",Dv(t,"fill"))]},{id:"fill-rule",keys:["fillRule"],project:t=>{let e=ze(t("fillRule"));return[pe("fill-rule",e&&e!=="nonzero"?e:null)]}},{id:"stroke",keys:["borderColor","strokeType","strokeGradient","strokeLibraryId","inheritStroke"],project:(t,e)=>{let n=ze(t("strokeType"))??"solid";return t("inheritStroke")===!0&&n==="solid"&&!t("strokeGradient")?[pe("stroke",null)]:n==="none"?[pe("stroke","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[pe("stroke",Lv(t,e.shapeId))]:[pe("stroke",ze(t("borderColor"))??"none")]}},{id:"stroke-width",keys:["borderWidth"],project:t=>{let e=t("borderWidth");return[pe("stroke-width",typeof e=="number"||typeof e=="string"?e:null)]}},{id:"stroke-opacity",keys:["strokeOpacity","preserveStrokeOpacity","strokeType","strokeGradient","inheritStroke"],project:t=>[pe("stroke-opacity",Dv(t,"stroke"))]},{id:"blend-mode",keys:["blendMode"],project:t=>{let e=ze(t("blendMode"));return[Kc("mix-blend-mode",e&&e!=="normal"?e:null)]}},{id:"paint-order",keys:["paintOrder"],project:t=>{let e=ze(t("paintOrder"));return[pe("paint-order",e&&e!=="normal"?e:null)]}},{id:"inline-style",keys:["inlineStyle"],project:t=>Xc(t("inlineStyle"),"style")},{id:"markers",keys:["markerStart","markerMid","markerEnd"],project:t=>[["marker-start",t("markerStart")],["marker-mid",t("markerMid")],["marker-end",t("markerEnd")]].map(([e,n])=>pe(String(e),typeof n=="string"&&n?`url(#${n})`:null))},{id:"stroke-linejoin",keys:["strokeLinejoin"],project:t=>{let e=ze(t("strokeLinejoin"));return[pe("stroke-linejoin",e&&e!=="miter"?e:null)]}},{id:"stroke-linecap",keys:["strokeLinecap"],project:t=>[pe("stroke-linecap",zv(t))]},{id:"stroke-miterlimit",keys:["strokeMiterlimit"],project:t=>{let e=br(t("strokeMiterlimit"));return[pe("stroke-miterlimit",e!==null&&e!==4?e:null)]}},{id:"stroke-dasharray",keys:["lineStyle","dashLength","gapLength","strokeDasharray","strokeLinecap"],project:t=>[pe("stroke-dasharray",SA(t)),pe("stroke-linecap",zv(t))]},{id:"stroke-dashoffset",keys:["dashOffset"],project:t=>{let e=br(t("dashOffset"));return[pe("stroke-dashoffset",e!==null&&e!==0?e:null)]}},{id:"shape-rendering",keys:["shapeRendering"],project:t=>{let e=ze(t("shapeRendering"));return[pe("shape-rendering",e&&e!=="auto"?e:null)]}},{id:"text-rendering",keys:["textRendering"],project:t=>{let e=ze(t("textRendering"));return[pe("text-rendering",e&&e!=="auto"?e:null)]}},{id:"image-rendering",keys:["imageRendering"],project:t=>{let e=ze(t("imageRendering"));return[pe("image-rendering",e&&e!=="auto"?e:null)]}},{id:"color-rendering",keys:["colorRendering"],project:t=>{let e=ze(t("colorRendering"));return[pe("color-rendering",e&&e!=="auto"?e:null)]}},{id:"color-interpolation",keys:["colorInterpolation"],project:t=>{let e=ze(t("colorInterpolation"));return[pe("color-interpolation",e&&e!=="sRGB"?e:null)]}},{id:"filter",keys:["filters","filterLibraryIds"],project:(t,e)=>[pe("filter",Gs(e.shapeId,t("filters"),t("filterLibraryIds")))]},{id:"system-language",keys:["systemLanguage"],project:t=>{let e=t("systemLanguage");return[pe("systemLanguage",typeof e=="string"?e:null,{allowEmpty:!0})]}},{id:"required-extensions",keys:["requiredExtensions"],project:t=>{let e=t("requiredExtensions");return[pe("requiredExtensions",typeof e=="string"?e:null,{allowEmpty:!0})]}},{id:"vector-effect",keys:["vectorEffect"],project:t=>{let e=ze(t("vectorEffect"));return[pe("vector-effect",e&&e!=="none"?e:null)]}},{id:"visibility",keys:["visibility"],project:t=>{let e=ze(t("visibility"));return[pe("visibility",e&&e!=="visible"?e:null)]}},{id:"display",keys:["displayAttr"],project:t=>[pe("display",t("displayAttr")==="none"?"none":null)]},{id:"visible",keys:["visible"],project:t=>[Kc("display",t("visible")===!1?"none":null)]},{id:"path-length",keys:["pathLength"],project:t=>{let e=br(t("pathLength"));return[pe("pathLength",e!==null&&e>=0?e:null)]}},{id:"transform-box",keys:["transformBox"],project:t=>{let e=ze(t("transformBox"));return[Kc("transform-box",e&&e!=="view-box"?e: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:t=>{let e=t("metadata"),n=[],r=e?.name?Pn(e.name):"";if(n.push(pe("id",r||null)),n.push(pe("class",e?.classes&&e.classes.length>0?e.classes.join(" "):null)),n.push(pe("role",e?.role??null)),n.push(pe("aria-label",e?.ariaLabel??null)),e?.aria)for(let[i,o]of Object.entries(e.aria))i!=="aria-label"&&um.test(i)&&n.push(pe(i,o));if(n.push(pe("xml:lang",e?.lang??null)),typeof e?.tabindex=="number"&&Number.isFinite(e.tabindex)&&n.push(pe("tabindex",String(Math.trunc(e.tabindex)))),e?.autofocus&&n.push(pe("autofocus","",{allowEmpty:!0})),n.push(pe("xml:space",e?.xmlSpace??null)),e?.customData)for(let[i,o]of Object.entries(e.customData)){let s=`data-${i}`;um.test(s)&&n.push(pe(s,o))}if(e?.foreignAttrs)for(let i of e.foreignAttrs)um.test(i.name)&&n.push(pe(i.name,i.value));return n}},{id:"css-clip-path",keys:["cssClipPath"],project:t=>[Kc("clip-path",ze(t("cssClipPath")))]},{id:"css-mask-properties",keys:["cssMaskProperties"],project:t=>Xc(t("cssMaskProperties"),"style")},{id:"container-presentation",keys:["containerPresentation"],project:(t,e)=>e.includeContainerPresentation?Xc(t("containerPresentation"),"attribute",{ifAbsent:!0}):[]},{id:"authored-attributes",keys:["authoredAttributes"],project:(t,e)=>e.includeAuthoredAttributes?Xc(t("authoredAttributes"),"attribute",{ifAbsent:!0}):[]}];function Jc(t,e,n){return t.project(e,n)}function oo(t,e){return Vs.flatMap(n=>n.project(t,e))}function Zn(t){let e=t;return n=>n==="displayAttr"?t.display:e[n]}function pm(t){return qc(e=>t[e])}function Bv(t){return Zc(e=>t[e])}function fm(t,e){return Fv(Zn(t),e)}function mm(t,e){return Lv(Zn(t),e)}var bA=[["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 de(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Qc(t){let e=new Map,n=new Map,r=t.state,i=r;switch(t.type){case"circle":e.set("cx",String(r.x??0)),e.set("cy",String(r.y??0)),e.set("r",String(r.radius??50));break;case"ellipse":e.set("cx",String(r.cx??0)),e.set("cy",String(r.cy??0)),e.set("rx",String(r.rx??50)),e.set("ry",String(r.ry??30));break;case"rectangle":case"square":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100));{let l=r.rx??r.cornerRadius??0,c=r.ry??r.cornerRadius??0;(l>0||c>0)&&(e.set("rx",String(l)),e.set("ry",String(c)))}break;case"line":e.set("x1",String(r.x1??0)),e.set("y1",String(r.y1??0)),e.set("x2",String(r.x2??0)),e.set("y2",String(r.y2??0));break;case"text":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),r.fontSize&&e.set("font-size",String(r.fontSize)),r.fontFamily&&e.set("font-family",r.fontFamily),r.fontWeight&&e.set("font-weight",String(r.fontWeight)),r.fontStyle&&e.set("font-style",r.fontStyle),r.textAnchor&&e.set("text-anchor",r.textAnchor),r.letterSpacing&&e.set("letter-spacing",String(r.letterSpacing));for(let[l,c]of bA){let u=typeof r[l]=="string"?String(r[l]).trim():"";u&&n.set(c,u)}break;case"image":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100)),i.href&&e.set("href",String(i.href));break}for(let l of oo(Zn(r),{shapeId:t.id,includeAuthoredAttributes:!0})){if(l.channel==="style"){n.delete(l.name),l.value!==null&&l.value!==""&&n.set(l.name,String(l.value));continue}l.ifAbsent&&e.has(l.name)||(e.delete(l.name),!(l.value===null||l.value===""&&!l.allowEmpty)&&e.set(l.name,String(l.value)))}n.size>0&&e.set("style",[...n].map(([l,c])=>`${l}: ${c}`).join("; "));let o=vA(i);o&&e.set("transform",o);let s=i.startEndpoint,a=i.endEndpoint;return s&&s!=="none"&&e.set("marker-start",`url(#line-marker-${s})`),a&&a!=="none"&&e.set("marker-end",`url(#line-marker-${a})`),e}function Gv(t){switch(t.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 vA(t){return pt(t)}function Vv(t,e){let n=t.viewboxes?.[0];return{width:e.width??n?.width??800,height:e.height??n?.height??600}}var vr="https://svgsketch.com/ns/metadata",ci="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Dt="http://purl.org/dc/elements/1.1/",xr="http://creativecommons.org/ns#",jv="http://www.w3.org/2000/svg",js={rdf:ci,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:Dt,dcterms:"http://purl.org/dc/terms/",cc:xr,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:vr},Us=new Set([`${Dt}|creator`,`${Dt}|subject`,`${Dt}|rights`,`${Dt}|description`,`${xr}|license`]);function nd(t){let e=t.indexOf(":");if(e<=0||e===t.length-1)return null;let n=t.slice(0,e),r=t.slice(e+1);if(!/^[A-Za-z_][\w.-]*$/.test(r))return null;let i=js[n];return i?{ns:i,local:r,prefix:n}:null}var xA={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"},IA={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 hm(t,e){return t==="custom"?e||"":xA[t]||""}function ym(t){return IA[t]||t}function ed(t){return!!(t.author||t.keywords&&t.keywords.length>0||t.license||t.customMetadata&&Object.keys(t.customMetadata).length>0)}function rd(t){let e=[];if(t.author&&e.push(`<dc:creator>${de(t.author)}</dc:creator>`),t.keywords&&t.keywords.length>0&&e.push(`<dc:subject>${de(t.keywords.join(", "))}</dc:subject>`),t.license){let n=hm(t.license,t.licenseUrl);n&&e.push(`<cc:license rdf:resource="${de(n)}"/>`),e.push(`<dc:rights>${de(ym(t.license))}</dc:rights>`)}if(t.customMetadata)for(let[n,r]of Object.entries(t.customMetadata)){let i=nd(n);if(i){if(Us.has(`${i.ns}|${i.local}`))continue;e.push(`<${i.prefix}:${i.local}>${de(r??"")}</${i.prefix}:${i.local}>`)}else e.push(`<svgsketch:custom key="${de(n)}" value="${de(r??"")}"/>`)}return e.join(`
18
+ `)}function Sm(t){let e=rd(t);return e.length>0?`<rdf:Description svgsketch:managed="true">
19
+ ${e}
20
+ </rdf:Description>`:`<rdf:Description svgsketch:managed="true">
21
+ </rdf:Description>`}function td(t){let e={rdf:ci,dc:Dt,cc:xr,svgsketch:vr};if(t.customMetadata)for(let r of Object.keys(t.customMetadata)){let i=nd(r);i&&!(i.prefix in e)&&(e[i.prefix]=i.ns)}return`<metadata>
22
+ <rdf:RDF ${Object.entries(e).map(([r,i])=>`xmlns:${r}="${i}"`).join(" ")}>
23
+ `+Sm(t)+`
24
+ </rdf:RDF>
25
+ </metadata>`}var wA=["dc:creator","dc:subject","dc:rights","dc:description","cc:license","svgsketch:custom"];function kA(t){let e=t;for(let n of wA)e=e.replace(new RegExp(`<${n}\\b[^>]*/>\\s*`,"g"),""),e=e.replace(new RegExp(`<${n}\\b[^>]*>[\\s\\S]*?</${n}>\\s*`,"g"),"");return e}function bm(t,e){let n=t.match(/<rdf:Description\b/g);if(!n||n.length!==1||!/<rdf:RDF\b/.test(t))return null;let r=/<rdf:Description\b((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(t);if(!r)return null;let[i,o,s]=[r[0],r[1],r[2]],a=r.index,l=rd(e),c=`<rdf:Description svgsketch:managed="true"${o}>`,u;if(s==="/")u=t.slice(0,a)+`${c}
26
+ ${l}
27
+ </rdf:Description>`+t.slice(a+i.length);else{let p=t.lastIndexOf("</rdf:Description>");if(p<=a)return null;let f=kA(t.slice(a+i.length,p));u=t.slice(0,a)+c+f+`${l}
28
+ `+t.slice(p)}let d=[["svgsketch",vr],["dc",Dt],["cc",xr]];return u=u.replace(/<rdf:RDF\b((?:[^>"']|"[^"]*"|'[^']*')*?)>/,(p,f)=>{let g="";for(let[m,h]of d)u.includes(`xmlns:${m}=`)||(g+=` xmlns:${m}="${h}"`);return g?`<rdf:RDF${f}${g}>`:p}),u}function Uv(t){return t.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 id(t){return t?.language?` xml:lang="${de(t.language)}"`:""}function gm(t,e,n){let r=n?` xml:lang="${de(n)}"`:"";return`<${t}${r}>${de(e)}</${t}>`}function Hv(t){let e=t.descriptiveElements;if(!e)return null;let n={title:!1,desc:!1},r=[];for(let i of e){let o=!n[i.kind];if(n[i.kind]=!0,!o){r.push(i.rawXml);continue}let s=i.kind==="title"?t.title:t.description;s&&r.push(s.trim()===i.text.trim()?i.rawXml:gm(i.kind,s,i.language))}return!n.title&&t.title&&r.unshift(gm("title",t.title,null)),!n.desc&&t.description&&r.push(gm("desc",t.description,null)),r.join("")}function so(t){if(!t)return"";let e="",n=Hv(t);if(n!==null)e+=n;else if(t.title&&(e+=`<title>${de(t.title)}</title>`),t.description||t.rawDescription){let r=Uv(t.rawDescription??""),i=(t.description??"").trim();e+=t.rawDescription&&r===i?`<desc>${t.rawDescription}</desc>`:`<desc>${de(t.description??"")}</desc>`}return t.rawMetadata&&(e+=t.rawMetadata),e}function od(t){if(!t)return"";let e="",n=Hv(t);if(n!==null)e+=n;else if(t.title&&(e+=`<title>${de(t.title)}</title>`),t.description||t.rawDescription){let r=Uv(t.rawDescription??""),i=(t.description??"").trim();t.rawDescription&&r===i?e+=`<desc>${t.rawDescription}</desc>`:e+=`<desc>${de(t.description)}</desc>`}if(t.rawMetadata)if(!t.rawMetadataAuthoritative&&ed(t)&&!t.rawMetadata.includes("svgsketch:managed")){let r=bm(t.rawMetadata,t);e+=r??td(t)+t.rawMetadata}else e+=t.rawMetadata;else ed(t)&&(e+=td(t));return t.rawHtmlMetadata&&(e+=t.rawHtmlMetadata),e}var vm="http://www.w3.org/1999/xhtml",Im="http://www.w3.org/XML/1998/namespace",RA="http://www.w3.org/1999/xlink",xm="http://www.w3.org/2000/xmlns/",TA=new Set([U,Im,RA,vm,xm]),PA=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"]),CA=Object.freeze(Object.fromEntries(Object.entries(js).map(([t,e])=>[e,t])));function wm(t,e,n){return t.attributes.find(r=>r.localName===e&&r.namespaceUri===n)??null}function km(t){let e=wm(t,"lang",Im);return e?e.value:E(t,"lang")}function di(t){let e="",n=[...t.children].reverse();for(;n.length>0;){let r=n.pop();r.kind==="text"||r.kind==="cdata"?e+=r.value:r.kind==="element"&&n.push(...[...r.children].reverse())}return e}function Xv(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function $A(t){return Xv(t).replaceAll('"',"&quot;")}function EA(t){switch(t.kind){case"text":return Xv(t.value);case"comment":return`<!--${t.value}-->`;case"cdata":return`<![CDATA[${t.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${t.value}?>`;case"doctype":return`<!DOCTYPE ${t.value}>`}}function AA(t){let e=new Set,n=!1,r=[t];for(;r.length>0;){let i=r.pop();i.prefix&&i.prefix!=="xml"?e.add(i.prefix):!i.prefix&&i.namespaceUri&&(n=!0);for(let o of i.attributes)o.prefix&&o.prefix!=="xmlns"&&o.prefix!=="xml"&&e.add(o.prefix);for(let o of i.children)o.kind==="element"&&r.push(o)}return{prefixes:e,defaultNamespace:n}}function NA(t,e){let n=AA(e),r=new Map;for(let o of e.attributes)(o.namespaceUri===xm||o.name==="xmlns")&&r.set(o.name,o);let i=t.index.parent(e.sourceNodeId);for(;i;){for(let o of i.attributes){if(!(o.namespaceUri===xm||o.name==="xmlns")||r.has(o.name))continue;(o.name==="xmlns"&&n.defaultNamespace||o.prefix==="xmlns"&&n.prefixes.has(o.localName))&&r.set(o.name,o)}i=t.index.parent(i.sourceNodeId)}return Object.freeze([...r.values()].filter(o=>!e.attributes.some(s=>s.name===o.name)))}function Yv(t,e=[]){let n=[...e,...t.attributes].map(s=>`${s.name}="${$A(s.value)}"`),r=`<${t.name}${n.length>0?` ${n.join(" ")}`:""}`,i=t.children.map(qv).join(""),o=/\/\s*>\s*$/u.test(t.rawXml??"");return i.length===0&&o?`${r}/>`:`${r}>${i}</${t.name}>`}function qv(t){return t.kind==="element"?Yv(t):EA(t)}function Hs(t,e){return Yv(e,NA(t,e))}function Rm(t,e){return t.children.map(n=>n.kind!=="element"||!e?qv(n):Hs(e,n)).join("")}function Zv(t,e,n){return e.children.filter(r=>r.kind==="element"&&(r.namespaceUri===U||t.root.namespaceUri===null&&r.namespaceUri===null)&&r.localName.toLowerCase()===n)}function Jv(t,e){return Object.freeze(e.children.filter(n=>n.kind==="element"&&(n.namespaceUri===U||t.root.namespaceUri===null&&n.namespaceUri===null)&&(n.localName.toLowerCase()==="title"||n.localName.toLowerCase()==="desc")).map(n=>Object.freeze({kind:n.localName.toLowerCase(),sourceNodeId:n.sourceNodeId,language:km(n),text:di(n).trim(),rawInnerXml:Rm(n),rawXml:Hs(t,n)})))}function Qv(t){return t.map(({kind:e,language:n,text:r,rawXml:i})=>({kind:e,language:n,text:r,rawXml:i}))}function ex(t){return t.children.some(e=>e.kind==="element")}function MA(t){if(t.classes&&Object.freeze(t.classes),t.aria&&Object.freeze(t.aria),t.customData&&Object.freeze(t.customData),t.foreignAttrs){for(let e of t.foreignAttrs)Object.freeze(e);Object.freeze(t.foreignAttrs)}if(t.descriptiveElements){for(let e of t.descriptiveElements)Object.freeze(e);Object.freeze(t.descriptiveElements)}return Object.freeze(t)}function OA(t,e,n,r,i){let o={};n.length>0&&(o.descriptiveElements=Qv(n));let s=E(e,"id");s&&(o.name=s);let a=(E(e,"class")??"").split(/\s+/u).filter(Boolean);a.length>0&&(o.classes=a);let l=n.find(S=>S.kind==="title"),c=n.find(S=>S.kind==="desc");if(l?.text&&(o.title=l.text),c?.text&&(o.description=c.text),c){let S=t.index.element(c.sourceNodeId);S&&ex(S)&&(o.rawDescription=Rm(S,t))}let u=E(e,"role");u&&(o.role=u);let d=E(e,"aria-label");d&&(o.ariaLabel=d);let p={},f={};for(let S of e.attributes)S.namespaceUri===null&&(S.name.startsWith("aria-")&&S.name!=="aria-label"&&S.value&&(p[S.name]=S.value),S.name.startsWith("data-")&&!PA.has(S.name)&&(f[S.name.slice(5)]=S.value));Object.keys(p).length>0&&(o.aria=p),Object.keys(f).length>0&&(o.customData=f);let g=km(e);g!==null&&(o.lang=g);let m=E(e,"tabindex");if(m!==null){if(/^[+-]?\d+$/u.test(m.trim())){let S=Number(m);Number.isSafeInteger(S)&&(o.tabindex=S)}o.tabindex===void 0&&i.push({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"metadata",documentPath:t.index.sourcePath(e.sourceNodeId),elementName:e.name,...s?{sourceId:s}:{},sourceNodeId:e.sourceNodeId,message:`Invalid tabindex value "${m}" was ignored.`})}if(ot(e,"autofocus")&&(o.autofocus=!0),!["text","tspan","flowroot"].includes(e.localName.toLowerCase())){let S=wm(e,"space",Im)?.value;(S==="default"||S==="preserve")&&(o.xmlSpace=S)}let h=e.attributes.filter(S=>S.namespaceUri!==null&&!TA.has(S.namespaceUri)).map(S=>({name:S.name,namespaceURI:S.namespaceUri,value:S.value}));h.length>0&&(o.foreignAttrs=h);let b=Zv(t,e,"metadata").map(S=>Hs(t,S)).join(`
29
+ `);return b&&(o.rawMetadata=b),MA(o)}function Wv(t){let e=[],n=[...t.children].reverse();for(;n.length>0;){let r=n.pop();r.kind==="element"&&(e.push(r),n.push(...[...r.children].reverse()))}return e}function Kv(t,e,n){return wm(t,e,n)?.value??null}function DA(t){let e=t.toLowerCase();return e.includes("publicdomain")||e.includes("cc0")?"cc0":e.includes("by-nc-nd")?"cc-by-nc-nd":e.includes("by-nc-sa")?"cc-by-nc-sa":e.includes("by-nc")?"cc-by-nc":e.includes("by-nd")?"cc-by-nd":e.includes("by-sa")?"cc-by-sa":e.includes("/by/")||e.includes("attribution")?"cc-by":e.includes("mit")?"mit":e.includes("apache")?"apache-2.0":"custom"}function zA(t){let e=t.flatMap(p=>Wv(p).filter(f=>f.namespaceUri===ci&&f.localName==="Description")),n=e.find(p=>Kv(p,"managed",vr)==="true")??e[0];if(!n)return{};let r={},i=Wv(n),o=i.find(p=>p.namespaceUri===Dt&&p.localName==="creator");o?.children.length&&(r.author=di(o).trim());let s=i.find(p=>p.namespaceUri===Dt&&p.localName==="subject");if(s){let p=di(s).split(",").map(f=>f.trim()).filter(Boolean);p.length>0&&(r.keywords=p)}let a=i.find(p=>p.namespaceUri===xr&&p.localName==="license"),l=i.find(p=>p.namespaceUri===Dt&&p.localName==="rights"),c=a?Kv(a,"resource",ci)??di(a).trim():l?di(l).trim():"";c&&(r.license=DA(c),r.license==="custom"&&(r.licenseUrl=c));let u={},d=n.children.filter(p=>p.kind==="element");for(let p of d){if(p.namespaceUri===vr&&p.localName==="custom"){let h=E(p,"key");h!==null&&(u[h]=E(p,"value")??"");continue}let f=p.namespaceUri??"";if(Us.has(`${f}|${p.localName}`))continue;let g=CA[f];if(!g)continue;let m=`${g}:${p.localName}`;m in u||(u[m]=di(p).trim())}if(Object.keys(u).length===0)for(let p of d){if(p.namespaceUri!==Dt||p.localName!=="description")continue;let f=di(p),g=f.indexOf(":");if(g<=0)continue;let m=f.slice(0,g).trim();m&&(u[m]=f.slice(g+1).trim())}return Object.keys(u).length>0&&(r.customMetadata=u),r}function _A(t){let e=t.root,n=Jv(t,e),r=Zv(t,e,"metadata"),i=zA(r);n.length>0&&(i.descriptiveElements=Qv(n));let o=km(e);o!==null&&(i.language=o);let s=n.find(d=>d.kind==="title"),a=n.find(d=>d.kind==="desc");if(s?.text&&(i.title=s.text),a?.text&&(i.description=a.text),a){let d=t.index.element(a.sourceNodeId);d&&ex(d)&&(i.rawDescription=Rm(d,t))}let l=r.map(d=>Hs(t,d)).join(`
30
+ `);l&&(i.rawMetadata=l,i.rawMetadataAuthoritative=!0);let c=Object.freeze(e.children.filter(d=>d.kind==="element"&&d.namespaceUri===vm&&["base","link","meta"].includes(d.localName.toLowerCase())).map(d=>Object.freeze({sourceNodeId:d.sourceNodeId,localName:d.localName.toLowerCase(),namespaceUri:vm,rawXml:Hs(t,d)})));c.length>0&&(i.rawHtmlMetadata=c.map(d=>d.rawXml).join(`
31
+ `));let u=[];for(let d=e.children.length-1;d>=0;d--){let p=e.children[d];if(p.kind==="comment"){u.unshift(p.value);continue}if(!(p.kind==="text"&&!p.value.trim()))break}if(u.length>0&&(i.trailingComments=u),i.keywords&&Object.freeze(i.keywords),i.customMetadata&&Object.freeze(i.customMetadata),i.trailingComments&&Object.freeze(i.trailingComments),i.descriptiveElements){for(let d of i.descriptiveElements)Object.freeze(d);Object.freeze(i.descriptiveElements)}return Object.freeze({sourceNodeId:e.sourceNodeId,metadata:Object.freeze(i),descriptiveElements:n,htmlMetadata:c})}function sd(t,e){let n=[],r=[];for(let a of t.index.elements){if(a===t.root||a.namespaceUri!==U&&!(t.root.namespaceUri===null&&a.namespaceUri===null))continue;let l=Jv(t,a),c=OA(t,a,l,e,n);Object.keys(c).length===0&&l.length===0||r.push(Object.freeze({sourceNodeId:a.sourceNodeId,metadata:c,descriptiveElements:l}))}let i=Object.freeze(r),o=new Map(i.map(a=>[a.sourceNodeId,a]));return{value:Object.freeze({document:_A(t),candidates:i,candidate(a){return o.get(a)??null}}),diagnostics:Object.freeze(n)}}var FA="https://boxy-svg.com",Cm=new Set(["cursive","emoji","fangsong","fantasy","math","monospace","sans-serif","serif","system-ui","ui-monospace","ui-rounded","ui-sans-serif","ui-serif"]);function tx(t){return/[\t\n\f\r ]/u.test(t??"")}function ad(t,e){if(t[e]!=="/"||t[e+1]!=="*")return e;let n=t.indexOf("*/",e+2);return n<0?t.length:n+2}function LA(t,e){let n=1,r=null,i=!1;for(let o=e+1;o<t.length;o++){let s=t[o];if(r){i?i=!1:s==="\\"?i=!0:s===r&&(r=null);continue}if(s==="/"&&t[o+1]==="*"){o=Math.max(o,ad(t,o)-1);continue}if(s==='"'||s==="'"){r=s;continue}if(s==="{")n++;else if(s==="}"&&--n===0)return o}return t.length-1}function cd(t){let e=[],n=null,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(n){r?r=!1:o==="\\"?r=!0:o===n&&(n=null);continue}if(o==="/"&&t[i+1]==="*"){i=Math.max(i,ad(t,i)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(o!=="@")continue;let s=i,a=i+1;for(;/[-_a-z0-9]/iu.test(t[a]??"");)a++;let l=t.slice(i+1,a).toLowerCase(),c=a,u=null,d=!1,p=0;for(;c<t.length;c++){let g=t[c];if(u){d?d=!1:g==="\\"?d=!0:g===u&&(u=null);continue}if(g==="/"&&t[c+1]==="*"){c=Math.max(c,ad(t,c)-1);continue}if(g==='"'||g==="'"){u=g;continue}if(g==="(")p++;else if(g===")")p=Math.max(0,p-1);else if(p===0&&(g===";"||g==="{"))break}if(c>=t.length)continue;if(t[c]===";"){e.push(Object.freeze({name:l,start:s,end:c+1,preludeStart:a,preludeEnd:c,blockStart:null,blockEnd:null})),i=c;continue}let f=LA(t,c);e.push(Object.freeze({name:l,start:s,end:Math.min(t.length,f+1),preludeStart:a,preludeEnd:c,blockStart:c+1,blockEnd:f}))}return Object.freeze(e)}function dd(t){let e=t.trim();if(e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))){let n=e.slice(1,-1);return zi(n)??n}return zi(e)??e}function ud(t){let e=cn(t).find(r=>r.name==="url");if(e)return dd(t.slice(e.argumentsStart,e.argumentsEnd));let n=t.trim();if(n.startsWith('"')||n.startsWith("'")){let r=n[0],i=n.indexOf(r,1);return i>0?n.slice(1,i):null}return null}function $m(t,e=0){let n=[];for(let r of cn(t)){if(r.name==="url"){n.push(Object.freeze({rawUrl:dd(t.slice(r.argumentsStart,r.argumentsEnd)),tokenStart:e+r.tokenStart,tokenEnd:e+r.tokenEnd}));continue}n.push(...$m(t.slice(r.argumentsStart,r.argumentsEnd),e+r.argumentsStart))}return Object.freeze(n)}function BA(t){let e=cd(t),n=e.filter(o=>o.name==="font-face"||o.name==="import"),r=[],i=0;for(let o of e){if(o.name!=="import")continue;let s=ud(t.slice(o.preludeStart,o.preludeEnd));s!==null&&r.push(Object.freeze({url:s,channel:"css-import",tokenIndex:i})),i++}for(let o of $m(t))n.some(s=>o.tokenStart>=s.start&&o.tokenEnd<=s.end)||(r.push(Object.freeze({url:o.rawUrl,channel:"css-url",tokenIndex:i})),i++);return Object.freeze(r)}function Ir(t){let e=t.trim();if(!e)return Object.freeze({status:"empty",requestUrl:null});if(/^data:/iu.test(e))return Object.freeze({status:"data",requestUrl:null});let n=pd(e);return Object.freeze(n?{status:"external",requestUrl:n.href}:{status:"blocked",requestUrl:null})}function Em(t){return Ir(t).status==="data"?t:""}var GA=new Set(["feimage","iframe","image","link","mpath","script","textpath","use"]),VA=new Set(["audio","embed","iframe","img","input","script","source","track","video"]);function Am(t){return t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;")}function rx(t){return Am(t).replace(/"/gu,"&quot;")}function Tm(t){return t.trim().startsWith("#")?t:Em(t)}function ix(t,e){if(t.kind!=="element"){if(t.kind==="comment")return`<!--${t.value}-->`;if(t.kind==="processing-instruction"||t.kind==="doctype")return"";let a=e==="style"?Ks(t.value):t.value;return Am(a)}let n=t.localName.toLowerCase();if(n==="script"||n==="meta"&&t.attributes.some(a=>a.localName.toLowerCase()==="http-equiv"&&a.value.trim().toLowerCase()==="refresh"))return"";let i=[];for(let a of t.attributes){let l=a.name.toLowerCase(),c=a.localName.toLowerCase();if(/^on/iu.test(l))continue;let u=a.value;c==="style"?u=Ks(u):(l==="href"||l==="xlink:href")&&GA.has(n)||c==="src"&&VA.has(n)||c==="poster"&&n==="video"||c==="data"&&n==="object"?u=Tm(u):c==="srcset"?u="":a.namespaceUri===null&&!l.startsWith("xmlns")&&(u=Ks(u)),i.push(`${a.name}="${rx(u)}"`)}let o=i.length>0?`<${t.name} ${i.join(" ")}>`:`<${t.name}>`,s=t.children.map(a=>ix(a,n)).join("");return`${o}${s}</${t.name}>`}function ox(t){let e=mn(t,{source:"svg",entrypoint:"svg-document-import"});if(!e.value)return"";let n=ix(e.value.root,null);return t.trimStart().startsWith("<?xml")?`<?xml version="1.0" encoding="UTF-8"?>
32
+ ${n}`:n}var jA=new Set(["animate","animatemotion","animatetransform","desc","metadata","mpath","set","title"]);function UA(t){switch(t.kind){case"text":return Am(t.value);case"comment":return`<!--${t.value}-->`;case"cdata":return`<![CDATA[${t.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${t.value}?>`;case"doctype":return`<!DOCTYPE ${t.value}>`}}function sx(t,e,n){let r=t.sourceNodeId===e,i=new Map(t.attributes.map(d=>[d.name,d.value])),o=t.attributes.map(d=>d.name),s=(d,p)=>{if(p===null){i.delete(d);return}i.has(d)||o.push(d),i.set(d,p)};r&&Object.prototype.hasOwnProperty.call(n,"clipPathUnits")&&s("clipPathUnits",n.clipPathUnits??null),n.clipRule!==void 0&&(r||!jA.has(t.localName.toLowerCase()))&&s("clip-rule",n.clipRule);let a=o.filter((d,p)=>o.indexOf(d)===p&&i.has(d)).map(d=>`${d}="${rx(i.get(d))}"`),l=`<${t.name}${a.length>0?` ${a.join(" ")}`:""}`,c=t.children.map(d=>d.kind==="element"?sx(d,e,n):UA(d)).join(""),u=/\/\s*>\s*$/u.test(t.rawXml??"");return c.length===0&&u?`${l}/>`:`${l}>${c}</${t.name}>`}function ax(t,e){let n=mn(`<svg xmlns="${U}">${t}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"});if(!n.value)return null;let r=n.value.index.children(n.value.root.sourceNodeId)[0];if(!r)return null;let i=r.localName.toLowerCase();return i!=="clippath"&&i!=="mask"?null:sx(r,r.sourceNodeId,e)}function pd(t){let e=/^(https?):\/\/([^/?#\s\\]+)([^\s\\]*)$/iu.exec(t);if(!e)return null;let n=e[1].toLowerCase(),r=e[2],i=r.lastIndexOf("@"),o=i>=0?r.slice(0,i+1):"",s=r.slice(i+1);if(!s)return null;let a=s.startsWith("[")?s.slice(0,Math.max(0,s.indexOf("]")+1)).toLowerCase():s.split(":")[0].toLowerCase();if(!a)return null;let l=e[3]||"/",c=l.indexOf("?"),u=l.indexOf("#",Math.max(0,c)),d=c<0?"":l.slice(c+1,u<0?void 0:u);return Object.freeze({href:`${n}://${o}${s.toLowerCase()}${l}`,hostname:a,query:d})}function nx(t){try{return decodeURIComponent(t.replace(/\+/gu," "))}catch{return t.replace(/\+/gu," ")}}function Nm(t){let e=[],n=0,r=null,i=!1,o=0;for(let s=0;s<t.length;s++){let a=t[s];if(r){i?i=!1:a==="\\"?i=!0:a===r&&(r=null);continue}if(a==="/"&&t[s+1]==="*"){s=Math.max(s,ad(t,s)-1);continue}a==='"'||a==="'"?r=a:a==="("||a==="["?o++:a===")"||a==="]"?o=Math.max(0,o-1):a===","&&o===0&&(e.push(t.slice(n,s).trim()),n=s+1)}return e.push(t.slice(n).trim()),Object.freeze(e.filter(Boolean))}function HA(t){let e=[],n=0;for(;n<t.length;){for(;n<t.length&&(tx(t[n])||t[n]===",");)n++;if(n>=t.length)break;let r=n;for(;n<t.length&&!tx(t[n]);)n++;let i=t.slice(r,n);if(i.endsWith(",")){i=i.replace(/,+$/u,""),i&&e.push(i);continue}i&&e.push(i);let o=0;for(;n<t.length;){let s=t[n++];if(s==="(")o++;else if(s===")")o=Math.max(0,o-1);else if(s===","&&o===0)break}}return Object.freeze(e)}function Mm(t){if(typeof t!="string")return null;let e=dd(Nm(t)[0]??"").trim();return!e||Cm.has(e.toLowerCase())?null:e}function WA(t){let e=[];for(let n of In(t,";")){let r=t.slice(n.start,n.end),i=In(r,":",!0)[0]?.end??r.length;if(i>=r.length)continue;let o=r.slice(0,i).trim().toLowerCase(),s=r.slice(i+1).trim();o&&e.push(Object.freeze({property:o,value:s}))}return Object.freeze(e)}function KA(t){let e=cn(t).find(n=>n.name==="format");return e&&dd(t.slice(e.argumentsStart,e.argumentsEnd))||null}var XA=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 YA(t){let e={};for(let n of t){let r=XA[n.property];r&&n.value&&(e[r]=n.value)}return Object.keys(e).length>0?Object.freeze(e):void 0}function Om(t){let e=[];for(let n of cd(t)){if(n.name!=="font-face"||n.blockStart===null||n.blockEnd===null)continue;let r=WA(t.slice(n.blockStart,n.blockEnd)),i=Mm(r.find(a=>a.property==="font-family")?.value),o=r.find(a=>a.property==="src")?.value;if(!i||!o)continue;let s=YA(r);for(let a of Nm(o)){let l=ud(a);if(l===null)continue;let c=Ir(l);c.status!=="external"||!c.requestUrl||e.push(Object.freeze({family:i,url:c.requestUrl,format:KA(a),...s?{descriptors:s}:{}}))}}return Object.freeze(e)}function lx(t){let e=[];for(let n of cd(t)){if(n.name!=="import")continue;let r=ud(t.slice(n.preludeStart,n.preludeEnd));if(r===null)continue;let i=Ir(r);if(i.status!=="external"||!i.requestUrl)continue;let o=pd(i.requestUrl);if(!o||o.hostname!=="fonts.googleapis.com")continue;let s=o.query.split("&").map(a=>a.split("=",2)).filter(([a])=>nx(a).toLowerCase()==="family").map(([,a])=>nx(a??""));for(let a of s)for(let l of a.split("|")){let c=l.split(":")[0].trim();c&&!Cm.has(c.toLowerCase())&&e.push(c)}}return Object.freeze(e)}function qA(t){return In(t,";").map(e=>{let n=t.slice(e.start,e.end),r=In(n,":",!0)[0]?.end??n.length;if(r>=n.length||n.slice(0,r).trim().toLowerCase()!=="src")return n;let o=n.slice(0,r+1),s=Nm(n.slice(r+1)).filter(a=>{let l=ud(a);return l===null||Ir(l).status==="data"});return`${o} ${s.length>0?s.join(", "):'local("__svgsketch_quarantined_font__")'}`}).join(";")}function Ks(t){let e=[];for(let i of cd(t)){if(i.name==="import"){e.push({start:i.start,end:i.end,value:"/* external stylesheet import quarantined */"});continue}i.name!=="font-face"||i.blockStart===null||i.blockEnd===null||e.push({start:i.blockStart,end:i.blockEnd,value:qA(t.slice(i.blockStart,i.blockEnd))})}let n=t;for(let i of e.sort((o,s)=>s.start-o.start))n=`${n.slice(0,i.start)}${i.value}${n.slice(i.end)}`;let r=$m(n).filter(i=>{let o=i.rawUrl.trim();return!o||o.startsWith("#")?!1:Ir(o).status!=="data"}).sort((i,o)=>o.tokenStart-i.tokenStart);for(let i of r)n=`${n.slice(0,i.tokenStart)}url("data:application/octet-stream;base64,")${n.slice(i.tokenEnd)}`;return n}function ZA(t,e,n){let r=[];for(let i of e.stylesheets)if(i.applicable){for(let o of lx(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"google-font-import",family:o}));for(let o of Om(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"external-font-face",family:o.family,url:o.url,format:o.format,...o.descriptors?{descriptors:o.descriptors}:{}}))}for(let i of t.index.elements)for(let o of i.attributes)if(!(o.namespaceUri!==FA||o.localName!=="fonts"))for(let s of o.value.split(",")){let a=s.replace(/\+/gu," ").trim();!a||a.includes("/")||Cm.has(a.toLowerCase())||r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"boxy-fonts",family:a}))}for(let i of n.candidates){if(i.canonicalType!=="text"||i.status!=="materialized")continue;let o=a=>{let l=Mm(a);l&&r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:i.occurrenceId,origin:"text-font-family",family:l}))};o(i.state.fontFamily);let s=Br(i.state);if(s){o(s.baseStyle.fontFamily);for(let a of s.runs)o(a.style.fontFamily)}}return Object.freeze(r)}function Wt(t,e){return t.attributes.find(n=>n.namespaceUri===null&&n.localName.toLowerCase()===e.toLowerCase())?.value??null}function ld(t){return t.children.map(e=>e.kind==="text"||e.kind==="cdata"?e.value:"").join("")}function fd(t,e){let n=[],r=[...t.index.children(e)].reverse();for(;r.length>0;){let i=r.pop();n.push(i),r.push(...[...t.index.children(i.sourceNodeId)].reverse())}return Object.freeze(n)}function gn(t,e){let n=Ir(e.href);t.push(Object.freeze({...e,...n}))}function lo(t,e,n,r=new Set(["css-import","css-url"]),i=()=>!0){for(let o of BA(e))!r.has(o.channel)||!i(o)||o.url.trim().startsWith("#")||gn(t,{...n,occurrenceId:`${n.occurrenceId}:css:${o.tokenIndex}`,channel:o.channel,href:o.url,hrefNamespace:null})}function Dm(t,e,n,r){for(let i of fd(e,n.sourceNodeId)){let o=i.localName.toLowerCase(),s=Wt(i,"id"),a={sourceNodeId:i.sourceNodeId,occurrenceId:`${r}:foreign:${i.sourceNodeId}`,sourceId:s,elementName:i.localName},l=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(o)||o==="input"&&Wt(i,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:o==="video"},{attributeName:"data",channel:"html-data",applies:o==="object"},{attributeName:"href",channel:"html-src",applies:o==="link"&&(Wt(i,"rel")??"").split(/\s+/u).some(d=>d.toLowerCase()==="stylesheet")}];for(let d of l){if(!d.applies)continue;let p=Wt(i,d.attributeName);p!==null&&gn(t,{...a,occurrenceId:`${a.occurrenceId}:${d.attributeName}`,attributeName:d.attributeName,channel:d.channel,href:p,hrefNamespace:null})}let c=Wt(i,"srcset");if(c!==null&&(o==="img"||o==="source"))for(let[d,p]of HA(c).entries())gn(t,{...a,occurrenceId:`${a.occurrenceId}:srcset:${d}`,attributeName:"srcset",channel:"html-srcset",href:p,hrefNamespace:null});let u=Wt(i,"style");u!==null&&lo(t,u,{...a,attributeName:"style"}),o==="style"&&lo(t,ld(i),{...a,attributeName:"textContent"})}}function JA(t,e,n,r){let i=Wt(n,"data-shape-type")?.toLowerCase();if(i==="video"||i==="audio"){let o=fd(e,n.sourceNodeId).find(s=>s.localName.toLowerCase()===i);if(o){let s=Wt(o,"src")??"";if(gn(t,{sourceNodeId:o.sourceNodeId,occurrenceId:`${r}:media:src`,sourceId:Wt(o,"id"),elementName:i,attributeName:"src",channel:"html-src",href:s,hrefNamespace:null}),i==="video"){let a=Wt(n,"data-poster")??Wt(o,"poster");a!==null&&gn(t,{sourceNodeId:n.sourceNodeId,occurrenceId:`${r}:media:poster`,sourceId:Wt(n,"id"),elementName:"video",attributeName:"poster",channel:"html-poster",href:a,hrefNamespace:null})}}return}Dm(t,e,n,r)}function QA(t,e,n){let r=[];for(let i of e.occurrences){let o=t.index.element(i.correspondingSourceNodeId);if(!o||o.namespaceUri!==U)continue;let s=o.localName.toLowerCase();if(s==="image"||s==="feimage"){let a=Pe(o)??{value:"",namespace:"svg2"};gn(r,{sourceNodeId:o.sourceNodeId,occurrenceId:i.occurrenceId,sourceId:E(o,"id"),elementName:s==="feimage"?"feImage":"image",attributeName:"href",channel:"svg-href",href:a.value,hrefNamespace:a.namespace})}else s==="foreignobject"&&JA(r,t,o,i.occurrenceId)}for(let i of n.stylesheets)i.applicable&&lo(r,i.authoredText,{sourceNodeId:i.sourceNodeId,occurrenceId:`style:${i.sourceNodeId}`,sourceId:i.id,elementName:"style",attributeName:"textContent"},new Set(["css-import"]),o=>pd(o.url)?.hostname!=="fonts.googleapis.com");for(let i of n.elements){let o=t.index.element(i.correspondingSourceNodeId);if(!(!o||o.namespaceUri!==U))for(let s of Object.values(i.cascadedValues))lo(r,s.value,{sourceNodeId:s.sourceNodeId,occurrenceId:`style:${i.occurrenceId}:${s.propertyName}`,sourceId:null,elementName:"style-declaration",attributeName:s.propertyName})}return Object.freeze(r)}function cx(t,e,n){let r=[...new Set(t.filter(u=>u.origin==="google-font-import"||u.origin==="boxy-fonts").map(u=>u.family))].sort(),i=[],o=new Set;for(let u of t){if(u.origin!=="external-font-face"||!u.url)continue;let d=`${u.family}\0${u.url}\0${u.format??""}\0${JSON.stringify(u.descriptors??{})}`;o.has(d)||(o.add(d),i.push(Object.freeze({family:u.family,url:u.url,format:u.format??null,...u.descriptors?{descriptors:u.descriptors}:{}})))}i.sort((u,d)=>u.family.localeCompare(d.family)||u.url.localeCompare(d.url)||(u.format??"").localeCompare(d.format??""));let s=[...new Set([...r,...i.map(u=>u.family)])].sort(),a=[...new Set(e.filter(u=>u.status==="external"&&u.requestUrl).map(u=>u.requestUrl))].sort(),l=[];s.length>0&&l.push(Object.freeze({kind:"font-consent",families:s,googleFamilies:r,...i.length>0?{externalSources:i}:{}})),a.length>0&&l.push(Object.freeze({kind:"external-asset-resolution",urls:a})),Object.freeze(s),Object.freeze(r),Object.freeze(i),Object.freeze(a),Object.freeze(l);let c=Object.freeze({fontCandidates:t,assetCandidates:e,effects:l});return Object.freeze({value:c,diagnostics:n})}function md(t,e,n,r,i){return cx(ZA(t,n,r),QA(t,e,n),Object.freeze([]))}function eN(t){let e=t.state,n=e.extra;return typeof n=="object"&&n!==null&&!Array.isArray(n)?{...n,...e}:e}function zm(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function _m(t,e,n){for(let r of lx(e))t.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"google-font-import",family:r}));for(let r of Om(e))t.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"external-font-face",family:r.family,url:r.url,format:r.format,...r.descriptors?{descriptors:r.descriptors}:{}}))}function dx(t,e,n,r){_m(t,n,r),lo(e,n,{sourceNodeId:r,occurrenceId:r,sourceId:null,elementName:"style",attributeName:"textContent"},void 0,o=>pd(o.url)?.hostname!=="fonts.googleapis.com");let i=new Set(Om(n).map(o=>o.url));for(let o=e.length-1;o>=0;o--){let s=e[o];s.sourceNodeId===r&&i.has(s.requestUrl??"")&&e.splice(o,1)}}function ux(t,e,n,r,i,o){let s=mn(`<svg xmlns="${U}"><foreignObject>${n}</foreignObject></svg>`,i);if(!s.value){o.push(...s.diagnostics.map(l=>Object.freeze({...l,severity:"warning",message:`Canonical foreign content could not be inspected for external requests: ${l.message}`,documentPath:r})));return}let a=s.value.index.children(s.value.root.sourceNodeId).find(l=>l.localName.toLowerCase()==="foreignobject");if(a){Dm(e,s.value,a,r);for(let l of fd(s.value,a.sourceNodeId))l.localName.toLowerCase()==="style"&&_m(t,ld(l),`${r}:${l.sourceNodeId}`)}}function Fm(t,e,n,r){lo(t,e,{sourceNodeId:n,occurrenceId:`${n}:${r}`,sourceId:null,elementName:"canonical-state",attributeName:r})}function Ws(t,e,n){if(zm(e))for(let[r,i]of Object.entries(e))typeof i=="string"&&Fm(t,i,n,r)}function Lm(t,e,n,r,i,o){if(Array.isArray(n))for(let[s,a]of n.entries()){if(!zm(a))continue;let l=`${r}:filter:${s}`;a.type==="feImage"&&gn(e,{sourceNodeId:r,occurrenceId:l,sourceId:null,elementName:"feImage",attributeName:"href",channel:"canonical-state",href:typeof a.href=="string"?a.href:typeof a.xlinkHref=="string"?a.xlinkHref:"",hrefNamespace:typeof a.href=="string"?"svg2":"xlink"}),a.type==="raw-svg"&&typeof a.svgContent=="string"&&ao(t,e,a.svgContent,`${l}:raw`,i,o),Lm(t,e,a.primitives,`${l}:primitives`,i,o)}}function Pm(t,e,n,r,i,o){!zm(n)||typeof n.svgContent!="string"||ao(t,e,n.svgContent,r,i,o)}function tN(t,e,n,r,i,o){let s=eN(n),a=`snapshot:${r}:${n.id}`;if(n.type==="text"){let l=u=>{let d=Mm(u);d&&t.push(Object.freeze({sourceNodeId:a,occurrenceId:a,origin:"text-font-family",family:d}))};l(s.fontFamily);let c=Br(s);if(c){l(c.baseStyle.fontFamily);for(let u of c.runs)l(u.style.fontFamily)}}n.type==="image"?gn(e,{sourceNodeId:a,occurrenceId:a,sourceId:n.id,elementName:"image",attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}):n.type==="video"||n.type==="audio"?(gn(e,{sourceNodeId:a,occurrenceId:`${a}:src`,sourceId:n.id,elementName:n.type,attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}),n.type==="video"&&typeof s.posterHref=="string"&&gn(e,{sourceNodeId:a,occurrenceId:`${a}:poster`,sourceId:n.id,elementName:"video",attributeName:"posterHref",channel:"canonical-state",href:s.posterHref,hrefNamespace:null})):n.type==="foreign-object"&&typeof s.rawContent=="string"&&ux(t,e,s.rawContent,a,i,o),Pm(t,e,s.fillGradient,`${a}:fillGradient`,i,o),Pm(t,e,s.strokeGradient,`${a}:strokeGradient`,i,o),Lm(t,e,s.filters,a,i,o),Ws(e,s.authoredAttributes,`${a}:authored`),Ws(e,s.containerPresentation,`${a}:container-presentation`),Ws(e,s.instancePresentation,`${a}:instance-presentation`),Ws(e,s.cssMaskProperties,`${a}:mask`),typeof s.cssClipPath=="string"&&Fm(e,s.cssClipPath,a,"clip-path")}function ao(t,e,n,r,i,o){let s=mn(`<svg xmlns="${U}">${n}</svg>`,i);if(!s.value){o.push(...s.diagnostics.map(l=>Object.freeze({...l,severity:"warning",message:`Canonical raw definition could not be inspected for external requests: ${l.message}`,documentPath:r})));return}let a=new Set;for(let l of s.value.index.elements){if(l.localName.toLowerCase()!=="foreignobject")continue;let c=`${r}:${l.sourceNodeId}`;Dm(e,s.value,l,c);for(let u of fd(s.value,l.sourceNodeId))a.add(u.sourceNodeId),u.localName.toLowerCase()==="style"&&_m(t,ld(u),`${r}:${u.sourceNodeId}`)}for(let l of s.value.index.elements){if(a.has(l.sourceNodeId))continue;let c=l.localName.toLowerCase();if(l.namespaceUri===U&&(c==="image"||c==="feimage")){let u=Pe(l)??{value:"",namespace:"svg2"};gn(e,{sourceNodeId:`${r}:${l.sourceNodeId}`,occurrenceId:`${r}:${l.sourceNodeId}`,sourceId:Wt(l,"id"),elementName:c==="feimage"?"feImage":"image",attributeName:"href",channel:"canonical-state",href:u.value,hrefNamespace:u.namespace})}c==="style"&&dx(t,e,ld(l),`${r}:${l.sourceNodeId}:style`);for(let u of l.attributes)u.localName.toLowerCase()==="href"||u.localName.toLowerCase()==="src"||Fm(e,u.value,`${r}:${l.sourceNodeId}`,u.name)}}function px(t,e){let n=[],r=[],i=[];for(let[s,a]of(t.documentStyles??[]).entries())dx(n,r,a.css,`snapshot:documentStyles[${s}]`);Nt(t,{onShape:(s,a)=>tN(n,r,s,a,e,i)});for(let[s,a]of(t.library??[]).entries()){let l=`snapshot:library[${s}]`;a.kind==="pattern"?Pm(n,r,a.pattern,`${l}:pattern`,e,i):a.kind==="filter"?Lm(n,r,a.filters,`${l}:filters`,e,i):(a.kind==="symbol"||a.kind==="marker")&&Ws(r,a.rootAttributes,`${l}:root`)}for(let[s,a]of(t.customPatterns??[]).entries())ao(n,r,a.svgContent,`snapshot:customPatterns[${s}]`,e,i);let o=t.documentMetadata?.rawHtmlMetadata;typeof o=="string"&&ux(n,r,o,"snapshot:documentMetadata.rawHtmlMetadata",e,i);for(let[s,a]of(t.paintServerDefs??[]).entries())ao(n,r,a.markup,`snapshot:paintServerDefs[${s}]`,e,i);for(let[s,a]of(t.rawPaintServerDefs??[]).entries())ao(n,r,a,`snapshot:rawPaintServerDefs[${s}]`,e,i);for(let[s,a]of(t.clipMaskGroups??[]).entries())a.rawDefinition&&ao(n,r,a.rawDefinition,`snapshot:clipMaskGroups[${s}].rawDefinition`,e,i);return cx(Object.freeze(n),Object.freeze(r),Object.freeze(i))}var Bm=Object.freeze({matchesMedia(t){let e=t.trim().toLowerCase();return e===""||e==="all"||e==="screen"},supportsCondition(){return!1}}),nN=new Map([["clippath","clip-path"],["marker","marker"],["mask","mask"],["pattern","pattern"]]);function rN(t){return Object.freeze(t.index.elements.flatMap(e=>{let n=nN.get(e.localName.toLowerCase());return n?[Object.freeze({sourceNodeId:e.sourceNodeId,capability:n})]:[]}))}function iN(t,e,n){let r=new Map(t.occurrences.map(i=>[i.occurrenceId,i]));return Object.freeze([...e.candidates.filter(i=>i.status==="materialized").map(i=>i.occurrenceId),...n.uses.filter(i=>["symbol-instance","linked-reference"].includes(i.status)).map(i=>i.useOccurrenceId)].filter(i=>r.get(i)?.role!=="definition"))}function gd(t,e={}){let n={source:e.source??"svg",entrypoint:e.entrypoint??"svg-document-import"},r=mn(t,n,e.xmlHost);if(!r.value)return Object.freeze({value:null,diagnostics:r.diagnostics});let i=r.value,o=Jl(i.root,n),s=Object.freeze({width:o.value.viewBoxWidth??300,height:o.value.viewBoxHeight??150}),a=e.rootFontSize??16,l=oc(i,{...e.claimedIds?{claimedIds:e.claimedIds}:{}}),c=ic(i,n),u=Fc(i,n),d=sd(i,n),p=ac(i,{...n,resourceRoots:rN(i),...e.maxUseDepth!==void 0?{maxDepth:e.maxUseDepth}:{},...e.maxUseOccurrences!==void 0?{maxOccurrences:e.maxUseOccurrences}:{}}),f=yc(i,p,{...n,environment:e.styleEnvironment??Bm}),g=Ic(i,p,f.value,{...n,viewport:s,rootFontSize:a,...e.textMetricsHost?{textMetricsHost:e.textMetricsHost}:{}}),m=bc(i,p,f.value,{...n,leafGeometry:g.value}),h=uc(i,p,f.value,n),b=fc(i,{...n,appliedDeclarations:f.value.appliedResourceDeclarations}),S=Cc(i,p,f.value,b,g.value,{...n,viewport:s,rootFontSize:a}),v=_c(i,p,f.value,b,{...n,viewport:s,rootFontSize:a}),I=$c(i,p,f.value,b,{...n,viewport:s,rootFontSize:a}),x=Ec(i,p,f.value,b,{...n,viewport:s,rootFontSize:a}),P=Ac(i,p,f.value,b,{...n,viewport:s,rootFontSize:a}),T=Mc(i,l,n),k=Ql(i,n),w=tc(i,n),$=mc(i),R=md(i,p,f.value,g.value,n),C=nc(i,p,{...n,materializedOccurrenceIds:iN(p,g.value,h)}),A=[...r.diagnostics,...o.diagnostics,...c.diagnostics,...u.diagnostics,...d.diagnostics,...p.diagnostics,...f.diagnostics,...m.diagnostics,...h.diagnostics,...g.diagnostics,...b.diagnostics,...S.diagnostics,...v.diagnostics,...I.diagnostics,...x.diagnostics,...P.diagnostics,...T.diagnostics,...k.diagnostics,...w.diagnostics,...R.diagnostics,...C.diagnostics],D=Object.freeze({sourceDocument:i,rootFrame:o.value,identifiers:l,conditionalProcessing:c.value,scripts:u.value,metadata:d.value,useOccurrences:p,styles:f.value,animations:m.value,symbolUses:h,leafGeometry:g.value,resourceDependencies:b,clipMasks:S.value,filters:v.value,markers:I.value,gradients:x.value,patterns:P.value,paintServerDefinitions:T.value,views:k.value,embeddedFrames:w.value,authoredAttributes:$,externalEffects:R.value,hierarchy:C.value});return Object.freeze({value:D,diagnostics:Object.freeze(A)})}function W(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function co(t={}){let e={schemaVersion:Tt,shapes:t.shapes?t.shapes.map(n=>({...n})):[],viewboxes:t.viewboxes?t.viewboxes.map(n=>({...n})):[]};return t.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...t.metadata}),e}function fx(t){let{type:e,id:n,...r}=t,i={};for(let[o,s]of Object.entries(r))s!==void 0&&(i[o]=s);return{id:n??W(),type:e,state:i}}function ui(t,e,n,r,i){return{id:i??W(),x:t,y:e,width:n,height:r}}var oN;function sN(){return oN??=new Set([...se.typeIds().filter(t=>t!=="document"),"spline"])}function wr(t){let e=[],n=[];if(t==null||typeof t!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:n};let r=t;for(let o of Object.keys(r))o in gt||n.push({path:o,message:`Unknown top-level field "${o}" (likely written by a newer version); it is preserved in the unknownFields quarantine on save`,severity:"warning"});let i={doc:r,errors:e,warnings:n};for(let o of Object.keys(gt)){let s=r[o];s===void 0&&!gt[o].required||pN[o](s,i)}return{valid:e.length===0,errors:e,warnings:n}}function He(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Pt(t,e,n){return Array.isArray(t)?!0:(n.push({path:e,message:`${e} must be an array`,severity:"error"}),!1)}var aN=new Set(["x1","y1","x2","y2","gradientTransform"]),lN=new Set(["cx","cy","fx","fy","r","fr","gradientTransform"]),cN=new Set(["x","y","width","height"]);function Cn(t,e,n){t.push({path:e,message:n,severity:"error"})}function dN(t,e,n,r){if(!He(t)){Cn(r,e,"Gradient must be a plain object");return}let i=n==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let o of i)t[o]!==void 0&&(typeof t[o]!="number"||!Number.isFinite(t[o]))&&Cn(r,`${e}.${o}`,`${o} must be a finite number`);if(t.fr!==void 0&&(typeof t.fr!="number"||!Number.isFinite(t.fr))&&Cn(r,`${e}.fr`,"fr must be a finite number"),t.authoredGeometry!==void 0)if(!He(t.authoredGeometry))Cn(r,`${e}.authoredGeometry`,"Gradient authoredGeometry must be a plain object");else{let o=n==="linear-gradient"?aN:lN;for(let[s,a]of Object.entries(t.authoredGeometry))o.has(s)?typeof a!="string"&&Cn(r,`${e}.authoredGeometry.${s}`,"Authored gradient geometry declarations must be strings"):Cn(r,`${e}.authoredGeometry.${s}`,"is not a supported authored gradient geometry field")}t.gradientTransform!==void 0&&(!Array.isArray(t.gradientTransform)||t.gradientTransform.length!==6||!t.gradientTransform.every(o=>typeof o=="number"&&Number.isFinite(o)))&&Cn(r,`${e}.gradientTransform`,"gradientTransform must be a 6-element finite affine matrix"),Array.isArray(t.stops)?t.stops.forEach((o,s)=>{if(!He(o)){Cn(r,`${e}.stops[${s}]`,"Gradient stop must be an object");return}for(let a of["offset","opacity"])o[a]!==void 0&&(typeof o[a]!="number"||!Number.isFinite(o[a]))&&Cn(r,`${e}.stops[${s}].${a}`,`${a} must be a finite number`)}):Cn(r,`${e}.stops`,"Gradient stops must be an array")}function uN(t,e,n){if(!He(t)){n.push({path:e,message:"Pattern must be a plain object",severity:"error"});return}for(let r of["x","y","width","height","scale","rotation","opacity"])t[r]!==void 0&&(typeof t[r]!="number"||!Number.isFinite(t[r]))&&n.push({path:`${e}.${r}`,message:`${r} must be a finite number`,severity:"error"});t.patternUnits!==void 0&&t.patternUnits!=="userSpaceOnUse"&&t.patternUnits!=="objectBoundingBox"&&n.push({path:`${e}.patternUnits`,message:"patternUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"}),t.patternContentUnits!==void 0&&t.patternContentUnits!=="userSpaceOnUse"&&t.patternContentUnits!=="objectBoundingBox"&&n.push({path:`${e}.patternContentUnits`,message:"patternContentUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"});for(let r of["svgContent","patternTransform","viewBox","preserveAspectRatio"])t[r]!==void 0&&typeof t[r]!="string"&&n.push({path:`${e}.${r}`,message:`${r} must be a string`,severity:"error"});if(t.authoredGeometry!==void 0)if(!He(t.authoredGeometry))n.push({path:`${e}.authoredGeometry`,message:"Pattern authoredGeometry must be a plain object",severity:"error"});else for(let[r,i]of Object.entries(t.authoredGeometry))cN.has(r)?typeof i!="string"&&n.push({path:`${e}.authoredGeometry.${r}`,message:"Authored pattern geometry declarations must be strings",severity:"error"}):n.push({path:`${e}.authoredGeometry.${r}`,message:"is not a supported authored pattern geometry field",severity:"error"})}var pN={schemaVersion:(t,{errors:e,warnings:n})=>{typeof t!="number"||!Number.isInteger(t)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):t>Tt&&n.push({path:"schemaVersion",message:`schemaVersion ${t} is newer than supported (${Tt})`,severity:"warning"})},shapes:(t,{errors:e,warnings:n})=>{if(!Pt(t,"shapes",e))return;let r=new Set;t.forEach((i,o)=>{Vm(i,`shapes[${o}]`,e,n,r)})},viewboxes:(t,{errors:e})=>{if(!Pt(t,"viewboxes",e))return;let n=new Set;t.forEach((r,i)=>{vN(r,`viewboxes[${i}]`,e,n)})},guides:(t,{errors:e})=>{Pt(t,"guides",e)&&t.forEach((n,r)=>{xN(n,`guides[${r}]`,e)})},measurements:(t,{errors:e})=>{Pt(t,"measurements",e)&&t.forEach((n,r)=>{let i=`measurements[${r}]`;if(!He(n)){e.push({path:i,message:"Measurement must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&e.push({path:`${i}.id`,message:"Measurement id must be a non-empty string",severity:"error"})})},sceneTree:(t,{doc:e,errors:n,warnings:r})=>{if(!Pt(t,"sceneTree",n))return;let i=fN(e.shapes),o=new Set;t.forEach((s,a)=>{mN(s,`sceneTree[${a}]`,n,r,i,o)})},groups:(t,{errors:e})=>{Pt(t,"groups",e)&&t.forEach((n,r)=>{IN(n,`groups[${r}]`,e)})},clipMaskGroups:(t,{errors:e,warnings:n})=>{Pt(t,"clipMaskGroups",e)&&t.forEach((r,i)=>{wN(r,`clipMaskGroups[${i}]`,e,n)})},documentMetadata:(t,{errors:e})=>{He(t)||e.push({path:"documentMetadata",message:"documentMetadata must be a plain object",severity:"error"})},documentScripts:(t,{errors:e})=>{Pt(t,"documentScripts",e)&&t.forEach((n,r)=>{let i=`documentScripts[${r}]`;if(!He(n)){e.push({path:i,message:"Document script must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&e.push({path:`${i}.id`,message:"Document script id must be a non-empty string",severity:"error"})})},documentStyles:(t,{errors:e})=>{Pt(t,"documentStyles",e)&&t.forEach((n,r)=>{let i=`documentStyles[${r}]`;if(!He(n)){e.push({path:i,message:"Document style must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&e.push({path:`${i}.id`,message:"Document style id must be a non-empty string",severity:"error"}),typeof n.css!="string"&&e.push({path:`${i}.css`,message:"Document style css must be a string",severity:"error"})})},templateVariables:(t,{errors:e})=>{Pt(t,"templateVariables",e)&&t.forEach((n,r)=>{let i=`templateVariables[${r}]`;if(!He(n)){e.push({path:i,message:"Template variable must be a non-null object",severity:"error"});return}(typeof n.name!="string"||n.name.length===0)&&e.push({path:`${i}.name`,message:"Template variable name must be a non-empty string",severity:"error"})})},animationTimeline:(t,{errors:e})=>{if(!He(t)){e.push({path:"animationTimeline",message:"animationTimeline must be a plain object",severity:"error"});return}t.tracks!==void 0&&!Array.isArray(t.tracks)&&e.push({path:"animationTimeline.tracks",message:"animationTimeline.tracks must be an array",severity:"error"})},library:(t,{doc:e,errors:n,warnings:r})=>{if(!Pt(t,"library",n))return;let i=new Set;t.forEach((o,s)=>{let a=`library[${s}]`;if(!He(o)){n.push({path:a,message:"Library def must be a non-null object",severity:"error"});return}if(typeof o.id!="string"||o.id.length===0?n.push({path:`${a}.id`,message:"Library def id must be a non-empty string",severity:"error"}):i.has(o.id)?n.push({path:`${a}.id`,message:`Duplicate library def id: "${o.id}"`,severity:"error"}):i.add(o.id),(typeof o.kind!="string"||o.kind.length===0)&&n.push({path:`${a}.kind`,message:"Library def kind must be a non-empty string",severity:"error"}),o.kind==="symbol"||o.kind==="marker"){if(o.kind==="symbol"){let l=typeof e.schemaVersion=="number"&&e.schemaVersion>=8;if(l)for(let c of["wrapperAttrs","groups","overflow"])o[c]!==void 0&&n.push({path:`${a}.${c}`,message:`Symbol ${c} is schema-v7 migration input only`,severity:"error"});for(let c of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])o[c]!==void 0&&typeof o[c]!="string"&&n.push({path:`${a}.${c}`,message:`Symbol ${c} must be a string when present`,severity:"error"});if(o.rootAttributes!==void 0)if(!He(o.rootAttributes))n.push({path:`${a}.rootAttributes`,message:"Symbol rootAttributes must be a plain object",severity:"error"});else for(let[c,u]of Object.entries(o.rootAttributes))l&&["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(c)&&n.push({path:`${a}.rootAttributes.${c}`,message:`Symbol ${c} must use its typed root field`,severity:"error"}),typeof u!="string"&&n.push({path:`${a}.rootAttributes.${c}`,message:"Symbol root attribute values must be strings",severity:"error"})}if(o.kind==="marker"){for(let l of["viewBox","preserveAspectRatio"])o[l]!==void 0&&typeof o[l]!="string"&&n.push({path:`${a}.${l}`,message:`Marker ${l} must be a string when present`,severity:"error"});if(o.authoredGeometry!==void 0)if(!He(o.authoredGeometry))n.push({path:`${a}.authoredGeometry`,message:"Marker authoredGeometry must be a plain object",severity:"error"});else for(let[l,c]of Object.entries(o.authoredGeometry))typeof c!="string"&&n.push({path:`${a}.authoredGeometry.${l}`,message:"Marker authored geometry declarations must be strings",severity:"error"});if(o.rootAttributes!==void 0)if(!He(o.rootAttributes))n.push({path:`${a}.rootAttributes`,message:"Marker rootAttributes must be a plain object",severity:"error"});else for(let[l,c]of Object.entries(o.rootAttributes))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(l)&&n.push({path:`${a}.rootAttributes.${l}`,message:`Marker ${l} must use its typed root field`,severity:"error"}),typeof c!="string"&&n.push({path:`${a}.rootAttributes.${l}`,message:"Marker root attribute values must be strings",severity:"error"})}if(Array.isArray(o.shapes)){let l=new Set;o.shapes.forEach((c,u)=>{Vm(c,`${a}.shapes[${u}]`,n,r,l)})}if(o.kind==="symbol"&&He(o.variants))for(let[l,c]of Object.entries(o.variants)){if(!Array.isArray(c))continue;let u=new Set;c.forEach((d,p)=>{Vm(d,`${a}.variants[${l}][${p}]`,n,r,u)})}}(o.kind==="linear-gradient"||o.kind==="radial-gradient")&&dN(o.gradient,`${a}.gradient`,o.kind,n),o.kind==="pattern"&&uN(o.pattern,`${a}.pattern`,n)})},rawPaintServerDefs:(t,{errors:e})=>{Pt(t,"rawPaintServerDefs",e)&&t.forEach((n,r)=>{typeof n!="string"&&e.push({path:`rawPaintServerDefs[${r}]`,message:"rawPaintServerDefs entries must be strings",severity:"error"})})},paintServerDefs:(t,{errors:e})=>{if(!Pt(t,"paintServerDefs",e))return;let n=new Set;t.forEach((r,i)=>{hN(r,`paintServerDefs[${i}]`,e,n)})},customPatterns:(t,{errors:e})=>{Gm(t,"customPatterns","Custom pattern",e)},symbols:(t,{errors:e})=>{Gm(t,"symbols","Symbol def",e)},markers:(t,{errors:e})=>{Gm(t,"markers","Marker def",e)},colorGlyphLibrary:(t,{errors:e})=>{if(!He(t)){e.push({path:"colorGlyphLibrary",message:"colorGlyphLibrary must be a plain object",severity:"error"});return}t.version!==void 0&&!Number.isInteger(t.version)&&e.push({path:"colorGlyphLibrary.version",message:"colorGlyphLibrary.version must be an integer",severity:"error"}),t.entries!==void 0&&!Array.isArray(t.entries)&&e.push({path:"colorGlyphLibrary.entries",message:"colorGlyphLibrary.entries must be an array",severity:"error"})},exportItems:(t,{errors:e})=>{Pt(t,"exportItems",e)&&t.forEach((n,r)=>{let i=`exportItems[${r}]`;if(!He(n)){e.push({path:i,message:"Export item must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&e.push({path:`${i}.id`,message:"Export item id must be a non-empty string",severity:"error"}),typeof n.filename!="string"&&e.push({path:`${i}.filename`,message:"Export item filename must be a string",severity:"error"}),typeof n.format!="string"&&e.push({path:`${i}.format`,message:"Export item format must be a string",severity:"error"})})},unknownFields:(t,{errors:e})=>{He(t)||e.push({path:"unknownFields",message:"unknownFields must be a plain object (forward-compat quarantine bag)",severity:"error"})}};function Gm(t,e,n,r){Pt(t,e,r)&&t.forEach((i,o)=>{let s=`${e}[${o}]`;if(!He(i)){r.push({path:s,message:`${n} must be a non-null object`,severity:"error"});return}(typeof i.id!="string"||i.id.length===0)&&r.push({path:`${s}.id`,message:`${n} id must be a non-empty string`,severity:"error"})})}function fN(t){let e=new Set;if(!Array.isArray(t))return e;for(let n of t)qt(n,{onShape:r=>{typeof r.id=="string"&&r.id.length>0&&e.add(r.id)}});return e}function mx(t){return t.startsWith("structural:")}function mN(t,e,n,r,i,o){if(t===null||typeof t!="object"){n.push({path:e,message:"Scene tree entry must be a non-null object",severity:"error"});return}let s=t;typeof s.id!="string"||s.id.length===0?n.push({path:`${e}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(o.has(s.id)&&n.push({path:`${e}.id`,message:`Duplicate scene tree id: "${s.id}"`,severity:"error"}),o.add(s.id),!i.has(s.id)&&!mx(s.id)&&r.push({path:`${e}.id`,message:`Scene tree id "${s.id}" is not present in shapes`,severity:"warning"})),s.parentId!==null&&typeof s.parentId!="string"?n.push({path:`${e}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof s.parentId=="string"&&!i.has(s.parentId)&&!mx(s.parentId)&&r.push({path:`${e}.parentId`,message:`Scene tree parentId "${s.parentId}" is not present in shapes`,severity:"warning"}),(typeof s.index!="number"||!Number.isInteger(s.index)||s.index<0)&&n.push({path:`${e}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),s.updatedAt!==void 0&&(typeof s.updatedAt!="number"||!Number.isFinite(s.updatedAt)||s.updatedAt<0)&&n.push({path:`${e}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),s.clientId!==void 0&&typeof s.clientId!="string"&&n.push({path:`${e}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var gN=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function hN(t,e,n,r){if(t===null||typeof t!="object"){n.push({path:e,message:"Paint server def must be a non-null object",severity:"error"});return}let i=t;typeof i.id!="string"||i.id.length===0?n.push({path:`${e}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):r.has(i.id)?n.push({path:`${e}.id`,message:`Duplicate paint server def id: "${i.id}"`,severity:"error"}):r.add(i.id);let o=i.role===void 0?"resource":i.role;o!=="resource"&&o!=="referenced-fragment"&&n.push({path:`${e}.role`,message:"Paint server def role must be resource or referenced-fragment",severity:"error"}),typeof i.type=="string"&&(o==="resource"&&gN.has(i.type)||o==="referenced-fragment"&&/^[A-Za-z][\w.-]*$/u.test(i.type))||n.push({path:`${e}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof i.markup!="string"||i.markup.length===0)&&n.push({path:`${e}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),i.passthrough!==void 0&&typeof i.passthrough!="boolean"&&n.push({path:`${e}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"});for(let a of["definitionChildIds","sourceDefinitionChildIds"]){let l=i[a];l!==void 0&&(!Array.isArray(l)||l.some(c=>typeof c!="string"||c.length===0))&&n.push({path:`${e}.${a}`,message:"Definition child ids must be non-empty strings",severity:"error"})}Array.isArray(i.definitionChildIds)&&Array.isArray(i.sourceDefinitionChildIds)&&i.definitionChildIds.length!==i.sourceDefinitionChildIds.length&&n.push({path:e,message:"Definition child id arrays must have equal lengths",severity:"error"})}function Vm(t,e,n,r,i){if(t===null||typeof t!="object"||Array.isArray(t)){n.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}qt(t,{onShape:(o,s)=>{yN(o,`${e}${s}`,n,r,i)}})}function yN(t,e,n,r,i){if(typeof t.id!="string"||t.id.length===0?n.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(t.id)?n.push({path:`${e}.id`,message:`Duplicate shape id: "${t.id}"`,severity:"error"}):i.add(t.id),typeof t.type!="string"?n.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):sN().has(t.type)||r.push({path:`${e}.type`,message:`Unknown shape type: "${t.type}"`,severity:"warning"}),t.state===void 0||t.state===null||typeof t.state!="object")n.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"});else{let o=t.state;bN(o,`${e}.state`,n,r),o.children!==void 0&&!Array.isArray(o.children)?n.push({path:`${e}.state.children`,message:"children must be an array",severity:"error"}):Array.isArray(o.children)&&o.children.forEach((s,a)=>{(s===null||typeof s!="object"||Array.isArray(s))&&n.push({path:`${e}.state.children[${a}]`,message:"Shape must be a non-null object",severity:"error"})})}}var SN=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function gx(t){return typeof t=="number"?isFinite(t):typeof t=="string"?SN.test(t):!1}function bN(t,e,n,r){if(t.authoredUseGeometry!==void 0)if(!He(t.authoredUseGeometry))n.push({path:`${e}.authoredUseGeometry`,message:"authoredUseGeometry must be a plain object",severity:"error"});else for(let[s,a]of Object.entries(t.authoredUseGeometry))(!["x","y","width","height"].includes(s)||typeof a!="string")&&n.push({path:`${e}.authoredUseGeometry.${s}`,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 s of i)t[s]!==void 0&&!gx(t[s])&&n.push({path:`${e}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"});for(let s of _o){let a=t[s];if(a!=null){if(s==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(l=>typeof l=="number"&&Number.isFinite(l)))&&n.push({path:`${e}.${s}`,message:`${s} must be a 6-element finite affine matrix`,severity:"error"});continue}gx(a)||n.push({path:`${e}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"})}}let o=["width","height","radius","fontSize"];for(let s of o){let a=t[s];typeof a=="number"&&a<=0&&r.push({path:`${e}.${s}`,message:`${s} should be positive (got ${a})`,severity:"warning"})}}function vN(t,e,n,r){if(t===null||typeof t!="object"){n.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let i=t;typeof i.id!="string"||i.id.length===0?n.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):r.has(i.id)?n.push({path:`${e}.id`,message:`Duplicate viewbox id: "${i.id}"`,severity:"error"}):r.add(i.id);for(let o of["x","y","width","height"])(typeof i[o]!="number"||!isFinite(i[o]))&&n.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof i.width=="number"&&i.width<=0&&n.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof i.height=="number"&&i.height<=0&&n.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function xN(t,e,n){if(t===null||typeof t!="object"){n.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let r=t;(typeof r.id!="string"||r.id.length===0)&&n.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),r.orientation!=="horizontal"&&r.orientation!=="vertical"&&n.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof r.position!="number"||!isFinite(r.position))&&n.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function IN(t,e,n){if(t===null||typeof t!="object"){n.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let r=t;(typeof r.id!="string"||r.id.length===0)&&n.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),r.parentId!==null&&typeof r.parentId!="string"&&n.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function wN(t,e,n,r){if(t===null||typeof t!="object"){n.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let i=t;(typeof i.id!="string"||i.id.length===0)&&n.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),i.type!=="clip"&&i.type!=="mask"&&n.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"});let o=i.clipShapeIds,s=i.clipShapeId,a=typeof s=="string"&&s.length>0,l=typeof i.rawDefinition=="string"&&i.rawDefinition.length>0;o!==void 0&&!Array.isArray(o)?n.push({path:`${e}.clipShapeIds`,message:"clipShapeIds must be an array",severity:"error"}):o===void 0&&!a?n.push({path:`${e}.clipShapeIds`,message:"ClipMaskGroup must carry clipShapeIds (or the deprecated clipShapeId)",severity:"error"}):Array.isArray(o)&&o.length===0&&!a&&!l&&r.push({path:`${e}.clipShapeIds`,message:"ClipMaskGroup has no clip shapes and no rawDefinition; it will clip nothing",severity:"warning"}),Array.isArray(i.contentShapeIds)||n.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function Xs(t){let e=[],n=new Map,r=new Set,i=new WeakSet,o=[...t].reverse();for(;o.length>0;){let a=o.pop();if(!a||typeof a!="object"||i.has(a))continue;i.add(a),e.push(a);let l=n.get(a.id);l&&l!==a?r.add(a.id):l||n.set(a.id,a);let c=a.state.children;if(Array.isArray(c))for(let u=c.length-1;u>=0;u--){let d=c[u];d&&typeof d=="object"&&typeof d.id=="string"&&o.push(d)}}let s=new Map(n);for(let a of r)s.delete(a);return{ordered:e,uniqueById:s,duplicateIds:r}}function uo(t){let e=[...t??[]],n=new Map;for(let o of e)n.set(o.id,(n.get(o.id)??0)+1);let r=new Set([...n].filter(([,o])=>o>1).map(([o])=>o)),i=new Map;for(let o of e)r.has(o.id)||i.set(o.id,o);return{ordered:e,uniqueById:i,duplicateIds:r,definition:o=>i.get(o),symbol:o=>{let s=i.get(o);return s?.kind==="symbol"?s:void 0}}}function kN(t){let e=t.groupData;if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e.transform;return typeof n=="string"&&n.trim()?n:null}function po(t,e){let n=pt(t,e);if(n)return{matrix:Jt(t,e),attribute:n,owner:"canonical"};let r=kN(t);return r?{matrix:Ot(r),attribute:r,owner:"group-data"}:{matrix:Ae,attribute:null,owner:"none"}}function Ct(t){let e=t.transformMatrix;return Un(e)&&!Bt(e)||t.customPivot||typeof t.rawTransform=="string"&&t.rawTransform?!1:(t.rotation??0)!==0||(t.skewX??0)!==0||(t.skewY??0)!==0||(t.scaleX??1)!==1||(t.scaleY??1)!==1}function Ys(t,e){let n=e?{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}:void 0;return po(t,n)}var RN=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,TN=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)px$/i,PN=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)%$/;function qs(t,e,n,r){let i=t.trim();if(RN.test(i))return Number(i);let o=TN.exec(i);if(o)return Number(o[1]);let s=PN.exec(i);if(s)return e.percentBasis===void 0?(r.push({code:"unresolved-symbol-viewport",message:`Symbol ${e.axis} percentage ${t} needs a containing viewport basis.`}),null):Number(s[1])/100*e.percentBasis;let a=n.resolveLength?.(t,e)??null;return a!==null&&Number.isFinite(a)?a:(r.push({code:"invalid-symbol-length",message:`Symbol ${e.axis} length ${t} is invalid or requires an unavailable length host.`}),null)}function CN(t){let e=t.state.authoredUseGeometry;return e&&typeof e=="object"?e:{}}function pi(t,e){let n=t[e];if(typeof n=="string")return n;if(["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(e))return;let r=t.rootAttributes?.[e];return typeof r=="string"?r:void 0}function $N(t,e){if(t===void 0)return;let n=Ue(t);return n?n.width<0||n.height<0?(e.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${t} has a non-finite or negative dimension and is ignored.`}),null):n:(e.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${t} is not four finite SVG numbers and is ignored.`}),null)}function hx(t,e,n,r,i,o){if(e===void 0){if(i.legacyNumericGeometry){let a=Number(t.state[n]??0);return Number.isFinite(a)?a:0}return 0}return qs(e,{axis:n,percentBasis:n==="x"?r?.width:r?.height},i,o)??0}function yx(t,e,n,r,i,o,s){let a=n==="width"?i?.width:i?.height,l=[r,pi(e,n)];for(let c of l){if(c===void 0||c.trim().toLowerCase()==="auto")continue;let u=qs(c,{axis:n,percentBasis:a},o,s);if(u!==null){if(u<0){s.push({code:"invalid-symbol-length",message:`Negative symbol ${n} ${c} is invalid and falls back to auto.`});continue}return u}}if(a!==void 0)return a;if(o.legacyNumericGeometry){let c=Number(t.state[n]);if(Number.isFinite(c)&&c>=0)return c}return s.push({code:"unresolved-symbol-viewport",message:`Symbol ${n} is auto and needs a containing viewport basis.`}),null}function Sx(t,e,n,r,i){if(t===void 0)return;let o=t.trim();if(e==="refX"){if(o==="left")return 0;if(o==="center")return(n?.width??0)/2;if(o==="right")return n?.width??0}else{if(o==="top")return 0;if(o==="center")return(n?.height??0)/2;if(o==="bottom")return n?.height??0}return qs(t,{axis:e,percentBasis:e==="refX"?n?.width:n?.height},r,i)??void 0}function fo(t,e,n,r={}){let i=[],o=CN(t),s=hx(t,o.x,"x",n,r,i),a=hx(t,o.y,"y",n,r,i),l=_e(s,a),c=pi(e,"transform"),u=c?Ot(c):Ae;if((e.defKind??"symbol")==="group")return{kind:"group",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:ce(l,u),childPercentBasis:n??null,viewport:null,diagnostics:i};let d=yx(t,e,"width",o.width,n,r,i),p=yx(t,e,"height",o.height,n,r,i),f=pi(e,"x"),g=pi(e,"y"),m=f!==void 0?qs(f,{axis:"x",percentBasis:n?.width},r,i)??0:0,h=g!==void 0?qs(g,{axis:"y",percentBasis:n?.height},r,i)??0:0,b=$N(e.viewBox,i),S=ri({width:d,height:p,...b?{viewBoxX:b.x,viewBoxY:b.y,viewBoxWidth:b.width,viewBoxHeight:b.height}:{},preserveAspectRatio:pi(e,"preserveAspectRatio")},n);for(let k of S.diagnostics)i.push({code:k.code==="unresolved-viewport-size"?"unresolved-symbol-viewport":"invalid-symbol-viewbox",message:k.message.replace("Nested SVG","Symbol")});if(d===null||p===null||!S.renders||!S.contentMatrix)return{kind:"symbol",renders:!1,useX:s,useY:a,useAttributes:o,contentMatrix:ce(l,u),childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i};let v=Sx(pi(e,"refX"),"refX",S.childPercentBasis,r,i),I=Sx(pi(e,"refY"),"refY",S.childPercentBasis,r,i),x=Fe(S.contentMatrix,{x:v??0,y:I??0}),P=_e(m-(v===void 0?0:x.x),h-(I===void 0?0:x.y)),T=ce(ce(ce(l,u),P),S.contentMatrix);return{kind:"symbol",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:T,childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i}}function Km(){return{bounds:null,status:"empty",diagnostics:[]}}function go(t,e,n){return n.resolveOwnTransform?.(t,e)??e}function yn(t,e){return{bounds:null,status:t,diagnostics:[e]}}function Sd(t,e){return t?e?{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}:t:e}function hn(t,e,n="empty"){return t?{bounds:t,status:"resolved",diagnostics:e}:e.some(r=>r.code==="container-cycle"||r.code==="reference-cycle"||r.code==="symbol-cycle")?{bounds:null,status:"cycle",diagnostics:e}:e.some(r=>r.code==="unsupported-shape"||r.code==="deferred-tree-kind")?{bounds:null,status:"unsupported",diagnostics:e}:e.some(r=>r.code==="unresolved-shape"||r.code==="unresolved-reference-target"||r.code==="unresolved-reference-pivot"||r.code==="duplicate-shape-id"||r.code==="unresolved-svg-viewport"||r.code==="unresolved-symbol-definition"||r.code==="duplicate-library-id"||r.code==="unresolved-symbol-viewport"||r.code==="unresolved-symbol-pivot")?{bounds:null,status:"unresolved",diagnostics:e}:{bounds:null,status:n,diagnostics:e}}function Hm(t){if(t.length===0)return null;let e=t[0].x,n=t[0].y,r=t[0].x,i=t[0].y;for(let o=1;o<t.length;o++){let s=t[o];e=Math.min(e,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y)}return{minX:e,minY:n,maxX:r,maxY:i}}function Xm(t,e){return Hm([Fe(e,{x:t.minX,y:t.minY}),Fe(e,{x:t.maxX,y:t.minY}),Fe(e,{x:t.maxX,y:t.maxY}),Fe(e,{x:t.minX,y:t.maxY})])}function bx(t,e,n,r,i){return n<0||r<0?null:Xm({minX:t,minY:e,maxX:t+n,maxY:e+r},i)}function vx(t,e,n,r,i){if(n<0||r<0)return null;let o=Fe(i,{x:t,y:e}),s=Math.hypot(i[0]*n,i[2]*r),a=Math.hypot(i[1]*n,i[3]*r);return{minX:o.x-s,minY:o.y-a,maxX:o.x+s,maxY:o.y+a}}function EN(t,e){let n=Array.isArray(t)?t:[t],r=null;for(let i of n)r=Sd(r,Xm(i,e));return r}function jm(t,e,n){return yn("unsupported",{code:e,shapeId:t.id,message:`Object bounds for ${n} require a document resolver policy.`,path:[t.id]})}function hd(t,e,n={}){let r=jt(t);if(!r)return yn("unsupported",{code:"unsupported-shape",shapeId:t.id,message:`No geometry kernel is registered for shape type ${t.type}.`,path:[t.id]});let i;switch(r.kind){case"circle":i=vx(r.cx,r.cy,r.r,r.r,e);break;case"ellipse":i=vx(r.cx,r.cy,r.rx,r.ry,e);break;case"rectangle":if(r.width<0||r.height<0)i=null;else if(r.pathData)i=en(r.pathData,e);else if(r.rx>0&&r.ry>0){let o=Bf(r.x,r.y,r.width,r.height,r.rx,r.ry);i=o?en(o,e):null}else i=bx(r.x,r.y,r.width,r.height,e);break;case"line":if(r.boundsPolicy==="linked-line")return jm(t,"deferred-tree-kind","linked line");i=Hm([Fe(e,{x:r.x1,y:r.y1}),Fe(e,{x:r.x2,y:r.y2})]);break;case"text":{let o=n.measureText?.(t,r)??null;if(!o)return jm(t,"deferred-tree-kind","text");i=EN(o,e);break}case"path":{let o=r.placement?ce(e,_e(r.placement.x,r.placement.y)):e;i=en(r.d,o);break}case"polyline":{let o=r.points.length>0?r.points:[{x:0,y:0}];i=Hm(o.map(s=>Fe(e,s)));break}case"positioning-rect":i=bx(r.x,r.y,r.width,r.height,e);break;case"view":return Km();case"container":case"embedded-svg":case"shape-reference":case"symbol-instance":return jm(t,"deferred-tree-kind",r.kind)}return i?{bounds:i,status:"resolved",diagnostics:[]}:{bounds:null,status:"empty",diagnostics:[]}}function Wm(t){let e=t.state.children;return Array.isArray(e)?e.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"):[]}function kr(t){let e=Xs(t.shapes),n=uo(t.library),r=t.sceneTree??[];if(r.length===0)return{roots:()=>t.shapes,shape:c=>e.uniqueById.get(c),duplicateShapeIds:()=>e.duplicateIds,libraryDefinition:c=>n.definition(c),duplicateLibraryIds:()=>n.duplicateIds,schemaVersion:()=>t.schemaVersion,children:Wm};let i=new Map,o=new Set;for(let c of r){let u=i.get(c.parentId)??[];i.set(c.parentId,[...u,c]),e.uniqueById.has(c.id)&&o.add(c.id)}let s=c=>{let u=[],d=new Set,p=f=>{for(let g of tt([...i.get(f)??[]])){let m=e.uniqueById.get(g.id);if(m){u.push(m);continue}d.has(g.id)||(d.add(g.id),p(g.id),d.delete(g.id))}};return p(c),u};return{roots:()=>[...s(null),...t.shapes.filter(c=>!o.has(c.id))],shape:c=>e.uniqueById.get(c),duplicateShapeIds:()=>e.duplicateIds,libraryDefinition:c=>n.definition(c),duplicateLibraryIds:()=>n.duplicateIds,schemaVersion:()=>t.schemaVersion,children:c=>[...s(c.id),...Wm(c).filter(u=>!o.has(u.id))]}}function xx(t,e){return`${e.identityPrefixes.at(-1)??"document"}\0${t.id}`}var AN=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"]),Um=new Set(["block","inline","run-in"]),NN=new Set(["flow","flow-root","table","flex","grid","ruby"]);function MN(t){let e=t.trim().toLowerCase();if(AN.has(e)||/^(?:var|env)\(/.test(e)&&e.endsWith(")"))return!0;let n=e.split(/\s+/);if(n.length<2||n.length>3||new Set(n).size!==n.length)return!1;if(n.includes("list-item")){let r=n.filter(i=>i!=="list-item");return r.filter(i=>Um.has(i)).length<=1&&r.filter(i=>i==="flow"||i==="flow-root").length<=1&&r.every(i=>Um.has(i)||i==="flow"||i==="flow-root")}return n.length===2&&n.some(r=>Um.has(r))&&n.some(r=>NN.has(r))}function ON(t){if(!t)return null;let e=null;for(let n of Yr(t,";")){let r=Yr(n,":");if(r.length<2||r[0].trim().toLowerCase()!=="display")continue;let i=r.slice(1).join(":").trim(),o=/\s*!important\s*$/i.test(i),s=i.replace(/\s*!important\s*$/i,"").trim().toLowerCase();MN(s)&&(!e||o||!e.important)&&(e={value:s,important:o})}return e}function Ix(t,e){let n=ON(typeof e=="string"?e:void 0);return n?n.value!=="none":typeof t!="string"||t.trim().toLowerCase()!=="none"}function Js(t,e){if(t.state.visible===!1)return!1;let n=t.type==="symbol-instance"?t.state.instancePresentation:void 0,r=n?.display??t.state.display;return Ix(r,n?.style)?e.participatesInRendering?.(t)??!0:!1}function DN(t,e,n){let r=t.rootAttributes;return Ix(r?.display,r?.style)?n.participatesSymbolDefinition?.(t,e)??!0:!1}function zN(t,e={}){return{x:t.x,y:t.y,width:e.width!==void 0?e.width:t.width,height:e.height!==void 0?e.height:t.height,viewBoxX:t.viewBoxX,viewBoxY:t.viewBoxY,viewBoxWidth:t.viewBoxWidth,viewBoxHeight:t.viewBoxHeight,preserveAspectRatio:t.preserveAspectRatio}}function Rr(t,e,n={}){let r=jt(t);if(!r||r.kind!=="embedded-svg")return{matrix:Ae,attribute:null,pivotRequired:!1,pivotResolved:!1,viewport:ri({})};let i=ri(zN(r,n),e),o=Ct(t.state),s=i.frame?{x:i.frame.x+i.frame.width/2,y:i.frame.y+i.frame.height/2}:void 0;return{matrix:Jt(t.state,s),attribute:pt(t.state,s),pivotRequired:o,pivotResolved:!o||s!==void 0,viewport:i}}function wx(t,e,n){return e.diagnostics.map(r=>({code:r.code==="unresolved-viewport-size"?"unresolved-svg-viewport":"invalid-svg-viewport",shapeId:t.id,message:r.message,path:[...n,t.id]}))}function yd(t,e,n,r){let i=null,o=[],s=n.forceInlineChildren>0?Wm(t):n.view.children(t);for(let a of s){if(!Js(a,n.host))continue;let l=Qs(a,e,n,r);i=Sd(i,l.bounds),o.push(...l.diagnostics)}return hn(i,o)}function kx(t,e){return{...t,diagnostics:t.diagnostics.map(n=>n.path.includes(e)?n:{...n,path:[e,...n.path]})}}function _N(t,e,n,r,i={}){let o=Rr(t,r,i),s=wx(t,o.viewport,n.path);if(o.pivotRequired&&!o.pivotResolved)return s.push({code:"unresolved-svg-viewport",shapeId:t.id,message:`Embedded SVG ${t.id} has legacy rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`,path:[...n.path,t.id]}),hn(null,s,"unresolved");if(!o.viewport.renders)return hn(null,s,o.viewport.status==="zero-disabled"?"empty":"unresolved");let a=xx(t,n);n.active.add(a),n.path.push(t.id);let c=t.state.isRootSvg===!0?e:ce(ce(e,go(t,o.matrix,n.host)),o.viewport.contentMatrix??Ae),u=yd(t,c,n,o.viewport.childPercentBasis??r);return n.path.pop(),n.active.delete(a),hn(u.bounds,[...s,...u.diagnostics],u.status)}function Rx(t,e,n={},r={}){let i=typeof e=="string"?t.shape(e):e;if(!i){let u=typeof e=="string"?e:e.id;return yn("unresolved",{code:"unresolved-shape",shapeId:u,message:`Shape ${u} is not present in the document bounds view.`,path:[u]})}let o=jt(i);if(!o||o.kind!=="embedded-svg")return yn("unsupported",{code:"unsupported-shape",shapeId:i.id,message:`Shape ${i.id} is not an embedded SVG viewport.`,path:[i.id]});let s=Rr(i,n.parentViewport),a=wx(i,s.viewport,[]);if(!s.viewport.frame||s.pivotRequired&&!s.pivotResolved)return hn(null,a,"unresolved");let l=ce(n.toTarget??Ae,go(i,s.matrix,r)),c=s.viewport.frame;return{bounds:Xm({minX:c.x,minY:c.y,maxX:c.x+c.width,maxY:c.y+c.height},l),status:"resolved",diagnostics:a}}function Tx(t,e,n){let r=n.view.duplicateShapeIds?.().has(e)??!1;return yn("unresolved",{code:r?"duplicate-shape-id":"unresolved-reference-target",shapeId:t.id,message:r?`Shape reference ${t.id} targets ambiguous duplicate id ${e}.`:e?`Shape reference ${t.id} targets ${e}, which is not present in the document.`:`Shape reference ${t.id} has no targetShapeId.`,path:e?[...n.path,e]:[...n.path]})}function FN(t,e){let n=[...e.path,t.id];return yn("cycle",{code:"reference-cycle",shapeId:t.id,message:`Shape reference cycle detected: ${n.join(" -> ")}.`,path:n})}function Px(t,e,n,r,i){if(!Ct(t.state))return{matrix:Jt(t.state),attribute:pt(t.state),pivotRequired:!1,pivotResolved:!0,diagnostics:[],contentBounds:null};let s=_e(e.offsetX,e.offsetY),a={width:e.width,height:e.height},l=kx(Qs(n,s,r,i,a),t.id),c=l.diagnostics.some(d=>d.code==="unsupported-shape"||d.code==="deferred-tree-kind"||d.code==="unresolved-reference-pivot"),u=l.bounds&&!c?{x:(l.bounds.minX+l.bounds.maxX)/2,y:(l.bounds.minY+l.bounds.maxY)/2}:null;if(!u){let d=l.bounds===null&&(l.status==="empty"||l.status==="cycle"||l.status==="unresolved"),p={code:"unresolved-reference-pivot",shapeId:t.id,message:`Shape reference ${t.id} has legacy rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`,path:[...r.path]};return{matrix:Jt(t.state),attribute:pt(t.state),pivotRequired:!0,pivotResolved:d,diagnostics:d?l.diagnostics:[...l.diagnostics,p],contentBounds:l}}return{matrix:Jt(t.state,u),attribute:pt(t.state,u),pivotRequired:!0,pivotResolved:!0,diagnostics:[],contentBounds:l}}function LN(t,e,n,r,i){if(r.activeReferences.has(t.id))return FN(t,r);r.activeReferences.add(t.id),r.path.push(t.id);let o=d=>(r.path.pop(),r.activeReferences.delete(t.id),d),s=e.targetShapeId?.trim()??"",a=s?r.view.shape(s):void 0;if(!a)return o(Tx(t,s,r));if(!Js(a,r.host))return o(Km());let l=Px(t,e,a,r,i);if(l.pivotRequired&&!l.pivotResolved)return o(hn(null,[...l.diagnostics],"unresolved"));if(l.contentBounds?.bounds===null&&l.pivotResolved)return o(l.contentBounds);let c=ce(ce(n,go(t,l.matrix,r.host)),_e(e.offsetX,e.offsetY)),u=kx(Qs(a,c,r,i,{width:e.width,height:e.height}),t.id);return o({...u,diagnostics:[...l.diagnostics,...u.diagnostics]})}function mo(t,e){let n=t.state.instancePresentation?.transform,r=typeof n=="string"&&n.trim()?n.trim():null,i=Jt(t.state,e),o=pt(t.state,e);return r?{matrix:ce(Ot(r),i),attribute:o?`${r} ${o}`:r}:{matrix:i,attribute:o}}function Zs(t,e,n,r){return{code:n,shapeId:t.id,message:r,path:[...e.path,t.id]}}function Cx(t,e,n,r,i,o=!1){let s=ei(e,t),a=fo(t,e,i,{resolveLength:r.host.resolveSymbolLength,legacyNumericGeometry:(r.view.schemaVersion?.()??8)<8}),l=[...s.diagnostics.map(m=>Zs(t,r,m.code,m.message)),...a.diagnostics.map(m=>Zs(t,r,m.code==="invalid-symbol-length"||m.code==="invalid-symbol-viewbox"?"invalid-symbol-viewport":"unresolved-symbol-viewport",m.message))];if(!a.renders){let m=a.viewport?.status==="zero-disabled";return{...hn(null,l,m?"empty":"unresolved"),transform:{...mo(t),pivotRequired:Ct(t.state),pivotResolved:!0,diagnostics:l}}}if(!DN(e,t,r.host))return{...Km(),transform:{...mo(t),pivotRequired:Ct(t.state),pivotResolved:!0,diagnostics:l}};if(r.activeSymbols.has(s.materializationKey)){let m=Zs(t,r,"symbol-cycle",`Symbol instance cycle detected through ${e.id}.`);return{...yn("cycle",m),transform:{...mo(t),pivotRequired:Ct(t.state),pivotResolved:!0,diagnostics:[m]}}}r.activeSymbols.add(s.materializationKey),r.identityPrefixes.push(s.materializationKey),r.forceInlineChildren++,r.path.push(t.id);let c=m=>{let h=null,b=[];for(let S of s.shapes){if(!Js(S,r.host))continue;let v=Qs(S,m,r,a.childPercentBasis??i);h=Sd(h,v.bounds),b.push(...v.diagnostics)}return hn(h,b)},u=Ct(t.state),d=mo(t),p=!u,f=[];if(u){let m=c(a.contentMatrix),h=m.diagnostics.some(S=>S.code==="unsupported-shape"||S.code==="deferred-tree-kind"||S.code==="unresolved-symbol-viewport"),b=m.bounds&&!h?{x:(m.bounds.minX+m.bounds.maxX)/2,y:(m.bounds.minY+m.bounds.maxY)/2}:void 0;if(b)d=mo(t,b),p=!0;else{let S=m.bounds===null&&(m.status==="empty"||m.status==="cycle"||m.status==="unresolved");p=S,S||(f=[Zs(t,r,"unresolved-symbol-pivot",`Symbol instance ${t.id} needs unavailable contextual geometry or measurement for its legacy transform pivot.`)]),S&&!o&&(f=[...m.diagnostics])}}let g;if(u&&!p)g=hn(null,[...l,...f],"unresolved");else{let m=ce(ce(n,go(t,d.matrix,r.host)),a.contentMatrix),h=c(m);g=hn(h.bounds,[...l,...f,...h.diagnostics],h.status)}return r.path.pop(),r.forceInlineChildren--,r.identityPrefixes.pop(),r.activeSymbols.delete(s.materializationKey),{...g,transform:{...d,pivotRequired:u,pivotResolved:p,diagnostics:[...l,...f]}}}function BN(t,e,n,r){let i=String(t.state.symbolId??"").trim(),o=i?n.view.duplicateLibraryIds?.().has(i)??!1:!1,s=i?n.view.libraryDefinition?.(i):void 0;if(o||!s||s.kind!=="symbol")return yn("unresolved",Zs(t,n,o?"duplicate-library-id":"unresolved-symbol-definition",o?`Symbol instance ${t.id} targets duplicate library id ${i}.`:`Symbol instance ${t.id} targets missing symbol definition ${i||"(blank)"}.`));let a=Cx(t,s,e,n,r),{transform:l,...c}=a;return c}function Qs(t,e,n,r,i={}){let o=xx(t,n);if(n.active.has(o)){if(!n.collectDiagnostics)return{bounds:null,status:"cycle",diagnostics:[]};let c=[...n.path,t.id];return yn("cycle",{code:"container-cycle",shapeId:t.id,message:`Container cycle detected: ${c.join(" -> ")}.`,path:c})}let s=jt(t);if(!s)return hd(t,e,n.host);if(s.kind==="shape-reference")return LN(t,s,e,n,r);if(s.kind==="embedded-svg")return _N(t,e,n,r,i);if(s.kind==="symbol-instance")return BN(t,e,n,r);if(s.kind!=="container"){let c=Jt(t.state,s.defaultPivot??void 0);return hd(t,ce(e,go(t,c,n.host)),n.host)}n.active.add(o),n.path.push(t.id);let a=po(t.state).matrix;if(Ct(t.state)){let c=n.collectDiagnostics;n.collectDiagnostics=!1;let u=yd(t,Ae,n,r);n.collectDiagnostics=c;let d=u.diagnostics.some(p=>p.code==="unsupported-shape"||p.code==="deferred-tree-kind");a=Ys(t.state,d?null:u.bounds).matrix}let l=yd(t,ce(e,go(t,a,n.host)),n,r);return n.path.pop(),n.active.delete(o),l}function ho(t,e,n={},r={}){let i=typeof e=="string"?t.shape(e):e;if(!i){let o=typeof e=="string"?e:e.id;return yn("unresolved",{code:"unresolved-shape",shapeId:o,message:`Shape ${o} is not present in the document bounds view.`,path:[o]})}return Qs(i,n.toTarget??Ae,{view:t,host:r,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},n.parentViewport)}function bd(t,e,n={},r={}){let i=typeof e=="string"?t.shape(e):e;if(!i){let s=typeof e=="string"?e:e.id;return yn("unresolved",{code:"unresolved-shape",shapeId:s,message:`Shape ${s} is not present in the document bounds view.`,path:[s]})}let o={...r,resolveOwnTransform:(s,a)=>s===i?Ae:r.resolveOwnTransform?.(s,a)??a};return ho(t,i,{parentViewport:n.parentViewport},o)}function vd(t,e,n={},r){let i=jt(e);if(!i||i.kind!=="shape-reference")return{matrix:Ae,attribute:null,pivotRequired:!1,pivotResolved:!1,diagnostics:[]};let o={view:t,host:n,active:new Set,activeReferences:new Set([e.id]),activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[e.id],collectDiagnostics:!0},s=i.targetShapeId?.trim()??"",a=s?t.shape(s):void 0;if(!a||!Js(a,n)){let c=Ct(e.state);return{matrix:Jt(e.state),attribute:pt(e.state),pivotRequired:c,pivotResolved:!0,diagnostics:a?[]:Tx(e,s,o).diagnostics}}let l=Px(e,i,a,o,r);return{matrix:l.matrix,attribute:l.attribute,pivotRequired:l.pivotRequired,pivotResolved:l.pivotResolved,diagnostics:l.diagnostics}}function xd(t,e,n={},r){let i=Ct(e.state),o=String(e.state.symbolId??"").trim(),s=o?t.duplicateLibraryIds?.().has(o)??!1:!1,a=o?t.libraryDefinition?.(o):void 0;return s||!a||a.kind!=="symbol"?{...mo(e),pivotRequired:i,pivotResolved:!0,diagnostics:[]}:Cx(e,a,Ae,{view:t,host:n,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},r,!0).transform}function $x(t,e={},n={}){let r=null,i=[];for(let o of t.roots()){if(!Js(o,n))continue;let s=ho(t,o,e,n);r=Sd(r,s.bounds),i.push(...s.diagnostics)}return hn(r,i)}function Id(t,e={}){if(!Ct(t.state))return{transform:po(t.state),contentBounds:null,pivotRequired:!1,pivotResolved:!0};let i={view:kr({shapes:[t],viewboxes:[]}),host:e,active:new Set([`document\0${t.id}`]),activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[t.id],collectDiagnostics:!0},o=yd(t,Ae,i),a=o.diagnostics.some(l=>l.code==="unsupported-shape"||l.code==="deferred-tree-kind")?null:o.bounds;return{transform:Ys(t.state,a),contentBounds:o,pivotRequired:!0,pivotResolved:a!==null||o.status==="empty"}}var GN=new Set(["class","height","href","id","preserveaspectratio","style","transform","viewbox","width","x","xlink:href","y"]),VN=new Set(["color","color-interpolation","display","fill","fill-opacity","fill-rule","filter","marker","marker-end","marker-mid","marker-start","mask","opacity","paint-order","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","vector-effect","visibility"]);function wd(t){if(t===null)return;let e=t.trim();if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:px)?$/u.test(e))return;let n=Number(e.replace(/px$/iu,""));return Number.isFinite(n)?n:void 0}function Ym(t){if(t===null)return;let e=t.trim(),n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/u.exec(e),r=n?Number(n[1])/100:wd(e);return r===void 0?void 0:Math.min(1,Math.max(0,r))}function jN(t,e){let n=Math.max(t.length,e.length);for(let r=0;r<n;r++){let i=(t[r]??-1)-(e[r]??-1);if(i!==0)return i}return 0}function kd(t,e){return e.replace(/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,(n,r,i)=>{let o=t.identifiers.liveIdForSourceId(i);return o?`url(${r}#${o}${r})`:n})}function UN(t,e,n){let r=t.metadata.candidate(e.correspondingSourceNodeId)?.metadata;if(!r||Object.keys(r).length===0)return;let i=structuredClone(r);if(typeof i.name=="string"&&e.usePath.length>0){let o=(n.get(i.name)??0)+1;n.set(i.name,o),i.name=`${i.name}-use-${o}`}return i}function HN(t,e){let n=t.scripts.forParent(e).map(r=>({...r.script,customAttrs:r.script.customAttrs?{...r.script.customAttrs}:void 0}));return n.length>0?n:void 0}function WN(t,e){let n={};for(let r of t.authoredAttributes.forElement(e)){let i=r.name.toLowerCase();r.classification==="namespace"||GN.has(i)||r.classification==="geometry"||r.classification==="metadata"||r.classification==="element-specific"||(n[r.name]=kd(t,r.value))}return n}function KN(t,e){let n=l=>t.styles.value(e,l),r={},i=n("fill"),o=n("stroke");i!==null&&(r.fillColor=kd(t,i),i.trim().toLowerCase()==="none"&&(r.fillType="none")),o!==null&&(r.borderColor=kd(t,o),o.trim().toLowerCase()==="none"&&(r.strokeType="none"));let s=[["fillOpacity","fill-opacity",Ym],["strokeOpacity","stroke-opacity",Ym],["opacity","opacity",Ym],["borderWidth","stroke-width",wd],["strokeMiterlimit","stroke-miterlimit",wd],["dashOffset","stroke-dashoffset",wd],["fillRule","fill-rule",l=>l??void 0],["strokeLinecap","stroke-linecap",l=>l??void 0],["strokeLinejoin","stroke-linejoin",l=>l??void 0],["strokeDasharray","stroke-dasharray",l=>l??void 0],["paintOrder","paint-order",l=>l??void 0],["vectorEffect","vector-effect",l=>l??void 0],["blendMode","mix-blend-mode",l=>l??void 0]];for(let[l,c,u]of s){let d=u(n(c));d!==void 0&&(r[l]=d)}n("display")?.trim().toLowerCase()==="none"&&(r.display="none");let a=n("visibility")?.trim();return(a==="hidden"||a==="collapse")&&(r.visibility=a),r}function XN(t,e){let n={},r=t.styles.style(e);if(!r)return n;for(let[i,o]of Object.entries(r.cascadedValues))VN.has(i)&&(n[i]=kd(t,o.value));return n}function YN(t,e){let n=t.symbolUses.use(e.occurrenceId);if(e.role==="use-carrier"&&n){let s=n.transform.matrix??[1,0,0,1,0,0],a=ce(s,_e(n.geometry.x,n.geometry.y));return Bt(a)?void 0:it(a)}let r=t.sourceDocument.index.element(e.correspondingSourceNodeId);if(!r)return;let i=t.styles.style(e.occurrenceId)?.cascadedValues.transform?.value??E(r,"transform");if(!i||i.trim().toLowerCase()==="none")return;let o=Gt(i);return o&&!Bt(o)?it(o):void 0}function Ex(t,e,n){let r=KN(t,e.occurrenceId),i=UN(t,e,n),o=HN(t,e.correspondingSourceNodeId),s=WN(t,e.correspondingSourceNodeId),a=t.conditionalProcessing.condition(e.correspondingSourceNodeId),l=YN(t,e);return i&&(r.metadata=i),o&&(r.scripts=o),Object.keys(s).length>0&&(r.authoredAttributes=s),a&&a.systemLanguage!==null&&(r.systemLanguage=a.systemLanguage),a&&a.requiredExtensions!==null&&(r.requiredExtensions=a.requiredExtensions),l&&(r.transformMatrix=l),r}function qN(t,e,n,r){let i=Ex(t,e,r),o=XN(t,e.occurrenceId);Object.keys(o).length>0&&(i.containerPresentation=o);let s=t.sourceDocument.index.element(e.correspondingSourceNodeId);if(!s)return i;if(n==="hyperlink"){let a=E(s,"href"),l=s.attributes.find(c=>c.name==="xlink:href")?.value;a!==null?i.href=a:l!==void 0&&(i.hrefXlink=l);for(let[c,u]of[["target","linkTarget"],["download","linkDownload"],["ping","linkPing"],["rel","linkRel"],["hreflang","linkHreflang"],["type","linkType"],["referrerpolicy","linkReferrerPolicy"]]){let d=E(s,c);d!==null&&(i[u]=d)}}else if(n==="switch"){let a=t.conditionalProcessing.condition(s.sourceNodeId);a&&(i.switchSystemLanguage=a.systemLanguage,i.switchRequiredExtensions=a.requiredExtensions)}else if(n==="embedded-svg"){let a=t.embeddedFrames.find(l=>l.sourceNodeId===s.sourceNodeId);a&&Object.assign(i,a.state)}return i}function ZN(t){return t==="embedded-svg"?"svg":t}function JN(t){let e=t.styles.stylesheets.map((n,r)=>({id:`svg-style-${r+1}`,...n.id?{svgId:n.id}:{},css:n.authoredText,...n.type?{type:n.type}:{},...n.media?{media:n.media}:{},preserved:!0}));return e.length>0?e:void 0}function QN(t){return{severity:"error",code:"application-rolled-back",source:"svg",entrypoint:"svg-document-import",capability:"geometry",message:t}}function qm(t){let e=new Map(t.useOccurrences.occurrences.map(w=>[w.occurrenceId,w])),n=new Map(t.hierarchy.containers.map(w=>[w.occurrenceId,w])),r=new Map(t.leafGeometry.candidates.filter(w=>w.status==="materialized").map(w=>[w.occurrenceId,w])),i=[...new Set([...t.hierarchy.containers.map(w=>w.occurrenceId),...t.hierarchy.placements.map(w=>w.occurrenceId)])].map(w=>e.get(w)).filter(w=>w!==void 0).sort((w,$)=>jN(w.orderKey,$.orderKey)||w.productIndex-$.productIndex||w.occurrenceId.localeCompare($.occurrenceId)),o=new Map;i.forEach((w,$)=>{o.set(w.occurrenceId,`svg-node-${$+1}`)});let s=new Map,a=[];for(let w of i){let $=o.get(w.occurrenceId),R=n.get(w.occurrenceId);if(R){a.push({id:$,type:ZN(R.kind),state:qN(t,w,R.kind,s)});continue}let C=r.get(w.occurrenceId);C?.canonicalType&&a.push({id:$,type:C.canonicalType,state:{...structuredClone(C.state),...Ex(t,w,s)}})}for(let[w,$]of t.views.entries())a.push({id:`svg-view-${w+1}`,type:"view",state:{...$.state}});let l=new Map,c=[];for(let w of i){let $=o.get(w.occurrenceId);if(!$||!a.some(O=>O.id===$))continue;let R=n.get(w.occurrenceId),C=t.hierarchy.placements.find(O=>O.occurrenceId===w.occurrenceId),A=R?.parentContainerOccurrenceId??C?.parentContainerOccurrenceId??null,D=A?o.get(A)??null:null,_=l.get(D)??0;l.set(D,_+1),c.push({id:$,parentId:D,index:_})}for(let w of a.filter($=>$.type==="view")){let $=l.get(null)??0;l.set(null,$+1),c.push({id:w.id,parentId:null,index:$})}let u=t.rootFrame,d=u.viewBoxWidth??u.width??300,p=u.viewBoxHeight??u.height??150,f=co({shapes:a,viewboxes:[ui(u.viewBoxX??0,u.viewBoxY??0,Math.max(d,1),Math.max(p,1),"svg-viewbox-1")],metadata:t.metadata.document.metadata});f.sceneTree=c;let g=kr(f),m=new Map,h=new Map;for(let w of i){let $=o.get(w.occurrenceId),R=$?a.find(C=>C.id===$):void 0;R&&(m.set(w.occurrenceId,R),h.has(w.correspondingSourceNodeId)||h.set(w.correspondingSourceNodeId,R.id))}let b=w=>{let $=[];for(let[R,C]of m){let A=e.get(R)?.parentOccurrenceId??null;for(;A;){if(A===w){$.push(C);break}A=e.get(A)?.parentOccurrenceId??null}}return $},S=w=>{let $=e.get(w)?.parentOccurrenceId??null;for(;$;){let R=m.get($);if(R?.type==="svg"){let C=R.state,A=C.svgViewBoxWidth,D=C.svgViewBoxHeight;if(typeof A=="number"&&typeof D=="number"&&A>0&&D>0)return{x:typeof C.svgViewBoxX=="number"?C.svgViewBoxX:0,y:typeof C.svgViewBoxY=="number"?C.svgViewBoxY:0,width:A,height:D};if(typeof C.svgWidth=="number"&&typeof C.svgHeight=="number"&&C.svgWidth>=0&&C.svgHeight>=0)return{x:0,y:0,width:C.svgWidth,height:C.svgHeight}}$=e.get($)?.parentOccurrenceId??null}return{x:u.viewBoxX??0,y:u.viewBoxY??0,width:u.viewBoxWidth??u.width??300,height:u.viewBoxHeight??u.height??150}},v=w=>({shapeId:w.id,shapeType:w.type,state:w.state}),I=Wl(t,{shapeIdForOccurrence:w=>m.get(w)?.id??null,shapeStateForOccurrence:w=>m.get(w)?.state??null,shapeIdForSourceNode:w=>h.get(w)??null,shapeBindingsForOccurrence:w=>{let $=m.get(w);return $?[v($)]:[]},descendantShapeBindingsForOccurrence:w=>b(w).map(v),cssTransformContextForOccurrence:(w,$)=>{let R=m.get(w),C=($==="fill-box"||$==="content-box")&&R?bd(g,R).bounds:null,A=S(w);return{viewportWidth:A.width,viewportHeight:A.height,...$==="view-box"?{boxX:A.x,boxY:A.y,boxWidth:A.width,boxHeight:A.height}:{},...C?{boxX:C.minX,boxY:C.minY,boxWidth:C.maxX-C.minX,boxHeight:C.maxY-C.minY}:{}}}});I&&(f.animationTimeline=I);let x=JN(t);x&&(f.documentStyles=x);let P=t.scripts.documentScripts.map(w=>({...w.script,customAttrs:w.script.customAttrs?{...w.script.customAttrs}:void 0}));P.length>0&&(f.documentScripts=P);let T=t.paintServerDefinitions.definitions();T.length>0&&(f.paintServerDefs=T.map(w=>structuredClone(w)));let k=wr(f);return k.errors.length>0?{value:null,diagnostics:k.errors.map(w=>QN(`${w.path}: ${w.message}`))}:{value:f,diagnostics:[]}}var ea=class extends Error{diagnostics;constructor(e){let n=e.filter(r=>r.severity==="error").map(r=>r.message).join("; ");super(`SVG import failed${n?`: ${n}`:"."}`),this.name="SvgImportError",this.diagnostics=e}};function Zm(t,e={}){let n=gd(t,e);if(!n.value)return{value:null,diagnostics:n.diagnostics};let r=qm(n.value);return{value:r.value,diagnostics:Object.freeze([...n.diagnostics,...r.diagnostics])}}function Rd(t,e={}){let n=Zm(t,e);if(!n.value||n.diagnostics.some(r=>r.severity==="error"))throw new ea(n.diagnostics);return n.value}var M=(t,e)=>({action:t,by:e}),Ye=t=>({action:"exempt",reason:t}),Ve=t=>t,$e="DocumentSerializer canonical snapshot restore",be="policy-driven SVG plan materializer",It="policy-driven clipboard plan materializer",ge="policy-driven fragment plan materializer",je="SceneGraph hierarchy and source-order projection",ta={schemaVersion:Ve({"native-document-open":M("derived","parseDocument migration and schema stamping"),"full-snapshot-restore":M("derived","snapshot migration and schema stamping"),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),shapes:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("append","fragment-scoped pattern materializer"),"vectorized-svg-fragment":M("append","path-only vectorized materializer")}),viewboxes:Ve({"native-document-open":M("derived",je),"full-snapshot-restore":M("derived",je),"svg-document-import":M("derived",je),"external-svg-paste":M("derived",je),"internal-clipboard-paste":M("derived",je),"plugin-svg-fragment":M("derived",je),"pattern-fragment":M("derived",je),"vectorized-svg-fragment":M("derived",je)}),guides:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),measurements:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),sceneTree:Ve({"native-document-open":M("derived",je),"full-snapshot-restore":M("derived",je),"svg-document-import":M("derived",je),"external-svg-paste":M("derived",je),"internal-clipboard-paste":M("derived",je),"plugin-svg-fragment":M("derived",je),"pattern-fragment":M("derived",je),"vectorized-svg-fragment":M("derived",je)}),groups:Ve({"native-document-open":Ye("Legacy group sidecar is migrated into SceneGraph structure before restoration."),"full-snapshot-restore":Ye("Legacy group sidecar is migrated into SceneGraph structure before restoration."),"svg-document-import":M("derived",je),"external-svg-paste":M("derived",je),"internal-clipboard-paste":M("derived",je),"plugin-svg-fragment":M("derived",je),"pattern-fragment":M("derived",je),"vectorized-svg-fragment":M("derived",je)}),clipMaskGroups:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":M("preserve-host","path-only vectorized materializer")}),documentMetadata:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("replace",be),"external-svg-paste":M("merge",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),documentScripts:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("replace",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),documentStyles:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("replace",be),"external-svg-paste":M("merge",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),templateVariables:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("replace",be),"external-svg-paste":M("merge",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),animationTimeline:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),library:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":M("preserve-host","path-only vectorized materializer")}),rawPaintServerDefs:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":M("preserve-host","path-only vectorized materializer")}),paintServerDefs:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("append",be),"external-svg-paste":M("append",be),"internal-clipboard-paste":M("append",It),"plugin-svg-fragment":M("append",ge),"pattern-fragment":M("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":M("preserve-host","path-only vectorized materializer")}),customPatterns:Ve({"native-document-open":M("derived","v1 to v2 pattern library migration"),"full-snapshot-restore":M("derived","v1 to v2 pattern library migration"),"svg-document-import":Ye("Deprecated compatibility field is never authored by SVG ingestion."),"external-svg-paste":Ye("Deprecated compatibility field is never authored by SVG ingestion."),"internal-clipboard-paste":Ye("Deprecated compatibility field is never authored by clipboard ingestion."),"plugin-svg-fragment":Ye("Deprecated compatibility field is never authored by plugin ingestion."),"pattern-fragment":Ye("Deprecated compatibility field is never authored by pattern fragments."),"vectorized-svg-fragment":Ye("Deprecated compatibility field is never authored by vectorized ingestion.")}),symbols:Ve({"native-document-open":M("derived","v1 symbol library compatibility migration"),"full-snapshot-restore":M("derived","v1 symbol library compatibility migration"),"svg-document-import":Ye("Deprecated compatibility field is represented through the unified library."),"external-svg-paste":Ye("Deprecated compatibility field is represented through the unified library."),"internal-clipboard-paste":Ye("Deprecated compatibility field is represented through the unified library."),"plugin-svg-fragment":Ye("Deprecated compatibility field is represented through the unified library."),"pattern-fragment":Ye("Deprecated compatibility field is represented through the unified library."),"vectorized-svg-fragment":Ye("Deprecated compatibility field is represented through the unified library.")}),markers:Ve({"native-document-open":M("derived","v1 marker library compatibility migration"),"full-snapshot-restore":M("derived","v1 marker library compatibility migration"),"svg-document-import":Ye("Deprecated compatibility field is represented through the unified library."),"external-svg-paste":Ye("Deprecated compatibility field is represented through the unified library."),"internal-clipboard-paste":Ye("Deprecated compatibility field is represented through the unified library."),"plugin-svg-fragment":Ye("Deprecated compatibility field is represented through the unified library."),"pattern-fragment":Ye("Deprecated compatibility field is represented through the unified library."),"vectorized-svg-fragment":Ye("Deprecated compatibility field is represented through the unified library.")}),colorGlyphLibrary:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),exportItems:Ve({"native-document-open":M("replace",$e),"full-snapshot-restore":M("replace",$e),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)}),unknownFields:Ve({"native-document-open":M("replace","forward-compatible quarantine restore"),"full-snapshot-restore":M("replace","forward-compatible quarantine restore"),"svg-document-import":M("preserve-host",be),"external-svg-paste":M("preserve-host",be),"internal-clipboard-paste":M("preserve-host",It),"plugin-svg-fragment":M("preserve-host",ge),"pattern-fragment":M("preserve-host",ge),"vectorized-svg-fragment":M("preserve-host",ge)})};function Ps(t,e){return ta[t][e]}function Jm(t=Hi,e=ta){let n=Object.keys(gt);if(n.length===0)throw new Error("Document field roster must not be empty.");if(t.length===0)throw new Error("Ingress intent roster must not be empty.");if(new Set(t).size!==t.length)throw new Error("Ingress intent roster contains duplicate entries.");let r=Object.keys(e);for(let i of n)if(!e[i])throw new Error(`Document field ${i} lacks an ingress matrix.`);for(let i of r)if(!Object.hasOwn(gt,i))throw new Error(`Unknown document field ${i} has an ingress matrix.`);for(let i of n){let o=e[i];for(let s of t){let a=o[s];if(!a)throw new Error(`Document field ${i} lacks intent ${s}.`);if((a.action==="exempt"?a.reason:a.by).trim().length<12)throw new Error(`Ingress policy ${s} lacks a substantive owner or reason.`)}for(let s of Object.keys(o))if(!t.includes(s))throw new Error(`Document field ${i} has unknown intent ${s}.`)}}var Ax=["renderToSvg","codegen","dxf","mermaid","pdf","editor-dom"],gt={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 authoring chrome (alignment guides); SVG document output has no representation for them by design."},codegen:{exempt:"Alignment guides are editor authoring chrome and do not belong in an embeddable generated component."},dxf:{exempt:"Alignment guides are editor authoring chrome rather than drawing geometry and do not become DXF entities."},mermaid:{exempt:"Alignment guides are editor authoring chrome rather than graph nodes or edges and do not enter Mermaid syntax."},pdf:{exempt:"Alignment guides are editor authoring chrome 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 chrome has no SVG document representation; the editor SVG export omits it by design."},codegen:{exempt:"Measurements are editor authoring chrome 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 chrome 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"}}},groups:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{exempt:"Retired legacy hierarchy sidecar. The serializer emits it EMPTY (see document-serializer.ts serializeSnapshot); parentage rides sceneTree plus the inline state.children projection. `groups:set` still exists inbound for pre-retirement writers."},rendered:{renderToSvg:{exempt:"Retired legacy hierarchy sidecar emitted empty by the serializer; renderToSvg consumes inline children instead."},codegen:{exempt:"Retired legacy hierarchy sidecar emitted empty by the serializer; component backends consume inline children instead."},dxf:{exempt:"Retired legacy hierarchy sidecar emitted empty by the serializer; DXF walks inline child containers instead."},mermaid:{exempt:"Retired legacy hierarchy sidecar emitted empty by the serializer; Mermaid uses the shape and connector records instead."},pdf:{exempt:"Retired legacy hierarchy sidecar is empty; PDF consumes the rendered SVG hierarchy produced from inline child containers."},"editor-dom":{exempt:"Retired legacy hierarchy sidecar is not live editor state; the SceneGraph owns and projects current structure."}}},clipMaskGroups:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["clipmasks:set","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"}}},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 injects SMIL children per target shape through smil-kernel"},codegen:{by:"buildRenderPlan attaches the same SMIL children to shape 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"}}},rawPaintServerDefs:{serialization:{kind:"verbatim"},precision:"opaque",required:!1,collab:{ops:["rawPaintServerDefs:set"]},rendered:{renderToSvg:{by:"renderer/paint-server-defs.ts lifts legacy fragments through typed-channel rules into defs"},codegen:{by:"buildRenderPlan paint-server channels carry reachable legacy fragments to every component backend"},dxf:{exempt:"Raw SVG paint-server markup has no DXF entity representation; the exporter operates on shape geometry rather than defs markup."},mermaid:{exempt:"Raw SVG paint-server markup has no Mermaid syntax representation; export operates on graph topology and labels."},pdf:{by:"The rendered SVG page carries reachable legacy paint-server fragments into the svg2pdf conversion boundary"},"editor-dom":{by:"ImportExportManager and paint-server definition ownership preserve and mount reachable raw fragments in 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"}}},customPatterns:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,deprecated:"Superseded by `library` pattern defs (v1 \u2192 v2 migration).",collab:{exempt:"Deprecated v1 field superseded by `library` pattern defs. Read-only inbound (see the v1->v2 migration that lifts it); the serializer never writes it, because emitting a tile through two channels with two owners is what let the Patterns panel and the fill dropdown disagree."},rendered:{renderToSvg:{exempt:"Deprecated v1 field lifted into library by migrateV1toV2 before renderToSvg runs; it is never a direct render source."},codegen:{exempt:"Deprecated v1 field lifted into library during codegen input migration; component backends never read it directly."},dxf:{exempt:"Deprecated v1 paint field is migrated into library before the editor builds live shapes; DXF never reads it directly."},mermaid:{exempt:"Deprecated v1 paint field is migrated into library before the editor builds live shapes; Mermaid never reads it directly."},pdf:{exempt:"Deprecated v1 paint data is migrated into library before the rendered SVG page reaches PDF conversion."},"editor-dom":{exempt:"Deprecated v1 paint field is migrated into LibraryRegistry before live DOM projection and has no separate editor owner."}}},symbols:{serialization:{kind:"id-sorted-array"},precision:"shape-trees",required:!1,deprecated:"Superseded by `library` symbol defs (v1 \u2192 v2 migration).",collab:{exempt:"Deprecated v1 field superseded by `library`. Read-only inbound; the serializer never writes it."},rendered:{renderToSvg:{by:"librarySymbols provides the v1 compatibility fallback when library has no symbol defs"},codegen:{by:"buildRenderPlan uses librarySymbols as the same v1 compatibility fallback for component backend symbol defs"},dxf:{exempt:"Deprecated symbol definitions are reusable SVG content with no DXF entity equivalent in the geometry exporter."},mermaid:{exempt:"Deprecated symbol definitions are reusable SVG content rather than Mermaid graph nodes or connectors."},pdf:{by:"Legacy symbol definitions are resolved into the rendered SVG page before that page crosses the svg2pdf conversion boundary"},"editor-dom":{by:"LibraryRegistry adopts legacy symbol definitions when no modern library symbol entry supersedes them"}}},markers:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,deprecated:"Superseded by `library` marker defs (v1 \u2192 v2 migration).",collab:{exempt:"Deprecated v1 field superseded by `library`. Read-only inbound; the serializer never writes it."},rendered:{renderToSvg:{by:"libraryMarkers provides the v1 compatibility fallback when library has no marker defs"},codegen:{by:"buildRenderPlan uses libraryMarkers as the same v1 compatibility fallback for component backend marker defs"},dxf:{exempt:"Deprecated SVG marker definitions are presentation attached to paths and have no DXF entity equivalent in this exporter."},mermaid:{exempt:"Deprecated SVG marker definitions are presentation rather than Mermaid node or connector records."},pdf:{by:"Legacy marker definitions are resolved into the rendered SVG page before that page crosses the svg2pdf conversion boundary"},"editor-dom":{by:"LibraryRegistry adopts legacy marker definitions when no modern library marker entry supersedes them"}}},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."}}}},Td=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","exportItems","viewboxes","guides","measurements","groups","sceneTree","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","paintServerDefs","rawPaintServerDefs","animationTimeline","unknownFields","shapes"],Nx=["id","type","state"];function Qm(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function yo(t){let e=t,n=e.unknownFields;if(!Qm(n))return delete e.unknownFields,t;for(let[r,i]of Object.entries(n))r!=="unknownFields"&&(r in e||(e[r]=i));return delete e.unknownFields,t}function So(t){let e=t,n=Qm(e.unknownFields)?e.unknownFields:void 0;for(let r of Object.keys(e)){if(r==="unknownFields"||r in gt)continue;let i=e[r];delete e[r],i!==void 0&&((n??={})[r]=i)}return n&&Object.keys(n).length>0?e.unknownFields=n:delete e.unknownFields,t}function Pd(t){let e=t,n,r=e.unknownFields;if(Qm(r))for(let[i,o]of Object.entries(r))i==="unknownFields"||i in gt||o===void 0||((n??={})[i]=o);for(let i of Object.keys(e)){if(i==="unknownFields"||i in gt)continue;let o=e[i];o!==void 0&&((n??={})[i]=o)}return n}var eM=[["splinePoints","pathPoints"],["splineClosed","pathClosed"],["splineCurveType","pathCurveType"],["splineTension","pathTension"],["splineArcParams","pathArcParams"],["splineControlBounds","pathControlBounds"]];function Cd(t){let e=!1;if(t.type==="spline"&&(t.type="path",e=!0),t.state&&typeof t.state=="object"){let n=t.state,r=n.extra&&typeof n.extra=="object"&&!Array.isArray(n.extra)?n.extra:null;for(let[i,o]of eM)Object.prototype.hasOwnProperty.call(n,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=n[i]),n[i]=void 0,e=!0),r&&Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=r[i]),delete r[i],e=!0);r&&Object.keys(r).length===0&&delete n.extra}return e}function Mx(t){let e=0;for(let n of t)Cd(n)&&e++;return e}function bo(t){return Nt(t,{onShape:e=>{Cd(e)}}),t}function Ox(t){return typeof t=="string"&&t.length>0?t:null}function tM(t){let e={};return t.transformOrigin&&(e.transformOrigin=t.transformOrigin),t.pluginId&&(e.pluginId=t.pluginId),t.pluginData&&(e.pluginData=t.pluginData),t.attributes&&Object.keys(t.attributes).length>0&&(e.attributes=t.attributes),t.fill&&(e.fill=t.fill),t.fillOpacity&&(e.fillOpacity=t.fillOpacity),t.strokeOpacity&&(e.strokeOpacity=t.strokeOpacity),t.opacity&&(e.opacity=t.opacity),t.filter&&(e.filter=t.filter),t.cssFilter&&(e.cssFilter=t.cssFilter),t.mixBlendMode&&(e.mixBlendMode=t.mixBlendMode),t.isolation&&(e.isolation=t.isolation),t.clipPath&&(e.clipPath=t.clipPath),t.mask&&(e.mask=t.mask),t.rawMetadata&&(e.rawMetadata=t.rawMetadata),t.transform&&(e.transform=t.transform),e}function nM(t){let e=tM(t),n={fillColor:null,borderColor:null,rotation:0,skewX:0,skewY:0,customPivot:null};return Object.keys(e).length>0&&(n.groupData=e),{id:t.id,type:"group",state:n}}function Dx(t,e){let n=t.state.children;if(Array.isArray(n))for(let r of n)e.add(r.id),Dx(r,e)}function zx(t,e=!1){let n=t.state,r=n.children;return e&&delete n.groupId,Array.isArray(r)&&(n.children=r.map(i=>zx(i,!0))),t}function rM(t){if(t.length<2)return t.map(s=>s.shape);let e=t.filter(s=>s.shape.type==="group"&&s.siblingIndex!==void 0&&Number.isFinite(s.siblingIndex)).sort((s,a)=>(s.siblingIndex??0)-(a.siblingIndex??0));if(e.length===0)return[...t].sort((s,a)=>s.flatOrder-a.flatOrder).map(s=>s.shape);let n=Array(t.length).fill(null),r=new Set(e);for(let s of e){let a=Math.max(0,Math.min(t.length-1,s.siblingIndex??0));for(;a<n.length&&n[a]!==null;)a++;if(a>=n.length)for(a=n.length-1;a>=0&&n[a]!==null;)a--;a>=0&&(n[a]=s)}let i=t.filter(s=>!r.has(s)).sort((s,a)=>s.flatOrder-a.flatOrder),o=0;for(let s of i){for(;o<n.length&&n[o]!==null;)o++;o<n.length&&(n[o]=s)}return n.filter(s=>s!==null).map(s=>s.shape)}function Tr(t,e=[]){let n=structuredClone(t),r=structuredClone(e),i=new Map;for(let h of r)i.set(h.id,h);let o=n.map(h=>zx(h)),s=new Set;for(let h of o)Dx(h,s);let a=new Map,l=new Map;o.forEach((h,b)=>{s.has(h.id)||l.has(h.id)||(a.set(h.id,b),l.set(h.id,h))});for(let h of r){if(s.has(h.id)||l.has(h.id))continue;let b=nM(h);a.set(b.id,Number.POSITIVE_INFINITY),l.set(b.id,b)}let c=new Map,u=new Map;for(let h of l.values()){let b=h.state,S=i.get(h.id),v=Ox(b.groupId)??(h.type==="group"?Ox(S?.parentId):null),I=c.get(v)??[];u.set(h.id,v),I.push({shape:h,flatOrder:a.get(h.id)??Number.POSITIVE_INFINITY,siblingIndex:h.type==="group"?S?.siblingIndex:void 0}),c.set(v,I)}let d=new Set,p=h=>{if(d.has(h.id))return null;d.add(h.id);let b=h.state,S=Array.isArray(b.children)?b.children:[],v=f(h.id),I=new Set(S.map(P=>P.id)),x=[...S,...v.filter(P=>!I.has(P.id))];return x.length>0?b.children=x:delete b.children,delete b.groupId,h},f=h=>{let b=[];for(let S of rM(c.get(h)??[])){let v=p(S);v&&b.push(v)}return b},g=f(null),m=h=>{if(!h)return;let b=p(h);b&&g.push(b)};for(let h of l.values()){let b=u.get(h.id);b&&!l.has(b)&&m(h)}for(let h of r)m(l.get(h.id));for(let h of l.values())m(h);return g}function Lx(t){let e=t.customPivot;if(e)return e;let n=t.x,r=t.y,i=t.width,o=t.height;if(typeof n=="number"&&typeof r=="number"&&typeof i=="number"&&typeof o=="number")return{x:n+i/2,y:r+o/2};let s=t.radius;if(typeof n=="number"&&typeof r=="number"&&typeof s=="number")return{x:n,y:r};let a=t.cx,l=t.cy;if(typeof a=="number"&&typeof l=="number")return{x:a,y:l};let c=t.x1,u=t.y1,d=t.x2,p=t.y2;if(typeof c=="number"&&typeof u=="number"&&typeof d=="number"&&typeof p=="number")return{x:(c+d)/2,y:(u+p)/2};let f=t.pathPoints;if(f?.[0])return{x:f[0].x,y:f[0].y};let g=t.polylinePoints;if(g?.[0])return{x:g[0].x,y:g[0].y}}function iM(t){return Nt(t,{onShape:e=>{let n=e.state;!n||typeof n!="object"||Kp(n,Lx(n))}}),t.schemaVersion=3,t}function eg(t){let e=t;return e&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)?{x:e.x,y:e.y}:null}function oM(t,e){let n=t.translateX??0,r=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",o=_e(n,r);if(i)return it(ce(o,Ot(i)));let s=t.rotation??0,a=t.skewX??0,l=t.skewY??0;if(s!==0||a!==0||l!==0){let d=eg(t.customPivot)??e??eg(t.scaleAnchor);d&&(o=ce(o,_e(d.x,d.y)),s!==0&&(o=ce(o,Fi(s))),a!==0&&(o=ce(o,ds(a))),l!==0&&(o=ce(o,us(l))),o=ce(o,_e(-d.x,-d.y)))}let c=t.scaleX??1,u=t.scaleY??1;if(c!==1||u!==1){let d=eg(t.scaleAnchor)??e;d&&(o=ce(o,_e(d.x,d.y)),o=ce(o,qr(c,u)),o=ce(o,_e(-d.x,-d.y)))}return it(o)}function sM(t){return Nt(t,{onShape:e=>{let n=e.state;!n||typeof n!="object"||!("scaleAnchor"in n)||(e.type==="text"&&!Un(n.transformMatrix)&&(n.transformMatrix=oM(n,Lx(n))),delete n.scaleAnchor)}}),t.schemaVersion=4,t}function aM(t){let e=Array.isArray(t.library)?[...t.library]:[],n=new Set(e.map(l=>l.id));if(Array.isArray(t.symbols))for(let l of t.symbols)!l||n.has(l.id)||(e.push({...l,kind:"symbol"}),n.add(l.id));if(Array.isArray(t.markers))for(let l of t.markers)!l||n.has(l.id)||(e.push({...l,kind:"marker"}),n.add(l.id));let r=new Map,i=(l,c)=>{let{id:u,sourceId:d,...p}=l,f=JSON.stringify({kind:c,...p}),g=r.get(f);if(g)return g;let m=n.has(l.id)?`grd-${$d()}`:l.id;n.add(m),r.set(f,m);let h=c==="linear-gradient"?{kind:"linear-gradient",id:m,name:l.sourceId??m,sourceId:l.sourceId,gradient:_x(l)}:{kind:"radial-gradient",id:m,name:l.sourceId??m,sourceId:l.sourceId,gradient:_x(l)};return e.push(h),m},o=new Map;if(Array.isArray(t.customPatterns))for(let l of t.customPatterns){if(!l)continue;let c=n.has(l.id)?`pat-${$d()}`:l.id;n.add(c),o.set(l.id,c),e.push(Bn(l,c))}let s=l=>{if(l.customPatternId){let b=o.get(l.customPatternId);if(b)return b}let{id:c,sourceId:u,customPatternId:d,...p}=l,f=JSON.stringify({kind:"pattern",...p}),g=r.get(f);if(g)return g;let m=n.has(l.id)?`pat-${$d()}`:l.id;n.add(m),r.set(f,m);let h={kind:"pattern",id:m,name:l.sourceId??m,sourceId:l.sourceId,pattern:p};return e.push(h),m};for(let l of t.shapes??[]){let c=l.state;if(!c)continue;let u=c.fillGradient;u&&(u.type==="linear-gradient"||u.type==="radial-gradient"?c.fillLibraryId=i(u,u.type):u.type==="pattern"&&(c.fillLibraryId=s(u)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=s(d)));let p=c.filters;if(Array.isArray(p)&&p.length>0){let f=a(p,c,l.id);c.filterLibraryIds=[f]}}return t.library=e,t;function a(l,c,u){let d={filters:l,colorInterpolation:c.filterColorInterpolation,filterUnits:c.filterUnits,primitiveUnits:c.primitiveUnits,x:c.filterX,y:c.filterY,width:c.filterWidth,height:c.filterHeight},p=JSON.stringify({kind:"filter",...d}),f=r.get(p);if(f)return f;let g=`filter-${u}`,m=n.has(g)?`flt-${$d()}`:g;n.add(m),r.set(p,m);let h={kind:"filter",id:m,name:m,filters:d.filters,...d.colorInterpolation?{colorInterpolation:d.colorInterpolation}:{},...d.filterUnits?{filterUnits:d.filterUnits}:{},...d.primitiveUnits?{primitiveUnits:d.primitiveUnits}:{},...d.x!==void 0?{x:d.x}:{},...d.y!==void 0?{y:d.y}:{},...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{}};return e.push(h),m}}function _x(t){let{id:e,sourceId:n,...r}=t;return r}var tg=0;function $d(){return tg=tg+1&65535,`${Date.now().toString(36)}-${tg.toString(36)}`}function lM(t){return Nt(t,{onState:e=>{jo(e)}}),t.schemaVersion=5,t}function cM(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t;if(e.richTextRuns!==void 0&&e.richTextRuns!==null)return;let n=e.richTextData;!n||typeof n!="object"||Array.isArray(n)||Array.isArray(n.lines)&&(e.richTextRuns=Lr(n))}function dM(t){return Nt(t,{onState:e=>cM(e)}),t.schemaVersion=6,t}function Fx(t,e){if(!e.has(t))return t;let n=2;for(;e.has(`${t}-${n}`);)n++;return`${t}-${n}`}function na(t){let e=new Set,n=new Set,r=new Map;Nt(t,{onShape:o=>{if(n.add(o.id),o.type!=="view")return;r.has(o.id)||r.set(o.id,o);let s=o.state.viewName;typeof s=="string"&&s&&e.add(s)}});let i=[];return(t.viewboxes??[]).filter(o=>{let s=r.get(o.id);return!(s&&s.state.viewBoxX===o.x&&s.state.viewBoxY===o.y&&s.state.viewBoxWidth===Math.max(1,o.width)&&s.state.viewBoxHeight===Math.max(1,o.height))}).forEach((o,s)=>{let a=Fx(`view-${s+1}`,e);e.add(a);let l=Fx(o.id||`legacy-view-${s+1}`,n);n.add(l),i.push({id:l,type:"view",state:{viewBoxX:o.x,viewBoxY:o.y,viewBoxWidth:Math.max(1,o.width),viewBoxHeight:Math.max(1,o.height),viewName:a}})}),i.length>0&&t.shapes.unshift(...i),t.viewboxes=[],t}var uM=["svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio"];function pM(t){if(t.type!=="svg"||t.state.isRootSvg===!0)return;let e=t.state;if(![e.svgViewBoxX,e.svgViewBoxY,e.svgViewBoxWidth,e.svgViewBoxHeight].every(i=>i===0))return;if(e.svgX===0&&e.svgY===0&&e.svgWidth===0&&e.svgHeight===0&&e.svgPreserveAspectRatio===""){for(let i of uM)delete e[i];return}delete e.svgViewBoxX,delete e.svgViewBoxY,delete e.svgViewBoxWidth,delete e.svgViewBoxHeight}function ng(t){return Nt(t,{onShape:pM}),na(t),t.schemaVersion=7,t}var fM=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function mM(t,e){if(t.type!=="symbol-instance"||t.state.authoredUseGeometry!==void 0)return;let n={};for(let r of["x","y","width","height"]){if((r==="width"||r==="height")&&e.has(String(t.state.symbolId??"")))continue;let i=t.state[r];typeof i=="number"&&Number.isFinite(i)&&(n[r]=String(i))}Object.keys(n).length>0&&(t.state.authoredUseGeometry=n)}function gM(t){let e=new Set((t.library??[]).filter(n=>n.kind==="symbol"&&n.defKind==="group").map(n=>n.id));for(let n of t.library??[]){if(n.kind!=="symbol")continue;let r=n,i={...r.wrapperAttrs??{},...r.rootAttributes??{}};for(let s of fM){let a=i[s];r[s]===void 0&&a!==void 0&&(r[s]=a),delete i[s]}if(r.overflow!==void 0&&i.overflow===void 0&&(i.overflow=r.overflow),Object.keys(i).length>0?r.rootAttributes=i:delete r.rootAttributes,r.shapes=Tr(r.shapes,r.groups),r.variants)for(let[s,a]of Object.entries(r.variants))r.variants[s]=Tr(a,r.groups);let o=r;delete o.wrapperAttrs,delete o.groups,delete o.overflow}return Nt(t,{onShape:n=>mM(n,e)}),t.schemaVersion=8,t}var rg=Object.freeze({1:aM,2:iM,3:sM,4:lM,5:dM,6:ng,7:gM});function hM(t){let e=t.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function vo(t,e=rg){let n=JSON.parse(JSON.stringify(t)),r=hM(n);if(r>Tt)return n;if(r===Tt)return n.schemaVersion=Tt,n;for(;r<Tt;){let i=e[r];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${r} \u2192 ${r+1}. Cannot safely upgrade this document to version ${Tt}.`);n=i(n),r+=1}return n.schemaVersion=Tt,n}function ra(t,e,n={}){let r=wr(t),i=r.errors.filter(o=>!n.ignoreError?.(o));if(i.length>0){let o=i.map(s=>` ${s.path}: ${s.message}`).join(`
10
33
  `);throw new Error(`Invalid .svgs document:
11
- ${a}`)}}return s}function qc(n){return[...n].sort((e,t)=>e.id.localeCompare(t.id))}function ft(n){if(n==null)return n;if(Array.isArray(n))return n.map(ft);if(typeof n!="object")return n;let e={},t=Object.keys(n).sort();for(let r of t)e[r]=ft(n[r]);return e}function Zc(n){let e={};return e.id=n.id,e.type=n.type,e.state=ft(n.state),e}var Re=/\{\{\s*([\w.\-]+)\s*\}\}/g;function dr(n,e){return n.replace(Re,(t,r)=>{let i=e[r];return i!==void 0?String(i):t})}function mr(n,e={}){let t={};if(n.templateVariables)for(let i of n.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(t[i.name]=i.defaultValue);if(Object.assign(t,e),Object.keys(t).length===0)return JSON.parse(JSON.stringify(n));let r=JSON.parse(JSON.stringify(n));for(let i of r.shapes)fr(i.state,t);if(r.documentMetadata){let i=r.documentMetadata;fr(i,t)}return r}function fr(n,e){for(let t of Object.keys(n)){let r=n[t];if(typeof r=="string"){if(Re.lastIndex=0,Re.test(r)){Re.lastIndex=0;let i=dr(r,e);if(Jc(r)){let s=Number(i);if(!isNaN(s)&&ed(t)){n[t]=s;continue}}n[t]=i}}else if(Array.isArray(r))for(let i=0;i<r.length;i++)typeof r[i]=="string"?(Re.lastIndex=0,Re.test(r[i])&&(Re.lastIndex=0,r[i]=dr(r[i],e))):r[i]!==null&&typeof r[i]=="object"&&fr(r[i],e);else r!==null&&typeof r=="object"&&fr(r,e)}}function Jc(n){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(n)}var Qc=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...Bt,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function ed(n){return Qc.has(n)}function hr(n){let e=n.templateVariables??[],t=new Set(e.map(s=>s.name)),r=new Set;for(let s of n.shapes)pr(s.state,r);n.documentMetadata&&pr(n.documentMetadata,r);let i=[...r].filter(s=>!t.has(s)).sort();return{defined:[...e],undeclared:i}}function pr(n,e){for(let t of Object.values(n))if(typeof t=="string"){let r;for(Re.lastIndex=0;(r=Re.exec(t))!==null;)e.add(r[1])}else if(Array.isArray(t))for(let r of t)if(typeof r=="string"){let i;for(Re.lastIndex=0;(i=Re.exec(r))!==null;)e.add(i[1])}else r!==null&&typeof r=="object"&&pr(r,e);else t!==null&&typeof t=="object"&&pr(t,e)}function nl(n){let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid variable format: "${t}". Expected "name=value".`);let i=t.slice(0,r).trim(),s=t.slice(r+1);if(!i)throw new Error(`Invalid variable format: "${t}". Variable name cannot be empty.`);e[i]=s}return e}var rl=3,il=12;function sl(n){return n==null||!Number.isFinite(n)?3:n<0?0:n>12?12:Math.floor(n)}function yr(n,e){if(!Number.isFinite(n))return n;let t=Math.pow(10,e);return Math.round(n*t)/t}var td=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function Is(n,e){return n.replace(td,t=>{let r=parseFloat(t);return Number.isFinite(r)?String(yr(r,e)):t})}var nd=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),rd=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextRuns","richTextData","cssMaskProperties","rawMetadata"]);function De(n,e,t){if(e==null)return e;if(typeof e=="number")return yr(e,t);if(typeof e=="string")return nd.has(n)?Is(e,t):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(r=>De(n,r,t));if(typeof e=="object"){if(rd.has(n))return e;if(n==="symbolOverrides"){let i={};for(let[s,o]of Object.entries(e))i[s]=De("state",o,t);return i}let r={};for(let[i,s]of Object.entries(e))r[i]=De(i,s,t);return r}return e}function gr(n,e){return{id:n.id,type:n.type,state:De("state",n.state,e)}}function al(n,e){let t={...n,shapes:n.shapes.map(r=>gr(r,e)),viewboxes:n.viewboxes.map(r=>De("viewbox",r,e))};return n.guides&&(t.guides=n.guides.map(r=>De("guide",r,e))),n.measurements&&(t.measurements=n.measurements.map(r=>De("measurement",r,e))),n.animationTimeline&&(t.animationTimeline=De("animationTimeline",n.animationTimeline,e)),n.symbols&&(t.symbols=n.symbols.map(r=>({...r,shapes:r.shapes.map(i=>gr(i,e))}))),n.markers&&(t.markers=n.markers.map(r=>De("marker",r,e))),n.customPatterns&&(t.customPatterns=n.customPatterns.map(r=>De("customPattern",r,e))),t}function mn(n,e,t=-90){let r=[],i=t*Math.PI/180;for(let s=0;s<n;s++){let o=i+s*2*Math.PI/n;r.push({x:e*Math.cos(o),y:e*Math.sin(o)})}return r}function Sr(n,e,t,r=-90){let i=[],s=e*(t/100),o=r*Math.PI/180;for(let a=0;a<n*2;a++){let l=o+a*Math.PI/n,c=a%2===0?e:s;i.push({x:c*Math.cos(l),y:c*Math.sin(l)})}return i}function xr(n,e,t=0){let r=n*(e/100)/2,i=[{x:-r,y:-n},{x:r,y:-n},{x:r,y:-r},{x:n,y:-r},{x:n,y:r},{x:r,y:r},{x:r,y:n},{x:-r,y:n},{x:-r,y:r},{x:-n,y:r},{x:-n,y:-r},{x:-r,y:-r}];if(t===0)return i;let s=Math.cos(t*Math.PI/180),o=Math.sin(t*Math.PI/180);return i.map(a=>({x:a.x*s-a.y*o,y:a.x*o+a.y*s}))}function $r(n,e,t,r,i=-90){let o=n*2*(t/100),a=n*(e/100),l=a*(r/100),c=[{x:n,y:0},{x:n-o,y:-a/2},{x:n-o,y:-l/2},{x:-n,y:-l/2},{x:-n,y:l/2},{x:n-o,y:l/2},{x:n-o,y:a/2}];if(i===0)return c;let f=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(p=>({x:p.x*f-p.y*d,y:p.x*d+p.y*f}))}function vr(n,e,t,r,i=0){let s=n,o=s*(t/100),a=s*(r/100),l=a/2,c=e*Math.PI/180,f=Math.cos(c),d=Math.sin(c),p=Math.abs(f),m=Math.abs(d),h=Math.max(p,m)||1,g={x:f*(s/h),y:d*(s/h)},b={x:g.x+f*o,y:g.y+d*o},$=Math.min(a,s-l),k=-s+l+$,S=s-l-$,x={x:-s,y:-s},v={x:s,y:-s},w={x:s,y:s},T={x:-s,y:s},P;if(p>=m&&f>0){let N=Math.max(k,Math.min(S,g.y)),B={x:s,y:N-l},D={x:s,y:N+l};P=[x,v,B,b,D,w,T]}else if(p>=m&&f<=0){let N=Math.max(k,Math.min(S,g.y)),B={x:-s,y:N+l},D={x:-s,y:N-l};P=[x,v,w,T,B,b,D]}else if(d<0){let N=Math.max(k,Math.min(S,g.x)),B={x:N-l,y:-s},D={x:N+l,y:-s};P=[x,B,b,D,v,w,T]}else{let N=Math.max(k,Math.min(S,g.x)),B={x:N+l,y:s},D={x:N-l,y:s};P=[x,v,w,B,b,D,T]}if(i===0)return P;let R=Math.cos(i*Math.PI/180),M=Math.sin(i*Math.PI/180);return P.map(N=>({x:N.x*R-N.y*M,y:N.x*M+N.y*R}))}function kr(n,e,t,r,i=0){let s=Math.max(2,Math.round(e)),o=n*(t/100),a=n*(r/100)/2,l=s+1,c=[];for(let g=0;g<l;g++){let b=g/(l-1),$=-n+b*2*n,k=0;g>0&&g<l-1&&(k=g%2===1?o:-o),c.push({x:k,y:$})}let f=[],d=[];for(let g=0;g<l;g++){if(g===0||g===l-1){f.push({...c[g]}),d.push({...c[g]});continue}let b=c[g-1],$=c[g],k=c[g+1],S=$.x-b.x,x=$.y-b.y,v=Math.hypot(S,x)||1,w=S/v,T=x/v,P=k.x-$.x,R=k.y-$.y,M=Math.hypot(P,R)||1,N=P/M,B=R/M,D=(w+N)/2,L=(T+B)/2,K=Math.hypot(D,L),C,re;K<1e-6?(C=-T,re=w):(C=-L/K,re=D/K),f.push({x:$.x-C*a,y:$.y-re*a}),d.push({x:$.x+C*a,y:$.y+re*a})}let p=[];p.push(f[0]);for(let g=1;g<l-1;g++)p.push(d[g]);p.push(f[l-1]);for(let g=l-2;g>=1;g--)p.push(f[g]);if(i===0)return p;let m=Math.cos(i*Math.PI/180),h=Math.sin(i*Math.PI/180);return p.map(g=>({x:g.x*m-g.y*h,y:g.x*h+g.y*m}))}function Tr(n,e,t,r=0){let i=n,s=Math.max(.3,Math.min(.9,e/100)),o=-i*(t/100),a={x:0,y:i},l={x:0,y:o},c={x:-i*s,y:i*.4},f={x:-i*s,y:-i},d={x:i*s,y:-i},p={x:i*s,y:i*.4},m=[a,c,f,l,d,p,a],h=r===0?m:(()=>{let v=Math.cos(r*Math.PI/180),w=Math.sin(r*Math.PI/180);return m.map(T=>({x:T.x*v-T.y*w,y:T.x*w+T.y*v}))})(),[g,b,$,k,S,x]=h;return`M ${g.x} ${g.y} C ${b.x} ${b.y} ${$.x} ${$.y} ${k.x} ${k.y} C ${S.x} ${S.y} ${x.x} ${x.y} ${g.x} ${g.y} Z`}function wr(n,e,t,r=0){let i=Math.max(3,Math.round(e)),s=Math.max(.3,Math.min(1,t/100)),o=n,a=o*1.7,l=o*1.15,c=[];for(let T=0;T<i;T++){let R=(90+T/i*360)*Math.PI/180;c.push({x:a/2*Math.cos(R),y:-(l/2)*Math.sin(R)})}let f=.15,d=0;for(let T=0;T<i;T++){let P=c[T],R=c[(T+1)%i];d=Math.max(d,Math.hypot(R.x-P.x,R.y-P.y))}let p=d/(2*(1-f))+.001,m=Math.max(p,d*(.68+s*.35)),h=c.map(T=>{let P=T.y/(l/2);return m*(1-f*P)});function g(T){let P=c[T],R=c[(T+1)%i],M=h[T],N=h[(T+1)%i],B=R.x-P.x,D=R.y-P.y,L=Math.hypot(B,D)||1,K=(M*M-N*N+L*L)/(2*L),C=Math.sqrt(Math.max(0,M*M-K*K)),re=P.x+K/L*B,ee=P.y+K/L*D,Z=-D/L,me=B/L,q={x:re+Z*C,y:ee+me*C},W={x:re-Z*C,y:ee-me*C};return q.x*q.x+q.y*q.y>W.x*W.x+W.y*W.y?q:W}let b=[];for(let T=0;T<i;T++)b.push(g(T));let $=14,k=[];for(let T=0;T<i;T++){let P=c[T],R=h[T],M=b[(T-1+i)%i],N=b[T],B=Math.atan2(M.y-P.y,M.x-P.x),L=Math.atan2(N.y-P.y,N.x-P.x)-B;L<=0&&(L+=2*Math.PI);let K=2*Math.PI-L,C=B+L/2,re=B-K/2,ee={x:P.x+R*Math.cos(C),y:P.y+R*Math.sin(C)},Z={x:P.x+R*Math.cos(re),y:P.y+R*Math.sin(re)},q=ee.x*ee.x+ee.y*ee.y>Z.x*Z.x+Z.y*Z.y?L:-K;for(let W=0;W<$;W++){let fe=W/$,he=B+fe*q;k.push({x:P.x+R*Math.cos(he),y:P.y+R*Math.sin(he)})}}let S=0;for(let T of k){let P=Math.max(Math.abs(T.x),Math.abs(T.y));P>S&&(S=P)}if(S>0&&S!==o){let T=o/S;for(let P of k)P.x*=T,P.y*=T}let x=T=>{if(r===0)return T;let P=Math.cos(r*Math.PI/180),R=Math.sin(r*Math.PI/180);return{x:T.x*P-T.y*R,y:T.x*R+T.y*P}},v=k.map(x),w=`M ${v[0].x} ${v[0].y}`;for(let T=1;T<v.length;T++)w+=` L ${v[T].x} ${v[T].y}`;return w+=" Z",w}function Ae(n,e=0,t=0){if(n.length<3)return"";if(e<=0)return n.map((s,o)=>(o===0?"M":"L")+`${s.x},${s.y}`).join(" ")+" Z";let r=Math.min(e,t*.4),i="";for(let s=0;s<n.length;s++){let o=n[(s-1+n.length)%n.length],a=n[s],l=n[(s+1)%n.length],c={x:o.x-a.x,y:o.y-a.y},f=Math.hypot(c.x,c.y);c.x/=f,c.y/=f;let d={x:l.x-a.x,y:l.y-a.y},p=Math.hypot(d.x,d.y);d.x/=p,d.y/=p;let m=Math.min(r,f/2),h=Math.min(r,p/2),g={x:a.x+c.x*m,y:a.y+c.y*m},b={x:a.x+d.x*h,y:a.y+d.y*h};i+=s===0?`M${g.x},${g.y}`:` L${g.x},${g.y}`,i+=` Q${a.x},${a.y} ${b.x},${b.y}`}return i+" Z"}function Pr(n,e,t="evenodd"){let r=n*(e/100),i=t==="nonzero"?1:0;return`M ${n} 0 A ${n} ${n} 0 1 1 ${-n} 0 A ${n} ${n} 0 1 1 ${n} 0 Z M ${r} 0 A ${r} ${r} 0 1 ${i} ${-r} 0 A ${r} ${r} 0 1 ${i} ${r} 0 Z`}function _r(n,e,t,r=1,i=0){let s=n*(t/100),a=Math.round(e*36),l=e*2*Math.PI,c=(n-s/2)/l,f=i*Math.PI/180,d=[],p=[];for(let g=0;g<=a;g++){let b=g/a,$=b*l*r+f,k=c*(b*l)+s/2,S=s/2;d.push({x:(k+S*.3)*Math.cos($),y:(k+S*.3)*Math.sin($)}),p.push({x:Math.max(0,k-S*.3)*Math.cos($),y:Math.max(0,k-S*.3)*Math.sin($)})}let m=`M ${d[0].x} ${d[0].y}`;for(let g=1;g<d.length;g++)m+=` L ${d[g].x} ${d[g].y}`;let h=p[p.length-1];m+=` L ${h.x} ${h.y}`;for(let g=p.length-2;g>=0;g--)m+=` L ${p[g].x} ${p[g].y}`;return m+=" Z",m}var id=.2;function Ds(n,e,t,r=0){let i=e*(t/100),s=e,o=e-i,a=2*Math.PI/n,l=a*id/2,c=a/4,f=r*Math.PI/180,d=[];for(let p=0;p<n;p++){let m=f+p*a;d.push({x:o*Math.cos(m),y:o*Math.sin(m)}),d.push({x:s*Math.cos(m+c-l),y:s*Math.sin(m+c-l)}),d.push({x:s*Math.cos(m+c+l),y:s*Math.sin(m+c+l)}),d.push({x:o*Math.cos(m+a/2),y:o*Math.sin(m+a/2)})}return d}function Rr(n,e,t,r=0,i=0,s="evenodd",o=0){let a=Ds(n,e,t,o),l=Math.min(r,e*.1),c=Ae(a,l,e);if(i>0){let f=e*(i/100),d=s==="nonzero"?1:0;c+=` M ${f} 0 A ${f} ${f} 0 1 ${d} ${-f} 0 A ${f} ${f} 0 1 ${d} ${f} 0 Z`}return c}function Ar(n,e,t,r,i,s="round",o="uniform",a){let l=Math.min(t,r)/2,c,f,d,p,m,h,g,b;if(o==="non-uniform"&&a?(c=Math.min(a.radiusTL??i,l),f=Math.min(a.radiusTR??i,l),d=Math.min(a.radiusBR??i,l),p=Math.min(a.radiusBL??i,l),m=a.shapeTL??s,h=a.shapeTR??s,g=a.shapeBR??s,b=a.shapeBL??s):(c=f=d=p=Math.min(i,l),m=h=g=b=s),!(s!=="round"||o==="non-uniform"||c>0&&m!=="round"||f>0&&h!=="round"||d>0&&g!=="round"||p>0&&b!=="round")&&c===f&&f===d&&d===p)return null;let k=`M${n+c},${e}`;return k+=` L${n+t-f},${e}`,k+=br(h,f,n+t,e,"tr"),k+=` L${n+t},${e+r-d}`,k+=br(g,d,n+t,e+r,"br"),k+=` L${n+p},${e+r}`,k+=br(b,p,n,e+r,"bl"),k+=` L${n},${e+c}`,k+=br(m,c,n,e,"tl"),k+=" Z",k}function br(n,e,t,r,i){if(e<=0)return"";switch(n){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${t},${r+e}`;case"br":return` A${e},${e} 0 0 1 ${t-e},${r}`;case"bl":return` A${e},${e} 0 0 1 ${t},${r-e}`;case"tl":return` A${e},${e} 0 0 1 ${t+e},${r}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${t},${r+e}`;case"br":return` A${e},${e} 0 0 0 ${t-e},${r}`;case"bl":return` A${e},${e} 0 0 0 ${t},${r-e}`;case"tl":return` A${e},${e} 0 0 0 ${t+e},${r}`}break;case"bevel":switch(i){case"tr":return` L${t},${r+e}`;case"br":return` L${t-e},${r}`;case"bl":return` L${t},${r-e}`;case"tl":return` L${t+e},${r}`}break;case"notch":switch(i){case"tr":return` L${t-e},${r+e} L${t},${r+e}`;case"br":return` L${t-e},${r-e} L${t-e},${r}`;case"bl":return` L${t+e},${r-e} L${t},${r-e}`;case"tl":return` L${t+e},${r+e} L${t+e},${r}`}break}return""}function Ir(n,e,t,r,i,s={}){let o=e+r/2,a=t+i/2;switch(n){case"diamond":return`M${o},${t} L${e+r},${a} L${o},${t+i} L${e},${a} Z`;case"parallelogram":{let l=(s.slantPercent??20)/100*r;return`M${e+l},${t} L${e+r},${t} L${e+r-l},${t+i} L${e},${t+i} Z`}case"trapezoid":{let l=(s.topWidthPercent??70)/100*r,c=(r-l)/2;return`M${e+c},${t} L${e+c+l},${t} L${e+r},${t+i} L${e},${t+i} Z`}case"terminator":{let l=i/2;return`M${e+l},${t} L${e+r-l},${t} A${l},${l} 0 0 1 ${e+r-l},${t+i} L${e+l},${t+i} A${l},${l} 0 0 1 ${e+l},${t} Z`}case"cylinder":{let l=r/2,c=Math.min((s.capHeightPercent??15)/100*i,i/2);return`M${e},${t+c} A${l},${c} 0 0 1 ${e+r},${t+c} A${l},${c} 0 0 1 ${e},${t+c} L${e},${t+i-c} A${l},${c} 0 0 0 ${e+r},${t+i-c} L${e+r},${t+c} M${o-l},${t+c} A${l},${c} 0 0 0 ${o+l},${t+c}`}case"document-shape":{let l=(s.waveAmplitudePercent??15)/100*i;return`M${e},${t} L${e+r},${t} L${e+r},${t+i} C${e+r*.75},${t+i-l*2} ${o+r*.25},${t+i+l} ${o},${t+i} C${o-r*.25},${t+i-l} ${e+r*.25},${t+i+l*.5} ${e},${t+i} Z`}}}function qe(n,e,t=!1,r=.5,i){if(n.length<2)return n.length===1?`M ${n[0].x} ${n[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return ld(n,t,r);case"BASIS":case"basis":return ud(n,t);case"ARC":case"arc":return i&&i.length>0?sd(n,t,i):pn(n,t,"CUBIC");case"LINEAR":case"linear":return pn(n,t,"LINEAR");case"QUADRATIC":case"quadratic":return pn(n,t,"QUADRATIC");case"CUBIC":case"cubic":return pn(n,t,"CUBIC");default:return pn(n,t)}}function sd(n,e,t){let r=`M ${n[0].x} ${n[0].y}`,i=0,s={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<n.length-1;o++){let a=n[o+1];if(a.isSubpathStart){if(e&&o-i>=1){let c=n[i],f=t?.[o]??s;r+=` A ${f.rx} ${f.ry} ${f.rotation} ${f.largeArc?1:0} ${f.sweep?1:0} ${c.x} ${c.y} Z`}r+=` M ${a.x} ${a.y}`,i=o+1;continue}let l=t?.[o]??s;r+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${a.x} ${a.y}`}if(e&&n.length-i>1){let o=n[i],a=t?.[n.length-1]??s;r+=` A ${a.rx} ${a.ry} ${a.rotation} ${a.largeArc?1:0} ${a.sweep?1:0} ${o.x} ${o.y} Z`}return r}function pn(n,e,t){let r=`M ${n[0].x} ${n[0].y}`,i=0,s=null,o=null;for(let a=0;a<n.length-1;a++){let l=n[a],c=n[a+1];if(c.isSubpathStart){if(e&&a-i>=1){let d=n[i];r+=Ms(l,d,d.segmentType,s,o,t),r+=" Z"}r+=` M ${c.x} ${c.y}`,i=a+1,s=null,o=null;continue}r+=Ms(l,c,c.segmentType,s,o,t);let f=od(c.segmentType??t,l,c);s=f,f==="quad"?o=l.handleOut??null:o=null}if(e&&n.length-i>1){let a=n[n.length-1],l=n[i],c=(l.segmentType??t??(a.handleOut||l.handleIn?"CUBIC":"LINEAR")).toUpperCase();c==="LINEAR"||c==="HORIZONTAL"||c==="VERTICAL"||(r+=Ms(a,l,l.segmentType,s,o,t)),r+=" Z"}return r}var ad=.001;function It(n,e){return Math.abs(n-e)<ad}function od(n,e,t){let r=(n??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase();return r==="CUBIC"||r==="SMOOTH_CUBIC"?"cubic":r==="QUADRATIC"||r==="SMOOTH_QUADRATIC"?"quad":null}function Ms(n,e,t,r,i,s){let o=(t??s??(n.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL")return(o==="HORIZONTAL"||o==="LINEAR")&&It(n.y,e.y)?` H ${e.x}`:(o==="VERTICAL"||o==="LINEAR")&&It(n.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(o==="ARC"){let c=e.arcParams;return c?` A ${c.rx} ${c.ry} ${c.rotation} ${c.largeArc?1:0} ${c.sweep?1:0} ${e.x} ${e.y}`:` L ${e.x} ${e.y}`}if(o==="QUADRATIC"||o==="SMOOTH_QUADRATIC"){let c=n.handleOut??{x:(n.x+e.x)/2,y:(n.y+e.y)/2};return r==="quad"&&i&&It(c.x,2*n.x-i.x)&&It(c.y,2*n.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let a=n.handleOut??{x:n.x,y:n.y},l=e.handleIn??{x:e.x,y:e.y};return r==="cubic"&&n.handleIn&&n.handleOut&&It(n.handleOut.x,2*n.x-n.handleIn.x)&&It(n.handleOut.y,2*n.y-n.handleIn.y)?` S ${l.x} ${l.y} ${e.x} ${e.y}`:` C ${a.x} ${a.y} ${l.x} ${l.y} ${e.x} ${e.y}`}function ld(n,e,t){if(n.length<2)return n.length===1?`M ${n[0].x} ${n[0].y}`:"";let r=t,i=e?[n[n.length-1],...n,n[0],n[1]]:[n[0],...n,n[n.length-1]],s=`M ${n[0].x} ${n[0].y}`,o=e?n.length:n.length-1;for(let a=0;a<o;a++){let l=i[a],c=i[a+1],f=i[a+2],d=i[a+3],p=Math.hypot(f.x-c.x,f.y-c.y),m=Math.hypot(c.x-l.x,c.y-l.y),h=Math.hypot(d.x-f.x,d.y-f.y),g=Math.pow(m,r),b=Math.pow(p,r),$=Math.pow(h,r),k=Math.pow(m,2*r),S=Math.pow(p,2*r),x=Math.pow(h,2*r),v,w,T,P;m<1e-8?(v=c.x,w=c.y):(v=(k*f.x-S*l.x+(2*k+3*g*b+S)*c.x)/(3*g*(g+b)),w=(k*f.y-S*l.y+(2*k+3*g*b+S)*c.y)/(3*g*(g+b))),h<1e-8?(T=f.x,P=f.y):(T=(x*c.x-S*d.x+(2*x+3*$*b+S)*f.x)/(3*$*($+b)),P=(x*c.y-S*d.y+(2*x+3*$*b+S)*f.y)/(3*$*($+b))),s+=` C ${v} ${w} ${T} ${P} ${f.x} ${f.y}`}return e&&(s+=" Z"),s}function ud(n,e){let t=n.length;if(t<2)return t===1?`M ${n[0].x} ${n[0].y}`:"";if(t===2)return`M ${n[0].x} ${n[0].y} L ${n[1].x} ${n[1].y}`;if(e){let s=(n[0].x+4*n[1].x+n[2].x)/6,o=(n[0].y+4*n[1].y+n[2].y)/6,a=`M ${s} ${o}`;for(let l=0;l<t;l++){let c=n[(l+1)%t],f=n[(l+2)%t],d=n[(l+3)%t];a+=Cs(c,f,d)}return a+=" Z",a}let r=n,i=`M ${r[0].x} ${r[0].y}`;i+=` L ${(5*r[0].x+r[1].x)/6} ${(5*r[0].y+r[1].y)/6}`;for(let s=0;s<=t-3;s++)i+=Cs(r[s],r[s+1],r[s+2]);return i+=Cs(r[t-2],r[t-1],r[t-1]),i+=` L ${r[t-1].x} ${r[t-1].y}`,i}function Cs(n,e,t){return` C ${(2*n.x+e.x)/3} ${(2*n.y+e.y)/3} ${(n.x+2*e.x)/3} ${(n.y+2*e.y)/3} ${(n.x+4*e.x+t.x)/6} ${(n.y+4*e.y+t.y)/6}`}function Mt(n,e,t){let r=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(t)?Math.max(1,t):4;switch(n){case"dashed":case"dotted":case"custom":return`${r} ${i}`;default:return null}}var cd=[["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 Y(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function dd(n){let e=n.fillType;return e||(n.fillGradient?n.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":n.linearGradient?"linear-gradient":n.radialGradient?"radial-gradient":"solid")}function Mr(n){let e=new Map,t=n.state,r=t;switch(n.type){case"circle":e.set("cx",String(t.x??0)),e.set("cy",String(t.y??0)),e.set("r",String(t.radius??50));break;case"ellipse":e.set("cx",String(t.cx??0)),e.set("cy",String(t.cy??0)),e.set("rx",String(t.rx??50)),e.set("ry",String(t.ry??30));break;case"rectangle":case"square":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100));{let x=t.rx??t.cornerRadius??0,v=t.ry??t.cornerRadius??0;(x>0||v>0)&&(e.set("rx",String(x)),e.set("ry",String(v)))}break;case"line":e.set("x1",String(t.x1??0)),e.set("y1",String(t.y1??0)),e.set("x2",String(t.x2??0)),e.set("y2",String(t.y2??0));break;case"text":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),t.fontSize&&e.set("font-size",String(t.fontSize)),t.fontFamily&&e.set("font-family",t.fontFamily),t.fontWeight&&e.set("font-weight",String(t.fontWeight)),t.fontStyle&&e.set("font-style",t.fontStyle),t.textAnchor&&e.set("text-anchor",t.textAnchor),t.letterSpacing&&e.set("letter-spacing",String(t.letterSpacing));{let x=cd.map(([v,w])=>{let T=typeof t[v]=="string"?String(t[v]).trim():"";return T?`${w}: ${T}`:""}).filter(Boolean).join("; ");x&&e.set("style",x)}break;case"image":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),r.href&&e.set("href",String(r.href));break}let i=dd(r);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${n.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${n.id})`):e.set("fill",t.fillColor??"#000000");let s=t.opacity;s!==void 0&&s<1&&e.set("opacity",String(s));let o=t.fillOpacity;o!==void 0&&o<1&&e.set("fill-opacity",String(o)),t.fillRule&&t.fillRule!=="nonzero"&&e.set("fill-rule",t.fillRule);let a=r.strokeType??"solid";if(a==="none")e.set("stroke","none");else if(a==="linear-gradient"||a==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${n.id})`);else{let x=t.borderColor??"none";x!=="none"&&e.set("stroke",x)}let l=t.borderWidth;l!=null&&l!==0&&e.set("stroke-width",String(l));let c=t.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let f=t.lineStyle??"solid",d=t.dashLength??8,p=t.gapLength??4,m=Mt(f,d,p);m&&(e.set("stroke-dasharray",m),f==="dotted"&&e.set("stroke-linecap","round"));let h=fd(r);h&&e.set("transform",h);let g=r.filters;g&&g.length>0&&e.set("filter",`url(#filter-${n.id})`);let b=t.shapeRendering;b&&b!=="auto"&&e.set("shape-rendering",b),t.pathLength!==void 0&&e.set("pathLength",String(t.pathLength));let $=r.startEndpoint,k=r.endEndpoint;$&&$!=="none"&&e.set("marker-start",`url(#line-marker-${$})`),k&&k!=="none"&&e.set("marker-end",`url(#line-marker-${k})`);let S=r.metadata;return S&&(S.role&&e.set("role",S.role),S.ariaLabel&&e.set("aria-label",S.ariaLabel)),e}function ol(n){switch(n.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 fd(n){return At(n)}function Fe(n,e){let t=n.viewboxes?.[0];return{width:e.width??t?.width??800,height:e.height??t?.height??600}}function u(n,e){return e==null||e===""?"":` ${n}="${Y(String(e))}"`}function Dr(n){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?{r:parseInt(e[1],16)/255,g:parseInt(e[2],16)/255,b:parseInt(e[3],16)/255}:{r:0,g:0,b:0}}function pd(n,e,t){let{offsetX:r,offsetY:i,blurRadius:s,spread:o,color:a,opacity:l}=n,c="";if(o===0)c+=`<feDropShadow${u("in",e)}${u("dx",r)}${u("dy",i)}${u("stdDeviation",s/2)}${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_shadow`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_shadow`)}/><feMergeNode${u("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${t}_alpha`)}/>`;let f=o>0?"dilate":"erode",d=Math.abs(o);c+=`<feMorphology${u("in",`${t}_alpha`)}${u("operator",f)}${u("radius",d)}${u("result",`${t}_spread`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_spread`)}${u("stdDeviation",s/2)}${u("result",`${t}_blur`)}/>`,c+=`<feOffset${u("in",`${t}_blur`)}${u("dx",r)}${u("dy",i)}${u("result",`${t}_offset`)}/>`,c+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_color`)}/>`,c+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_offset`)}${u("operator","in")}${u("result",`${t}_shadow`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_shadow`)}/><feMergeNode${u("in",e)}/></feMerge>`}return c}function md(n,e,t){let{offsetX:r,offsetY:i,blurRadius:s,choke:o,color:a,opacity:l}=n,c=s*(1-o/100),f="";return f+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${t}_alpha`)}/>`,f+=`<feComponentTransfer${u("in",`${t}_alpha`)}${u("result",`${t}_inverted`)}><feFuncA${u("type","table")}${u("tableValues","1 0")}/></feComponentTransfer>`,f+=`<feGaussianBlur${u("in",`${t}_inverted`)}${u("stdDeviation",c/2)}${u("result",`${t}_blur`)}/>`,f+=`<feOffset${u("in",`${t}_blur`)}${u("dx",r)}${u("dy",i)}${u("result",`${t}_offset`)}/>`,f+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_color`)}/>`,f+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_offset`)}${u("operator","in")}${u("result",`${t}_coloredShadow`)}/>`,f+=`<feComposite${u("in",`${t}_coloredShadow`)}${u("in2",`${t}_alpha`)}${u("operator","in")}${u("result",`${t}_innerShadow`)}/>`,f+=`<feComposite${u("in",`${t}_innerShadow`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`,f}function hd(n,e,t){let{blurX:r,blurY:i}=n;return r===0&&i===0?H(e,t):`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${r/2} ${i/2}`)}${u("result",t)}/>`}function gd(n,e,t){let{distance:r,angle:i}=n;if(r===0)return H(e,t);let s=i*Math.PI/180,o=Math.abs(Math.cos(s)*r),a=Math.abs(Math.sin(s)*r);return`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${o/2} ${a/2}`)}${u("result",t)}/>`}function ll(n,e,t){let{x:r,y:i,z:s,color:o,surfaceScale:a,diffuseConstant:l,specularConstant:c,specularExponent:f}=n,d="";return d+=`<feDiffuseLighting${u("in","SourceAlpha")}${u("surfaceScale",a)}${u("diffuseConstant",l)}${u("lighting-color",o)}${u("result",`${t}_diffuse`)}>`,d+=`<fePointLight${u("x",r)}${u("y",i)}${u("z",s)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${u("in","SourceAlpha")}${u("surfaceScale",a)}${u("specularConstant",c)}${u("specularExponent",f)}${u("lighting-color",o)}${u("result",`${t}_specular`)}>`,d+=`<fePointLight${u("x",r)}${u("y",i)}${u("z",s)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${u("in",e)}${u("in2",`${t}_diffuse`)}${u("operator","arithmetic")}${u("k1",1)}${u("k2",0)}${u("k3",0)}${u("k4",0)}${u("result",`${t}_lit`)}/>`,d+=`<feComposite${u("in",`${t}_specular`)}${u("in2",`${t}_lit`)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",t)}/>`,d}function ul(n,e,t){let{x:r,y:i,z:s,pointsAtX:o,pointsAtY:a,pointsAtZ:l,coneAngle:c,color:f,surfaceScale:d,specularConstant:p,specularExponent:m}=n,h="";return h+=`<feSpecularLighting${u("in","SourceAlpha")}${u("surfaceScale",d)}${u("specularConstant",p)}${u("specularExponent",m)}${u("lighting-color",f)}${u("result",`${t}_specular`)}>`,h+=`<feSpotLight${u("x",r)}${u("y",i)}${u("z",s)}${u("pointsAtX",o)}${u("pointsAtY",a)}${u("pointsAtZ",l)}${u("limitingConeAngle",c)}/>`,h+="</feSpecularLighting>",h+=`<feComposite${u("in",`${t}_specular`)}${u("in2","SourceAlpha")}${u("operator","in")}${u("result",`${t}_clipped`)}/>`,h+=`<feComposite${u("in",`${t}_clipped`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",t)}/>`,h}function cl(n){switch(n.kind){case"point":return`<fePointLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}/>`;case"spot":{let e=`<feSpotLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}${u("pointsAtX",n.pointsAtX)}${u("pointsAtY",n.pointsAtY)}${u("pointsAtZ",n.pointsAtZ)}`;return n.limitingConeAngle!==void 0&&(e+=u("limitingConeAngle",n.limitingConeAngle)),n.specularExponent!==void 0&&(e+=u("specularExponent",n.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${u("azimuth",n.azimuth)}${u("elevation",n.elevation)}/>`}}function yd(n,e,t){return`<feDiffuseLighting${u("in",e)}${u("surfaceScale",n.surfaceScale)}${u("diffuseConstant",n.diffuseConstant)}${u("lighting-color",n.color)}${u("result",t)}>`+cl(n.lightSource)+"</feDiffuseLighting>"}function bd(n,e,t){return`<feSpecularLighting${u("in",e)}${u("surfaceScale",n.surfaceScale)}${u("specularConstant",n.specularConstant)}${u("specularExponent",n.specularExponent)}${u("lighting-color",n.color)}${u("result",t)}>`+cl(n.lightSource)+"</feSpecularLighting>"}function Sd(n,e,t){let{width:r,color:i,opacity:s,position:o}=n,a="";if(o==="inside")a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","erode")}${u("radius",r)}${u("result",`${t}_eroded`)}/>`,a+=`<feComposite${u("in","SourceAlpha")}${u("in2",`${t}_eroded`)}${u("operator","out")}${u("result",`${t}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${t}_color`)}/>`,a+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_outlineAlpha`)}${u("operator","in")}${u("result",`${t}_outline`)}/>`,a+=`<feComposite${u("in",`${t}_outline`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`;else{let l=o==="outside"?r:r/2;a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","dilate")}${u("radius",l)}${u("result",`${t}_dilated`)}/>`,a+=`<feComposite${u("in",`${t}_dilated`)}${u("in2","SourceAlpha")}${u("operator","out")}${u("result",`${t}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${t}_color`)}/>`,a+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_outlineAlpha`)}${u("operator","in")}${u("result",`${t}_outline`)}/>`,a+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_outline`)}/><feMergeNode${u("in",e)}/></feMerge>`}return a}function xd(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=1+4*r,s=-r,o=[0,s,0,s,i,s,0,s,0].join(" ");return`<feConvolveMatrix${u("in",e)}${u("order","3")}${u("kernelMatrix",o)}${u("divisor","1")}${u("bias","0")}${u("preserveAlpha","true")}${u("edgeMode","duplicate")}${u("result",t)}/>`}function $d(n,e,t){let{blockSize:r}=n;if(r<=1)return H(e,t);let i=r/2,s="";return s+=`<feMorphology${u("in",e)}${u("operator","erode")}${u("radius",i)}${u("result",`${t}_eroded`)}/>`,s+=`<feMorphology${u("in",`${t}_eroded`)}${u("operator","dilate")}${u("radius",i)}${u("result",t)}/>`,s}function vd(n,e,t){let{scale:r,frequency:i,octaves:s,warpType:o}=n;if(r===0)return H(e,t);let a="";return a+=`<feTurbulence${u("type",o)}${u("baseFrequency",i)}${u("numOctaves",s)}${u("seed",0)}${u("result",`${t}_turbulence`)}/>`,a+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_turbulence`)}${u("scale",r)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",t)}/>`,a}function kd(n,e,t){let{operator:r,radiusX:i,radiusY:s}=n;return i===0&&s===0?H(e,t):`<feMorphology${u("in",e)}${u("operator",r)}${u("radius",`${i} ${s}`)}${u("result",t)}/>`}function Td(n,e,t){let{levels:r}=n;if(r<2)return H(e,t);let i=[];for(let a=0;a<r;a++)i.push(a/(r-1));let s=i.join(" "),o=`<feComponentTransfer${u("in",e)}${u("result",t)}>`;return o+=`<feFuncR${u("type","discrete")}${u("tableValues",s)}/>`,o+=`<feFuncG${u("type","discrete")}${u("tableValues",s)}/>`,o+=`<feFuncB${u("type","discrete")}${u("tableValues",s)}/>`,o+="</feComponentTransfer>",o}function wd(n,e,t){let{levels:r,contrast:i}=n;if(r<2)return H(e,t);let s=[];for(let l=0;l<r;l++){let c=l/(r-1),f=c;i!==1&&(f=.5+(c-.5)*i,f=Math.max(0,Math.min(1,f))),s.push(f)}let o=s.join(" "),a=`<feComponentTransfer${u("in",e)}${u("result",t)}>`;return a+=`<feFuncR${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function Pd(n,e,t){let{radius:r}=n;if(r===0)return H(e,t);let i="";return i+=`<feGaussianBlur${u("in","SourceAlpha")}${u("stdDeviation",r)}${u("result",`${t}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${u("in",`${t}_blurredAlpha`)}${u("result",`${t}_thresholdAlpha`)}><feFuncA${u("type","linear")}${u("slope",20)}${u("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${u("in",e)}${u("in2",`${t}_thresholdAlpha`)}${u("operator","in")}${u("result",t)}/>`,i}function _d(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=1-r;return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",i)}${u("result",t)}/>`}function Rd(n,e,t){let{red:r,green:i,blue:s}=n;if(r===1&&i===1&&s===1)return H(e,t);let o=`<feComponentTransfer${u("in",e)}${u("result",t)}>`;return o+=`<feFuncR${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,o+=`<feFuncG${u("type","linear")}${u("slope",i)}${u("intercept",0)}/>`,o+=`<feFuncB${u("type","linear")}${u("slope",s)}${u("intercept",0)}/>`,o+="</feComponentTransfer>",o}function Ad(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return i+=`<feFuncR${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+=`<feFuncG${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+=`<feFuncB${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Id(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=.5*(1-r),s=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return s+=`<feFuncR${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+=`<feFuncG${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+=`<feFuncB${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+="</feComponentTransfer>",s}function Md(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return i+=`<feFuncA${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Cd(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=r,s=1-r,o=`${i} ${s}`,a=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return a+=`<feFuncR${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function Dd(n,e,t){let{angle:r}=n;return r===0||r===360?H(e,t):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","hueRotate")}${u("values",r)}${u("result",t)}/>`}function Fd(n,e,t){let{amount:r}=n;return r===1?H(e,t):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",r)}${u("result",t)}/>`}function Ed(n,e,t){let{threshold:r}=n,i="";if(i+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_gray`)}/>`,r===.5)i+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,i+=`<feFuncR${u("type","discrete")}${u("tableValues","0 1")}/>`,i+=`<feFuncG${u("type","discrete")}${u("tableValues","0 1")}/>`,i+=`<feFuncB${u("type","discrete")}${u("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let o=[];for(let l=0;l<256;l++)o.push(l/255<r?0:1);let a=o.join(" ");i+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,i+=`<feFuncR${u("type","table")}${u("tableValues",a)}/>`,i+=`<feFuncG${u("type","table")}${u("tableValues",a)}/>`,i+=`<feFuncB${u("type","table")}${u("tableValues",a)}/>`,i+="</feComponentTransfer>"}return i}function Od(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=[.393,.769,.189,0,0],s=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],a=[1,0,0,0,0],l=[0,1,0,0,0],c=[0,0,1,0,0],f=(g,b)=>g.map(($,k)=>$*(1-r)+b[k]*r),d=f(a,i),p=f(l,s),m=f(c,o),h=[...d,...p,...m,0,0,0,1,0].join(" ");return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","matrix")}${u("values",h)}${u("result",t)}/>`}function Ld(n,e,t){let{shadowColor:r,highlightColor:i}=n,s=Dr(r),o=Dr(i),a="";return a+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_gray`)}/>`,a+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,a+=`<feFuncR${u("type","table")}${u("tableValues",`${s.r} ${o.r}`)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",`${s.g} ${o.g}`)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",`${s.b} ${o.b}`)}/>`,a+="</feComponentTransfer>",a}function Nd(n,e,t){let{intensity:r}=n;if(r===0)return H(e,t);let i="";i+=`<feComponentTransfer${u("in",e)}${u("result",`${t}_invert`)}>`,i+=`<feFuncR${u("type","table")}${u("tableValues","1 0")}/>`,i+=`<feFuncG${u("type","table")}${u("tableValues","1 0")}/>`,i+=`<feFuncB${u("type","table")}${u("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${u("in",`${t}_invert`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_gray`)}/>`;let s=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],a=[.5,.5,.8,0,0],l=[1,0,0,0,0],c=[0,1,0,0,0],f=[0,0,1,0,0],d=(b,$)=>b.map((k,S)=>k*(1-r)+$[S]*r),p=d(l,s),m=d(c,o),h=d(f,a),g=[...p,...m,...h,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${u("in",`${t}_gray`)}${u("type","matrix")}${u("values",g)}${u("result",t)}/>`,i}function Bd(n,e,t){let{amount:r,scale:i}=n;if(r===0)return H(e,t);let s=1/i,o="";return o+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",s)}${u("numOctaves",3)}${u("seed",0)}${u("result",`${t}_noise`)}/>`,o+=`<feColorMatrix${u("in",`${t}_noise`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_noiseGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${t}_noiseGray`)}${u("mode","overlay")}${u("result",`${t}_blended`)}/>`,o+=`<feComposite${u("in",`${t}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",r)}${u("k3",1-r)}${u("k4",0)}${u("result",`${t}_amt`)}/>`,o+=`<feComposite${u("in",`${t}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,o}function zd(n,e,t){let{strength:r,angle:i}=n;if(r===0)return H(e,t);let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=r,c=[-(l*(o+a)),-(l*a),l*(-o+a),-(l*o),1,l*o,l*(o-a),l*a,l*(o+a)].join(" ");return`<feConvolveMatrix${u("in",e)}${u("order","3 3")}${u("kernelMatrix",c)}${u("divisor",1)}${u("bias",.5)}${u("preserveAlpha","true")}${u("result",t)}/>`}function Gd(n,e,t){let{amount:r,size:i}=n;if(r===0)return H(e,t);let s=.5/i,o="";return o+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",`${s} ${s}`)}${u("numOctaves",5)}${u("seed",0)}${u("stitchTiles","stitch")}${u("result",`${t}_grain`)}/>`,o+=`<feColorMatrix${u("in",`${t}_grain`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_grainGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${t}_grainGray`)}${u("mode","soft-light")}${u("result",`${t}_blended`)}/>`,o+=`<feComposite${u("in",`${t}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",r)}${u("k3",1-r)}${u("k4",0)}${u("result",`${t}_amt`)}/>`,o+=`<feComposite${u("in",`${t}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,o}function Vd(n,e,t){let{wetness:r,turbulence:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.02+i*.03)}${u("numOctaves",4)}${u("seed",42)}${u("result",`${t}_turb`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_turb`)}${u("scale",r*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${t}_disp`)}${u("stdDeviation",r*2)}${u("result",`${t}_blur`)}/>`,s+=`<feBlend${u("in",`${t}_blur`)}${u("in2",e)}${u("mode","multiply")}${u("result",t)}/>`,s}function Ud(n,e,t){let{thickness:r,texture:i}=n;if(r===0&&i===0)return H(e,t);let s="";s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.03+i*.02)}${u("numOctaves",3)}${u("seed",1e3)}${u("result",`${t}_brush`)}/>`;let o=Math.max(3,8-Math.floor(r*5)),a=Array.from({length:o+1},(l,c)=>c/o).join(" ");s+=`<feComponentTransfer${u("in",e)}${u("result",`${t}_poster`)}>`;for(let l of["R","G","B"])s+=`<feFunc${l}${u("type","discrete")}${u("tableValues",a)}/>`;return s+="</feComponentTransfer>",s+=`<feDisplacementMap${u("in",`${t}_poster`)}${u("in2",`${t}_brush`)}${u("scale",i*4)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feMorphology${u("in",`${t}_disp`)}${u("operator","dilate")}${u("radius",r*.5)}${u("result",`${t}_thick`)}/>`,s+=`<feComposite${u("in",`${t}_thick`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,s}function Wd(n,e,t){let{spread:r,edges:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.01+i*.02)}${u("numOctaves",5)}${u("seed",1100)}${u("result",`${t}_ink`)}/>`,s+=`<feMorphology${u("in",e)}${u("operator","dilate")}${u("radius",r*3)}${u("result",`${t}_dilate`)}/>`,s+=`<feDisplacementMap${u("in",`${t}_dilate`)}${u("in2",`${t}_ink`)}${u("scale",i*10)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${t}_disp`)}${u("stdDeviation",r*.5)}${u("result",t)}/>`,s}function Hd(n,e,t){let{wrinkles:r,shine:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.02)}${u("numOctaves",4)}${u("seed",1200)}${u("result",`${t}_wrinkle`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_wrinkle`)}${u("scale",r*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feSpecularLighting${u("in",`${t}_wrinkle`)}${u("surfaceScale",r*2)}${u("specularConstant",i*1.5)}${u("specularExponent",20)}${u("result",`${t}_sheen`)}>`,s+=`<feDistantLight${u("azimuth",45)}${u("elevation",60)}/>`,s+="</feSpecularLighting>",s+=`<feBlend${u("in",`${t}_disp`)}${u("in2",`${t}_sheen`)}${u("mode","screen")}${u("result",`${t}_blend`)}/>`,s+=`<feComposite${u("in",`${t}_blend`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,s}function jd(n,e,t){let{density:r,size:i}=n;if(r===0)return H(e,t);let s="",o=1-r;s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.1/i)}${u("numOctaves",1)}${u("seed",1400)}${u("result",`${t}_hole`)}/>`,s+=`<feComponentTransfer${u("in",`${t}_hole`)}${u("result",`${t}_thresh`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${u("type","linear")}${u("slope",10)}${u("intercept",-o*10+5)}/>`;s+="</feComponentTransfer>",s+=`<feComponentTransfer${u("in",`${t}_thresh`)}${u("result",`${t}_clamp`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${u("type","table")}${u("tableValues","0 0 1 1")}/>`;return s+="</feComponentTransfer>",s+=`<feComposite${u("in",e)}${u("in2",`${t}_clamp`)}${u("operator","in")}${u("result",t)}/>`,s}function Kd(n,e,t){let{color:r,radius:i,intensity:s}=n;if(s===0||i===0)return H(e,t);let{r:o,g:a,b:l}=Dr(r),c="";return c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${t}_alpha`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_alpha`)}${u("stdDeviation",i/2)}${u("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${t}_blur`)}${u("type","matrix")}${u("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${s} 0`)}${u("result",`${t}_color`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_color`)}/><feMergeNode${u("in",e)}/></feMerge>`,c}function Xd(n,e,t){let{color:r,radius:i,intensity:s}=n;if(s===0||i===0)return H(e,t);let{r:o,g:a,b:l}=Dr(r),c="";return c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${t}_alpha`)}/>`,c+=`<feMorphology${u("in",`${t}_alpha`)}${u("operator","erode")}${u("radius",i/4)}${u("result",`${t}_erode`)}/>`,c+=`<feComposite${u("in",`${t}_alpha`)}${u("in2",`${t}_erode`)}${u("operator","out")}${u("result",`${t}_edge`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_edge`)}${u("stdDeviation",i/3)}${u("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${t}_blur`)}${u("type","matrix")}${u("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${s*2} 0`)}${u("result",`${t}_color`)}/>`,c+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_alpha`)}${u("operator","in")}${u("result",`${t}_clipped`)}/>`,c+=`<feComposite${u("in",`${t}_clipped`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`,c}function H(n,e){return`<feMerge${u("result",e)}><feMergeNode${u("in",n)}/></feMerge>`}function Fr(n){switch(n.type){case"feBlend":return Yd(n);case"feColorMatrix":return qd(n);case"feComponentTransfer":return Zd(n);case"feComposite":return Jd(n);case"feConvolveMatrix":return Qd(n);case"feDiffuseLighting":return ef(n);case"feSpecularLighting":return tf(n);case"feDisplacementMap":return nf(n);case"feDropShadow":return rf(n);case"feFlood":return sf(n);case"feGaussianBlur":return af(n);case"feImage":return of(n);case"feMerge":return lf(n);case"feMorphology":return uf(n);case"feOffset":return cf(n);case"feTile":return df(n);case"feTurbulence":return ff(n)}}function ue(n){let e="";if(e+=u("in",n.in),e+=u("x",n.x),e+=u("y",n.y),e+=u("width",n.width),e+=u("height",n.height),e+=u("color-interpolation-filters",n.colorInterpolationFilters),e+=u("result",n.result),n.unknownAttrs){let t=Object.keys(n.unknownAttrs).sort();for(let r of t)e+=u(r,n.unknownAttrs[r])}return e}function ce(n){return n.animations&&n.animations.length>0?n.animations.join(""):""}function Yd(n){let e=`<feBlend${ue(n)}${u("in2",n.in2)}${u("mode",n.mode)}`;n.noComposite&&(e+=' no-composite="no-composite"');let t=ce(n);return t?`${e}>${t}</feBlend>`:`${e}/>`}function qd(n){let e=`<feColorMatrix${ue(n)}${u("type",n.matrixType)}${u("values",n.values)}`,t=ce(n);return t?`${e}>${t}</feColorMatrix>`:`${e}/>`}function Cr(n,e){if(!e)return"";let t=`feFunc${n}`;switch(e.type){case"identity":return`<${t} type="identity"/>`;case"table":case"discrete":return`<${t} type="${e.type}"${u("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${t} type="linear"${u("slope",e.slope)}${u("intercept",e.intercept)}/>`;case"gamma":return`<${t} type="gamma"${u("amplitude",e.amplitude)}${u("exponent",e.exponent)}${u("offset",e.offset)}/>`}}function Zd(n){let e="";return e+=Cr("R",n.funcR),e+=Cr("G",n.funcG),e+=Cr("B",n.funcB),e+=Cr("A",n.funcA),e+=ce(n),`<feComponentTransfer${ue(n)}>${e}</feComponentTransfer>`}function Jd(n){let e=`<feComposite${ue(n)}${u("in2",n.in2)}${u("operator",n.operator)}`;n.operator==="arithmetic"&&(e+=u("k1",n.k1),e+=u("k2",n.k2),e+=u("k3",n.k3),e+=u("k4",n.k4));let t=ce(n);return t?`${e}>${t}</feComposite>`:`${e}/>`}function Qd(n){let e=`<feConvolveMatrix${ue(n)}`;e+=u("order",n.order),e+=u("kernelMatrix",n.kernelMatrix),e+=u("divisor",n.divisor),e+=u("bias",n.bias),e+=u("targetX",n.targetX),e+=u("targetY",n.targetY),e+=u("edgeMode",n.edgeMode),e+=u("kernelUnitLength",n.kernelUnitLength),n.preserveAlpha!==void 0&&(e+=u("preserveAlpha",n.preserveAlpha?"true":"false"));let t=ce(n);return t?`${e}>${t}</feConvolveMatrix>`:`${e}/>`}function dl(n){switch(n.kind){case"feDistantLight":return`<feDistantLight${u("azimuth",n.azimuth)}${u("elevation",n.elevation)}/>`;case"fePointLight":return`<fePointLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}${u("pointsAtX",n.pointsAtX)}${u("pointsAtY",n.pointsAtY)}${u("pointsAtZ",n.pointsAtZ)}`;return e+=u("specularExponent",n.specularExponent),e+=u("limitingConeAngle",n.limitingConeAngle),e+"/>"}}}function ef(n){let e=`<feDiffuseLighting${ue(n)}`;e+=u("surfaceScale",n.surfaceScale),e+=u("diffuseConstant",n.diffuseConstant),e+=u("kernelUnitLength",n.kernelUnitLength),e+=u("lighting-color",n.lightingColor);let t="";return n.lightSource&&(t+=dl(n.lightSource)),t+=ce(n),`${e}>${t}</feDiffuseLighting>`}function tf(n){let e=`<feSpecularLighting${ue(n)}`;e+=u("surfaceScale",n.surfaceScale),e+=u("specularConstant",n.specularConstant),e+=u("specularExponent",n.specularExponent),e+=u("kernelUnitLength",n.kernelUnitLength),e+=u("lighting-color",n.lightingColor);let t="";return n.lightSource&&(t+=dl(n.lightSource)),t+=ce(n),`${e}>${t}</feSpecularLighting>`}function nf(n){let e=`<feDisplacementMap${ue(n)}`;e+=u("in2",n.in2),e+=u("scale",n.scale),e+=u("xChannelSelector",n.xChannelSelector),e+=u("yChannelSelector",n.yChannelSelector);let t=ce(n);return t?`${e}>${t}</feDisplacementMap>`:`${e}/>`}function rf(n){let e=`<feDropShadow${ue(n)}`;e+=u("dx",n.dx),e+=u("dy",n.dy),e+=u("stdDeviation",n.stdDeviation),e+=u("flood-color",n.floodColor),e+=u("flood-opacity",n.floodOpacity);let t=ce(n);return t?`${e}>${t}</feDropShadow>`:`${e}/>`}function sf(n){let e=`<feFlood${ue(n)}${u("flood-color",n.floodColor)}${u("flood-opacity",n.floodOpacity)}`,t=ce(n);return t?`${e}>${t}</feFlood>`:`${e}/>`}function af(n){let e=`<feGaussianBlur${ue(n)}${u("stdDeviation",n.stdDeviation)}${u("edgeMode",n.edgeMode)}`,t=ce(n);return t?`${e}>${t}</feGaussianBlur>`:`${e}/>`}function of(n){let e=`<feImage${ue(n)}`;n.href!==void 0?e+=u("href",n.href):n.xlinkHref!==void 0&&(e+=u("xlink:href",n.xlinkHref)),e+=u("preserveAspectRatio",n.preserveAspectRatio),e+=u("crossorigin",n.crossorigin);let t=ce(n);return t?`${e}>${t}</feImage>`:`${e}/>`}function lf(n){let e="";for(let t of n.nodes)e+=`<feMergeNode${u("in",t.in)}/>`;return e+=ce(n),`<feMerge${ue(n)}>${e}</feMerge>`}function uf(n){let e=`<feMorphology${ue(n)}${u("operator",n.operator)}${u("radius",n.radius)}`,t=ce(n);return t?`${e}>${t}</feMorphology>`:`${e}/>`}function cf(n){let e=`<feOffset${ue(n)}${u("dx",n.dx)}${u("dy",n.dy)}`,t=ce(n);return t?`${e}>${t}</feOffset>`:`${e}/>`}function df(n){let e=`<feTile${ue(n)}`,t=ce(n);return t?`${e}>${t}</feTile>`:`${e}/>`}function ff(n){let e=`<feTurbulence${ue(n)}`;e+=u("baseFrequency",n.baseFrequency),e+=u("numOctaves",n.numOctaves),e+=u("seed",n.seed),e+=u("stitchTiles",n.stitchTiles),e+=u("type",n.turbulenceType);let t=ce(n);return t?`${e}>${t}</feTurbulence>`:`${e}/>`}function Fs(n,e){let t=`<filter${u("id",n)}`;t+=u("x",e.x),t+=u("y",e.y),t+=u("width",e.width),t+=u("height",e.height),t+=u("filterUnits",e.filterUnits),t+=u("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(t+=u("color-interpolation-filters",e.filterColorInterpolation)),t+=u("flood-color",e.floodColor),t+=u("flood-opacity",e.floodOpacity),t+=u("lighting-color",e.lightingColor),t+=">",e.filterTitle&&(t+=`<title>${Y(e.filterTitle)}</title>`),e.filterDescription&&(t+=`<desc>${Y(e.filterDescription)}</desc>`);for(let r of e.primitives)t+=Fr(r);if(e.filterAnimations)for(let r of e.filterAnimations)t+=r;return t+="</filter>",t}function Es(n,e,t,r){switch(n.type){case"drop-shadow":return pd(n,e,t);case"inner-shadow":return md(n,e,t);case"gaussian-blur":return hd(n,e,t);case"motion-blur":return gd(n,e,t);case"point-light":{let i=n;return ll(r?{...i,x:i.x+r.x,y:i.y+r.y}:i,e,t)}case"spot-light":{let i=n;return ul(r?{...i,x:i.x+r.x,y:i.y+r.y,pointsAtX:i.pointsAtX+r.x,pointsAtY:i.pointsAtY+r.y}:i,e,t)}case"diffuse-lighting":return yd(n,e,t);case"specular-lighting":return bd(n,e,t);case"outline":return Sd(n,e,t);case"sharpen":return xd(n,e,t);case"pixelate":return $d(n,e,t);case"warp":return vd(n,e,t);case"morphology":return kd(n,e,t);case"contouring-discrete":return Td(n,e,t);case"contouring-table":return wd(n,e,t);case"round-edges":return Pd(n,e,t);case"grayscale":return _d(n,e,t);case"channel-painter":return Rd(n,e,t);case"brightness":return Ad(n,e,t);case"contrast":return Id(n,e,t);case"opacity":return Md(n,e,t);case"invert":return Cd(n,e,t);case"hue-rotate":return Dd(n,e,t);case"saturate":return Fd(n,e,t);case"black-and-white":return Ed(n,e,t);case"sepia":return Od(n,e,t);case"duotone":return Ld(n,e,t);case"xray":return Nd(n,e,t);case"noise":return Bd(n,e,t);case"emboss":return zd(n,e,t);case"film-grain":return Gd(n,e,t);case"watercolor":return Vd(n,e,t);case"gouache":return Ud(n,e,t);case"ink-blot":return Wd(n,e,t);case"crumpled-plastic":return Hd(n,e,t);case"riddled":return jd(n,e,t);case"glow":return Kd(n,e,t);case"inner-glow":return Xd(n,e,t);case"raw-svg":return n.svgContent;case"svg-primitive-chain":return n.primitives.map(Fr).join("");default:return H(e,t)}}function pf(n){return n.some(e=>e.type==="gaussian-blur"||e.type==="motion-blur"||e.type==="drop-shadow"||e.type==="inner-shadow"||e.type==="glow"||e.type==="inner-glow"||e.type==="outline"||e.type==="morphology"||e.type==="warp"||e.type==="svg-primitive-chain"&&e.primitives.some(t=>t.type==="feGaussianBlur"||t.type==="feDropShadow"||t.type==="feOffset"||t.type==="feMorphology"||t.type==="feDisplacementMap"||t.type==="feTurbulence"))}function Os(n,e,t={}){let r=e.filter(x=>x.enabled);if(r.length===0)return"";let i=t.colorInterpolation&&t.colorInterpolation!=="auto"?u("color-interpolation-filters",t.colorInterpolation):"",s=r.find(x=>x.type==="raw-svg");if(s){let x=t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:s.colorInterpolationFilters,v=t.filterUnits??s.filterUnits,w=t.primitiveUnits??s.primitiveUnits,T=t.x??s.x,P=t.y??s.y,R=t.width??s.width,M=t.height??s.height;return`<filter${u("id",n)}${u("x",T)}${u("y",P)}${u("width",R)}${u("height",M)}${u("filterUnits",v)}${u("primitiveUnits",w)}${u("color-interpolation-filters",x)}${u("flood-color",s.floodColor)}${u("flood-opacity",s.floodOpacity)}${u("lighting-color",s.lightingColor)}${u("display",s.display)}>${s.svgContent}</filter>`}let o=r.find(x=>x.type==="svg-primitive-chain");if(o){let x={...o,x:t.x??o.x,y:t.y??o.y,width:t.width??o.width,height:t.height??o.height,filterUnits:t.filterUnits??o.filterUnits,primitiveUnits:t.primitiveUnits??o.primitiveUnits,filterColorInterpolation:t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:o.filterColorInterpolation};return Fs(n,x)}let a=r.some(x=>x.type==="gaussian-blur"&&x.quality==="high"||x.type==="motion-blur"&&x.quality==="high"),l=pf(r),c=l?a?"-200%":"-100%":"-10%",f=l?a?"500%":"300%":"120%",d="",p="SourceGraphic",m=0;for(let x of r){let v=`result${m++}`;d+=Es(x,p,v),p=v}let h=t.filterUnits??"objectBoundingBox",g=t.primitiveUnits??"userSpaceOnUse",b=t.x??c,$=t.y??c,k=t.width??f,S=t.height??f;return`<filter${u("id",n)}${u("x",b)}${u("y",$)}${u("width",k)}${u("height",S)}${u("filterUnits",h)}${u("primitiveUnits",g)}${i}>${d}</filter>`}function fl(n){let e="",t=new Set;for(let r of n){let i=r.state.filters;if(!i||i.length===0)continue;let s=i.filter(c=>c.enabled);if(s.length===0)continue;let o=r.state.filterLibraryIds,a=Array.isArray(o)&&o.length>0?o[0]:`filter-${r.id}`;if(t.has(a))continue;t.add(a);let l=r.state;e+=Os(a,s,{colorInterpolation:l.filterColorInterpolation,filterUnits:l.filterUnits,primitiveUnits:l.primitiveUnits,x:l.filterX,y:l.filterY,width:l.filterWidth,height:l.filterHeight})}return e}function Er(n,e,t){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(t)&&t.length>0?` filter="${t.map(s=>`url(#${Y(s)})`).join(" ")}"`:` filter="url(#filter-${Y(n)})"`}function mf(n){if(n instanceof Map)return n;let e=new Map;for(let t of n)e.set(t.id,t);return e}function hf(n){if(n.kind==="marker")return n.shapes;if(n.kind!=="symbol")return[];if(!n.variants)return n.shapes;let e=[...n.shapes];for(let t of Object.values(n.variants))e.push(...t);return e}function pl(n,e,t,r){let i=mf(t),s=new Set,o=[],a=[],l=d=>{if(typeof d!="string"||!d||s.has(d))return;let p=i.get(d);p&&(p.kind!=="symbol"&&p.kind!=="marker"||(s.add(d),o.push(p)))},c=d=>{a.push(d)},f=d=>{let p=d.state;if(!p)return;l(p.symbolId),l(p.markerStart),l(p.markerMid),l(p.markerEnd);let m=p.children;if(Array.isArray(m))for(let g of m)c(g);let h=p.symbolOverrides;if(h&&typeof h=="object"&&!Array.isArray(h))for(let[g,b]of Object.entries(h))!b||typeof b!="object"||Array.isArray(b)||c({id:g,type:"symbol-override",state:b})};for(let d of n)c(d);for(let d of e)l(d);for(;;){let d=a.shift();if(d){r(d),f(d);continue}let p=o.shift();if(!p)break;for(let m of hf(p))c(m)}}var gf=[],yf=[];function gn(n,e,t){pl(n,yf,e,t)}function ml(n,e,t){pl(gf,n,e,t)}function hl(n,e){if(!n)return;let t=n,r=t.markerStart;typeof r=="string"&&r&&e(r);let i=t.markerMid;typeof i=="string"&&i&&e(i);let s=t.markerEnd;typeof s=="string"&&s&&e(s);let o=t.startEndpoint;typeof o=="string"&&o&&o!=="none"&&e(hn(o));let a=t.endEndpoint;typeof a=="string"&&a&&a!=="none"&&e(hn(a))}function hn(n){return`line-marker-${n}`}function gl(n,e,t){if(!n)return;let r=n,i=o=>{typeof o=="string"&&o&&t(o)};i(r.fillLibraryId),i(r.strokeLibraryId),i(r.markerStart),i(r.markerMid),i(r.markerEnd),i(r.symbolId);let s=r.filterLibraryIds;if(Array.isArray(s)&&s.length>0)for(let o of s)i(o);else Array.isArray(r.filters)&&r.filters.length>0&&t(`filter-${e}`);r.fillLibraryId||i(r.fillGradient?.id),r.strokeLibraryId||i(r.strokeGradient?.id)}function yn(n,e=[]){let t=new Set,r=new Set;return gn(n,e,i=>{let s=i.state;if(!s)return;typeof s.markerStart=="string"&&s.markerStart&&t.add(s.markerStart),typeof s.markerMid=="string"&&s.markerMid&&t.add(s.markerMid),typeof s.markerEnd=="string"&&s.markerEnd&&t.add(s.markerEnd);let o=s.startEndpoint,a=s.endEndpoint;typeof o=="string"&&o&&o!=="none"&&r.add(o),typeof a=="string"&&a&&a!=="none"&&r.add(a)}),{ids:t,legacyEndpoints:r}}function yl(n,e){let{ids:t,legacyEndpoints:r}=yn(n,e);for(let i of r)t.add(hn(i));return t}function bn(n,e,t,r){let i=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/10);switch(n){case"stripes":return[{tag:"rect",attrs:{width:r?.strokeWidth!=null?Math.max(.01,Math.min(1,r.strokeWidth))*e:e/2,height:e,fill:t}}];case"dots":{let s=r?.dotRadius!=null?Math.max(.05,Math.min(.45,r.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*s,fill:t}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:t,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:t}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:t}}];case"diagonal":{let s=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:t,"stroke-width":s}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:t,"stroke-width":i}}];case"zigzag":{let s=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.amplitude)):.25,o=e*s;return[{tag:"path",attrs:{d:`M 0 ${o} L ${e/4} 0 L ${e/2} ${o} L ${e*3/4} 0 L ${e} ${o}`,fill:"none",stroke:t,"stroke-width":i}}]}case"waves":{let s=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.amplitude)):.25,o=e*s,a=e/2;return[{tag:"path",attrs:{d:`M 0 ${a} Q ${e/4} ${a-o} ${e/2} ${a} T ${e} ${a}`,fill:"none",stroke:t,"stroke-width":i}}]}case"triangles":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${s} L 0 ${s} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"hexagons":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${s*.5} L ${e*.75} ${s} L ${e*.25} ${s} L 0 ${s*.5} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:t,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:t,"stroke-width":i}}];case"bricks":{let s=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":s}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":s}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":s}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${e/2} ${e/2} L 0 ${e} M ${e/2} ${e/2} L ${e} 0 M ${e/2} ${e/2} L ${e} ${e}`,fill:"none",stroke:t,"stroke-width":i}}];default:return[]}}function bf(n){let e=Object.entries(n.attrs).map(([t,r])=>` ${t}="${r}"`).join("");return`<${n.tag}${e}/>`}function Or(n,e,t,r,i){let s=10*e,o="";o+=`<rect width="${s}" height="${s}" fill="${r}"/>`;let a=bn(n,s,t,i);for(let l of a)o+=bf(l);return{svgContent:o,width:s,height:s}}var Sn="0 0 10 10",Lr=6,Nr=6;function pt(){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 Ls={"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"},Sf={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function bl(){return pt().map(n=>{let e=Ls[n.id]??n.id;return{kind:"marker",id:e,name:Sf[e]??e,viewBox:Sn,refX:n.refX,refY:n.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function xf(n){return n.replace(/[^a-zA-Z0-9_-]/g,"_")}function $f(n){let e=n.state.symbolOverrides;return!!e&&Object.keys(e).length>0}function Ct(n){let e=n.state.symbolId??"",t=n.state.variantKey??"";return $f(n)?`${e}--ovr-${n.id}`:t?`${e}--${xf(t)}`:e}function Br(n,e){let t=e.state.variantKey??"",r=t?n.variants?.[t]??n.shapes:n.shapes,i=e.state.symbolOverrides;return!i||Object.keys(i).length===0?r:r.map(s=>{let o=i[s.id];return!o||Object.keys(o).length===0?s:{...s,state:{...s.state,...o}}})}function xn(n,e){switch(e){case"uppercase":return n.toLocaleUpperCase();case"lowercase":return n.toLocaleLowerCase();case"capitalize":return n.replace(/\b\p{L}/gu,t=>t.toLocaleUpperCase());default:return n}}var vf=[["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 Dt(n){return vf.map(([e,t])=>{let r=n[e],i=typeof r=="string"?r.trim():"";return i?`${t}: ${i}`:""}).filter(Boolean).join("; ")}function zr(n,e){let t=[],r=(a,l)=>{l!==""&&t.push({name:a,value:l})};n.fontFamily!==e.fontFamily&&r("font-family",String(n.fontFamily)),n.fontSize!==e.fontSize&&r("font-size",String(n.fontSize)),n.fontWeight!==e.fontWeight&&r("font-weight",String(n.fontWeight)),n.fontStyle!==e.fontStyle&&r("font-style",String(n.fontStyle));let i=Dt(n);i&&i!==Dt(e)&&r("style",i);let s=n.textDecoration,o=e.textDecoration;if(s.underline!==o.underline||s.strikethrough!==o.strikethrough||s.overline!==o.overline){let a=[];s.underline&&a.push("underline"),s.strikethrough&&a.push("line-through"),s.overline&&a.push("overline"),r("text-decoration",a.join(" "))}if(n.baselineShift!==e.baselineShift){let a=n.baselineShift;a==="super"||a==="sub"?r("baseline-shift",a):typeof a=="number"&&r("baseline-shift",`${a}px`)}return n.letterSpacing!==e.letterSpacing&&r("letter-spacing",String(n.letterSpacing)),n.fill!==e.fill&&r("fill",String(n.fill)),n.fillOpacity!==e.fillOpacity&&r("fill-opacity",String(n.fillOpacity)),n.direction!==e.direction&&r("direction",String(n.direction)),n.unicodeBidi!==e.unicodeBidi&&r("unicode-bidi",String(n.unicodeBidi)),t}function y(n,e){return e==null||e===""?"":` ${n}="${Y(String(e))}"`}function Ft(n,e){return e==null?"":` ${n}="${Y(e)}"`}function kf(n){let e=n.map(t=>(t??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?y("style",e):""}function Tf(n,e){return typeof e=="number"&&e>0?`${n}: ${e}px`:""}function wf(n){if(n&&typeof n=="object"){let e=n;return"dx"in e?{x:typeof e.x=="number"?e.x:null,y:typeof e.y=="number"?e.y:null,dx:typeof e.dx=="number"?e.dx:0,dy:typeof e.dy=="number"?e.dy:0,rotate:typeof e.rotate=="number"?e.rotate:0}:{x:null,y:null,dx:typeof e.x=="number"?e.x:0,dy:typeof e.y=="number"?e.y:0,rotate:typeof e.rotate=="number"?e.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function Sl(n,e){let t=-1;for(let i=n.length-1;i>=0;i--)if(n[i][e]!==null){t=i;break}if(t<0)return[];let r=new Array(t+1);for(let i=0;i<=t;i++)r[i]=n[i][e]??0;return r}function xl(n,e){let t=-1;for(let i=n.length-1;i>=0;i--)if(n[i][e]!==0){t=i;break}if(t<0)return[];let r=new Array(t+1);for(let i=0;i<=t;i++)r[i]=n[i][e];return r}function Pf(n){if(n.length===0)return[];let e=n.length-1,t=n[e].rotate;for(;e>0&&n[e-1].rotate===t;)e--;if(e===0&&t===0)return[];let r=new Array(e+1);for(let i=0;i<=e;i++)r[i]=n[i].rotate;return r}function Me(n,e){return At(n,e)}function _f(n,e,t){return Ts(n,e,t)}function Rf(n){if(typeof n=="string"){let r=n.trim();return r.length>0?r:void 0}if(!n||typeof n!="object")return;let e=n,t=[];return e.underline&&t.push("underline"),e.strikethrough&&t.push("line-through"),e.overline&&t.push("overline"),t.length>0?t.join(" "):void 0}function Af(n){if(typeof n.strokeDasharray=="string")return n.strokeDasharray;let e=n.lineStyle??"solid",t=n.dashLength??8,r=n.gapLength??4;return Mt(e,t,r)}function Gr(n,e){let t=n[e];return t!==void 0?t:n.extra?.[e]}function If(n){let e=n.fillType;return e||(n.fillGradient?n.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":Gr(n,"linearGradient")?"linear-gradient":Gr(n,"radialGradient")?"radial-gradient":"solid")}function Mf(n){return n.fillGradient??Gr(n,"linearGradient")??Gr(n,"radialGradient")??void 0}function Ie(n,e){let t=y("data-shape-id",e),r=If(n),i=Mf(n);if(r==="none")t+=y("fill","none");else if(r==="linear-gradient"||r==="radial-gradient"){let w=n.fillLibraryId??i?.id;t+=y("fill",`url(#${w??`gradient-fill-${e}`})`)}else if(r==="pattern"){let w=n.fillLibraryId??i?.id;t+=y("fill",`url(#${w??`pattern-fill-${e}`})`)}else t+=y("fill",n.fillColor??"#000000");let s=n.opacity;s!==void 0&&s<1&&(t+=y("opacity",s));let o=n.fillOpacity;o!==void 0&&o<1&&(t+=y("fill-opacity",o));let a=n.fillRule;a&&a!=="nonzero"&&(t+=y("fill-rule",a));let l=n.strokeType??"solid",c=n.strokeGradient;if(l==="none")t+=y("stroke","none");else if(l==="linear-gradient"||l==="radial-gradient"){let w=n.strokeLibraryId??c?.id;t+=y("stroke",`url(#${w??`gradient-stroke-${e}`})`)}else if(l==="pattern"){let w=n.strokeLibraryId??c?.id;t+=y("stroke",`url(#${w??`pattern-stroke-${e}`})`)}else t+=y("stroke",n.borderColor??"none");let f=n.borderWidth;f!=null&&(t+=y("stroke-width",f));let d=n.strokeOpacity;d!==void 0&&d<1&&(t+=y("stroke-opacity",d));let p=n.paintOrder;p&&p!=="normal"&&(t+=y("paint-order",p));let m=n.markerStart,h=n.markerMid,g=n.markerEnd;m&&(t+=y("marker-start",`url(#${m})`)),h&&(t+=y("marker-mid",`url(#${h})`)),g&&(t+=y("marker-end",`url(#${g})`));let b=Af(n);b&&(t+=y("stroke-dasharray",b),!n.strokeDasharray&&n.lineStyle==="dotted"&&(t+=y("stroke-linecap","round")));let $=n.dashOffset;$!==void 0&&$!==0&&(t+=y("stroke-dashoffset",$));let k=n.shapeRendering;k&&k!=="auto"&&(t+=y("shape-rendering",k)),t+=Er(e,n.filters,n.filterLibraryIds),t+=Ft("systemLanguage",n.systemLanguage),t+=Ft("requiredExtensions",n.requiredExtensions);let S=n.vectorEffect;S&&S!=="none"&&(t+=y("vector-effect",S));let x=n.visibility;x&&x!=="visible"&&(t+=y("visibility",x));let v=n.metadata;return v&&(v.role&&(t+=y("role",v.role)),v.ariaLabel&&(t+=y("aria-label",v.ariaLabel))),t}function Ns(n){let e=n.metadata;if(!e)return"";let t="";return e.title&&(t+=`<title>${Y(e.title)}</title>`),e.description&&(t+=`<desc>${Y(e.description)}</desc>`),t}function Cf(n,e){let t=Ns(e);if(!t)return n;let r=n.lastIndexOf("/>");if(r===-1){let o=n.indexOf(">");return o===-1?n:n.slice(0,o+1)+t+n.slice(o+1)}let i=n.match(/^<(\w+)/),s=i?i[1]:"g";return n.slice(0,r)+">"+t+`</${s}>`}function Bs(n){let e="",t=n.startEndpoint,r=n.endEndpoint;return t&&t!=="none"&&(e+=y("marker-start",`url(#line-marker-${t})`)),r&&r!=="none"&&(e+=y("marker-end",`url(#line-marker-${r})`)),e}function zs(n){let e=n.state,t=e.x??0,r=e.y??0,i=e.radius??50,s=Me(e,{x:t,y:r});return`<circle${y("cx",t)}${y("cy",r)}${y("r",i)}${Ie(e,n.id)}${s?y("transform",s):""}/>`}function Gs(n){let e=n.state,t=e.cx??0,r=e.cy??0,i=e.rx??50,s=e.ry??30,o=e.pathLength,a=Me(e,{x:t,y:r});return`<ellipse${y("cx",t)}${y("cy",r)}${y("rx",i)}${y("ry",s)}${o!==void 0?y("pathLength",o):""}${Ie(e,n.id)}${a?y("transform",a):""}/>`}function Vs(n){let e=n.state,t=e,r=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100,a=e.cornerRadius??0,l=e.rx??a,c=e.ry??a,f=t.cornerShape??"round",d=t.cornerMode??"uniform",p={x:r+s/2,y:i+o/2},m=Me(e,p);if(f!=="round"||d==="non-uniform"){let h=Ar(r,i,s,o,a,f,d,d==="non-uniform"?{radiusTL:t.cornerRadiusTL,radiusTR:t.cornerRadiusTR,radiusBR:t.cornerRadiusBR,radiusBL:t.cornerRadiusBL,shapeTL:t.cornerShapeTL,shapeTR:t.cornerShapeTR,shapeBR:t.cornerShapeBR,shapeBL:t.cornerShapeBL}:void 0);if(h)return`<path${y("d",h)}${Ie(e,n.id)}${m?y("transform",m):""}/>`}return`<rect${y("x",r)}${y("y",i)}${y("width",s)}${y("height",o)}${l>0||c>0?`${y("rx",l)}${y("ry",c)}`:""}${Ie(e,n.id)}${m?y("transform",m):""}/>`}function Us(n){let e=n.state,t=e.x1??0,r=e.y1??0,i=e.x2??0,s=e.y2??0,o={x:(t+i)/2,y:(r+s)/2},a=Me(e,o),l={...e,fillType:"none"};return`<line${y("x1",t)}${y("y1",r)}${y("x2",i)}${y("y2",s)}${Ie(l,n.id)}${Bs(e)}${a?y("transform",a):""}/>`}function Ws(n){let e=n.state,t=e.x??0,r=e.y??0,i=xn(e.text??"",e.textTransform),s=e.fontSize??16,o=e.fontFamily??"sans-serif",a=e.fontWeight??"normal",l=e.fontStyle??"normal",c=e.textAnchor??"start",f=Rf(e.textDecoration),d=e.letterSpacing,p=e.wordSpacing,m=e.lineHeight??1.25,g=Me(e,{x:t,y:r}),b=y("x",t)+y("y",r);b+=y("font-size",s),b+=y("font-family",o),a!=="normal"&&(b+=y("font-weight",a)),l!=="normal"&&(b+=y("font-style",l)),c!=="start"&&(b+=y("text-anchor",c)),f&&(b+=y("text-decoration",f)),d&&(b+=y("letter-spacing",d)),p&&(b+=y("word-spacing",p));let $=e.baselineShift;$&&$!=="baseline"&&(b+=y("baseline-shift",$));let k=e.dominantBaseline;k&&k!=="auto"&&(b+=y("dominant-baseline",k));let S=e.writingMode;S&&S!=="horizontal-tb"&&(b+=y("writing-mode",S));let x=e.textLength;x!==void 0&&x>0&&(b+=y("textLength",x),e.lengthAdjust==="spacingAndGlyphs"&&(b+=y("lengthAdjust","spacingAndGlyphs")));let v=e.textDirection;v&&v!=="ltr"&&(b+=y("direction",v));let w=e.unicodeBidi;w&&w!=="normal"&&(b+=y("unicode-bidi",w));let T=e.shapeInsideRef;if(T){b+=y("shape-inside",`url(#${T})`);let D=e.shapePadding;D!==void 0&&(b+=y("shape-padding",D))}let P=Dt(e),R=e.fontVariationSettings,M="";if(R&&Object.keys(R).length>0&&(M=`font-variation-settings: ${Object.entries(R).map(([L,K])=>`'${L}' ${K}`).join(", ")}`),b+=kf([P,M,Tf("inline-size",e.inlineSize),typeof e.overflowWrap=="string"?`overflow-wrap: ${e.overflowWrap}`:"",typeof e.whiteSpace=="string"?`white-space: ${e.whiteSpace}`:"",typeof e.lineHeight=="number"?`line-height: ${e.lineHeight}`:""]),b+=Ie(e,n.id),g&&(b+=y("transform",g)),e.isTextPath&&e.textPathPoints){let D=e.textPathPoints,L=e.textPathStartOffset??0,K=e.textPathSide,C=`text-path-${n.id}`,re=e.textPathMethod,ee=e.textPathSpacing,Z=e.textPathLengthAdjust,me=e.textPathLength,q="";if(D.length>=2)if(K==="right"){let W=D[D.length-1];q=`M ${W.x} ${W.y}`;for(let fe=D.length-1;fe>0;fe--){let he=D[fe],Te=D[fe-1],ve=he.handleIn??he,gt=Te.handleOut??Te;q+=` C ${ve.x} ${ve.y}, ${gt.x} ${gt.y}, ${Te.x} ${Te.y}`}}else{q=`M ${D[0].x} ${D[0].y}`;for(let W=0;W<D.length-1;W++){let fe=D[W],he=D[W+1],Te=fe.handleOut??fe,ve=he.handleIn??he;q+=` C ${Te.x} ${Te.y}, ${ve.x} ${ve.y}, ${he.x} ${he.y}`}}return`<defs><path id="${Y(C)}"${y("d",q)} fill="none"/></defs><text${b}><textPath href="#${Y(C)}"${y("startOffset",`${L}%`)}${y("method",re)}${y("spacing",ee)}${y("lengthAdjust",Z)}${y("textLength",me)}>${Y(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let D=e.charOffsets.map(wf),L=i.split(`
12
- `),K=e.linePositions??[],C=s*m,re="",ee=0;return L.forEach((Z,me)=>{let q=Array.from(Z).length,W=D.slice(ee,ee+q),fe=K[me],he=fe?t+fe.x:me>0?t:NaN,Te=fe?fe.dy:me>0?C:NaN,ve="",gt=Sl(W,"x");if(Number.isFinite(he)||gt.length>0){let Hi=gt.length>0?gt.slice():[];Number.isFinite(he)&&(Hi[0]=Hi[0]??he),ve+=y("x",Hi.join(" "))}let wa=Sl(W,"y");wa.length>0&&(ve+=y("y",wa.join(" ")));let Pa=xl(W,"dx");Pa.length>0&&(ve+=y("dx",Pa.join(" ")));let _a=xl(W,"dy"),je=_a.length>0||Number.isFinite(Te)?_a.slice():[];for(Number.isFinite(Te)&&(je[0]=(je[0]??0)+Te);je.length>0&&je[je.length-1]===0;)je.pop();je.length>0&&(ve+=y("dy",je.join(" ")));let Ra=Pf(W);Ra.length>0&&(ve+=y("rotate",Ra.join(" "))),re+=`<tspan${ve}>${Y(Z)}</tspan>`,ee+=q+1}),`<text${b}>${re}</text>`}let B=Zn(e);if(B){let D=Ve(B),L=e.linePositions,K=s*D.lineHeight,C="";return D.lines.forEach((re,ee)=>{re.segments.forEach((Z,me)=>{let q="";if(me===0){let W=L?.[ee];W?((Math.abs(W.x)>.001||ee>0)&&(q+=y("x",t+W.x)),(Math.abs(W.dy)>.001||ee>0)&&(q+=y("dy",W.dy))):ee>0&&(q+=y("x",t),q+=y("dy",`${K}px`))}for(let{name:W,value:fe}of zr(Z.style,D.baseStyle))q+=y(W,fe);q+=' xml:space="preserve"',C+=`<tspan${q}>${Y(xn(Z.text,Z.style.textTransform))}</tspan>`})}),`<text${b}>${C}</text>`}return`<text${b}>${Y(i)}</text>`}function Hs(n){let e=n.state,t=e.pathPoints??[],r=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,s=e.pathTension??.5,o=e.pathArcParams,a=qe(t,r,i,s,o),l=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,c=l?Me(e,l):null;return`<path${y("d",a)}${Ie(e,n.id)}${Bs(e)}${c?y("transform",c):""}/>`}function js(n){let e=n.state,t=e.polylinePoints??[],r=e.polylineClosed??!1,i=t.map(l=>`${l.x},${l.y}`).join(" "),s=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,o=s?Me(e,s):null;return`<${r?"polygon":"polyline"}${y("points",i)}${Ie(e,n.id)}${Bs(e)}${o?y("transform",o):""}/>`}function Ks(n){let e=n.state,t=e.x??0,r=e.y??0,i=e.width??100,s=e.height??100,o=e.href??"",a=e.imageOpacity,l=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:t+i/2,y:r+s/2},f=Me(e,c);return`<image${y("x",t)}${y("y",r)}${y("width",i)}${y("height",s)}${y("href",o)}${y("preserveAspectRatio",l)}${a!==void 0&&a<1?y("opacity",a):""}${Ie(e,n.id)}${f?y("transform",f):""}/>`}function Vr(n){return!n||n.length===0?"":n.map(e=>de(e)).join("")}function $l(n){let e=n.state,t="",r=Me(e);r&&(t+=y("transform",r));let i=e.opacity;i!==void 0&&i<1&&(t+=y("opacity",i));let s=e.metadata;s&&(s.role&&(t+=y("role",s.role)),s.ariaLabel&&(t+=y("aria-label",s.ariaLabel)));let o=e.containerPresentation;if(o)for(let[l,c]of Object.entries(o))/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(l)&&(t+=` ${l}="${Y(c)}"`);let a=e.authoredAttributes;if(a)for(let[l,c]of Object.entries(a))c===null||!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(l)||(t+=` ${l}="${Y(c)}"`);return t}function Df(n){let e=n.state,t=e.href,r=e.hrefXlink,i="<a";return t!==void 0&&(i+=y("href",t)),r!==void 0&&(i+=y("xlink:href",r)),i+=y("target",e.linkTarget),i+=y("rel",e.linkRel),e.linkDownload===""?i+=' download=""':i+=y("download",e.linkDownload),i+=y("ping",e.linkPing),i+=y("hreflang",e.linkHreflang),i+=y("type",e.linkType),i+=y("referrerpolicy",e.linkReferrerPolicy),i+=$l(n),i+=y("data-shape-id",n.id),i+=">",i+=Ns(e),i+=Vr(e.children),i+="</a>",i}function Ff(n){let e=n.state,t="<switch";return t+=Ft("systemLanguage",e.switchSystemLanguage),t+=Ft("requiredExtensions",e.switchRequiredExtensions),t+=$l(n),t+=y("data-shape-id",n.id),t+=">",t+=Ns(e),t+=Vr(e.children),t+="</switch>",t}function Ef(n){let e=n.state,t=Me(e),r="<g";return r+=y("data-shape-id",n.id),t&&(r+=y("transform",t)),e.opacity!==void 0&&e.opacity<1&&(r+=y("opacity",e.opacity)),e.visibility&&(r+=y("visibility",e.visibility)),e.blendMode&&(r+=y("style",`mix-blend-mode:${e.blendMode}`)),r+=">",r+=Vr(e.children),r+="</g>",r}function Of(n){let e=n.state,t=e.viewBoxX,r=e.viewBoxY,i=e.viewBoxWidth,s=e.viewBoxHeight,o=t!==void 0&&r!==void 0&&i!==void 0&&s!==void 0?`${t} ${r} ${i} ${s}`:void 0,a="<view";return a+=y("id",n.id),a+=y("viewBox",o),a+=y("preserveAspectRatio",e.viewPreserveAspectRatio),a+=y("zoomAndPan",e.viewZoomAndPan),a+=y("viewTarget",e.viewTarget),e.viewName&&(a+=y("data-view-name",e.viewName)),a+="/>",a}function Lf(n){let e=n.state,t=e.svgX,r=e.svgY,i=e.svgWidth,s=e.svgHeight,o=e.svgViewBoxX,a=e.svgViewBoxY,l=e.svgViewBoxWidth,c=e.svgViewBoxHeight,f=o!==void 0&&a!==void 0&&l!==void 0&&c!==void 0?`${o} ${a} ${l} ${c}`:void 0,d="<svg";return d+=y("xmlns","http://www.w3.org/2000/svg"),d+=y("x",t),d+=y("y",r),d+=y("width",i),d+=y("height",s),d+=y("viewBox",f),d+=y("preserveAspectRatio",e.svgPreserveAspectRatio),d+=y("data-shape-id",n.id),d+=">",d+=Vr(e.children),d+="</svg>",d}function Nf(n){let e=n.state,t=e.targetShapeId;if(!t)return`<!-- shape-reference ${Y(n.id)} has no targetShapeId -->`;let r=e.offsetX??0,i=e.offsetY??0,s="<use";return s+=y("href",`#${t}`),s+=y("x",r),s+=y("y",i),e.width!==void 0&&(s+=y("width",e.width)),e.height!==void 0&&(s+=y("height",e.height)),s+=y("data-shape-id",n.id),e.opacity!==void 0&&e.opacity<1&&(s+=y("opacity",e.opacity)),s+="/>",s}function Xs(n){let e=n.state,t=Ct(n),r=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100;return`<use href="#${Y(t)}" x="${r}" y="${i}" width="${s}" height="${o}"/>`}function Bf(n){let e=n.state,t=e.mediaKind??n.type,r=e.x??0,i=e.y??0,s=e.width??320,o=e.height??180,a=e.href??"",l=e.mediaMimeType,c=e.posterHref,f=e.mediaOpacity,d=`<${t} xmlns="http://www.w3.org/1999/xhtml"`;d+=y("src",a),l&&(d+=y("type",l)),c&&t==="video"&&(d+=y("poster",c)),e.muted&&(d+=' muted=""'),e.loop&&(d+=' loop=""'),e.playbackRate!==void 0&&(d+=y("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(d+=y("data-volume",e.volume)),d+=' preload="auto" playsinline=""',d+=t==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let p="<foreignObject";return p+=y("x",r),p+=y("y",i),p+=y("width",s),p+=y("height",o),p+=y("data-shape-id",n.id),p+=y("data-media-kind",t),e.naturalDuration!==void 0&&(p+=y("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(p+=y("data-begin",e.begin)),e.trimStart!==void 0&&(p+=y("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(p+=y("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(p+=y("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(p+=y("data-fade-out",e.fadeOutDuration)),p+=Ft("systemLanguage",e.systemLanguage),p+=Ft("requiredExtensions",e.requiredExtensions),f!==void 0&&f<1&&(p+=y("opacity",f)),p+=">",p+=d,p+="</foreignObject>",p}function Ys(n){let e=n.state,t=e.x??0,r=e.y??0,i=e.width??100,s=e.height??60,o={x:t+i/2,y:r+s/2},a=Me(e,o),l=Ir(n.type,t,r,i,s,{slantPercent:e.slantPercent,topWidthPercent:e.topWidthPercent,capHeightPercent:e.capHeightPercent,waveAmplitudePercent:e.waveAmplitudePercent});return`<path${y("d",l)}${Ie(e,n.id)}${a?y("transform",a):""}/>`}function qs(n){let e=n.state,t=e.cx??0,r=e.cy??0,i=e.radius??50,s=e.cornerRadius??0,o=e.shiftAngle??-90,a=e.fillRule??"nonzero",l=_f(e,t,r),c="";switch(n.type){case"triangle":c=Ae(mn(3,i,o),s,i);break;case"ngon":{let d=e.sides??6;c=Ae(mn(d,i,o),s,i);break}case"star":{let d=e.arms??5,p=e.innerRadiusPercent??50;c=Ae(Sr(d,i,p,o),s,i);break}case"cross":{let d=e.armWidthPercent??40;c=Ae(xr(i,d,o),s,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=Pr(i,d,a);break}case"spiral":{let d=e.turns??3,p=e.thicknessPercent??20,m=e.spiralDirection??1;c=_r(i,d,p,m,o);break}case"gear":{let d=e.teeth??8,p=e.toothDepthPercent??30,m=e.holeRadiusPercent??0;c=Rr(d,i,p,s,m,a,o);break}case"arrow":{let d=e.headWidthPercent??100,p=e.headLengthPercent??30,m=e.shaftWidthPercent??40;c=Ae($r(i,d,p,m,o),s,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,p=e.tailLengthPercent??40,m=e.tailWidthPercent??25;c=Ae(vr(i,d,p,m,o),s,i);break}case"lightning":{let d=e.boltSegments??3,p=e.boltJaggednessPercent??40,m=e.boltWidthPercent??30;c=Ae(kr(i,d,p,m,o),s,i);break}case"heart":{let d=e.lobeRadiusPercent??50,p=e.cleftDepthPercent??25;c=Tr(i,d,p,o);break}case"cloud":{let d=e.cloudBumps??5,p=e.cloudPuffinessPercent??60;c=wr(i,d,p,o);break}default:return`<!-- unsupported polygon shape: ${Y(n.type)} -->`}let f="";return(n.type==="ring"||n.type==="gear")&&(f=y("fill-rule",a)),`<path${y("d",c)}${f}${Ie(e,n.id)}${y("transform",l)}/>`}function de(n){let e;switch(n.type){case"circle":e=zs(n);break;case"ellipse":e=Gs(n);break;case"rectangle":case"square":e=Vs(n);break;case"line":e=Us(n);break;case"text":e=Ws(n);break;case"path":e=Hs(n);break;case"polyline":e=js(n);break;case"image":e=Ks(n);break;case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":case"speechBubble":case"lightning":case"heart":case"cloud":e=qs(n);break;case"diamond":case"parallelogram":case"trapezoid":case"terminator":case"cylinder":case"document-shape":e=Ys(n);break;case"hyperlink":e=Df(n);break;case"switch":e=Ff(n);break;case"container":case"group":e=Ef(n);break;case"view":e=Of(n);break;case"svg":e=Lf(n);break;case"shape-reference":e=Nf(n);break;case"symbol-instance":e=Xs(n);break;case"audio":case"video":e=Bf(n);break;default:return`<!-- unsupported shape type: ${Y(n.type)} -->`}return Cf(e,n.state)}function vl(n,e){let t=(e.stops??[]).map(o=>{let a=`<stop${y("offset",`${o.offset*100}%`)}${y("stop-color",o.color)}`;return o.opacity!==void 0&&o.opacity<1&&(a+=y("stop-opacity",o.opacity)),a+="/>",a}).join(""),r=e.gradientUnits==="userSpaceOnUse",i=o=>r?String(o):`${o*100}%`,s=r?y("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${y("id",n)}${s}${y("x1",i(e.x1))}${y("y1",i(e.y1))}${y("x2",i(e.x2))}${y("y2",i(e.y2))}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}>${t}</linearGradient>`}function kl(n,e){let t=(e.stops??[]).map(f=>{let d=`<stop${y("offset",`${f.offset*100}%`)}${y("stop-color",f.color)}`;return f.opacity!==void 0&&f.opacity<1&&(d+=y("stop-opacity",f.opacity)),d+="/>",d}).join(""),r=e.gradientUnits==="userSpaceOnUse",i=f=>r?String(f):`${f*100}%`,s=r?y("gradientUnits","userSpaceOnUse"):"",o="",a=e.ry!==void 0&&e.ry!==e.r,l=!!e.rotation;if(a||l){let f=e.cx??(r?0:.5),d=e.cy??(r?0:.5),p=[];p.push(`translate(${f}, ${d})`),l&&p.push(`rotate(${e.rotation})`),a&&e.ry!==0&&p.push(`scale(1, ${e.ry/e.r})`),p.push(`translate(-${f}, -${d})`),o=y("gradientTransform",p.join(" "))}let c=e.fr!==void 0&&e.fr>0?y("fr",i(e.fr)):"";return`<radialGradient${y("id",n)}${s}${y("cx",i(e.cx))}${y("cy",i(e.cy))}${y("fx",i(e.fx))}${y("fy",i(e.fy))}${y("r",i(e.r))}${c}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}${o}>${t}</radialGradient>`}function Tl(n,e){if(e.svgContent!=null){let a=e.width??10,l=e.height??10,c=e.patternUnits??"userSpaceOnUse",f=e.patternContentUnits,d=e.patternTransform,p=e.viewBox,m=e.preserveAspectRatio,h=e.x??0,g=e.y??0,b=`<pattern${y("id",n)}`;return b+=y("patternUnits",c),f&&(b+=y("patternContentUnits",f)),h&&(b+=y("x",h)),g&&(b+=y("y",g)),b+=y("width",a),b+=y("height",l),p&&(b+=y("viewBox",p)),m&&(b+=y("preserveAspectRatio",m)),d&&(b+=y("patternTransform",d)),b+=`>${e.svgContent}</pattern>`,b}let t=10*(e.scale??1),r=e.rotation??0,i=e.color||"#000000",s=e.backgroundColor||"#ffffff",o="";return o+=`<rect${y("width",t)}${y("height",t)}${y("fill",s)}/>`,o+=zf(e.patternType,t,i),`<pattern${y("id",n)}${y("patternUnits","userSpaceOnUse")}${y("width",t)}${y("height",t)}${r?y("patternTransform",`rotate(${r})`):""}>${o}</pattern>`}function zf(n,e,t){return bn(n,e,t).map(i=>{let s=Object.entries(i.attrs).map(([o,a])=>y(o,a)).join("");return`<${i.tag}${s}/>`}).join("")}function Ee(n,e=[]){let t=Array.isArray(n)?yn(n,e):n;if(t.ids.size===0&&t.legacyEndpoints.size===0)return"";let r="",i=pt();for(let s of i){let o=s.id,a=o.replace("line-marker-",""),l=`mkr-builtin-${a}`,c=t.legacyEndpoints.has(a)||t.ids.has(o),f=t.ids.has(l);if(!c&&!f)continue;let d=s.element,p=Object.entries(d.attrs).map(([g,b])=>y(g,b)).join(""),m=`<${d.tag}${p}/>`,h=g=>{r+=`<marker${y("id",g)}${y("viewBox",Sn)}${y("refX",s.refX)}${y("refY",s.refY)}${y("markerWidth",6)}${y("markerHeight",6)}${y("orient","auto-start-reverse")}>${m}</marker>`};c&&h(o),f&&h(l)}return r}var He=n=>n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Zs=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Js(n){switch(n.kind){case"symbol":return Qs(n);case"marker":return ea(n);case"linear-gradient":return ta(n);case"radial-gradient":return na(n);case"pattern":return ra(n);case"filter":return ia(n)}}function Qs(n){let e=n.shapes.map(i=>de(i)).join(""),t=n.viewBox?` viewBox="${He(n.viewBox)}"`:"",r=n.overflow?` overflow="${He(n.overflow)}"`:"";return`<symbol id="${He(n.id)}"${t}${r}>${e}</symbol>`}function ea(n){let e;if(n.builtIn){let s=pt().find(o=>n.id.includes(o.id)||n.id===o.id);if(s){let o=Object.entries(s.element.attrs).map(([a,l])=>` ${a}="${He(String(l))}"`).join("");e=`<${s.element.tag}${o}/>`}else e=""}else e=n.shapes.map(s=>de(s)).join("");let t=typeof n.orient=="number"?String(n.orient):n.orient,r=n.viewBox?` viewBox="${He(n.viewBox)}"`:"",i=n.overflow?` overflow="${He(n.overflow)}"`:"";return`<marker id="${He(n.id)}"${r} refX="${n.refX}" refY="${n.refY}" markerWidth="${n.markerWidth}" markerHeight="${n.markerHeight}" markerUnits="${He(n.markerUnits)}" orient="${He(t)}"${i}>${e}</marker>`}function ta(n){let e={...n.gradient,type:"linear-gradient",id:n.id};return vl(n.id,e)}function na(n){let e={...n.gradient,type:"radial-gradient",id:n.id};return kl(n.id,e)}function ra(n){let e={...n.pattern,type:"pattern",id:n.id};return Tl(n.id,e)}function ia(n){return Os(n.id,n.filters,{colorInterpolation:n.colorInterpolation,filterUnits:n.filterUnits,primitiveUnits:n.primitiveUnits,x:n.x,y:n.y,width:n.width,height:n.height})}function $n(n){let e=new Map;for(let r of n){let i=e.get(r.kind);i?i.push(r):e.set(r.kind,[r])}let t="";for(let r of Zs){let i=e.get(r);if(i)for(let s of i)t+=Js(s)}return t}function Ze(n,e){let t=vn(n,e);return t.length===0?"":$n(t)}function vn(n,e){let t=new Map;for(let l of e)t.set(l.id,l);let r=new Map,i=l=>{if(!l)return;let c=t.get(l);c&&r.set(l,c)},s=(l,c)=>{if(!l||typeof l!="object")return;let f=l;if(!f.id||r.has(f.id))return;let d=c==="linear-gradient"?"linear-gradient":c==="radial-gradient"?"radial-gradient":c==="pattern"?"pattern":null;if(!d)return;let{id:p,sourceId:m,...h}=l,g;if(d==="linear-gradient")g={kind:"linear-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:h};else if(d==="radial-gradient")g={kind:"radial-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:h};else{let{customPatternId:b,...$}=h;g={kind:"pattern",id:f.id,name:m??f.id,sourceId:m,pattern:$}}r.set(f.id,g)},o=(l,c)=>{let f=l.filters;if(!Array.isArray(f)||f.length===0)return;let d=`filter-${c}`;r.has(d)||r.set(d,{kind:"filter",id:d,name:d,filters:f,...l.filterColorInterpolation&&l.filterColorInterpolation!=="auto"?{colorInterpolation:l.filterColorInterpolation}:{},...l.filterUnits?{filterUnits:l.filterUnits}:{},...l.primitiveUnits?{primitiveUnits:l.primitiveUnits}:{},...typeof l.filterX=="string"?{x:l.filterX}:{},...typeof l.filterY=="string"?{y:l.filterY}:{},...typeof l.filterWidth=="string"?{width:l.filterWidth}:{},...typeof l.filterHeight=="string"?{height:l.filterHeight}:{}})},a=l=>{let c=l.state;if(!c)return;i(c.fillLibraryId),i(c.strokeLibraryId),i(c.markerStart),i(c.markerMid),i(c.markerEnd),i(c.symbolId);let f=c.filterLibraryIds;if(Array.isArray(f))for(let d of f)typeof d=="string"&&i(d);c.fillLibraryId||s(c.fillGradient,c.fillType),c.strokeLibraryId||s(c.strokeGradient,c.strokeType),(!Array.isArray(f)||f.length===0)&&o(c,l.id)};for(let l of n)a(l);return gn(n,e,a),Array.from(r.values())}function sa(n){return n.easing==="custom-bezier"&&n.customBezier?n.customBezier:Cn[n.easing]??null}function aa(n,e,t,r,i){if(n===e&&t===r)return i;let s=1e-6,o=8,a=m=>(((1-3*t+3*n)*m+(3*t-6*n))*m+3*n)*m,l=m=>(((1-3*r+3*e)*m+(3*r-6*e))*m+3*e)*m,c=m=>(3*(1-3*t+3*n)*m+2*(3*t-6*n))*m+3*n,f=i;for(let m=0;m<o;m++){let h=a(f)-i;if(Math.abs(h)<s)return l(f);let g=c(f);if(Math.abs(g)<s)break;f-=h/g}let d=0,p=1;for(f=i;d<p;){let m=a(f);if(Math.abs(m-i)<s)return l(f);i>m?d=f:p=f;let h=(p-d)*.5+d;if(h===f)break;f=h}return l(f)}function oa(n){let e=n.split(/\s+/).map(parseFloat);if(e.length!==4||e.some(o=>!Number.isFinite(o)))return n;let[t,r,i,s]=e;return`${1-i} ${1-s} ${1-t} ${1-r}`}function be(n){return!Number.isFinite(n)||Math.abs(n)<1e-9?"0":Math.abs(n-1)<1e-9?"1":parseFloat(n.toFixed(6)).toString()}function Wr([n,e,t,r]){let i=s=>Number.isFinite(s)?parseFloat(s.toFixed(6)).toString():"0";return`${i(n)} ${i(e)} ${i(t)} ${i(r)}`}function la(n){return n.length>0&&n.every(e=>e==="0 0 1 1")}function kn(n){if(n.length<2)return!1;let e=n.length-1,t=1e-4;for(let r=0;r<n.length;r++){let i=r/e,s=parseFloat(n[r]);if(!Number.isFinite(s)||Math.abs(s-i)>t)return!1}return!0}function Hr(n){if(n.length<2)return!1;let e=n.length-1,t=1e-4;for(let r=0;r<n.length;r++)if(Math.abs(n[r]-r/e)>t)return!1;return!0}function Qe(n){let e=n.cycleDuration??(n.keyframes.length>0?n.keyframes[n.keyframes.length-1].time:0);return n.cycleBehavior==="alternate"?e*2:e}function mt(n){let e=n.beginTrigger;if(e)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}let t=n.keyframes[0]?.time??0;return t!==0?`${t}s`:""}function jr(n){return n.keyframes.length===1&&n.cycleDuration===void 0}function Kr(n){return n.calcMode!=="discrete"?!1:n.sourceSmilElement==="set"?!0:!n.sourceSmilElement&&!n.cycleInfinite&&n.keyframes.every(e=>e.easing!=="steps")}function Xr(n,e){if(e<=0)return mt(n);if(mt(n)==="indefinite")return"indefinite";let t=n.keyframes[e]?.time??0;return t!==0?`${t}s`:""}function Yr(n){return n.cycleInfinite?"indefinite":n.cycleRepeats&&n.cycleRepeats>1?String(n.cycleRepeats):null}function ht(n){return n.cycleInfinite||n.fill==="remove"?null:"freeze"}function qr(n){return n.additive==="sum"?"sum":null}function Zr(n){return n.keyframes.map(e=>{let t=typeof e.value=="number"?e.value:parseFloat(String(e.value));return Number.isFinite(t)?Math.max(0,Math.min(1,t)):0})}function Gf(n){let e=t=>Math.max(0,Math.min(1,t));return[n[0],e(n[1]),n[2],e(n[3])]}function Vf(n){let[e,t,r,i]=n,s=new Set,o=8;for(let d=1;d<=o;d++)s.add(d/o);let a=t-2*i+1,l=2*(i-2*t),c=t,f=d=>{if(!Number.isFinite(d)||d<=0||d>=1)return;let p=3*(1-d)**2*d*e+3*(1-d)*d**2*r+d**3;p>0&&p<1&&s.add(Number(p.toFixed(6)))};if(Math.abs(a)<1e-9)Math.abs(l)>=1e-9&&f(-c/l);else{let d=l*l-4*a*c;if(d>=0){let p=Math.sqrt(d);f((-l+p)/(2*a)),f((-l-p)/(2*a))}}return[...s].sort((d,p)=>d-p)}function Uf(n,e,t,r,i,s){let o=typeof n.value=="number"&&typeof e.value=="number",a=Je(e.value);if(e.easing==="linear-function"&&e.linearPoints&&e.linearPoints.length>=2){if(o){let b=e.linearPoints;for(let $=1;$<b.length;$++){let k=b[$],S=n.time+(e.time-n.time)*k.position,x=n.value+(e.value-n.value)*k.value;r.push(x),i.push(be(t(S))),s.push("0 0 1 1")}return}r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}if(e.easing==="steps"){r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}let l=sa(e);if(!l){r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}let[,c,,f]=l;if(!(c<0||c>1||f<0||f>1)){r.push(a),i.push(be(t(e.time))),s.push(Wr(l));return}if(!o){r.push(a),i.push(be(t(e.time))),s.push(Wr(Gf(l)));return}let p=Vf(l),m=n.value,h=e.value,g=e.time-n.time;for(let b of p){let $=aa(l[0],l[1],l[2],l[3],b),k=n.time+g*b,S=m+(h-m)*$;r.push(S),i.push(be(t(k))),s.push("0 0 1 1")}}function Je(n){return Array.isArray(n)?n.join(" "):n}function Wf(n,e,t){let r=[],{count:i,position:s}=t,o=e.time-n.time,a=Je(n.value),l=Je(e.value),c=typeof a=="number"&&typeof l=="number",f=typeof a=="string"&&typeof l=="string",d=h=>f?h<.5?a:l:c?a+(l-a)*h:h>=1?l:a,p=h=>{let g=Math.floor(h*i);(s==="jump-start"||s==="jump-both")&&(g+=1);let b;switch(s){case"jump-start":case"jump-end":b=i;break;case"jump-none":b=i-1;break;case"jump-both":b=i+1;break}return g>b&&(g=b),g<0&&(g=0),g/b},m=p(0);for(let h=1;h<=i;h++){let g=h/i,b=p(g);if(b===m)continue;let $=n.time+g*o;r.push({value:d(b),time:$}),m=b}return r.length===0||r[r.length-1].time<e.time?r.push({value:l,time:e.time}):r[r.length-1]={value:l,time:e.time},r}function Hf(n,e){let t=[],r=[],i=(s,o)=>{t.push(s),r.push(be(e(o)))};i(Je(n[0].value),n[0].time);for(let s=1;s<n.length;s++){let o=n[s-1],a=n[s];if(a.easing==="steps"&&a.stepsParams){let l=Wf(o,a,a.stepsParams);for(let c of l)i(c.value,c.time)}else i(Je(a.value),a.time)}return{values:t,keyTimes:r}}function Ur(n,e,t,r,i){if(i.cycleBehavior!=="alternate"||n.length<2)return{values:n,keyTimes:e,keySplines:t,calcMode:r};let s=n.slice(0,-1).reverse(),o=e.slice(0,-1).reverse().map(l=>be(1-parseFloat(l))),a=t.slice().reverse().map(oa);return{values:[...n,...s],keyTimes:[...e,...o],keySplines:[...t,...a],calcMode:r}}function et(n){let e=n.keyframes;if(e.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let t=Qe(n),r=e[0]?.time??0,i=c=>t>0?(c-r)/t:0;if(e.some(c=>c.easing==="steps")){let{values:c,keyTimes:f}=Hf(e,i);return Ur(c,f,[],"discrete",n)}if(n.calcMode==="discrete"){let c=e.map(d=>Je(d.value)),f=e.map(d=>be(i(d.time)));return Ur(c,f,[],"discrete",n)}if(n.calcMode==="paced"){let c=e.map(d=>Je(d.value)),f=e.map(d=>be(i(d.time)));return Ur(c,f,[],"paced",n)}let o=[Je(e[0].value)],a=[be(i(e[0].time))],l=[];for(let c=1;c<e.length;c++)Uf(e[c-1],e[c],i,o,a,l);return Ur(o,a,l,"spline",n)}function Tn(n,e={}){let t=e.defaultCalcMode??"linear",r={};if(n.calcMode==="paced")return t!=="paced"&&(r.calcMode="paced"),r;if(n.calcMode==="discrete")return r.keyTimes=n.keyTimes.join(";"),r.calcMode="discrete",r;let i=n.keySplines.length>0&&!la(n.keySplines);return kn(n.keyTimes)||(r.keyTimes=n.keyTimes.join(";")),i&&(r.calcMode="spline",r.keySplines=n.keySplines.join(";")),r}function ua(n,e){if(n.shapeId!==e.shapeId||n.keyframes.length!==e.keyframes.length||(n.cycleDuration??-1)!==(e.cycleDuration??-1)||(n.cycleRepeats??1)!==(e.cycleRepeats??1)||!!n.cycleInfinite!=!!e.cycleInfinite||(n.cycleBehavior??"restart")!==(e.cycleBehavior??"restart")||(n.additive??"replace")!==(e.additive??"replace")||(n.calcMode??"linear")!==(e.calcMode??"linear")||!!n.locked!=!!e.locked)return!1;let t=(r,i)=>!r&&!i||!!r&&!!i&&r.type===i.type&&r.value===i.value;if(!t(n.beginTrigger,e.beginTrigger)||!t(n.endTrigger,e.endTrigger))return!1;for(let r=0;r<n.keyframes.length;r++){let i=n.keyframes[r],s=e.keyframes[r];if(i.time!==s.time||i.easing!==s.easing)return!1;let o=i.customBezier,a=s.customBezier;if(!!o!=!!a)return!1;if(o&&a){for(let l=0;l<4;l++)if(o[l]!==a[l])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(s.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(s.stepsParams??null))return!1}return!0}function Jr(n){let e=new Map,t=new Set,r=new Map;for(let i of n){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let s=r.get(i.shapeId)??[];s.push(i),r.set(i.shapeId,s)}for(let i of r.values()){let s=new Set;for(let o=0;o<i.length;o++){let a=i[o];if(s.has(a.id))continue;let l=a.property==="translateX"||a.property==="translateY",c=l?"translateX":"scaleX",f=l?"translateY":"scaleY";if(!(a.property!==c&&a.property!==f))for(let d=o+1;d<i.length;d++){let p=i[d];if(s.has(p.id)||!(a.property===c&&p.property===f||a.property===f&&p.property===c)||!ua(a,p))continue;let m=a.property===c?a:p,h=a.property===f?a:p;e.set(m.id,h),t.add(h.id),s.add(m.id),s.add(h.id);break}}}return{partner:e,skip:t}}function Qr(n,e,t,r){if(r){let s=e?r.values:n.values,o=e?n.values:r.values,a=Math.min(s.length,o.length),l=[];for(let c=0;c<a;c++)l.push(`${s[c]} ${o[c]}`);return l}let i=t?"1":"0";return n.values.map(s=>e?`${i} ${s}`:`${s} ${i}`)}var Pl={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",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",display:"display",visibility:"visibility",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",pathMorph:"d",polylinePoints:"points"},_l=new Set(["transformMatrix","rotation","skewX","skewY"]),Rl=new Set(["translateX","translateY","scaleX","scaleY"]);function ei(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function j(n,e){return e==null?"":` ${n}="${ei(e)}"`}function ca(n,e){let t=Tn(n,e);return j("keyTimes",t.keyTimes)+j("calcMode",t.calcMode)+j("keySplines",t.keySplines)}function ti(n,e){return j("dur",`${e}s`)+j("begin",mt(n)||null)+j("repeatCount",Yr(n))}function jf(n){let e=Pl[n.property];if(!e)return"";let t=Qe(n);if(t<=0)return"";let r=et(n);return r.values.length<2?"":"<animate"+j("attributeName",e)+j("values",r.values.join(";"))+ca(r)+ti(n,t)+j("fill",ht(n))+"/>"}function Kf(n){let e;switch(n.property){case"transformMatrix":e="matrix";break;case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let t=Qe(n);if(t<=0)return"";let r=et(n),i=e==="matrix"?r.values.map(o=>Yf(o)):r.values.map(o=>String(o));if(i.length<2||i.some(o=>o.length===0))return"";let s=e==="rotate"&&n.transformOrigin?i.map(o=>`${o} ${n.transformOrigin.x} ${n.transformOrigin.y}`):i;return'<animateTransform attributeName="transform"'+j("type",e)+j("values",s.join(";"))+ca(r)+ti(n,t)+j("additive",qr(n))+j("fill",ht(n))+"/>"}function Xf(n,e,t){let r=n.property==="scaleX"||n.property==="scaleY",i=n.property==="translateY"||n.property==="scaleY",s=r?"scale":"translate",o=Qe(n);if(o<=0)return"";let a=et(n);if(a.values.length<2)return"";let l=e?et(e):void 0,c=Qr(a,i,r,l);if(c.length<2)return"";let f=!n.replacesCarrierBase||t?"sum":null;return'<animateTransform attributeName="transform"'+j("type",s)+j("values",c.join(";"))+ca(a)+ti(n,o)+j("additive",f)+j("fill",ht(n))+"/>"}function Yf(n){if(Array.isArray(n)&&n.length>=6){let e=n.slice(0,6);if(e.every(t=>typeof t=="number"&&Number.isFinite(t)))return e.join(" ")}if(typeof n=="string"){let e=n.trim(),t=/^matrix\(([^)]+)\)$/i.exec(e),i=(t?t[1]:e).split(/[\s,]+/).filter(Boolean).map(Number);if(i.length>=6&&i.slice(0,6).every(Number.isFinite))return i.slice(0,6).join(" ")}return""}function qf(n){if(!n.motionPath)return"";let e=Qe(n);if(e<=0)return"";let t=et(n),r=Zr(n),i=!!n.motionPathRef&&(n.motionPathRef.mode??"trackShape")==="curveTemplate",s=Tn(t,{defaultCalcMode:"paced"}),o=Hr(r)&&kn(t.keyTimes)&&t.calcMode!=="discrete"&&s.calcMode===void 0,a="<animateMotion";return i||(a+=j("path",n.motionPath)),a+=j("keyTimes",s.keyTimes),o||(a+=j("keyPoints",r.join(";"))),a+=j("calcMode",s.calcMode)+j("keySplines",s.keySplines),a+=ti(n,e),a+=j("fill",ht(n)),n.motionRotate!==void 0&&(a+=j("rotate",typeof n.motionRotate=="number"?String(n.motionRotate):n.motionRotate)),i?a+=`><mpath href="#${ei(n.motionPathRef.shapeId)}"/></animateMotion>`:a+="/>",a}function wl(n,e){if(_l.has(n.property)||Rl.has(n.property)||n.property==="pathMotion")return"";let t=Pl[n.property];if(!t)return"";let r=n.keyframes[e];return r?"<set"+j("attributeName",t)+j("to",Array.isArray(r.value)?r.value.join(" "):String(r.value))+j("begin",Xr(n,e)||null)+"/>":""}function Zf(n){let e=mt(n);return e?`<discard begin="${ei(e)}"/>`:"<discard/>"}function ni(n){let e=new Map,t=n.tracks.map(a=>({...a,locked:a.locked??!1,keyframes:[...a.keyframes].sort((l,c)=>l.time-c.time).map(l=>({...l,time:l.time,value:l.value,easing:l.easing}))})),r=Jr(t),i=new Set,s=new Set,o=(a,l,c)=>{if(!l)return;let f=l;c.sourceSmilId&&!i.has(c.sourceSmilId)&&(i.add(c.sourceSmilId),f=l.replace(/^(<[a-zA-Z]+)/,`$1 id="${ei(c.sourceSmilId)}"`));let d=e.get(a)??[];d.push(f),e.set(a,d)};for(let a of t){if(!a.enabled||r.skip.has(a.id)||a.keyframes.length<1)continue;if(a.property==="discard"){o(a.shapeId,Zf(a),a);continue}if(jr(a)){o(a.shapeId,wl(a,0),a);continue}if(Kr(a)){for(let c=0;c<a.keyframes.length;c++)o(a.shapeId,wl(a,c),a);continue}if(a.keyframes.length<2)continue;let l="";a.property==="pathMotion"&&a.motionPath?l=qf(a):_l.has(a.property)?(l=Kf(a),l&&s.add(a.shapeId)):Rl.has(a.property)?(l=Xf(a,r.partner.get(a.id),s.has(a.shapeId)),l&&s.add(a.shapeId)):l=jf(a),o(a.shapeId,l,a)}return e}function Et(n,e={}){let{xmlDeclaration:t=!0,backgroundColor:r,indent:i=!0,className:s}=e,o=n.viewboxes?.[0],a=e.width??o?.width??800,l=e.height??o?.height??600,c=e.viewBox??`0 0 ${a} ${l}`,f=i?`
13
- `:"",d=i?" ":"",p=n.shapes??[],m=p.filter(D=>D.state?.displayMode==="motionOnly"),h=p.filter(D=>D.state?.displayMode!=="motionOnly"),g=tp(n),b=np(n),$=[...Array.isArray(n.library)?n.library:[],...(b??[]).filter(D=>!D.builtIn&&!(Array.isArray(n.library)&&n.library.some(L=>L.id===D.id)))],k=vn(h,$),S=k.length>0?$n(k):"",x=Ee(h,$),v=rp(g,h,new Set(k.map(D=>D.id))),w=Jf(m),T=S.length>0||x.length>0||v.length>0||w.length>0,P="";T&&(P=`${f}${d}<defs>${f}`,S.length>0&&(P+=`${d}${d}${S}${f}`),x.length>0&&(P+=`${d}${d}${x}${f}`),v.length>0&&(P+=`${d}${d}${v}${f}`),w.length>0&&(P+=`${d}${d}${w}${f}`),P+=`${d}</defs>`);let R="";r&&(R=`${f}${d}<rect width="${a}" height="${l}" fill="${r}"/>`);let M=n.animationTimeline?ni(n.animationTimeline):null,N=h.map(D=>{let L=de(D),K=M?.get(D.id);return K&&K.length>0&&(L=ip(L,K,d)),`${d}${L}`}).join(f),B="";return t&&(B+=`<?xml version="1.0" encoding="UTF-8"?>${f}`),B+='<svg xmlns="http://www.w3.org/2000/svg"',B+=` width="${a}" height="${l}"`,B+=` viewBox="${c}"`,s&&(B+=` class="${s}"`),B+=">",B+=P,B+=R,h.length>0&&(B+=`${f}${N}`),B+=`${f}</svg>${f}`,B}function Jf(n){if(n.length===0)return"";let e=[];for(let t of n){let r=Qf(t);if(!r)continue;let i=ep(r);e.push(`<path id="${Al(t.id)}" d="${Al(i)}"/>`)}return e.join("")}function Qf(n){let e=n.state;if(typeof e?.d=="string")return e.d;switch(n.type){case"rectangle":{let t=e?.x??0,r=e?.y??0,i=e?.width??0,s=e?.height??0;return i<=0||s<=0?null:`M${t},${r}h${i}v${s}h${-i}Z`}case"circle":{let t=e?.cx??0,r=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${t-i},${r}A${i},${i} 0 1 0 ${t+i},${r}A${i},${i} 0 1 0 ${t-i},${r}Z`}case"ellipse":{let t=e?.cx??0,r=e?.cy??0,i=e?.rx??0,s=e?.ry??0;return i<=0||s<=0?null:`M${t-i},${r}A${i},${s} 0 1 0 ${t+i},${r}A${i},${s} 0 1 0 ${t-i},${r}Z`}case"line":{let t=e?.x1??0,r=e?.y1??0,i=e?.x2??0,s=e?.y2??0;return`M${t},${r}L${i},${s}`}default:return null}}function ep(n){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(n);if(!e)return n;let t=parseFloat(e[1]),r=parseFloat(e[2]);if(!isFinite(t)||!isFinite(r)||t===0&&r===0)return n;let i=!0;return n.replace(/([MLCQSTHVAZ])\s*([\d\s.,e+-]*)/gi,(s,o,a)=>{let l=o.toUpperCase(),c=o!==l,f=i;if(i=!1,l==="Z")return s;let d=a.trim().split(/[\s,]+/).filter(m=>m.length>0).map(Number);if(d.length===0||c&&!f)return s;let p=[];if(l==="H")for(let m of d)p.push(m-t);else if(l==="V")for(let m of d)p.push(m-r);else if(l==="A")for(let m=0;m<d.length;m+=7)p.push(d[m],d[m+1],d[m+2],d[m+3],d[m+4]),m+5<d.length&&p.push(d[m+5]-t),m+6<d.length&&p.push(d[m+6]-r);else for(let m=0;m<d.length;m+=2)p.push(d[m]-t),m+1<d.length&&p.push(d[m+1]-r);return`${o} ${p.join(" ")}`})}function Al(n){return n.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function tp(n){let t=(Array.isArray(n.library)?n.library:[]).filter(r=>r.kind==="symbol");return t.length>0?t:n.symbols??[]}function np(n){let t=(Array.isArray(n.library)?n.library:[]).filter(r=>r.kind==="marker");return t.length>0?t:n.markers}var da=n=>n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function rp(n,e,t=new Set){if(n.length===0)return"";let r=new Map;for(let l of n)r.set(l.id,l);let i=new Map,s=new Set,o=[...e];for(let l=0;l<o.length;l++){let c=o[l],f=c.state?.children;if(Array.isArray(f)&&o.push(...f),c.type!=="symbol-instance")continue;let d=r.get(c.state.symbolId??"");if(!d)continue;let p=Ct(c);if(s.has(p))continue;s.add(p);let m=Br(d,c);o.push(...m),!t.has(p)&&i.set(p,{def:d,resolved:m})}if(i.size===0)return"";let a=[];for(let[l,{def:c,resolved:f}]of i){let d=f.map(h=>de(h)).join(""),p=c.viewBox?` viewBox="${da(c.viewBox)}"`:"",m=c.overflow?` overflow="${da(c.overflow)}"`:"";a.push(`<symbol id="${da(l)}"${p}${m}>${d}</symbol>`)}return a.join("")}function ip(n,e,t){let r=e.join(""),i=0;for(;i<n.length;){let c=n.slice(i);if(!/^<defs[\s>]/.test(c))break;let f=n.indexOf("</defs>",i);if(f===-1)break;i=f+7}let s=n.slice(0,i),o=n.slice(i),a=o.lastIndexOf("/>");if(a!==-1){let c=o.match(/^<(\w+)/),f=c?c[1]:"g";return s+o.slice(0,a)+">"+r+`</${f}>`}let l=o.match(/<\/(\w+)>$/);if(l){let c=o.lastIndexOf(`</${l[1]}>`);return s+o.slice(0,c)+r+o.slice(c)}return s+o+r}var Ot=Math.PI*2;function sp(n,e,t,r){let i=e*e-4*n*t;if(!(i>=0))return;let s=Math.sqrt(i),o=-.5*(e+(e>=0?s:-s));if(n!==0){let a=o/n;a>0&&a<1&&r.push(a)}if(o!==0){let a=t/o;a>0&&a<1&&r.push(a)}}function ap(n,e,t,r,i){let s=1-i;return s*s*s*n+3*s*s*i*e+3*s*i*i*t+i*i*i*r}function op(n,e,t,r){let i=1-r;return i*i*n+2*i*r*e+r*r*t}function si(n,e,t,r){let i=n<r?n:r,s=n>r?n:r,o=-n+3*e-3*t+r,a=2*(n-2*e+t),l=e-n,c=[];sp(o,a,l,c);for(let f of c){let d=ap(n,e,t,r,f);d<i&&(i=d),d>s&&(s=d)}return{min:i,max:s}}function ai(n,e,t){let r=n<t?n:t,i=n>t?n:t,s=n-2*e+t;if(s!==0){let o=(n-e)/s;if(o>0&&o<1){let a=op(n,e,t,o);a<r&&(r=a),a>i&&(i=a)}}return{min:r,max:i}}function Il(n,e,t,r){let i=n*r-e*t>=0?1:-1,s=Math.sqrt((n*n+e*e)*(t*t+r*r));if(s===0)return 0;let o=(n*t+e*r)/s;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function pa(n,e,t,r,i,s,o,a,l){if(n===a&&e===l||t===0||r===0)return null;let c=Math.abs(t),f=Math.abs(r),d=i%360*Math.PI/180,p=Math.cos(d),m=Math.sin(d),h=(n-a)/2,g=(e-l)/2,b=p*h+m*g,$=-m*h+p*g,k=b*b,S=$*$,x=c*c,v=f*f,w=k/x+S/v;if(w>1){let me=Math.sqrt(w);c*=me,f*=me,x=c*c,v=f*f}let T=x*S+v*k;if(T===0)return null;let P=(x*v-T)/T;P<0&&(P=0);let R=Math.sqrt(P);s===o&&(R=-R);let M=R*(c*$/f),N=R*(-(f*b)/c),B=p*M-m*N+(n+a)/2,D=m*M+p*N+(e+l)/2,L=(b-M)/c,K=($-N)/f,C=(-b-M)/c,re=(-$-N)/f,ee=Il(1,0,L,K),Z=Il(L,K,C,re);return!o&&Z>0?Z-=Ot:o&&Z<0&&(Z+=Ot),{cx:B,cy:D,rx:c,ry:f,phi:d,theta1:ee,deltaTheta:Z}}function lp(n,e){let t=Math.cos(n.phi),r=Math.sin(n.phi),i=Math.cos(e),s=Math.sin(e);return{x:n.cx+n.rx*t*i-n.ry*r*s,y:n.cy+n.rx*r*i+n.ry*t*s}}function up(n,e,t){if(t>=0){let i=(n-e)%Ot;return i<0&&(i+=Ot),i<=t}let r=(e-n)%Ot;return r<0&&(r+=Ot),r<=-t}function ma(n,e,t,r,i,s,o,a,l){let c={minX:Math.min(n,a),minY:Math.min(e,l),maxX:Math.max(n,a),maxY:Math.max(e,l)},f=pa(n,e,t,r,i,s,o,a,l);if(!f)return c;let d=Math.cos(f.phi),p=Math.sin(f.phi),m=Math.atan2(-f.ry*p,f.rx*d),h=Math.atan2(f.ry*d,f.rx*p),g=[m,m+Math.PI,h,h+Math.PI];for(let b of g){if(!up(b,f.theta1,f.deltaTheta))continue;let $=lp(f,b);$.x<c.minX&&(c.minX=$.x),$.x>c.maxX&&(c.maxX=$.x),$.y<c.minY&&(c.minY=$.y),$.y>c.maxY&&(c.maxY=$.y)}return c}var cp="MmLlHhVvCcSsQqTtAaZz";function ri(n){return n>=48&&n<=57}function dp(n){return n===32||n===9||n===10||n===12||n===13}var fa=class{constructor(e){this.d=e}d;i=0;skipWsp(){for(;this.i<this.d.length&&dp(this.d.charCodeAt(this.i));)this.i++}skipCommaWsp(){this.skipWsp(),this.d.charCodeAt(this.i)===44&&(this.i++,this.skipWsp())}atEnd(){return this.skipWsp(),this.i>=this.d.length}readCommand(){this.skipWsp();let e=this.d[this.i];return e!==void 0&&cp.indexOf(e)>=0?(this.i++,e):null}nextIsNumber(){this.skipCommaWsp();let e=this.d.charCodeAt(this.i);return ri(e)||e===43||e===45||e===46}readNumber(){this.skipCommaWsp();let e=this.d,t=this.i,r=this.i,i=e.charCodeAt(r);(i===43||i===45)&&r++;let s=0;for(;r<e.length&&ri(e.charCodeAt(r));)r++,s++;if(e.charCodeAt(r)===46)for(r++;r<e.length&&ri(e.charCodeAt(r));)r++,s++;if(s===0)return null;let o=e.charCodeAt(r);if(o===101||o===69){let l=r+1,c=e.charCodeAt(l);(c===43||c===45)&&l++;let f=0;for(;l<e.length&&ri(e.charCodeAt(l));)l++,f++;f>0&&(r=l)}let a=Number.parseFloat(e.slice(t,r));return Number.isFinite(a)?(this.i=r,a):null}readFlag(){this.skipCommaWsp();let e=this.d[this.i];return e==="0"?(this.i++,!1):e==="1"?(this.i++,!0):null}};function ii(n,e,t){e<n.minX&&(n.minX=e),e>n.maxX&&(n.maxX=e),t<n.minY&&(n.minY=t),t>n.maxY&&(n.maxY=t),n.any=!0}function ha(n,e){e.minX<n.minX&&(n.minX=e.minX),e.maxX>n.maxX&&(n.maxX=e.maxX),e.minY<n.minY&&(n.minY=e.minY),e.maxY>n.maxY&&(n.maxY=e.maxY),n.any=!0}function Ml(n,e,t,r,i,s,o,a,l){let c=si(e,r,s,a),f=si(t,i,o,l);ha(n,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function Cl(n,e,t,r,i,s,o){let a=ai(e,r,s),l=ai(t,i,o);ha(n,{minX:a.min,maxX:a.max,minY:l.min,maxY:l.max})}function ga(n){if(!n)return null;let e=new fa(n),t={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},r=0,i=0,s=0,o=0,a=0,l=0,c=null,f="",d=!1,p=()=>t.any?{minX:t.minX,minY:t.minY,maxX:t.maxX,maxY:t.maxY}:null;for(;!e.atEnd();){let m=e.readCommand();if(m!==null)f=m;else if(f===""||f==="Z"||f==="z"||!e.nextIsNumber())break;if(!d){if(f!=="M"&&f!=="m")return null;d=!0}let h=f>="a"&&f<="z";switch(f){case"M":case"m":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();r=h?r+g:g,i=h?i+b:b,s=r,o=i,ii(t,r,i),c=null,f=h?"l":"L";break}case"L":case"l":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();r=h?r+g:g,i=h?i+b:b,ii(t,r,i),c=null;break}case"H":case"h":{let g=e.readNumber();if(g===null)return p();r=h?r+g:g,ii(t,r,i),c=null;break}case"V":case"v":{let g=e.readNumber();if(g===null)return p();i=h?i+g:g,ii(t,r,i),c=null;break}case"C":case"c":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber(),S=e.readNumber(),x=e.readNumber();if(g===null||b===null||$===null||k===null||S===null||x===null)return p();let v=h?r+g:g,w=h?i+b:b,T=h?r+$:$,P=h?i+k:k,R=h?r+S:S,M=h?i+x:x;Ml(t,r,i,v,w,T,P,R,M),a=T,l=P,c="cubic",r=R,i=M;break}case"S":case"s":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber();if(g===null||b===null||$===null||k===null)return p();let S=c==="cubic"?2*r-a:r,x=c==="cubic"?2*i-l:i,v=h?r+g:g,w=h?i+b:b,T=h?r+$:$,P=h?i+k:k;Ml(t,r,i,S,x,v,w,T,P),a=v,l=w,c="cubic",r=T,i=P;break}case"Q":case"q":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber();if(g===null||b===null||$===null||k===null)return p();let S=h?r+g:g,x=h?i+b:b,v=h?r+$:$,w=h?i+k:k;Cl(t,r,i,S,x,v,w),a=S,l=x,c="quad",r=v,i=w;break}case"T":case"t":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();let $=c==="quad"?2*r-a:r,k=c==="quad"?2*i-l:i,S=h?r+g:g,x=h?i+b:b;Cl(t,r,i,$,k,S,x),a=$,l=k,c="quad",r=S,i=x;break}case"A":case"a":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readFlag(),S=e.readFlag(),x=e.readNumber(),v=e.readNumber();if(g===null||b===null||$===null||k===null||S===null||x===null||v===null)return p();let w=h?r+x:x,T=h?i+v:v;ha(t,ma(r,i,g,b,$,k,S,w,T)),r=w,i=T,c=null;break}case"Z":case"z":{r=s,i=o,c=null;break}default:return p()}}return p()}function Dl(n,e,t=!1,r=.5,i){return n.length===0?null:ga(qe(n,e,t,r,i))}function oi(n,e){let t=Fe(n,e);return Et(n,{width:t.width,height:t.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function fp(n){return n==="class"?"className":n==="for"?"htmlFor":n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Fl(n){return n.replace(/\s([a-z][a-z-]*?)=/g,(e,t)=>t.startsWith("data-")||t.startsWith("aria-")?e:` ${fp(t)}=`)}function li(n,e){let t=e.componentName??"SvgComponent",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=Array.isArray(n.library)?n.library:[],l=Ze(s,a),c=Ee(s,a),f=l+c,d=f.length>0,p=s.map(h=>{let g=de(h);return`${i}${i}${i}${Fl(g)}`}),m=[];m.push("import React from 'react';"),m.push(""),o?(m.push(`interface ${t}Props {`),m.push(`${i}className?: string;`),m.push(`${i}style?: React.CSSProperties;`),m.push("}"),m.push(""),m.push(`const ${t}: React.FC<${t}Props> = ({ className, style }) => {`)):m.push(`const ${t} = ({ className, style }) => {`),m.push(`${i}return (`),m.push(`${i}${i}<svg xmlns="http://www.w3.org/2000/svg" width="${r.width}" height="${r.height}" viewBox="0 0 ${r.width} ${r.height}" className={className} style={style}>`),d&&(m.push(`${i}${i}${i}<defs>`),m.push(`${i}${i}${i}${i}${Fl(f)}`),m.push(`${i}${i}${i}</defs>`));for(let h of p)m.push(h);return m.push(`${i}${i}</svg>`),m.push(`${i});`),m.push("};"),m.push(""),m.push(`export default ${t};`),m.push(""),m.join(`
14
- `)}function ui(n,e){let t=e.componentName??"SvgComponent",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=Array.isArray(n.library)?n.library:[],l=Ze(s,a),c=Ee(s,a),f=l+c,d=f.length>0,p=s.map(h=>`${i}${i}${de(h)}`),m=[];m.push("<template>"),m.push(`${i}<svg xmlns="http://www.w3.org/2000/svg" width="${r.width}" height="${r.height}" viewBox="0 0 ${r.width} ${r.height}" :class="className" :style="style">`),d&&(m.push(`${i}${i}<defs>`),m.push(`${i}${i}${i}${f}`),m.push(`${i}${i}</defs>`));for(let h of p)m.push(h);return m.push(`${i}</svg>`),m.push("</template>"),m.push(""),o?m.push('<script setup lang="ts">'):m.push("<script setup>"),m.push(`// ${t}`),o?(m.push("defineProps<{"),m.push(`${i}className?: string;`),m.push(`${i}style?: Record<string, string>;`),m.push("}>();")):(m.push("defineProps({"),m.push(`${i}className: { type: String, default: '' },`),m.push(`${i}style: { type: Object, default: () => ({}) },`),m.push("});")),m.push("</script>"),m.push(""),m.join(`
15
- `)}var pp=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function El(n){return n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Ol(n){return n.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function mp(n){if(!pp.has(n.type))return!0;let e=n.state.metadata;return!!(e?.title||e?.description||n.type==="text"&&n.state.isTextPath)}function ci(n,e){let t=e.componentName??"createSvg",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=[];a.push("import * as d3 from 'd3';"),a.push(""),o?a.push(`export function ${t}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):a.push(`export function ${t}(container) {`),a.push(`${i}const svg = d3.select(container)`),a.push(`${i}${i}.append('svg')`),a.push(`${i}${i}.attr('xmlns', 'http://www.w3.org/2000/svg')`),a.push(`${i}${i}.attr('width', ${r.width})`),a.push(`${i}${i}.attr('height', ${r.height})`),a.push(`${i}${i}.attr('viewBox', '0 0 ${r.width} ${r.height}');`),a.push("");let l=Array.isArray(n.library)?n.library:[],c=Ze(s,l),f=Ee(s,l),d=`${c}${f}`;d.length>0&&(a.push(`${i}svg.append('defs').html(\`${Ol(d)}\`);`),a.push(""));for(let p=0;p<s.length;p++){let m=s[p];if(a.push(`${i}// ${m.type}${m.state.metadata?.name?` \u2014 ${m.state.metadata.name}`:""}`),mp(m)){a.push(`${i}svg.append('g').html(\`${Ol(de(m))}\`);`),a.push("");continue}let h=ol(m),g=Mr(m),b=`shape${p+1}`;a.push(`${i}const ${b} = svg.append('${h}')`);for(let[$,k]of g)a.push(`${i}${i}.attr('${$}', '${El(k)}')`);m.type==="text"&&m.state.text&&a.push(`${i}${i}.text('${El(m.state.text)}')`),a[a.length-1]=a[a.length-1]+";",a.push("")}return a.push(`${i}return svg;`),a.push("}"),a.push(""),a.join(`
16
- `)}function Ll(n,e){let t=n.state.metadata?.name;return t?t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${n.type}-${e+1}`}var hp=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function di(n,e){let t=Fe(n,e),r=e.indent??" ",i=n.shapes??[],s=[];for(let l=0;l<i.length;l++){let c=i[l],f=Ll(c,l),d=Mr(c),p=[];for(let[m,h]of d)hp.has(m)&&p.push(`${r}${m}: ${h};`);p.length>0&&s.push(`.${f} {
17
- ${p.join(`
34
+ ${o}`)}return n.includeWarnings===!1?[]:r.warnings.map(o=>({severity:"warning",code:/\.type$/.test(o.path)&&/Unknown shape type/.test(o.message)?"unavailable-shape-descriptor":"native-validation-warning",source:"native-document",entrypoint:e,message:o.message,documentPath:o.path}))}var Bx=["migration","validation","normalization","canonical-node-construction","document-section-staging"];function Ed(t){let e=structuredClone(t);return e.shapes=Tr(e.shapes,e.groups),e.groups=[],e}function Gx(t,e,n,r,i){e.set(t.id,t),n.push({id:t.id,parentId:r,index:i});let o=t.state.children;Array.isArray(o)&&o.forEach((s,a)=>Gx(s,e,n,t.id,a))}function yM(t){let e=new Map,n=new Map,r=new Map,i=(s,a)=>{let l=a?n:e,c=l.get(s.id)??[];c.push(s),l.set(s.id,c),r.set(s.id,(r.get(s.id)??0)+1);let u=s.state.children;Array.isArray(u)&&u.forEach(d=>i(d,!0))};t.shapes.forEach(s=>i(s,!1));let o=new Set;for(let[s,a]of e){if(a.length!==1||r.get(s)!==2)continue;let l=n.get(s)??[];if(l.length!==1||(o.add(s),JSON.stringify(a[0])!==JSON.stringify(l[0])))continue;let c=[],u=p=>{c.push(p.id);let f=p.state.children;Array.isArray(f)&&f.forEach(u)};u(a[0]);let d=new Set(c);d.size===c.length&&([...d].some(p=>r.get(p)!==2)||d.forEach(p=>o.add(p)))}return o}function SM(t,e){let n=new Map,r=[];t.shapes.forEach((c,u)=>Gx(c,n,r,null,u));let i=new Map(r.map(c=>[c.id,c])),o=new Set,s=[];for(let c of t.sceneTree??[])o.has(c.id)||(o.add(c.id),s.push(structuredClone(c)));for(let c of r)o.has(c.id)||(o.add(c.id),s.push(structuredClone(c)));let a=new Set(s.map(c=>c.id)),l=new Map;for(let c of s){let u=i.get(c.id),d=e||c.parentId===null||a.has(c.parentId)?c.parentId:u?.parentId??null,p=l.get(d)??[];p.push({...c,parentId:d}),l.set(d,p)}t.sceneTree=[...l.values()].flatMap(c=>tt(c).map((u,d)=>{let p={...u,index:d};return p.orderKey===void 0&&delete p.orderKey,p.updatedAt===void 0&&delete p.updatedAt,p.clientId===void 0&&delete p.clientId,p}))}function bM(t,e){if(!e.has(t))return t;let n=2;for(;e.has(`${t}-${n}`);)n++;return`${t}-${n}`}function vM(t){let e=t.shapes.filter(a=>a.type==="view"&&a.state.isHomeView===!0);if(e.length===0)return;let n=e[0].state,r=n.viewBoxWidth??0,i=n.viewBoxHeight??0,o=t.shapes.find(a=>a.type==="svg"&&a.state.isRootSvg===!0);if(o){let a=o.state,l=Number(a.svgViewBoxWidth??0),c=Number(a.svgViewBoxHeight??0);!(l>0&&c>0)&&r>0&&i>0&&(a.svgViewBoxX=n.viewBoxX??0,a.svgViewBoxY=n.viewBoxY??0,a.svgViewBoxWidth=r,a.svgViewBoxHeight=i,Number(a.svgWidth??0)>0||(a.svgWidth=r),Number(a.svgHeight??0)>0||(a.svgHeight=i))}let s=new Set(e.map(a=>a.id));t.shapes=t.shapes.filter(a=>!s.has(a.id)),t.sceneTree=t.sceneTree?.filter(a=>!s.has(a.id))}function xM(t,e){if(e===!1||t.shapes.find(d=>d.type==="svg"&&d.state.isRootSvg===!0))return;let r=new Set((t.sceneTree??[]).filter(d=>d.parentId===null).map(d=>d.id)),i=(t.sceneTree?.length??0)>0;if(t.shapes.some(d=>d.type==="svg"&&d.state.isRootSvg!==!0&&(!i||r.has(d.id))))return;let s=e?.width??800,a=e?.height??600,l=new Set,c=d=>{for(let p of d){l.add(p.id);let f=p.state.children;Array.isArray(f)&&c(f)}};c(t.shapes);let u=bM(e?.idBase??"document-root",l);t.shapes.unshift({id:u,type:"svg",state:{isRootSvg:!0,svgWidth:s,svgHeight:a,svgViewBoxX:0,svgViewBoxY:0,svgViewBoxWidth:s,svgViewBoxHeight:a,svgPreserveAspectRatio:"xMidYMid meet"}}),t.sceneTree&&t.sceneTree.length>0&&(t.sceneTree=[{id:u,parentId:null,index:0},...t.sceneTree.map(d=>d.parentId===null?{...d,index:d.index+1}:d)])}function IM(t){let e=new Set,n=r=>{let i=r.state.children;if(Array.isArray(i))for(let o of i)e.add(o.id),n(o)};t.shapes.forEach(n),t.shapes=t.shapes.filter(r=>!e.has(r.id))}function Vx(t,e){SM(t,e.preserveUnresolvedParents),e.materializeClipMaskStructure&&ir(t),Hr(t),IM(t)}function jx(t){let e=Ed(t);return Vx(e,{materializeClipMaskStructure:!1,preserveUnresolvedParents:!0}),e}function wM(t){let e=new Map,n=r=>{if(e.has(r.id))return;e.set(r.id,r);let i=r.state.children;Array.isArray(i)&&i.forEach(n)};return t.forEach(n),e}var kM=/^structural:(clip|mask):(.+):(group|path|content)$/;function RM(t,e,n,r){let i=new tr,o=wM(t.shapes);for(let s of o.values()){let a=e===null||e.has(s.type),l=structuredClone(s);a&&l.state.children&&delete l.state.children;let c=_t.fromSerialized(l);a||(c.preserveSerializedState(s.state),r.push(s.id),n.push({severity:"warning",code:"unavailable-shape-descriptor",source:"native-document",entrypoint:"full-snapshot-restore",message:`No shape descriptor is available for ${s.type}.`,documentPath:`shapes.${s.id}`,shapeId:s.id})),i.addNode(c)}for(let s of t.sceneTree??[]){if(i.getNode(s.id))continue;let a=kM.exec(s.id);if(!a)continue;let[,l,c,u]=a,d=t.clipMaskGroups?.find(f=>f.type===l&&f.id===c),p={structural:!0};u==="group"&&d&&(p.clipMaskDefId=St(d)),i.addNode(_t.fromSerialized({id:s.id,type:`${l}-${u}-structure`,state:p}))}for(let s of t.sceneTree??[])i.getNode(s.id)&&i.moveNodeToParentId(s.id,s.parentId,s.index);return i.clearAllDirty(),i}function Ux(t,e={}){let n=null,r=null;try{let i=structuredClone(t);i=yo(i),i=vo(i),e.injectFault?.("migration"),i=bo(i),i=So(i);let o=yM(i);ra(i,"full-snapshot-restore",{includeWarnings:!1,ignoreError:u=>{let d=/^Duplicate shape id: "(.+)"$/.exec(u.message);return d?o.has(d[1]):!1}}),i=Ed(i),na(i),vM(i),xM(i,e.rootFrame),Vx(i,{materializeClipMaskStructure:!0,preserveUnresolvedParents:!1});let s=ra(i,"full-snapshot-restore").filter(u=>u.code!=="unavailable-shape-descriptor");e.injectFault?.("validation"),e.injectFault?.("normalization");let a=[],l=e.availableShapeTypes?new Set(e.availableShapeTypes):null;n=RM(i,l,s,a),e.injectFault?.("canonical-node-construction"),r=new or(n),r.loadSections(i),e.injectFault?.("document-section-staging");let c=Kr.own(r,e.identity);return c.assertCoherent(),{document:c,snapshot:structuredClone(i),diagnostics:Object.freeze(structuredClone(s)),unavailableNodeIds:Object.freeze([...a])}}catch(i){throw r?r.dispose():n?.dispose(),i}}var Xx=["unknown-shape-diagnostic","symbol-variants-overrides","smil-timeline","motion-only-partition","paint-server-references","filter-references","document-definition-context","inline-child-containers","isolated-flowchart-nodes","text-path","common-presentation","gradient-definition-envelope","filter-definition-envelope","export-precision-rounding","defs-deduplication","source-id-restoration","orphan-def-exclusion","font-embedding","initial-value-elision","namespace-declaration-completion"],Y=t=>({mode:"supported",by:t}),Pr=t=>({mode:"diagnostic",signal:"warning",by:t}),ue=t=>({mode:"outside-contract",reason:t}),qe=t=>t,Hx=ue("DXF is a static CAD geometry contract and has no representation for this SVG behavior."),Wx=ue("Mermaid is a static graph-structure contract and has no representation for this SVG behavior."),Kx=ue("PDF export produces a static page from the current editor SVG projection and does not promise animation playback."),Yx={"unknown-shape-diagnostic":qe({renderToSvg:Pr("renderShape reports UNSUPPORTED_SHAPE_TYPE through renderToSvgWithDiagnostics"),codegen:Pr("buildRenderPlan carries UNSUPPORTED_SHAPE_TYPE into generateCodeWithDiagnostics"),dxf:Pr("DxfExportStats records unsupported types and the DXF export UI reports them"),mermaid:Pr("exportMermaidWithDiagnostics records unsupported nodes and both Mermaid UIs report them"),pdf:ue("PDF conversion consumes an already-projected editor SVG; unknown model nodes never enter its input."),"editor-dom":ue("Unknown nodes are preserved for round-trip but require a registered shape implementation for projection.")}),"symbol-variants-overrides":qe({renderToSvg:Y("buildRenderPlan materializes symbol variants and per-instance overrides before emission"),codegen:Y("every component backend consumes buildRenderPlan symbol materialization"),dxf:Pr("DXF unsupported-shape accounting reports symbol instances without a lowering"),mermaid:Pr("Mermaid node-skip diagnostics report symbol instances without a lowering"),pdf:Y("the editor projects SymbolInstance content into the SVG consumed by svg2pdf"),"editor-dom":Y("SymbolInstance projects resolved library variants and overrides")}),"smil-timeline":qe({renderToSvg:Y("buildRenderPlan injects renderAnimationElements output into shape markup"),codegen:Y("component backends preserve SMIL children in planned shape markup"),dxf:Hx,mermaid:Wx,pdf:Kx,"editor-dom":Y("AnimationManager and the shared SMIL kernel project live playback")}),"motion-only-partition":qe({renderToSvg:Y("buildRenderPlan diverts motionOnly templates into defs outside visible paint"),codegen:Y("component backends consume the render plan visible and motion-def partitions"),dxf:Hx,mermaid:Wx,pdf:Kx,"editor-dom":ue("The authoring DOM retains motion templates for editing instead of applying export partitioning.")}),"paint-server-references":qe({renderToSvg:Y("plan defs and shapes use one library-first paint-server reference resolver"),codegen:Y("buildShapeAttrs and plan defs use the library-first reference resolver"),dxf:ue("DXF promises geometry and basic entity colors, not SVG paint-server definition graphs."),mermaid:ue("Mermaid graph syntax has no SVG gradient or pattern paint-server model."),pdf:Y("the cloned SVG carries paint-server definitions and references into svg2pdf"),"editor-dom":Y("GradientManager maintains live defs matching shape paint references")}),"filter-references":qe({renderToSvg:Y("renderFilterDefs and filterReferenceValue emit matching identifiers"),codegen:Y("planned filter defs and buildShapeAttrs share filter reference resolution"),dxf:ue("DXF entity geometry has no SVG filter graph or filter-reference representation."),mermaid:ue("Mermaid graph syntax has no SVG filter graph or filter-reference representation."),pdf:Y("the cloned SVG carries filter definitions and references into svg2pdf"),"editor-dom":Y("FilterManager maintains live filter definitions and shape references")}),"document-definition-context":qe({renderToSvg:Y("buildRenderPlan consumes the full snapshot definition and style context"),codegen:Y("component codegen accepts snapshot context and clipboard supplies its definitions"),dxf:ue("DXF consumes resolved shapes and does not serialize SVG document definition sections."),mermaid:ue("Mermaid consumes graph nodes and does not serialize SVG definition sections."),pdf:Y("PDF receives a cloned SVG document with its referenced definition context"),"editor-dom":Y("the document aggregate and managers project referenced resources into defs")}),"inline-child-containers":qe({renderToSvg:Y("renderShape recursively renders INLINE_CHILD_CONTAINER_TYPES children"),codegen:Y("component backends preserve recursively rendered plan container markup"),dxf:Y("DXF walks INLINE_CHILD_CONTAINER_TYPES with transforms and cycle guards"),mermaid:Pr("unsupported container nodes are counted by exportMermaidWithDiagnostics"),pdf:Y("the cloned editor SVG preserves nested containers for svg2pdf"),"editor-dom":Y("registered containers project managed children into nested SVG elements")}),"isolated-flowchart-nodes":qe({renderToSvg:ue("Isolated-node declarations are a Mermaid graph concern, not an SVG branch."),codegen:ue("Isolated-node declarations are a Mermaid graph concern, not component SVG output."),dxf:ue("DXF emits geometry independently and has no connector-enrolment requirement."),mermaid:Y("exportMermaid declares mapped nodes before emitting connector edges"),pdf:ue("PDF paints SVG geometry independently and has no graph-node declaration requirement."),"editor-dom":ue("The live SVG projects shapes independently and has no graph-node declaration requirement.")}),"text-path":qe({renderToSvg:Y("renderText emits textPath markup and its referenced path definition"),codegen:Y("component backends preserve planned textPath markup and definitions"),dxf:ue("DXF text entities do not reproduce SVG textPath layout along arbitrary paths."),mermaid:ue("Mermaid labels do not reproduce SVG textPath layout along arbitrary paths."),pdf:Pr("ExportPanel.generatePdfBlob detects textPath content and shows its localized warning"),"editor-dom":Y("Text projects textPath attributes and maintains its referenced path")}),"common-presentation":qe({renderToSvg:Y("commonAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),codegen:Y("buildShapeAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),dxf:ue("DXF is not an SVG presentation-attribute serialization contract."),mermaid:ue("Mermaid is not an SVG presentation-attribute serialization contract."),pdf:Y("svg2pdf consumes common presentation attributes from the cloned SVG"),"editor-dom":Y("COMMON_PROP_RENDERERS derives its dispatch from PRESENTATION_SEMANTICS")}),"gradient-definition-envelope":qe({renderToSvg:Y("gradient renderers serialize the shared typed definition envelopes"),codegen:Y("render plan defs contain gradients serialized from shared typed envelopes"),dxf:ue("DXF has no SVG linearGradient or radialGradient definition envelope."),mermaid:ue("Mermaid has no SVG linearGradient or radialGradient definition envelope."),pdf:Y("the cloned SVG supplies shared-envelope gradient definitions to svg2pdf"),"editor-dom":Y("GradientManager projects shared gradient envelopes into live defs")}),"filter-definition-envelope":qe({renderToSvg:Y("renderFilterElement serializes filterDefinitionEnvelope for each wrapper kind"),codegen:Y("render plan defs contain filters serialized from shared typed envelopes"),dxf:ue("DXF has no SVG filter element or primitive graph envelope representation."),mermaid:ue("Mermaid has no SVG filter element or primitive graph envelope representation."),pdf:Y("the cloned SVG supplies shared-envelope filter definitions to svg2pdf"),"editor-dom":Y("FilterManager projects filterDefinitionEnvelope before primitive emission")}),"export-precision-rounding":qe({renderToSvg:Y("finalizeRenderPlan rounds markup coordinates at the effective documentMetadata.coordinatePrecision"),codegen:ue("Codegen backends consume the un-finalized render plan; component output precision is a code-style concern, not an export boundary."),dxf:ue("DXF numeric precision is owned by the DXF writer, not the SVG export boundary."),mermaid:ue("Mermaid emits graph syntax rather than SVG coordinate attribute streams."),pdf:Y("PDF viewbox pages consume the plan-assembled string (core rounding); selection pages pass through SvgExportFinalizer.roundSvgAttributes"),"editor-dom":Y("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":qe({renderToSvg:Y("finalizeRenderPlan collapses content-identical gradient/pattern/marker defs and rewrites references"),codegen:ue("Codegen backends consume the un-finalized render plan; def duplication in generated components is a code-size concern outside the export contract."),dxf:ue("DXF output has no shared-definition graph in which duplicates could exist."),mermaid:ue("Mermaid output has no shared-definition graph in which duplicates could exist."),pdf:Y("PDF viewbox pages consume the plan-assembled string (core dedup); selection pages pass through SvgExportFinalizer.deduplicateDefsForExport"),"editor-dom":Y("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":qe({renderToSvg:Y("finalizeRenderPlan restores uncontested library sourceIds and rewrites references"),codegen:ue("Generated components keep collision-safe runtime ids; source ids are a document round-trip concern."),dxf:ue("DXF entities carry no SVG id namespace for source ids to be restored into."),mermaid:ue("Mermaid nodes carry no SVG id namespace for source ids to be restored into."),pdf:ue("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":Y("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":qe({renderToSvg:Y("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:Y("component backends consume the same demand-driven plan def channels"),dxf:ue("DXF output has no defs graph from which orphans could need excluding."),mermaid:ue("Mermaid output has no defs graph from which orphans could need excluding."),pdf:Y("the editor SVG consumed by svg2pdf passes through pruneOrphanedDefs"),"editor-dom":Y("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":qe({renderToSvg:Y("finalizeRenderPlan ships @font-face CSS from the injected resolveFontEmbedCss hook (core is platform-free; binary resolution is the caller environment responsibility)"),codegen:ue("Generated components inherit the host page font pipeline; embedding binaries in component source is out of contract."),dxf:ue("DXF text styling is font-name based; the format has no font binary embedding."),mermaid:ue("Mermaid delegates font resolution entirely to the rendering host page."),pdf:Y("svg2pdf consumes the editor SVG after embedFontsInClone inlined @font-face CSS"),"editor-dom":Y("static string exports resolve plan-collected families through fontManager into the core resolveFontEmbedCss hook; the embedded-SVG subtree async export runs SvgExportFinalizer.embedFontsInClone; raster sinks rasterize with the session live font faces and need no embedding")}),"initial-value-elision":qe({renderToSvg:Y("finalizeRenderPlan drops redundant spec initials and product defaults under an initial-valued cascade (elideInitialValuesInPlan)"),codegen:ue("Codegen backends consume the un-finalized plan; explicit values in component source are a readability choice, not an export-boundary concern."),dxf:ue("DXF entities carry explicit CAD attributes with no SVG initial-value cascade."),mermaid:ue("Mermaid emits graph syntax; SVG presentation initial values never appear in its output."),pdf:Y("PDF viewbox pages consume the plan-assembled string (core elision); selection pages pass through SvgExportFinalizer.stripDefaultPaintAttributes"),"editor-dom":Y("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":qe({renderToSvg:Y("finalizeRenderPlan declares used prefixes on the root via a well-known URI table (declareUsedNamespacePrefixes); unresolvable prefixes warn undeclarable-namespace-prefix"),codegen:ue("Generated components render into a host document whose framework owns namespace handling; JSX/Vue templates have no xmlns declaration surface to complete."),dxf:ue("DXF is not XML and has no namespace prefixes to declare or complete."),mermaid:ue("Mermaid graph syntax is not XML; no namespace declarations exist."),pdf:Y("svg2pdf consumes the editor SVG string whose serializer declared every namespace it uses"),"editor-dom":Y("static string exports complete declarations through core declareUsedNamespacePrefixes; the raster/selection clone sinks rely on XMLSerializer plus hoistForeignNamespaceDecls")})};function fi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}async function og(t,e,n,r){let i=t[e];typeof i=="string"&&(t[e]=await r(i,n))}async function ig(t,e){fi(t)&&await og(t,"svgContent","svgMarkup",e)}async function Ad(t,e){if(!fi(t))return;await og(t,"href","href",e),await ig(t.fillGradient,e),await ig(t.strokeGradient,e);let n=t.children;if(Array.isArray(n))for(let r of n)fi(r)&&await Ad(r.state,e)}async function qx(t,e){if(!fi(t))return;let n=t.shapes;if(Array.isArray(n))for(let o of n)fi(o)&&await Ad(o.state,e);let r=t.library;if(Array.isArray(r))for(let o of r)fi(o)&&o.kind==="pattern"&&await ig(o.pattern,e);let i=t.customPatterns;if(Array.isArray(i))for(let o of i)fi(o)&&await og(o,"svgContent","svgMarkup",e)}function Nd(t,e={}){let{indent:n=2,trailingNewline:r=!0,validate:i=!1}=e;if(i){let a=wr(t);if(!a.valid){let l=a.errors.map(c=>` ${c.path}: ${c.message}`).join(`
35
+ `);throw new Error(`Invalid document:
36
+ ${l}`)}}let o={};for(let a of Td){let l=a==="unknownFields"?Pd(t):t[a];l!==void 0&&(o[a]=TM(gt[a].serialization,l))}let s=JSON.stringify(o,null,n);return r?s+`
37
+ `:s}function TM(t,e){switch(t.kind){case"verbatim":return e;case"shape-array":return e.map(n=>$M(La(structuredClone(n))));case"id-sorted-array":return CM(e).map(xo);case"ordered-array":return e.map(xo);case"deep-sorted-object":case"unknown-bag":return xo(e);default:return PM(t)}}function PM(t){throw new Error(`Unhandled serialization kind: ${JSON.stringify(t)}`)}function Md(t,e={}){return sg(t,e).value}function sg(t,e={}){let{validate:n=!0,migrate:r=!0}=e,i;try{i=JSON.parse(t)}catch(a){throw new Error(`Failed to parse .svgs document: ${a.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let o=i;o=yo(o),r&&(o=vo(o),o=bo(o)),o=So(o);let s=[];return n&&s.push(...ra(o,"native-document-open")),{value:o,diagnostics:s}}function CM(t){return[...t].sort((e,n)=>e.id.localeCompare(n.id))}function xo(t){if(t==null)return t;if(Array.isArray(t))return t.map(xo);if(typeof t!="object")return t;let e={},n=Object.keys(t).sort();for(let r of n)e[r]=xo(t[r]);return e}function $M(t){let e={id:t.id,type:t.type},n=Object.keys(t).filter(r=>r!=="id"&&r!=="type").sort();for(let r of n)e[r]=xo(t[r]);return e}var Sn=/\{\{\s*([\w.\-]+)\s*\}\}/g;function Od(t,e){return t.replace(Sn,(n,r)=>{let i=e[r];return i!==void 0?String(i):n})}function ia(t,e={}){let n={};if(t.templateVariables)for(let i of t.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(n[i.name]=i.defaultValue);if(Object.assign(n,e),Object.keys(n).length===0)return JSON.parse(JSON.stringify(t));let r=JSON.parse(JSON.stringify(t));if(r.templateVariables)for(let i of r.templateVariables)Object.prototype.hasOwnProperty.call(e,i.name)&&(i.defaultValue=String(e[i.name]));return ag(r,n),r}function ag(t,e){for(let n of Object.keys(t)){let r=t[n];if(typeof r=="string"){if(Sn.lastIndex=0,Sn.test(r)){Sn.lastIndex=0;let i=Od(r,e);if(EM(r)){let o=Number(i);if(!isNaN(o)&&NM(n)){t[n]=o;continue}}t[n]=i}}else if(Array.isArray(r))for(let i=0;i<r.length;i++)typeof r[i]=="string"?(Sn.lastIndex=0,Sn.test(r[i])&&(Sn.lastIndex=0,r[i]=Od(r[i],e))):r[i]!==null&&typeof r[i]=="object"&&ag(r[i],e);else r!==null&&typeof r=="object"&&ag(r,e)}}function EM(t){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(t)}var AM=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",..._o,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function NM(t){return AM.has(t)}function Dd(t){let e=t.templateVariables??[],n=new Set(e.map(o=>o.name)),r=new Set;lg(t,r);let i=[...r].filter(o=>!n.has(o)).sort();return{defined:[...e],undeclared:i}}function lg(t,e){for(let n of Object.values(t))if(typeof n=="string"){let r;for(Sn.lastIndex=0;(r=Sn.exec(n))!==null;)e.add(r[1])}else if(Array.isArray(n))for(let r of n)if(typeof r=="string"){let i;for(Sn.lastIndex=0;(i=Sn.exec(r))!==null;)e.add(i[1])}else r!==null&&typeof r=="object"&&lg(r,e);else n!==null&&typeof n=="object"&&lg(n,e)}function Zx(t){let e={};for(let n of t){let r=n.indexOf("=");if(r===-1)throw new Error(`Invalid variable format: "${n}". Expected "name=value".`);let i=n.slice(0,r).trim(),o=n.slice(r+1);if(!i)throw new Error(`Invalid variable format: "${n}". Variable name cannot be empty.`);e[i]=o}return e}var oa=3,zd=12;function _d(t){return t==null||!Number.isFinite(t)?oa:t<0?0:t>zd?zd:Math.floor(t)}function bn(t,e){if(!Number.isFinite(t))return t;let n=Math.pow(10,e);return Math.round(t*n)/n}var MM=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function sa(t,e){return t.replace(MM,n=>{let r=parseFloat(n);return Number.isFinite(r)?String(bn(r,e)):n})}var OM=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),DM=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextRuns","richTextData","cssMaskProperties","rawMetadata"]);function mi(t,e,n){if(e==null)return e;if(typeof e=="number")return bn(e,n);if(typeof e=="string")return OM.has(t)?sa(e,n):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(r=>mi(t,r,n));if(typeof e=="object"){if(DM.has(t))return e;if(t==="symbolOverrides"){let i={};for(let[o,s]of Object.entries(e))i[o]=mi("state",s,n);return i}let r={};for(let[i,o]of Object.entries(e))r[i]=mi(i,o,n);return r}return e}function cg(t,e){return{id:t.id,type:t.type,state:mi("state",t.state,e)}}function Jx(t,e){let n=t,r={...n};for(let i of Object.keys(gt)){let o=n[i];if(o!==void 0)switch(gt[i].precision){case"opaque":break;case"numeric-leaves":r[i]=mi(i,o,e);break;case"animation-timeline":r[i]=zM(o,e);break;case"shape-trees":r[i]=_M(i,o,e);break}}return r}function zM(t,e){return{...t,tracks:t.tracks.map(n=>({...n,...n.motionPathMatrix?{motionPathMatrix:n.motionPathMatrix.map(r=>bn(r,e))}:{},...n.ancestorMatrix?{ancestorMatrix:n.ancestorMatrix.map(r=>bn(r,e))}:{},...n.transformOrigin?{transformOrigin:{x:bn(n.transformOrigin.x,e),y:bn(n.transformOrigin.y,e)}}:{},...n.pasteOffset?{pasteOffset:{x:bn(n.pasteOffset.x,e),y:bn(n.pasteOffset.y,e)}}:{},...typeof n.motionRotate=="number"?{motionRotate:bn(n.motionRotate,e)}:{},keyframes:n.keyframes.map(r=>({...r,value:mi("value",r.value,e)}))}))}}function _M(t,e,n){return Array.isArray(e)?t==="shapes"?e.map(r=>cg(r,n)):e.map(r=>mi("libraryDef",r,n)):e}function FM(t){return{text:t.text,style:{...t.style}}}function Fd(t){return{segments:[{text:"",style:t}]}}function LM(t){let e=[];for(let n of t.segments){let r=n.text.match(/\S+|\s+/g);if(r)for(let i of r)e.push({text:i,style:n.style})}return e}function BM(t,e){if(e<=0)return t;let n=t.width-e*2;return n>0?{x:t.x+e,width:n}:null}function Qx(t,e,n){let r=t.measureText(e,n);if(!Number.isFinite(r)||r<0)throw new TypeError(`TextMeasurementHost returned invalid width ${String(r)}`);return r}function eI(t,e,n,r){if(t.length===0)return;let i=t[t.length-1],o=i.text.replace(/\s+$/,""),s=i.text.length-o.length;if(s!==0){n.length=r-s;for(let a=0;a<s;a++)e[e.length-s+a]=-1;t[t.length-1]={...i,text:o}}}function tI(t,e){let n=t.whiteSpace==="normal"||t.whiteSpace==="nowrap"||t.whiteSpace==="pre-line",r=t.whiteSpace==="normal"||t.whiteSpace==="nowrap",i=t.whiteSpace!=="pre"&&t.whiteSpace!=="nowrap",o=t.whiteSpace!=="break-spaces",s=t.shapeInsideGeometry??null,a=Math.max(0,t.shapePadding??0),l=[],c=[],u=new Map,d=x=>{if(!s)return t.inlineSize;let P=t.baseStyle.fontSize*t.lineHeight,T=s.bounds.minY+t.baseStyle.fontSize+x*P;if(T>s.bounds.maxY)return c.push(s.bounds.minX),0;let k=Math.round(T*256),w=u.get(k);if(w===void 0){let $=s.getSpanAtY(T);w=$?BM($,a):null,u.set(k,w)}return w?(c.push(w.x),w.width):(c.push(s.bounds.minX),0)},p=[];for(let x=0;x<t.lines.length;x++){x>0&&p.push(r?{text:" ",style:t.baseStyle,modelLen:1,isHardBreak:!1,isWhitespace:!0}:{text:"",style:t.baseStyle,modelLen:1,isHardBreak:!0,isWhitespace:!1});for(let P of LM(t.lines[x])){let T=/^\s+$/.test(P.text);p.push({text:n&&T?" ":P.text,style:P.style,modelLen:P.text.length,isHardBreak:!1,isWhitespace:T})}}if(n)for(let x=p.length-1;x>0;x--){let P=p[x],T=p[x-1];P.isWhitespace&&!P.isHardBreak&&T.isWhitespace&&!T.isHardBreak&&(T.modelLen+=P.modelLen,p.splice(x,1))}let f=[],g=[],m=0,h=0,b=[],S=0,v=d(0),I=!0;for(let x of p){if(x.isHardBreak){b.length===0&&(g.push(m),h++,s&&c.length<=l.length&&d(l.length)),f.push(h),m++,l.push(b.length>0?{segments:b}:Fd(t.baseStyle)),b=[],S=0,v=d(l.length),I=!0;continue}if(n&&x.isWhitespace&&I){for(let k=0;k<x.modelLen;k++)f.push(-1),m++;continue}let P=Qx(e,x.text,x.style);if(i&&v>0&&S+P>v&&S>0&&(o&&(eI(b,f,g,h),h=g.length),l.push(b.length>0?{segments:b}:Fd(t.baseStyle)),b=[],S=0,v=d(l.length),I=!0,x.isWhitespace)){for(let k=0;k<x.modelLen;k++)f.push(-1),m++;continue}if(i&&v>0&&P>v&&t.overflowWrap!=="normal"){for(let w of x.text){let $=Qx(e,w,x.style);S+$>v&&S>0&&(l.push(b.length>0?{segments:b}:Fd(t.baseStyle)),b=[],S=0,v=d(l.length)),f.push(h),g.push(m),m++,h++;let R=b[b.length-1];R&&Fn(R.style,x.style)?b[b.length-1]={...R,text:R.text+w}:b.push({text:w,style:{...x.style}}),S+=$}let k=x.modelLen-x.text.length;for(let w=0;w<k;w++)f.push(-1),m++;I=!1;continue}for(let k of x.text)f.push(h),g.push(m),m++,h++;for(let k=x.text.length;k<x.modelLen;k++)f.push(-1),m++;let T=b[b.length-1];T&&Fn(T.style,x.style)?b[b.length-1]={...T,text:T.text+x.text}:x.text&&b.push(FM(x)),S+=P,I=!1}return n&&b.length>0&&eI(b,f,g,h),b.length===0&&p.length===0&&g.push(m),l.push(b.length>0?{segments:b}:Fd(t.baseStyle)),{lines:l,modelToSvgMap:f,svgToModelMap:g,shapeInsideLineXOffsets:c}}var aa=class{constructor(e){this.measurementHost=e}measurementHost;layout(e){return tI(e,this.measurementHost)}};var Ld=["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"],Io=class{collected=[];seen=new Set;report(e){let n=`${e.severity}|${e.code}|${e.shapeId??""}|${e.message}`;this.seen.has(n)||(this.seen.add(n),this.collected.push(e))}get diagnostics(){return[...this.collected]}},dg=[];function Bd(t,e){dg.push(t);try{return e()}finally{dg.pop()}}function $t(t){for(let e of dg)e.report(t)}var la="0 0 10 10",Gd=6,Vd=6;function gi(){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 ca={"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"},GM={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function nI(){return gi().map(t=>{let e=ca[t.id]??t.id;return{kind:"marker",id:e,name:GM[e]??e,viewBox:la,refX:t.refX,refY:t.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function da(t,e){switch(e){case"uppercase":return t.toLocaleUpperCase();case"lowercase":return t.toLocaleLowerCase();case"capitalize":return t.replace(/\b\p{L}/gu,n=>n.toLocaleUpperCase());default:return t}}var VM=[["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 wo(t){return VM.map(([e,n])=>{let r=t[e],i=typeof r=="string"?r.trim():"";return i?`${n}: ${i}`:""}).filter(Boolean).join("; ")}function jd(t,e){let n=[],r=(a,l)=>{l!==""&&n.push({name:a,value:l})};t.fontFamily!==e.fontFamily&&r("font-family",String(t.fontFamily)),t.fontSize!==e.fontSize&&r("font-size",String(t.fontSize)),t.fontWeight!==e.fontWeight&&r("font-weight",String(t.fontWeight)),t.fontStyle!==e.fontStyle&&r("font-style",String(t.fontStyle));let i=wo(t);i&&i!==wo(e)&&r("style",i);let o=t.textDecoration,s=e.textDecoration;if(o.underline!==s.underline||o.strikethrough!==s.strikethrough||o.overline!==s.overline){let a=[];o.underline&&a.push("underline"),o.strikethrough&&a.push("line-through"),o.overline&&a.push("overline"),r("text-decoration",a.join(" "))}if(t.baselineShift!==e.baselineShift){let a=t.baselineShift;a==="super"||a==="sub"?r("baseline-shift",a):typeof a=="number"&&r("baseline-shift",`${a}px`)}return t.letterSpacing!==e.letterSpacing&&r("letter-spacing",String(t.letterSpacing)),t.fill!==e.fill&&r("fill",String(t.fill)),t.fillOpacity!==e.fillOpacity&&r("fill-opacity",String(t.fillOpacity)),t.direction!==e.direction&&r("direction",String(t.direction)),t.unicodeBidi!==e.unicodeBidi&&r("unicode-bidi",String(t.unicodeBidi)),n}function ua(t){let e=0;for(;e<t.length;){let r=t.slice(e);if(!/^<defs[\s>]/.test(r))break;let i=t.indexOf("</defs>",e);if(i===-1)break;e=i+7}let n=/^<([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/.exec(t.slice(e));return n?{prefixEnd:e,openStart:e,openEnd:e+n[0].length,tagName:n[1],attributes:n[2],selfClosing:n[3]==="/"}:null}function N(t,e){return e==null||e===""?"":` ${t}="${de(String(e))}"`}function oI(t){let e=Id(t);return e.pivotRequired&&!e.pivotResolved&&$t({severity:"warning",code:"unresolved-container-pivot",shapeId:t.id,message:`Container ${t.id} has legacy 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.`}),e.transform.attribute}function wt(t,e){let n=jt(t);if(!n||n.kind!==e)throw new Error(`Shape geometry registry mismatch for ${t.type}: expected ${e}`);return n}function ko(t,e){return e==null?"":` ${t}="${de(e)}"`}function jM(t){let e=t.map(n=>(n??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?N("style",e):""}function UM(t,e){return typeof e=="number"&&e>0?`${t}: ${e}px`:""}function HM(t){if(t&&typeof t=="object"){let e=t;return"dx"in e?{x:typeof e.x=="number"?e.x:null,y:typeof e.y=="number"?e.y:null,dx:typeof e.dx=="number"?e.dx:0,dy:typeof e.dy=="number"?e.dy:0,rotate:typeof e.rotate=="number"?e.rotate:0}:{x:null,y:null,dx:typeof e.x=="number"?e.x:0,dy:typeof e.y=="number"?e.y:0,rotate:typeof e.rotate=="number"?e.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function rI(t,e){let n=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==null){n=i;break}if(n<0)return[];let r=new Array(n+1);for(let i=0;i<=n;i++)r[i]=t[i][e]??0;return r}function iI(t,e){let n=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==0){n=i;break}if(n<0)return[];let r=new Array(n+1);for(let i=0;i<=n;i++)r[i]=t[i][e];return r}function WM(t){if(t.length===0)return[];let e=t.length-1,n=t[e].rotate;for(;e>0&&t[e-1].rotate===n;)e--;if(e===0&&n===0)return[];let r=new Array(e+1);for(let i=0;i<=e;i++)r[i]=t[i].rotate;return r}function $n(t,e){return pt(t,e)}function KM(t,e,n){return Xp(t,e,n)}function XM(t){if(typeof t=="string"){let r=t.trim();return r.length>0?r:void 0}if(!t||typeof t!="object")return;let e=t,n=[];return e.underline&&n.push("underline"),e.strikethrough&&n.push("line-through"),e.overline&&n.push("overline"),n.length>0?n.join(" "):void 0}function rn(t,e,n=[]){return N("data-shape-id",e)+sI(oo(Zn(t),{shapeId:e}),n)}function sI(t,e=[]){let n="",r=new Map,i=new Map;for(let o of t){if(o.channel==="style"){i.delete(o.name),o.value!==null&&o.value!==""&&i.set(o.name,o.value);continue}o.ifAbsent&&r.has(o.name)||(r.delete(o.name),!(o.value===null||o.value===""&&!o.allowEmpty)&&r.set(o.name,o))}for(let o of r.values())n+=o.allowEmpty?ko(o.name,String(o.value)):N(o.name,o.value);return(e.length>0||i.size>0)&&(n+=jM([...e,...[...i].map(([o,s])=>`${o}: ${s}`)])),n}var YM=new Set(["element-opacity","system-language","required-extensions","visibility","display","metadata","container-presentation","authored-attributes"]);function Hd(t){let e=t.metadata;return so(e)}function qM(t,e){let n=Hd(e);if(!n)return t;let r=ua(t);if(!r)return t;let i=t.slice(0,r.openStart),o=t.slice(r.openStart),s=r.openEnd-r.openStart;return r.selfClosing?i+`<${r.tagName}${r.attributes}>`+n+`</${r.tagName}>`+o.slice(s):i+o.slice(0,s)+n+o.slice(s)}function ZM(t,e){if(e.length===0)return t;let n=e.join(""),r=ua(t);if(!r)return t;let i=t.slice(0,r.openStart),o=t.slice(r.openStart),s=r.openEnd-r.openStart;if(r.selfClosing)return i+`<${r.tagName}${r.attributes}>`+n+`</${r.tagName}>`+o.slice(s);let a=o.match(/<\/([\w:-]+)>$/);if(!a)return i+o+n;let l=o.lastIndexOf(`</${a[1]}>`);return i+o.slice(0,l)+n+o.slice(l)}function ug(t){let e="",n=t.startEndpoint,r=t.endEndpoint;return n&&n!=="none"&&!t.markerStart&&(e+=N("marker-start",`url(#line-marker-${n})`)),r&&r!=="none"&&!t.markerEnd&&(e+=N("marker-end",`url(#line-marker-${r})`)),e}function pg(t){let e=t.state,{cx:n,cy:r,r:i,defaultPivot:o}=wt(t,"circle"),s=$n(e,o??void 0);return`<circle${N("cx",n)}${N("cy",r)}${N("r",i)}${rn(e,t.id)}${s?N("transform",s):""}/>`}function fg(t){let e=t.state,{cx:n,cy:r,rx:i,ry:o,pathLength:s,defaultPivot:a}=wt(t,"ellipse"),l=$n(e,a??void 0);return`<ellipse${N("cx",n)}${N("cy",r)}${N("rx",i)}${N("ry",o)}${s!==void 0?N("pathLength",s):""}${rn(e,t.id)}${l?N("transform",l):""}/>`}function mg(t){let e=t.state,{x:n,y:r,width:i,height:o,rx:s,ry:a,pathData:l,defaultPivot:c}=wt(t,"rectangle"),u=$n(e,c??void 0);return l?`<path${N("d",l)}${rn(e,t.id)}${u?N("transform",u):""}/>`:`<rect${N("x",n)}${N("y",r)}${N("width",i)}${N("height",o)}${s>0||a>0?`${N("rx",s)}${N("ry",a)}`:""}${rn(e,t.id)}${u?N("transform",u):""}/>`}function gg(t){let e=t.state,{x1:n,y1:r,x2:i,y2:o,defaultPivot:s}=wt(t,"line"),a=$n(e,s??void 0),l={...e,fillType:"none"};return`<line${N("x1",n)}${N("y1",r)}${N("x2",i)}${N("y2",o)}${rn(l,t.id)}${ug(e)}${a?N("transform",a):""}/>`.replace(' fill="none"',"")}function hg(t,e){let n=t.state,{x:r,y:i,defaultPivot:o}=wt(t,"text"),s=da(n.text??"",n.textTransform),a=n.fontSize??16,l=n.fontFamily??"sans-serif",c=n.fontWeight??"normal",u=n.fontStyle??"normal",d=n.textAnchor??"start",p=XM(n.textDecoration),f=n.letterSpacing,g=n.wordSpacing,m=n.lineHeight??1.25,h=$n(n,o??void 0),S=n.isTextPath&&n.textPathPoints?"":N("x",r)+N("y",i);S+=N("font-size",a),S+=N("font-family",l),c!=="normal"&&c!=="400"&&(S+=N("font-weight",c)),u!=="normal"&&(S+=N("font-style",u)),d!=="start"&&(S+=N("text-anchor",d)),p&&(S+=N("text-decoration",p)),f&&(S+=N("letter-spacing",f)),g&&(S+=N("word-spacing",g));let v=n.baselineShift;v&&v!=="baseline"&&(S+=N("baseline-shift",v));let I=n.dominantBaseline;I&&I!=="auto"&&(S+=N("dominant-baseline",I));let x=n.writingMode;x&&x!=="horizontal-tb"&&(S+=N("writing-mode",x));let P=n.textLength;P!==void 0&&P>0&&(S+=N("textLength",P),n.lengthAdjust==="spacingAndGlyphs"&&(S+=N("lengthAdjust","spacingAndGlyphs")));let T=n.textDirection;T&&T!=="ltr"&&(S+=N("direction",T));let k=n.unicodeBidi;k&&k!=="normal"&&(S+=N("unicode-bidi",k));let w=n.shapeInsideRef,$="",R="";if(w){$=`shape-inside: url(#${e?.shapeInsideTargetElementId?.(w)??w})`;let V=n.shapePadding;V!==void 0&&V>0&&(R=`shape-padding: ${V}`)}let C=wo(n),A=n.fontVariationSettings,D="";A&&Object.keys(A).length>0&&(D=`font-variation-settings: ${Object.entries(A).map(([V,K])=>`'${V}' ${K}`).join(", ")}`);let _=n.inlineSize!==void 0||w!==void 0||typeof n.overflowWrap=="string",O=typeof n.lineHeight=="number"&&n.lineHeight!==1.2,L=[C,D,UM("inline-size",n.inlineSize),$,R,typeof n.overflowWrap=="string"?`overflow-wrap: ${n.overflowWrap}`:"",typeof n.whiteSpace=="string"?`white-space: ${n.whiteSpace}`:"",_&&O?`line-height: ${n.lineHeight}`:""];if(S+=rn(n,t.id,L),h&&(S+=N("transform",h)),n.isTextPath&&n.textPathPoints){let F=n.textPathPoints,V=n.textPathStartOffset??0,K=n.textPathSide,X=`text-path-${t.id}`,z=n.textPathMethod,G=n.textPathSpacing,q=n.textPathLengthAdjust,te=n.textPathLength,ie="";if(F.length>=2)if(K==="right"){let J=F[F.length-1];ie=`M ${J.x} ${J.y}`;for(let ke=F.length-1;ke>0;ke--){let Le=F[ke],Be=F[ke-1],Ze=Le.handleIn??Le,Rt=Be.handleOut??Be;ie+=` C ${Ze.x} ${Ze.y} ${Rt.x} ${Rt.y} ${Be.x} ${Be.y}`}}else{ie=`M ${F[0].x} ${F[0].y}`;for(let J=0;J<F.length-1;J++){let ke=F[J],Le=F[J+1],Be=ke.handleOut??ke,Ze=Le.handleIn??Le;ie+=` C ${Be.x} ${Be.y} ${Ze.x} ${Ze.y} ${Le.x} ${Le.y}`}}return`<defs><path id="${de(X)}"${N("d",ie)} fill="none"/></defs><text${S}><textPath href="#${de(X)}"${N("startOffset",`${V}%`)}${N("method",z)}${N("spacing",G)}${N("lengthAdjust",q)}${N("textLength",te)}>${de(s)}</textPath></text>`}if(n.charOffsets&&Array.isArray(n.charOffsets)&&n.charOffsets.length>0){let F=n.charOffsets.map(HM),V=s.split(`
38
+ `),K=n.linePositions??[],X=a*m,z="",G=0;return V.forEach((q,te)=>{let ie=Array.from(q).length,J=F.slice(G,G+ie),ke=K[te],Le=ke?r+ke.x:te>0?r:NaN,Be=ke?ke.dy:te>0?X:NaN,Ze="",Rt=rI(J,"x");if(Number.isFinite(Le)||Rt.length>0){let yt=Rt.length>0?Rt.slice():[];Number.isFinite(Le)&&(yt[0]=yt[0]??Le),Ze+=N("x",yt.join(" "))}let Oo=rI(J,"y");Oo.length>0&&(Ze+=N("y",Oo.join(" ")));let B=iI(J,"dx");B.length>0&&(Ze+=N("dx",B.join(" ")));let ve=iI(J,"dy"),Re=ve.length>0||Number.isFinite(Be)?ve.slice():[];for(Number.isFinite(Be)&&(Re[0]=(Re[0]??0)+Be);Re.length>0&&Re[Re.length-1]===0;)Re.pop();Re.length>0&&(Ze+=N("dy",Re.join(" ")));let lt=WM(J);lt.length>0&&(Ze+=N("rotate",lt.join(" "))),z+=`<tspan${Ze}>${de(q)}</tspan>`,G+=ie+1}),`<text${S}>${z}</text>`}let ee=Br(n);if(ee){let F=Ln(ee),V=e?.textShapeInsideGeometry?.(t)??null,X=!!e?.textMeasurementHost&&(typeof n.inlineSize=="number"||V!==null||n.whiteSpace==="normal"||n.whiteSpace==="nowrap"||n.whiteSpace==="pre-line")?new aa(e.textMeasurementHost).layout({lines:F.lines,baseStyle:F.baseStyle,lineHeight:F.lineHeight,inlineSize:typeof n.inlineSize=="number"?n.inlineSize:0,overflowWrap:n.overflowWrap==="break-word"||n.overflowWrap==="anywhere"?n.overflowWrap:"normal",whiteSpace:n.whiteSpace==="normal"||n.whiteSpace==="nowrap"||n.whiteSpace==="pre"||n.whiteSpace==="pre-line"||n.whiteSpace==="break-spaces"?n.whiteSpace:"pre-wrap",shapeInsideGeometry:V,shapePadding:typeof n.shapePadding=="number"?n.shapePadding:0}):null,z=X?.lines??F.lines,G=n.linePositions,q=a*F.lineHeight,te="";return z.forEach((ie,J)=>{ie.segments.forEach((ke,Le)=>{let Be="";if(Le===0){let Ze=X?.shapeInsideLineXOffsets[J];if(V&&Ze!==void 0)Be+=N("x",Ze),Be+=N("y",V.bounds.minY+a+J*q);else if(G?.[J]){let Rt=G[J];(Math.abs(Rt.x)>.001||J>0)&&(Be+=N("x",r+Rt.x)),(Math.abs(Rt.dy)>.001||J>0)&&(Be+=N("dy",Rt.dy))}else J>0&&(Be+=N("x",r),Be+=N("dy",`${q}px`))}for(let{name:Ze,value:Rt}of jd(ke.style,F.baseStyle))Be+=N(Ze,Rt);Be+=' xml:space="preserve"',te+=`<tspan${Be}>${de(da(ke.text||(X?"\u200B":""),ke.style.textTransform))}</tspan>`})}),`<text${S}>${te}</text>`}return`<text${S}>${de(s)}</text>`}function yg(t){let e=t.state,n=wt(t,"path"),r=n.defaultPivot?$n(e,n.defaultPivot):null;return`<path${N("d",n.d)}${rn(e,t.id)}${ug(e)}${r?N("transform",r):""}/>`}function Sg(t){let e=t.state,{points:n,closed:r,defaultPivot:i}=wt(t,"polyline"),o=n.map(l=>`${l.x},${l.y}`).join(" "),s=i?$n(e,i):null;return`<${r?"polygon":"polyline"}${N("points",o)}${rn(e,t.id)}${ug(e)}${s?N("transform",s):""}/>`}function bg(t){let e=t.state,{x:n,y:r,width:i,height:o,defaultPivot:s}=wt(t,"positioning-rect"),a=e.href??"",l=e.imageOpacity,c=e.specPreserveAspectRatio||(e.preserveAspectRatio?"xMidYMid meet":"none"),u=$n(e,s??void 0);return`<image${N("x",n)}${N("y",r)}${N("width",i)}${N("height",o)}${N("href",a)}${N("preserveAspectRatio",c)}${l!==void 0&&l<1?N("opacity",l):""}${rn(e,t.id)}${u?N("transform",u):""}/>`}function vg(t){let e=t.state,{x:n,y:r,width:i,height:o,defaultPivot:s}=wt(t,"positioning-rect"),a=e.rawContent??"",l=$n(e,s??void 0);return`<foreignObject${N("x",n)}${N("y",r)}${N("width",i)}${N("height",o)}${rn(e,t.id)}${l?N("transform",l):""}>${a}</foreignObject>`}function Wd(t,e){return!t||t.length===0?"":t.map(n=>on(n,e)).join("")}function aI(t){let e=t.state,n="",r=Zn(e),i=Vs.filter(o=>YM.has(o.id)).flatMap(o=>Jc(o,r,{shapeId:t.id,includeAuthoredAttributes:!0,includeContainerPresentation:!0}));return n+=sI(i),n}function lI(t){let e=oI(t);return(e?N("transform",e):"")+aI(t)}function JM(t,e){let n=t.state,r=n.href,i=n.hrefXlink,o="<a";return r!==void 0&&(o+=N("href",r)),i!==void 0&&(o+=N("xlink:href",i)),o+=N("target",n.linkTarget),o+=N("rel",n.linkRel),n.linkDownload===""?o+=' download=""':o+=N("download",n.linkDownload),o+=N("ping",n.linkPing),o+=N("hreflang",n.linkHreflang),o+=N("type",n.linkType),o+=N("referrerpolicy",n.linkReferrerPolicy),o+=lI(t),o+=N("data-shape-id",t.id),o+=">",o+=Hd(n),o+=Wd(n.children,e),o+="</a>",o}function QM(t,e){let n=t.state,r="<switch";return r+=ko("systemLanguage",n.switchSystemLanguage),r+=ko("requiredExtensions",n.switchRequiredExtensions),r+=lI(t),r+=N("data-shape-id",t.id),r+=">",r+=Hd(n),r+=Wd(n.children,e),r+="</switch>",r}function eO(t,e){let n=t.state,r=oI(t),i="<g";i+=N("data-shape-id",t.id),r&&(i+=N("transform",r)),n.opacity!==void 0&&n.opacity<1&&(i+=N("opacity",n.opacity)),n.visibility&&(i+=N("visibility",n.visibility));let o=n.groupData,s=[];if(n.blendMode&&s.push(`mix-blend-mode:${n.blendMode}`),o){let a=o;if(a.clipPath&&(i+=N("clip-path",a.clipPath)),a.mask&&(i+=N("mask",a.mask)),a.filter&&(i+=N("filter",a.filter)),a.fill&&(i+=N("fill",a.fill)),a.fillOpacity&&(i+=N("fill-opacity",a.fillOpacity)),a.strokeOpacity&&(i+=N("stroke-opacity",a.strokeOpacity)),a.opacity&&n.opacity===void 0&&(i+=N("opacity",a.opacity)),Array.isArray(a.classes)&&a.classes.length>0&&(i+=N("class",a.classes.join(" "))),a.attributes)for(let[l,c]of Object.entries(a.attributes))/^[A-Za-z_][\w:.-]*$/.test(l)&&(i+=N(l,c));a.cssFilter&&s.push(`filter:${a.cssFilter}`),a.mixBlendMode&&!n.blendMode&&s.push(`mix-blend-mode:${a.mixBlendMode}`),a.isolation&&s.push(`isolation:${a.isolation}`),a.transformOrigin&&s.push(`transform-origin:${a.transformOrigin}`)}return s.length>0&&(i+=N("style",s.join(";"))),i+=">",i+=Wd(n.children,e),i+="</g>",i}function tO(t){let e=t.state,n=wt(t,"view"),r=n.viewBoxX,i=n.viewBoxY,o=n.viewBoxWidth,s=n.viewBoxHeight,a=r!==void 0&&i!==void 0&&o!==void 0&&s!==void 0?`${r} ${i} ${o} ${s}`:void 0,l="<view";return l+=N("id",t.id),l+=N("viewBox",a),l+=N("preserveAspectRatio",n.preserveAspectRatio),l+=N("zoomAndPan",e.viewZoomAndPan),l+=N("viewTarget",e.viewTarget),e.viewName&&(l+=N("data-view-name",e.viewName)),l+="/>",l}function nO(t,e){let n=t.state,r=wt(t,"embedded-svg"),i=Rr(t);i.pivotRequired&&!i.pivotResolved&&$t({severity:"warning",code:"unresolved-svg-viewport",shapeId:t.id,message:`Embedded SVG ${t.id} has legacy rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`});let o=r.x,s=r.y,a=r.width,l=r.height,c=r.viewBoxX,u=r.viewBoxY,d=r.viewBoxWidth,p=r.viewBoxHeight,f=c!==void 0&&u!==void 0&&d!==void 0&&p!==void 0?`${c} ${u} ${d} ${p}`:void 0,g="<svg";return g+=N("xmlns","http://www.w3.org/2000/svg"),g+=N("x",o),g+=N("y",s),g+=N("width",a),g+=N("height",l),g+=N("viewBox",f),r.preserveAspectRatio!==void 0&&(g+=ko("preserveAspectRatio",r.preserveAspectRatio)),i.attribute&&(g+=N("transform",i.attribute)),g+=aI(t),g+=N("data-shape-id",t.id),g+=">",g+=Hd(n),g+=Wd(n.children,e),g+="</svg>",g}function rO(t,e){let n=t.state,r=wt(t,"shape-reference"),i=r.targetShapeId;if(!i?.trim())return $t({severity:"warning",code:"unresolved-reference",shapeId:t.id,message:`Shape reference ${t.id} has no targetShapeId and was not rendered.`}),`<!-- shape-reference ${de(t.id)} has no targetShapeId -->`;let o=r.offsetX,s=r.offsetY,a=e?.shapeReferenceTargetElementId?.(i);if(a===null)return $t({severity:"error",code:"duplicate-shape-id",shapeId:t.id,message:`Shape reference ${t.id} targets ambiguous duplicate id ${i}.`}),`<!-- shape-reference ${de(t.id)} has ambiguous target ${de(i)} -->`;let l=a??i,c=e?.shapeReferenceBounds?.(t),u=c?.diagnostics.find(h=>h.code==="reference-cycle");if(u&&$t({severity:"warning",code:"reference-cycle",shapeId:t.id,message:u.message}),c?.status==="cycle"&&c.bounds===null)return`<!-- cyclic shape-reference ${de(t.id)} was not rendered -->`;let d=e?.shapeReferenceTransform?.(t),p=d?.pivotRequired??Ct(t.state),f=d?.pivotResolved??!p;p&&!f&&$t({severity:"warning",code:"unresolved-reference-pivot",shapeId:t.id,message:`Shape reference ${t.id} has legacy rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`});let g=d?.attribute??pt(t.state),m="<use";return m+=N("href",`#${l}`),m+=N("x",o),m+=N("y",s),r.width!==void 0&&(m+=N("width",r.width)),r.height!==void 0&&(m+=N("height",r.height)),m+=N("data-shape-id",t.id),g&&(m+=N("transform",g)),n.opacity!==void 0&&n.opacity<1&&(m+=N("opacity",n.opacity)),m+="/>",m}function xg(t,e){let n=t.state,r=wt(t,"symbol-instance"),i=e?.symbolInstanceTargetElementId?.(t),o=i===void 0?r.targetId:i;if(o===null)return`<!-- Invalid symbol instance: ${de(t.id)} -->`;let s=e?.symbolDefKind?.(r.symbolId),a=`<use href="#${de(o)}"`,l=n.authoredUseGeometry;l&&typeof l=="object"?(l.x!==void 0&&(a+=N("x",l.x)),l.y!==void 0&&(a+=N("y",l.y)),s!=="group"&&(l.width!==void 0&&(a+=N("width",l.width)),l.height!==void 0&&(a+=N("height",l.height)))):e?.legacySymbolNumericGeometry&&(a+=N("x",r.x),a+=N("y",r.y),s!=="group"&&(a+=N("width",r.width),a+=N("height",r.height))),a+=N("data-shape-id",t.id);let c=n.instancePresentation;if(c)for(let[m,h]of Object.entries(c))m!=="transform"&&(h==null||h===""||/^[A-Za-z_][\w:.-]*$/.test(m)&&(a+=N(m,h)));let u=e?.symbolInstanceTransform?.(t),d=pt(n),p=c?.transform?.trim(),f=p?d?`${p} ${d}`:p:d,g=u?.attribute??f;return g&&(a+=N("transform",g)),`${a}/>`}function iO(t){let e=t.state,n=wt(t,"positioning-rect"),r=e.mediaKind??t.type,i=e.href??"",o=e.mediaMimeType,s=e.posterHref,a=e.mediaOpacity,l=`<${r} xmlns="http://www.w3.org/1999/xhtml"`;l+=N("src",i),o&&(l+=N("type",o)),s&&r==="video"&&(l+=N("poster",s)),e.muted&&(l+=' muted=""'),e.loop&&(l+=' loop=""'),e.playbackRate!==void 0&&(l+=N("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(l+=N("data-volume",e.volume)),l+=' preload="auto" playsinline=""',l+=r==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let c="<foreignObject";return c+=N("x",n.x),c+=N("y",n.y),c+=N("width",n.width),c+=N("height",n.height),c+=N("data-shape-id",t.id),c+=N("data-media-kind",r),e.naturalDuration!==void 0&&(c+=N("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(c+=N("data-begin",e.begin)),e.trimStart!==void 0&&(c+=N("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(c+=N("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(c+=N("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(c+=N("data-fade-out",e.fadeOutDuration)),c+=ko("systemLanguage",e.systemLanguage),c+=ko("requiredExtensions",e.requiredExtensions),a!==void 0&&a<1&&(c+=N("opacity",a)),c+=">",c+=l,c+="</foreignObject>",c}function Ig(t){let e=t.state,n=wt(t,"path"),r=n.defaultPivot?$n(e,n.defaultPivot):null;return`<path${N("d",n.d)}${rn(e,t.id)}${r?N("transform",r):""}/>`}function wg(t){let e=t.state;if(ji(t.type)?.renderer!=="polygon")return $t({severity:"warning",code:"unsupported-polygon-type",message:`Unsupported polygon shape type "${t.type}" on shape "${t.id}"; the shape was dropped from the rendered output`,shapeId:t.id}),`<!-- unsupported polygon shape: ${de(t.type)} -->`;let r=wt(t,"path"),i=r.placement??{x:0,y:0},o=KM(e,i.x,i.y),s=r.fillRule?N("fill-rule",r.fillRule):"";return`<path${N("d",r.d)}${s}${rn(e,t.id)}${N("transform",o)}/>`}var oO={circle:pg,ellipse:fg,rectangle:mg,line:gg,text:hg,path:yg,polyline:Sg,image:bg,polygon:wg,flowchart:Ig,hyperlink:JM,switch:QM,container:eO,view:tO,svg:nO,"shape-reference":rO,"symbol-instance":xg,media:iO,"foreign-object":vg};function on(t,e){let n=ji(t.type);if(!n)return $t({severity:"warning",code:"unsupported-shape-type",message:`Unsupported shape type "${t.type}" on shape "${t.id}"; the shape was dropped from the rendered output`,shapeId:t.id}),`<!-- unsupported shape type: ${de(t.type)} -->`;let r=oO[n.renderer](t,e);r=aO(r,t),r=qM(r,t.state),e?.forcedElementIds?.has(t.id)&&(r=cI(r,t.id));let i=e?.elementIdForShape?.(t);i&&(r=sO(r,i));let o=e?.animationElementsForShape?.(t);o&&o.length>0&&(r=ZM(r,o));let s=t.state?.leadingComments;return Array.isArray(s)&&s.length>0&&(r=s.map(l=>`<!--${l.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")+r),r}function cI(t,e){let n=ua(t);if(!n)return t;let r=t.slice(n.openStart,n.openEnd);if(/\sid=/.test(r))return t;let i=n.openStart+1+n.tagName.length;return`${t.slice(0,i)}${N("id",e)}${t.slice(i)}`}function sO(t,e){let n=ua(t);if(!n)return t;let r=t.slice(n.openStart,n.openEnd),i=/\sid=("[^"]*"|'[^']*')/.exec(r);if(!i)return cI(t,e);let o=n.openStart+i.index;return`${t.slice(0,o)}${N("id",e)}${t.slice(o+i[0].length)}`}function aO(t,e){let n=e.state?.authoredAttributes;if(!n)return t;let r=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(t);if(!r)return t;let[i,o,s,a]=r,l="";for(let[c,u]of Object.entries(n))u===null||!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(c)||new RegExp(`\\s${c}\\s*=`).test(s)||(l+=` ${c}="${de(u)}"`);return l?`<${o}${s}${l}${a}>`+t.slice(i.length):t}function dI(t){let e="",n=new Set,r=i=>{if(i&&typeof i=="object"&&"id"in i){let o=i.id;return typeof o=="string"?o:void 0}};for(let i of t){let o=i.state,s=pm(o),a=Bv(o),l=o.strokeType??"solid",c=o.strokeGradient;if(s==="linear-gradient"&&a){let u=r(a)??`gradient-fill-${i.id}`;n.has(u)||(e+=Ro(u,a),n.add(u))}if(s==="radial-gradient"&&a){let u=r(a)??`gradient-fill-${i.id}`;n.has(u)||(e+=To(u,a),n.add(u))}if(s==="pattern"&&a){let u=r(a)??`pattern-fill-${i.id}`;n.has(u)||(e+=Ud(u,a),n.add(u))}if(l==="linear-gradient"&&c){let u=r(c)??`gradient-stroke-${i.id}`;n.has(u)||(e+=Ro(u,c),n.add(u))}if(l==="radial-gradient"&&c){let u=r(c)??`gradient-stroke-${i.id}`;n.has(u)||(e+=To(u,c),n.add(u))}if(l==="pattern"&&c){let u=r(c)??`pattern-stroke-${i.id}`;n.has(u)||(e+=Ud(u,c),n.add(u))}}return e}function Ro(t,e,n){return uI(Gc(t,e),n)}function To(t,e,n){return uI(Vc(t,e),n)}function uI(t,e){let n=t.attributes.map(([o,s])=>N(o,s)).join(""),r=String(t.attributes.find(([o])=>o==="id")?.[1]??""),i=t.stops.map((o,s)=>{let a=o.attributes.map(([c,u])=>N(c,u)).join(""),l=e?.gradientStopAnimationElements?.(r,s)??[];return l.length>0?`<stop${a}>${l.join("")}</stop>`:`<stop${a}/>`}).join("");return`<${t.element}${n}>${i}</${t.element}>`}function Ud(t,e){let n=Bc(t,e);return`<pattern${n.attributes.map(([i,o])=>N(i,o)).join("")}>${n.content}</pattern>`}function Kd(t,e=[]){let n=Array.isArray(t)?ni(t,e):t;if(n.ids.size===0&&n.legacyEndpoints.size===0)return"";let r="",i=gi();for(let o of i){let s=o.id,a=s.replace("line-marker-",""),l=`mkr-builtin-${a}`,c=n.legacyEndpoints.has(a)||n.ids.has(s),u=n.ids.has(l);if(!c&&!u)continue;let d=o.element,p=Object.entries(d.attrs).map(([m,h])=>N(m,h)).join(""),f=`<${d.tag}${p}/>`,g=m=>{r+=`<marker${N("id",m)}${N("viewBox",la)}${N("refX",o.refX)}${N("refY",o.refY)}${N("markerWidth",6)}${N("markerHeight",6)}${N("orient","auto-start-reverse")}>${f}</marker>`};c&&g(s),u&&g(l)}return r}var kt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Xd(t){let e=new Set,n=r=>{for(let i of wn(r))e.add(i.targetAuthoredId)};for(let r of t.documentStyles??[])n(r.css);for(let r of t.animationTimeline?.tracks??[])for(let i of r.keyframes)typeof i.value=="string"&&n(i.value);return e}var kg=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Cr(t){let e=new Map;for(let n of t)n.kind==="symbol"&&e.set(n.id,n.defKind??"symbol");return{symbolDefKind:n=>e.get(n)}}function Rg(t,e){switch(t.kind){case"symbol":return Tg(t,e);case"marker":return Pg(t,e);case"linear-gradient":return Cg(t,e);case"radial-gradient":return $g(t,e);case"pattern":return Eg(t);case"filter":return Ag(t)}}function Tg(t,e){return Po(t,t.id,t.shapes,e)}var pI=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function fI(t,e){let n=t.rootAttributes??{},r="";if(e)for(let i of pI){let o=t[i];o!==void 0&&(r+=` ${i}="${kt(o)}"`)}for(let[i,o]of Object.entries(n))i==="id"||pI.includes(i)||/^[A-Za-z_][\w:.-]*$/.test(i)&&(r+=` ${i}="${kt(o)}"`);return r}function Po(t,e,n,r){let i=so(t.metadata)+n.map(o=>on(o,r)).join("");return(t.defKind??"symbol")==="group"?`<g id="${kt(e)}"${fI(t,!1)}>${i}</g>`:`<symbol id="${kt(e)}"${fI(t,!0)}>${i}</symbol>`}function Pg(t,e){let n;if(t.builtIn){let a=gi().find(l=>t.id.includes(l.id)||t.id===l.id);if(a){let l=Object.entries(a.element.attrs).map(([c,u])=>` ${c}="${kt(String(u))}"`).join("");n=`<${a.element.tag}${l}/>`}else n=""}else n=t.shapes.map(a=>on(a,e)).join("");let r=t.authoredGeometry??{},i={refX:r.refX??String(t.refX),refY:r.refY??String(t.refY),markerWidth:r.markerWidth??String(t.markerWidth),markerHeight:r.markerHeight??String(t.markerHeight),markerUnits:r.markerUnits??t.markerUnits,orient:r.orient??(typeof t.orient=="number"?String(t.orient):t.orient)},o="";t.viewBox!==void 0&&(o+=` viewBox="${kt(t.viewBox)}"`),t.preserveAspectRatio!==void 0&&(o+=` preserveAspectRatio="${kt(t.preserveAspectRatio)}"`);let s=new Set(["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"]);for(let[a,l]of Object.entries(t.rootAttributes??{}))s.has(a)||!/^[A-Za-z_][\w:.-]*$/.test(a)||(o+=` ${a}="${kt(l)}"`);return t.overflow!==void 0&&t.rootAttributes?.overflow===void 0&&(o+=` overflow="${kt(t.overflow)}"`),n=so(t.metadata)+n,`<marker id="${kt(t.id)}"${o} refX="${kt(i.refX)}" refY="${kt(i.refY)}" markerWidth="${kt(i.markerWidth)}" markerHeight="${kt(i.markerHeight)}" markerUnits="${kt(i.markerUnits)}" orient="${kt(i.orient)}">${n}</marker>`}function Cg(t,e){let n={...t.gradient,type:"linear-gradient",id:t.id};return Yd(Ro(t.id,n,e),t.metadata)}function $g(t,e){let n={...t.gradient,type:"radial-gradient",id:t.id};return Yd(To(t.id,n,e),t.metadata)}function Eg(t){let e={...t.pattern,type:"pattern",id:t.id};return Yd(Ud(t.id,e),t.metadata)}function Ag(t){return Yd(Bs(t.id,t.filters,{colorInterpolation:t.colorInterpolation,filterUnits:t.filterUnits,primitiveUnits:t.primitiveUnits,x:t.x,y:t.y,width:t.width,height:t.height}),t.metadata)}function Yd(t,e){let n=so(e);if(!n)return t;let r=t.match(/^<([\w:-]+)([^>]*)\/>$/u);if(r)return`<${r[1]}${r[2]}>${n}</${r[1]}>`;let i=t.indexOf(">");return i<0?t:t.slice(0,i+1)+n+t.slice(i+1)}function pa(t,e){let n=new Map;for(let o of t){let s=n.get(o.kind);s?s.push(o):n.set(o.kind,[o])}let r=e??Cr(t),i="";for(let o of kg){let s=n.get(o);if(s)for(let a of s)i+=Rg(a,r)}return i}function mI(t,e){let n=fa(t,e);return n.length===0?"":pa(n,Cr(e))}function fa(t,e,n=[]){let r=new Map;for(let u of e)r.set(u.id,u);let i=new Map,o=u=>{if(!u)return;let d=r.get(u);d&&i.set(u,d)},s=(u,d)=>{if(!u||typeof u!="object")return;let p=u;if(!p.id||i.has(p.id))return;let f=d==="linear-gradient"?"linear-gradient":d==="radial-gradient"?"radial-gradient":d==="pattern"?"pattern":null;if(!f)return;let{id:g,sourceId:m,...h}=u,b;if(f==="linear-gradient")b={kind:"linear-gradient",id:p.id,name:m??p.id,sourceId:m,gradient:h};else if(f==="radial-gradient")b={kind:"radial-gradient",id:p.id,name:m??p.id,sourceId:m,gradient:h};else{let{customPatternId:S,...v}=h;b={kind:"pattern",id:p.id,name:m??p.id,sourceId:m,pattern:v}}i.set(p.id,b)},a=(u,d)=>{let p=u.filters;if(!Array.isArray(p)||p.length===0)return;let f=`filter-${d}`;i.has(f)||i.set(f,{kind:"filter",id:f,name:f,filters:p,...u.filterColorInterpolation&&u.filterColorInterpolation!=="auto"?{colorInterpolation:u.filterColorInterpolation}:{},...u.filterUnits?{filterUnits:u.filterUnits}:{},...u.primitiveUnits?{primitiveUnits:u.primitiveUnits}:{},...typeof u.filterX=="string"?{x:u.filterX}:{},...typeof u.filterY=="string"?{y:u.filterY}:{},...typeof u.filterWidth=="string"?{width:u.filterWidth}:{},...typeof u.filterHeight=="string"?{height:u.filterHeight}:{}})},l=u=>{let d=u.state;if(!d)return;if(o(d.fillLibraryId),o(d.strokeLibraryId),o(d.markerStart),o(d.markerMid),o(d.markerEnd),u.type==="symbol-instance"){let f=d.symbolId;f&&Gi(u)===f&&o(f)}else o(d.symbolId);let p=d.filterLibraryIds;if(Array.isArray(p))for(let f of p)typeof f=="string"&&o(f);d.fillLibraryId||s(d.fillGradient,d.fillType),d.strokeLibraryId||s(d.strokeGradient,d.strokeType),(!Array.isArray(p)||p.length===0)&&a(d,u.id)};for(let u of t)l(u);let c=Array.from(n);for(let u of c)o(u);return Rs(t,e,l),ql(c,e,l),Array.from(i.values())}function gI(t){let e=new Map,n=(s,a)=>{let l=s.type??a;return l==="linear-gradient"||l==="radial-gradient"||l==="pattern"?l:null},r=(s,a,l)=>{if(typeof s!="string"||s.length===0||!a||typeof a!="object"||e.has(s))return;let c=a,u=n(c,l);if(!u)return;let{id:d,sourceId:p,type:f,...g}=c,m=typeof p=="string"?p:s;if(u==="linear-gradient")e.set(s,{kind:u,id:s,name:m,...typeof p=="string"?{sourceId:p}:{},gradient:g});else if(u==="radial-gradient")e.set(s,{kind:u,id:s,name:m,...typeof p=="string"?{sourceId:p}:{},gradient:g});else{let{customPatternId:h,...b}=g;e.set(s,{kind:"pattern",id:s,name:m,...typeof p=="string"?{sourceId:p}:{},pattern:b})}},i=s=>{let a=s.filterLibraryIds;if(!Array.isArray(a)||a.length!==1||typeof a[0]!="string")return;let l=a[0],c=s.filters;!Array.isArray(c)||c.length===0||e.has(l)||e.set(l,{kind:"filter",id:l,name:l,filters:c,...s.filterColorInterpolation&&s.filterColorInterpolation!=="auto"?{colorInterpolation:s.filterColorInterpolation}:{},...s.filterUnits?{filterUnits:s.filterUnits}:{},...s.primitiveUnits?{primitiveUnits:s.primitiveUnits}:{},...typeof s.filterX=="string"?{x:s.filterX}:{},...typeof s.filterY=="string"?{y:s.filterY}:{},...typeof s.filterWidth=="string"?{width:s.filterWidth}:{},...typeof s.filterHeight=="string"?{height:s.filterHeight}:{}})},o=s=>{let a=s.state;if(!a)return;r(a.fillLibraryId,a.fillGradient,a.fillType),r(a.strokeLibraryId,a.strokeGradient,a.strokeType),i(a);let l=a.children;if(Array.isArray(l))for(let c of l)o(c)};for(let s of t)o(s);return Array.from(e.values())}function Ng(t){return t.easing==="custom-bezier"&&t.customBezier?t.customBezier:Or[t.easing]??null}function Mg(t,e,n,r,i){if(t===e&&n===r)return i;let o=1e-6,s=8,a=f=>(((1-3*n+3*t)*f+(3*n-6*t))*f+3*t)*f,l=f=>(((1-3*r+3*e)*f+(3*r-6*e))*f+3*e)*f,c=f=>(3*(1-3*n+3*t)*f+2*(3*n-6*t))*f+3*t,u=i;for(let f=0;f<s;f++){let g=a(u)-i;if(Math.abs(g)<o)return l(u);let m=c(u);if(Math.abs(m)<o)break;u-=g/m}let d=0,p=1;for(u=i;d<p;){let f=a(u);if(Math.abs(f-i)<o)return l(u);i>f?d=u:p=u;let g=(p-d)*.5+d;if(g===u)break;u=g}return l(u)}function ma(t){let e=t.split(/\s+/).map(parseFloat);if(e.length!==4||e.some(s=>!Number.isFinite(s)))return t;let[n,r,i,o]=e;return`${1-i} ${1-o} ${1-n} ${1-r}`}function ht(t){return!Number.isFinite(t)||Math.abs(t)<1e-9?"0":Math.abs(t-1)<1e-9?"1":parseFloat(t.toFixed(6)).toString()}function Zd([t,e,n,r]){let i=o=>Number.isFinite(o)?parseFloat(o.toFixed(6)).toString():"0";return`${i(t)} ${i(e)} ${i(n)} ${i(r)}`}function Og(t){return t.length>0&&t.every(e=>e==="0 0 1 1")}function ga(t){if(t.length<2)return!1;let e=t.length-1,n=1e-4;for(let r=0;r<t.length;r++){let i=r/e,o=parseFloat(t[r]);if(!Number.isFinite(o)||Math.abs(o-i)>n)return!1}return!0}function Jd(t){if(t.length<2)return!1;let e=t.length-1,n=1e-4;for(let r=0;r<t.length;r++)if(Math.abs(t[r]-r/e)>n)return!1;return!0}function Er(t){let e=t.cycleDuration??(t.keyframes.length>0?t.keyframes[t.keyframes.length-1].time:0);return t.cycleBehavior==="alternate"||t.cycleBehavior==="alternate-reverse"?e*2:e}function hi(t){let e=t.beginTrigger;if(e)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}let n=t.keyframes[0]?.time??0;return n!==0?`${n}s`:""}function ha(t){return t.keyframes.length===1&&t.cycleDuration===void 0}function ya(t){return t.calcMode!=="discrete"?!1:t.sourceSmilElement==="set"?!0:!t.sourceSmilElement&&!t.cycleInfinite&&t.keyframes.every(e=>e.easing!=="steps")}function Qd(t,e){if(e<=0)return hi(t);if(hi(t)==="indefinite")return"indefinite";let n=t.keyframes[e]?.time??0;return n!==0?`${n}s`:""}function eu(t){if(t.cycleInfinite)return"indefinite";let e=t.cycleRepeats??1,n=t.cycleBehavior==="alternate"||t.cycleBehavior==="alternate-reverse"?e/2:e;return n===1?null:String(n)}function yi(t){return t.cycleInfinite||t.fill==="remove"?null:"freeze"}function tu(t){return t.additive==="sum"?"sum":null}function nu(t){return t.keyframes.map(e=>{let n=typeof e.value=="number"?e.value:parseFloat(String(e.value));return Number.isFinite(n)?Math.max(0,Math.min(1,n)):0})}function lO(t){let e=n=>Math.max(0,Math.min(1,n));return[t[0],e(t[1]),t[2],e(t[3])]}function cO(t){let[e,n,r,i]=t,o=new Set,s=8;for(let d=1;d<=s;d++)o.add(d/s);let a=n-2*i+1,l=2*(i-2*n),c=n,u=d=>{if(!Number.isFinite(d)||d<=0||d>=1)return;let p=3*(1-d)**2*d*e+3*(1-d)*d**2*r+d**3;p>0&&p<1&&o.add(Number(p.toFixed(6)))};if(Math.abs(a)<1e-9)Math.abs(l)>=1e-9&&u(-c/l);else{let d=l*l-4*a*c;if(d>=0){let p=Math.sqrt(d);u((-l+p)/(2*a)),u((-l-p)/(2*a))}}return[...o].sort((d,p)=>d-p)}function dO(t,e,n,r,i,o){let s=typeof t.value=="number"&&typeof e.value=="number",a=$r(e.value);if(e.easing==="linear-function"&&e.linearPoints&&e.linearPoints.length>=2){if(s){let h=e.linearPoints;for(let b=1;b<h.length;b++){let S=h[b],v=t.time+(e.time-t.time)*S.position,I=t.value+(e.value-t.value)*S.value;r.push(I),i.push(ht(n(v))),o.push("0 0 1 1")}return}r.push(a),i.push(ht(n(e.time))),o.push("0 0 1 1");return}if(e.easing==="steps"){r.push(a),i.push(ht(n(e.time))),o.push("0 0 1 1");return}let l=Ng(e);if(!l){r.push(a),i.push(ht(n(e.time))),o.push("0 0 1 1");return}let[,c,,u]=l;if(!(c<0||c>1||u<0||u>1)){r.push(a),i.push(ht(n(e.time))),o.push(Zd(l));return}if(!s){r.push(a),i.push(ht(n(e.time))),o.push(Zd(lO(l)));return}let p=cO(l),f=t.value,g=e.value,m=e.time-t.time;for(let h of p){let b=Mg(l[0],l[1],l[2],l[3],h),S=t.time+m*h,v=f+(g-f)*b;r.push(v),i.push(ht(n(S))),o.push("0 0 1 1")}}function $r(t){return Array.isArray(t)?t.join(" "):t}function uO(t,e,n){let r=[],{count:i,position:o}=n,s=e.time-t.time,a=$r(t.value),l=$r(e.value),c=typeof a=="number"&&typeof l=="number",u=typeof a=="string"&&typeof l=="string",d=g=>u?g<.5?a:l:c?a+(l-a)*g:g>=1?l:a,p=g=>{let m=Math.floor(g*i);(o==="jump-start"||o==="jump-both")&&(m+=1);let h;switch(o){case"jump-start":case"jump-end":h=i;break;case"jump-none":h=i-1;break;case"jump-both":h=i+1;break}return m>h&&(m=h),m<0&&(m=0),m/h},f=p(0);for(let g=1;g<=i;g++){let m=g/i,h=p(m);if(h===f)continue;let b=t.time+m*s;r.push({value:d(h),time:b}),f=h}return r.length===0||r[r.length-1].time<e.time?r.push({value:l,time:e.time}):r[r.length-1]={value:l,time:e.time},r}function pO(t,e){let n=[],r=[],i=(o,s)=>{n.push(o),r.push(ht(e(s)))};i($r(t[0].value),t[0].time);for(let o=1;o<t.length;o++){let s=t[o-1],a=t[o];if(a.easing==="steps"&&a.stepsParams){let l=uO(s,a,a.stepsParams);for(let c of l)i(c.value,c.time)}else i($r(a.value),a.time)}return{values:n,keyTimes:r}}function fO(t,e,n){return{values:t.slice().reverse(),keyTimes:e.slice().reverse().map(r=>ht(1-parseFloat(r))),keySplines:n.slice().reverse().map(ma)}}function qd(t,e,n,r,i){let o=i.cycleBehavior??"restart";if(o==="restart"||t.length<2)return{values:t,keyTimes:e,keySplines:n,calcMode:r};if(o==="reverse")return{...fO(t,e,n),calcMode:r};if(o==="alternate-reverse"){let c=t.slice().reverse(),u=e.slice().reverse().map(p=>ht(.5-parseFloat(p))),d=n.slice().reverse().map(ma);return{values:[...c,...t.slice(1)],keyTimes:[...u,...e.slice(1).map(p=>ht(.5+parseFloat(p)))],keySplines:[...d,...n],calcMode:r}}let s=t.slice(0,-1).reverse(),a=e.slice(0,-1).reverse().map(c=>ht(1-parseFloat(c))),l=n.slice().reverse().map(ma);return{values:[...t,...s],keyTimes:[...e,...a],keySplines:[...n,...l],calcMode:r}}function Ar(t){let e=t.keyframes;if(e.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let n=Er(t),r=e[0]?.time??0,i=c=>n>0?(c-r)/n:0;if(e.some(c=>c.easing==="steps")){let{values:c,keyTimes:u}=pO(e,i);return qd(c,u,[],"discrete",t)}if(t.calcMode==="discrete"){let c=e.map(d=>$r(d.value)),u=e.map(d=>ht(i(d.time)));return qd(c,u,[],"discrete",t)}if(t.calcMode==="paced"){let c=e.map(d=>$r(d.value)),u=e.map(d=>ht(i(d.time)));return qd(c,u,[],"paced",t)}let s=[$r(e[0].value)],a=[ht(i(e[0].time))],l=[];for(let c=1;c<e.length;c++)dO(e[c-1],e[c],i,s,a,l);return qd(s,a,l,"spline",t)}function Sa(t,e={}){let n=e.defaultCalcMode??"linear",r={};if(t.calcMode==="paced")return n!=="paced"&&(r.calcMode="paced"),r;if(t.calcMode==="discrete")return r.keyTimes=t.keyTimes.join(";"),r.calcMode="discrete",r;let i=t.keySplines.length>0&&!Og(t.keySplines);return ga(t.keyTimes)||(r.keyTimes=t.keyTimes.join(";")),i&&(r.calcMode="spline",r.keySplines=t.keySplines.join(";")),r}function Dg(t,e){if(t.shapeId!==e.shapeId||t.keyframes.length!==e.keyframes.length||(t.cycleDuration??-1)!==(e.cycleDuration??-1)||(t.cycleRepeats??1)!==(e.cycleRepeats??1)||!!t.cycleInfinite!=!!e.cycleInfinite||(t.cycleBehavior??"restart")!==(e.cycleBehavior??"restart")||(t.additive??"replace")!==(e.additive??"replace")||(t.calcMode??"linear")!==(e.calcMode??"linear")||!!t.locked!=!!e.locked)return!1;let n=(r,i)=>!r&&!i||!!r&&!!i&&r.type===i.type&&r.value===i.value;if(!n(t.beginTrigger,e.beginTrigger)||!n(t.endTrigger,e.endTrigger))return!1;for(let r=0;r<t.keyframes.length;r++){let i=t.keyframes[r],o=e.keyframes[r];if(i.time!==o.time||i.easing!==o.easing)return!1;let s=i.customBezier,a=o.customBezier;if(!!s!=!!a)return!1;if(s&&a){for(let l=0;l<4;l++)if(s[l]!==a[l])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(o.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(o.stepsParams??null))return!1}return!0}function ru(t){let e=new Map,n=new Set,r=new Map;for(let i of t){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let o=r.get(i.shapeId)??[];o.push(i),r.set(i.shapeId,o)}for(let i of r.values()){let o=new Set;for(let s=0;s<i.length;s++){let a=i[s];if(o.has(a.id))continue;let l=a.property==="translateX"||a.property==="translateY",c=l?"translateX":"scaleX",u=l?"translateY":"scaleY";if(!(a.property!==c&&a.property!==u))for(let d=s+1;d<i.length;d++){let p=i[d];if(o.has(p.id)||!(a.property===c&&p.property===u||a.property===u&&p.property===c)||!Dg(a,p))continue;let f=a.property===c?a:p,g=a.property===u?a:p;e.set(f.id,g),n.add(g.id),o.add(f.id),o.add(g.id);break}}}return{partner:e,skip:n}}function iu(t,e,n,r){if(r){let o=e?r.values:t.values,s=e?t.values:r.values,a=Math.min(o.length,s.length),l=[];for(let c=0;c<a;c++)l.push(`${o[c]} ${s[c]}`);return l}let i=n?"1":"0";return t.values.map(o=>e?`${i} ${o}`:`${o} ${i}`)}var hI={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",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",display:"display",visibility:"visibility",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",pathMorph:"d",polylinePoints:"points"},yI=new Set(["transformMatrix","rotation","skewX","skewY"]),SI=new Set(["translateX","translateY","scaleX","scaleY"]);function su(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ne(t,e){return e==null?"":` ${t}="${su(e)}"`}function zg(t,e){let n=Sa(t,e);return Ne("keyTimes",n.keyTimes)+Ne("calcMode",n.calcMode)+Ne("keySplines",n.keySplines)}function au(t,e){return Ne("dur",`${e}s`)+Ne("begin",hi(t)||null)+Ne("repeatCount",eu(t))}function bI(t,e){let n=e??hI[t.property];if(!n)return"";let r=Er(t);if(r<=0)return"";let i=Ar(t);return i.values.length<2?"":"<animate"+Ne("attributeName",n)+Ne("values",i.values.join(";"))+zg(i)+au(t,r)+Ne("fill",yi(t))+"/>"}function mO(t,e){let n;switch(t.property){case"transformMatrix":n="matrix";break;case"rotation":n="rotate";break;case"skewX":n="skewX";break;case"skewY":n="skewY";break;default:return""}let r=Er(t);if(r<=0)return"";let i=Ar(t),o=n==="matrix"?i.values.map(l=>hO(l)):i.values.map(l=>String(l));if(o.length<2||o.some(l=>l.length===0))return"";let s=n==="rotate"&&t.transformOrigin?o.map(l=>`${l} ${t.transformOrigin.x} ${t.transformOrigin.y}`):o,a=t.replacesCarrierBase&&e?"sum":tu(t);return'<animateTransform attributeName="transform"'+Ne("type",n)+Ne("values",s.join(";"))+zg(i)+au(t,r)+Ne("additive",a)+Ne("fill",yi(t))+"/>"}function gO(t,e,n){let r=t.property==="scaleX"||t.property==="scaleY",i=t.property==="translateY"||t.property==="scaleY",o=r?"scale":"translate",s=Er(t);if(s<=0)return"";let a=Ar(t);if(a.values.length<2)return"";let l=e?Ar(e):void 0,c=iu(a,i,r,l);if(c.length<2)return"";let u=!t.replacesCarrierBase||n?"sum":null;return'<animateTransform attributeName="transform"'+Ne("type",o)+Ne("values",c.join(";"))+zg(a)+au(t,s)+Ne("additive",u)+Ne("fill",yi(t))+"/>"}function hO(t){if(Array.isArray(t)&&t.length>=6){let e=t.slice(0,6);if(e.every(n=>typeof n=="number"&&Number.isFinite(n)))return e.join(" ")}if(typeof t=="string"){let e=t.trim(),n=/^matrix\(([^)]+)\)$/i.exec(e),i=(n?n[1]:e).split(/[\s,]+/).filter(Boolean).map(Number);if(i.length>=6&&i.slice(0,6).every(Number.isFinite))return i.slice(0,6).join(" ")}return""}function yO(t){if(!t.motionPath)return"";let e=Er(t);if(e<=0)return"";let n=Ar(t),r=nu(t),i=!!t.motionPathRef&&(t.motionPathRef.mode??"trackShape")==="curveTemplate",o=Sa(n,{defaultCalcMode:"paced"}),s=Jd(r)&&ga(n.keyTimes)&&n.calcMode!=="discrete"&&o.calcMode===void 0,a="<animateMotion";return i||(a+=Ne("path",t.motionPath)),a+=Ne("keyTimes",o.keyTimes),s||(a+=Ne("keyPoints",r.join(";"))),a+=Ne("calcMode",o.calcMode)+Ne("keySplines",o.keySplines),a+=au(t,e),a+=Ne("fill",yi(t)),t.motionRotate!==void 0&&(a+=Ne("rotate",typeof t.motionRotate=="number"?String(t.motionRotate):t.motionRotate)),i?a+=`><mpath href="#${su(t.motionPathRef.shapeId)}"/></animateMotion>`:a+="/>",a}function ou(t,e,n){if(yI.has(t.property)||SI.has(t.property)||t.property==="pathMotion")return"";let r=n??hI[t.property];if(!r)return"";let i=t.keyframes[e];return i?"<set"+Ne("attributeName",r)+Ne("to",Array.isArray(i.value)?i.value.join(" "):String(i.value))+Ne("begin",Qd(t,e)||null)+"/>":""}function vI(t,e){let n={...t,locked:t.locked??!1,keyframes:[...t.keyframes].sort((r,i)=>r.time-i.time).map(r=>({...r,easing:r.easing}))};return!n.enabled||n.keyframes.length===0?"":ha(n)?ou(n,0,e):ya(n)?n.keyframes.map((r,i)=>ou(n,i,e)).join(""):n.keyframes.length<2?"":bI(n,e)}function SO(t){let e=hi(t);return e?`<discard begin="${su(e)}"/>`:"<discard/>"}function lu(t){let e=new Map,n=t.tracks.map(c=>({...c,locked:c.locked??!1,keyframes:[...c.keyframes].sort((u,d)=>u.time-d.time).map(u=>({...u,time:u.time,value:u.value,easing:u.easing}))})),r=[...n.flatMap(c=>{let u=Bp(c);return u?[u]:[]}),...n],i=ru(r),o=new Set,s=new Set,a=new Set,l=(c,u,d)=>{if(!u)return;let p=u;d.sourceSmilId&&!o.has(d.sourceSmilId)&&(o.add(d.sourceSmilId),p=u.replace(/^(<[a-zA-Z]+)/,`$1 id="${su(d.sourceSmilId)}"`));let f=e.get(c)??[];f.push(p),e.set(c,f)};for(let c of r){if(!c.enabled||i.skip.has(c.id)||c.keyframes.length<1)continue;if(c.property==="discard"){l(c.shapeId,SO(c),c);continue}if(ha(c)){l(c.shapeId,ou(c,0),c);continue}if(ya(c)){for(let p=0;p<c.keyframes.length;p++)l(c.shapeId,ou(c,p),c);continue}if(c.keyframes.length<2)continue;let u=c.id.endsWith(":backwards-fill")?s:a,d="";c.property==="pathMotion"&&c.motionPath?d=yO(c):yI.has(c.property)?(d=mO(c,u.has(c.shapeId)),d&&u.add(c.shapeId)):SI.has(c.property)?(d=gO(c,i.partner.get(c.id),u.has(c.shapeId)),d&&u.add(c.shapeId)):d=bI(c),l(c.shapeId,d,c)}return e}function du(t){return t===null||typeof t!="object"?JSON.stringify(t)??"null":Array.isArray(t)?`[${t.map(du).join(",")}]`:`{${Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${JSON.stringify(e)}:${du(n)}`).join(",")}}`}function cu(t,e,n){for(let r of t){r.type==="symbol-instance"&&n(r,e);let i=r.state.children;if(!Array.isArray(i))continue;let o=e;r.type==="svg"&&(o=Rr(r,e).viewport.childPercentBasis??e),cu(i,o,n)}}function uu(t,e,n={}){let r=n.reservedIds??new Set,i=uo(t),o=new Map,s=[],a=new WeakMap,l=new Map,c=[],u=(R,C)=>{a.set(R,C);let A=l.get(R.id);A?A.push(C):l.set(R.id,[C]),c.push(...C.diagnostics)},d=(R,C,A)=>{if(a.has(R))return;let D=String(R.state.symbolId??"").trim(),_=D!==""&&i.duplicateIds.has(D),O=D?i.symbol(D):void 0;if(_||!O){u(R,{targetId:null,definition:null,materializationKey:null,materialization:null,parentViewport:A,viewport:null,diagnostics:[{code:_?"duplicate-library-id":"unresolved-symbol-definition",shapeId:R.id,message:_?`Symbol instance ${R.id} targets duplicate library id ${D}.`:`Symbol instance ${R.id} targets missing symbol definition ${D||"(blank)"}.`}]});return}let L=n.instancePolicy?.(R),re=L?.initialVariantKey===void 0?R:{...R,state:{...R.state,variantKey:L.initialVariantKey}},ee=ei(O,re),F=L?.dedicated===!0,V=fo(R,O,A,n.viewportHost);if(C.includes(ee.materializationKey)){u(R,{targetId:null,definition:O,materializationKey:ee.materializationKey,materialization:null,parentViewport:A,viewport:V,diagnostics:[...ee.diagnostics,{code:"symbol-cycle",shapeId:R.id,message:`Symbol instance cycle detected through ${O.id}.`}]});return}let K=A?`${A.width},${A.height}`:"none",X=`${ee.materializationKey}\0path=${C.join("")}\0viewport=${K}`+(F?`\0dedicated=${R.id}`:""),z=o.get(X);if(!z){let te=structuredClone(ee.shapes);z={occurrenceKey:X,materializationKey:ee.materializationKey,candidateTargetId:F?`${O.id}--ovr-${R.id}`:ee.candidateTargetId,targetId:F?`${O.id}--ovr-${R.id}`:ee.candidateTargetId,definition:O,shapes:te,materialized:ee.materialized||F,forcedDedicated:F,activeDepth:C.length,parentViewport:A,viewport:V},o.set(X,z),s.push(z)}let G={targetId:z.targetId,definition:O,materializationKey:ee.materializationKey,materialization:null,diagnostics:ee.diagnostics,parentViewport:A,viewport:V,pending:z};u(R,G);let q=[...C,ee.materializationKey];cu(z.shapes,z.viewport.childPercentBasis??A,(te,ie)=>d(te,q,ie))};cu(e,n.parentViewport,(R,C)=>{d(R,[],C)});let p=new Map,f=new Map,g=new Set,m=R=>{let C=p.get(R);if(C)return C;if(g.has(R))throw new Error(`Materialization occurrence graph retained a cycle at ${R.occurrenceKey}.`);g.add(R);let A=[];cu(R.shapes,R.viewport.childPercentBasis??R.parentViewport,O=>{let L=a.get(O);if(L?.pending){A.push(`resolved:${m(L.pending)}`);return}A.push(du({materializationKey:L?.materializationKey??null,diagnostics:L?.diagnostics.map(re=>re.code)??["missing-resolution"]}))}),g.delete(R);let D=du({materializationKey:R.materializationKey,nested:A,forcedOccurrence:R.forcedDedicated?R.occurrenceKey:null}),_=f.get(D);return _||(_=`materialization-signature:${f.size+1}`,f.set(D,_)),p.set(R,_),_},h=(R,C)=>R.activeDepth-C.activeDepth||R.candidateTargetId.localeCompare(C.candidateTargetId)||R.occurrenceKey.localeCompare(C.occurrenceKey),b=new Map;for(let R of s){let C=m(R),A=b.get(C);(!A||h(R,A)<0)&&b.set(C,R)}let S=new Map;for(let R of s)S.set(R,b.get(m(R)));let v=s.filter(R=>S.get(R)===R),I=new Map;for(let R of v){let C=I.get(R.materializationKey);(!C||C.forcedDedicated&&!R.forcedDedicated||C.forcedDedicated===R.forcedDedicated&&h(R,C)<0)&&I.set(R.materializationKey,R)}let x=R=>R.forcedDedicated||R.materialized||I.get(R.materializationKey)!==R,P=new Set(v.filter(R=>!x(R)).map(R=>R.definition.id)),T=new Set([...r,...P,...v.filter(x).map(R=>R.candidateTargetId)]),k=new Set([...r,...P]);for(let R of v){if(!x(R)){R.targetId=R.definition.id;continue}let C=R.candidateTargetId,A=C;if(k.has(A)){let D=2;do A=`${C}-${D++}`;while(T.has(A)||k.has(A))}R.targetId=A,k.add(A)}let w=new Map,$=v.map(R=>{let C={materializationKey:R.materializationKey,targetId:R.targetId,candidateTargetId:R.candidateTargetId,definition:R.definition,shapes:R.shapes,parentViewport:R.parentViewport,viewport:R.viewport};return w.set(R,C),C});for(let R of s){let C=S.get(R),A=w.get(C);R.targetId=A.targetId,R!==C&&w.set(R,{materializationKey:R.materializationKey,targetId:A.targetId,candidateTargetId:R.candidateTargetId,definition:R.definition,shapes:R.shapes,parentViewport:R.parentViewport,viewport:R.viewport})}for(let R of l.values())for(let C of R)C.pending&&(C.targetId=C.pending.targetId,C.materialization=w.get(C.pending)??null,delete C.pending);return{materializations:$,diagnostics:c,resolve(R){let C=a.get(R);if(C)return C;let A=l.get(R.id);return A?.length===1?A[0]:void 0}}}var bO="text/css";function ba(t){return t.includes("{")?t.replace(/([^{}]*)\{([^{}]*)\}/g,(e,n,r)=>{let i=xI(r);if(i===r)return e;let o=String(n).trim();return!/^(?:from|to|[\d.]+%)(?:\s*,\s*(?:from|to|[\d.]+%))*$/i.test(o)&&!/[^\s;]/.test(i)?"":`${n}{${i}}`}):xI(t)}var vO=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?animation(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,xO=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?transition(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,IO=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?(?:transform-origin|transform-box)\s*:[^;]*(?:;|$)/gi;function xI(t){let e=!1,n=t.replace(vO,r=>(e=!0,_g(r)));return n=n.replace(xO,r=>_g(r)),e&&(n=n.replace(IO,r=>_g(r))),n}function _g(t){return t.startsWith(";")?";":""}function wO(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function II(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function va(t){let e=t.map(({name:n,defaultValue:r})=>` --${n}: ${r};`);return e.length?`:root, svg {
39
+ ${e.join(`
40
+ `)}
41
+ }
42
+ `:""}function pu(t){if(!t||t.length===0)return"";let e=va(t);return e?`<style id="svgsketch-variables">${II(e)}</style>`:""}function fu(t){if(!t||t.length===0)return"";let e=[];for(let n of t){let r=new Map;if(n.svgId&&r.set("id",n.svgId),n.type&&n.type!==bO&&r.set("type",n.type),n.media&&r.set("media",n.media),n.customAttrs)for(let[o,s]of Object.entries(n.customAttrs))r.has(o)||r.set(o,s);let i="<style";for(let[o,s]of r)i+=` ${o}="${wO(s)}"`;i+=`>${II(ba(n.css))}</style>`,e.push(i)}return e.join("")}function kO(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function RO(t){return t?t.includes("]]>")?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):/[<&>]/.test(t)?`<![CDATA[${t}]]>`:t:""}function mu(t){if(!t||t.length===0)return"";let e=[];for(let n of t){let r=new Map;if(n.svgId&&r.set("id",n.svgId),n.type&&r.set("type",n.type),n.source==="external"&&n.href&&r.set("href",n.href),n.crossorigin&&r.set("crossorigin",n.crossorigin),n.async&&r.set("async",""),n.defer&&r.set("defer",""),n.customAttrs)for(let[o,s]of Object.entries(n.customAttrs))r.has(o)||r.set(o,s);let i="<script";for(let[o,s]of r)i+=` ${o}="${kO(s)}"`;n.source==="inline"&&n.content?i+=`>${RO(n.content)}</script>`:i+="/>",e.push(i)}return e.join("")}function wI(t){return t.replace(new RegExp(`\\s+${Oi}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function Fg(t,e){let n=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,r;for(;(r=n.exec(t))!==null;)e.add(r[1]);let i=/\b(?:xlink:)?href\s*=\s*(?:"#([^"]+)"|'#([^']+)')/g;for(;(r=i.exec(t))!==null;)e.add(r[1]??r[2])}function gu(t,e,n=[],r=new Set){let i=new Map;for(let c of t.rawPaintServerDefs??[]){if(typeof c!="string")continue;let u=Di(c);if(!u||r.has(u))continue;let d=c.includes(Oi);i.set(u,{id:u,markup:wI(c),passthrough:d})}for(let c of t.paintServerDefs??[]){if(!c||typeof c.markup!="string")continue;let u=c.id??Di(c.markup);!u||r.has(u)||i.set(u,{id:u,markup:wI(c.markup),passthrough:c.passthrough===!0})}if(i.size===0)return"";let o=new Set;Fg(e,o);for(let c of n)Fg(c,o);let s=new Map;for(let c of i.values())c.passthrough&&s.set(c.id,c);let a=!0;for(;a;){a=!1;for(let c of i.values())s.has(c.id)||!o.has(c.id)||(s.set(c.id,c),a=!0);for(let c of s.values()){let u=o.size;Fg(c.markup,o),o.size>u&&(a=!0)}}if(s.size===0)return"";let l=[];for(let c of i.values())s.has(c.id)&&l.push(c.markup);return l.join("")}function hu(t){let e=new Set;for(let n of t??[])e.add(n.definitionId??`${n.type}-${n.id}`);return e}var TO={defsMarkup:"",suppressedShapeIds:new Set,memberToDirective:new Map};function Kt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function Ia(t){return t.definitionId??`${t.type}-${t.id}`}function Lg(t,e){let n=0;for(;n<t.length;){let c=/^\s+/.exec(t.slice(n));if(c){n+=c[0].length;continue}if(!t.startsWith("<!--",n))break;let u=t.indexOf("-->",n+4);if(u<0)return t;n=u+3}let r=t.slice(n),i=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(r);if(!i)return t;let[o,s,a,l]=i;return t.slice(0,n)+`<${s}${e(a)}${l}>`+r.slice(o.length)}function PO(t,e){return Lg(t,n=>{let r=n.replace(/\s+id\s*=\s*(?:"[^"]*"|'[^']*')/,"");return` id="${Kt(e)}"${r}`})}function xa(t,e){return t.replace(new RegExp(`\\s+${e}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function CO(t,e,n){return Lg(t,r=>{let i=xa(r,"data-shape-id");if(e==="clip"){let o=/\bfill-rule\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(i);i=xa(i,"fill-rule"),i=xa(i,"clip-rule"),i=xa(i,"fill"),i=i.replace(/\s+stroke(?:-[a-z-]+)?\s*=\s*(?:"[^"]*"|'[^']*')/g,""),i+=' fill="black"';let s=n??o?.[1]??o?.[2];s&&(i+=` clip-rule="${Kt(s)}"`)}return i})}function yu(t){let e=t.clipMaskGroups;if(!Array.isArray(e)||e.length===0)return TO;let n=new Map;for(let l of t.shapes??[])qt(l,{onShape:c=>n.set(c.id,c)});let r=Cr(Array.isArray(t.library)?t.library:[]),i=new Set,o=new Map,s=new Set,a=[];for(let l of e){if(!l||l.type!=="clip"&&l.type!=="mask")continue;let c=Ia(l),u=Array.isArray(l.clipShapeIds)?l.clipShapeIds:[];for(let p of u)i.add(p);if(!s.has(c)){if(typeof l.rawDefinition=="string"&&l.rawDefinition.length>0)s.add(c),a.push(PO(l.rawDefinition,c));else if(u.length>0){s.add(c);let p=l.type==="clip"?"clipPath":"mask",f=`<${p} id="${Kt(c)}"`;l.type==="clip"?(l.clipPathUnits&&(f+=` clipPathUnits="${Kt(l.clipPathUnits)}"`),l.clipRule&&(f+=` clip-rule="${Kt(l.clipRule)}"`)):(l.maskUnits&&(f+=` maskUnits="${Kt(l.maskUnits)}"`),l.maskContentUnits&&(f+=` maskContentUnits="${Kt(l.maskContentUnits)}"`),l.maskBounds&&(f+=` x="${Kt(l.maskBounds.x)}" y="${Kt(l.maskBounds.y)}"`,f+=` width="${Kt(l.maskBounds.width)}"`,f+=` height="${Kt(l.maskBounds.height)}"`),l.maskType&&(f+=` mask-type="${Kt(l.maskType)}"`)),f+=">";for(let g of u){let m=n.get(g);m&&(f+=CO(on(m,r),l.type,l.clipRule))}f+=`</${p}>`,a.push(f)}}let d=Array.isArray(l.contentShapeIds)?l.contentShapeIds:[];if(d.length>0){let p={attr:l.type==="clip"?"clip-path":"mask",defId:c,memberIds:d};for(let f of d)o.has(f)||o.set(f,p)}}return{defsMarkup:a.join(""),suppressedShapeIds:i,memberToDirective:o}}function Su(t,e){return Lg(t,n=>`${xa(n,e.attr)} ${e.attr}="url(#${Kt(e.defId)})"`)}function wa(t,e){let n=t.state?.children;return!Array.isArray(n)||n.length===0?t:{...t,state:{...t.state,children:Bg(n,e)}}}function Bg(t,e){let n=t.filter(i=>!e.suppressedShapeIds.has(i?.id)).map(i=>wa(i,e)),r=[];for(let i=0;i<n.length;){let o=n[i],s=e.memberToDirective.get(o.id);if(!s){r.push(o),i++;continue}let a=[o],l=i+1;for(;l<n.length&&e.memberToDirective.get(n[l].id)===s;)a.push(n[l]),l++;a.length===1?r.push($O(o,s)):r.push(EO(a,s)),i=l}return r}function $O(t,e){let n=t.state,r={...n.authoredAttributes??{},[e.attr]:`url(#${e.defId})`};return{...t,state:{...n,authoredAttributes:r}}}function EO(t,e){return{id:`clipmask-wrapper:${e.defId}:${t[0].id}`,type:"group",state:{children:t,groupData:{[e.attr==="clip-path"?"clipPath":"mask"]:`url(#${e.defId})`}}}}function Et(t){return t.library+t.builtinMarkers+t.symbols+t.motionPaths+t.paintServers+t.clipMask+t.inlineHoisted}function AO(t){return Ld.some(e=>e===t)}function NO(t,e){let n=Ue(t);return n&&n.width>0&&n.height>0?{width:n.width,height:n.height}:e}function sn(t,e={}){let{backgroundColor:n,includeScripts:r=!0}=e;if(t.sceneTree&&t.sceneTree.length>0){let B={...t,shapes:structuredClone(t.shapes??[])};Hr(B),t=B}let i=t.shapes??[],o=i.find(B=>B.type==="svg"&&B.state?.isRootSvg===!0),s=o?.state,a=Number(s?.svgViewBoxWidth??0),l=Number(s?.svgViewBoxHeight??0),c=a>0&&l>0?{x:Number(s?.svgViewBoxX??0),y:Number(s?.svgViewBoxY??0),width:a,height:l,intrinsicWidth:Number(s?.svgWidth??0)>0?Number(s?.svgWidth):a,intrinsicHeight:Number(s?.svgHeight??0)>0?Number(s?.svgHeight):l,preserveAspectRatio:typeof s?.svgPreserveAspectRatio=="string"?s.svgPreserveAspectRatio.trim():""}:null,u=t.viewboxes?.[0],d=e.width??c?.intrinsicWidth??u?.width??800,p=e.height??c?.intrinsicHeight??u?.height??600,f=e.viewBox??(c?`${c.x} ${c.y} ${c.width} ${c.height}`:`0 0 ${d} ${p}`),g=e.preserveAspectRatio??c?.preserveAspectRatio??"",m=NO(f,c?{width:c.width,height:c.height}:{width:d,height:p}),h=new Set,b=B=>{for(let ve of B??[])h.add(ve.id),b(ve.state?.children)};for(let B of i)b(B.state?.children);let S=i.filter(B=>B.state?.displayMode==="motionOnly"),v=i.filter(B=>B.state?.displayMode!=="motionOnly"&&B!==o&&!h.has(B.id)),I=new Set(S.filter(B=>Ra(B)!==null).map(B=>B.id)),x=t.animationTimeline?{...t.animationTimeline,tracks:t.animationTimeline.tracks.map(B=>{let ve=B.motionPathRef;if(B.property!=="pathMotion"||!B.motionPath||!ve||(ve.mode??"trackShape")!=="curveTemplate"||I.has(ve.shapeId))return B;let{motionPathRef:Re,...lt}=B;return lt})}:null,P=x?lu(x):null,T=yu(t),k=DO(t),w=zO(t),$=[...Array.isArray(t.library)?t.library:[],...k.filter(B=>!(Array.isArray(t.library)&&t.library.some(ve=>ve.id===B.id))),...(w??[]).filter(B=>!B.builtIn&&!(Array.isArray(t.library)&&t.library.some(ve=>ve.id===B.id)))],R=Xd({documentStyles:t.documentStyles,animationTimeline:x}),C=fa(v,$,R).filter(B=>B.kind!=="symbol"),A=ni(v,$);for(let B of R)A.ids.add(B);let D=Cr($);D.textMeasurementHost=e.textMeasurementHost,D.legacySymbolNumericGeometry=(t.schemaVersion??1)<8;let _;{let B=Xs(i),ve=new Map,Re=new Set,lt=new Set,yt=(Z,Me)=>{Z&&Me.add(Z)};for(let Z of B.ordered)Z.type==="text"&&yt(Z.state?.shapeInsideRef,Re),Z.type==="shape-reference"&&yt(Z.state?.targetShapeId,lt);let an=new Map;for(let Z of B.ordered){let Me=Z.state?.metadata?.name,Je=Me?Pn(Me):"",xe=Re.has(Z.id)||lt.has(Z.id);Je?an.set(Z,Je):xe&&!B.duplicateIds.has(Z.id)&&an.set(Z,Z.id)}let En=new Set([...C.map(Z=>Z.id),...S.filter(Z=>Ra(Z)).map(Z=>Z.id),...(t.clipMaskGroups??[]).map(Ia)]);for(let[Z,Me]of Object.entries(ca)){let Je=Z.replace("line-marker-","");(A.legacyEndpoints.has(Je)||A.ids.has(Z))&&En.add(Z),A.ids.has(Me)&&En.add(Me)}for(let Z of B.ordered)Z.type==="text"&&Z.state.isTextPath&&Z.state.textPathPoints&&En.add(`text-path-${Z.id}`);_=uu($,v,{reservedIds:new Set([...En,...an.values()]),parentViewport:m,viewportHost:{legacyNumericGeometry:(t.schemaVersion??1)<8},instancePolicy:(()=>{let Z=e.symbolInstanceInitialVariants;if(!Z||Z.size===0)return;let Me=new WeakMap;for(let[Je,xe]of Z){let At=B.uniqueById.get(Je);At?.type==="symbol-instance"&&Me.set(At,xe)}return Je=>{let xe=Me.get(Je);return xe===void 0?void 0:{initialVariantKey:xe,dedicated:!0}}})()});for(let Z of _.materializations)En.add(Z.targetId);for(let Z of _.diagnostics)$t({severity:"warning",code:Z.code,shapeId:Z.shapeId,message:Z.message});D.symbolInstanceTargetElementId=Z=>_.resolve(Z)?.targetId;let bi=kr(t),Do=new WeakMap;D.symbolInstanceTransform=Z=>{let Me=Do.get(Z);if(!Me){let Je=_.resolve(Z);Me=xd(bi,Z,{},Je?.parentViewport??m),Do.set(Z,Me);for(let xe of Me.diagnostics)!["invalid-symbol-viewport","unresolved-symbol-viewport","unresolved-symbol-pivot"].includes(xe.code)||!AO(xe.code)||$t({severity:"warning",code:xe.code,shapeId:xe.shapeId,message:xe.message})}return Me};let zo=new Set([...an.values(),...En]),vi=new Set(En),xi=new Map,Mr=new Map,oh=new Map;for(let[Z,Me]of an){let Je=(xi.get(Me)??0)+1;xi.set(Me,Je);let xe=Me;if(Je>1||vi.has(xe)){let At=2;do xe=`${Me}-${At++}`;while(zo.has(xe)||vi.has(xe))}Mr.set(Z,xe),B.duplicateIds.has(Z.id)||oh.set(Z.id,xe),vi.add(xe)}for(let[Z,Me]of B.uniqueById){let Je=Mr.get(Me);Je&&ve.set(Z,Je)}if(Mr.size>0&&(D.elementIdForShape=Z=>oh.get(Z.id)??Mr.get(Z)),Re.size>0&&(D.shapeInsideTargetElementId=Z=>ve.get(Z)),lt.size>0){D.shapeReferenceTargetElementId=xe=>B.duplicateIds.has(xe)?null:ve.get(xe);let Z=kr(t),Me=new WeakMap,Je=new WeakMap;D.shapeReferenceBounds=xe=>{let At=Me.get(xe);return At||(At=ho(Z,xe),Me.set(xe,At)),At},D.shapeReferenceTransform=xe=>{let At=Je.get(xe);return At||(At=vd(Z,xe),Je.set(xe,At)),At}}}let O=new Map,L=new Set,re=new Map(Xs(i).ordered.map(B=>[B.id,B]));for(let B of x?.tracks??[]){let ve=/^(fill|stroke)GradientStop(\d+)(Color|Opacity|Offset)$/.exec(B.property);if(!ve)continue;let Re=re.get(B.shapeId);if(!Re)continue;let lt=ve[1],yt=Number(ve[2]),an=ve[3],En=Re.state?.[lt==="fill"?"fillGradient":"strokeGradient"],bi=Re.state?.[lt==="fill"?"fillLibraryId":"strokeLibraryId"]??En?.id;if(!bi)continue;let Do=an==="Color"?"stop-color":an==="Opacity"?"stop-opacity":"offset",zo=vI(B,Do);if(!zo)continue;let vi=`${bi}|${yt}|${Do}|${zo}`;if(L.has(vi))continue;L.add(vi);let xi=O.get(bi)??new Map,Mr=xi.get(yt)??[];Mr.push(zo),xi.set(yt,Mr),O.set(bi,xi)}D.gradientStopAnimationElements=(B,ve)=>O.get(B)?.get(ve);let ee=C.length>0?pa(C,D):"",F=_.materializations.filter(B=>B.targetId===B.definition.id).map(B=>Po(B.definition,B.targetId,B.shapes,D)).join(""),V=ee+F,K=Kd(A,$),X=_.materializations.filter(B=>B.targetId!==B.definition.id).map(B=>Po(B.definition,B.targetId,B.shapes,D)).join(""),z=_O(S),G=n?`<rect width="${d}" height="${p}" fill="${n}"/>`:"",q={...D,animationElementsForShape:B=>P?.get(B.id)},te=B=>{let ve=on(B,q),Re=P?.get(B.id),lt=Re&&Re.length>0?Re:[];return{shape:B,markup:ve,smil:lt}},ie=v.filter(B=>!T.suppressedShapeIds.has(B.id)).map(B=>wa(B,T)),J=[];for(let B=0;B<ie.length;){let ve=ie[B],Re=T.memberToDirective.get(ve.id);if(!Re){J.push({kind:"shape",...te(ve)}),B++;continue}let lt=[ve],yt=B+1;for(;yt<ie.length&&T.memberToDirective.get(ie[yt].id)===Re;)lt.push(ie[yt]),yt++;if(lt.length===1){let an=te(ve);J.push({kind:"shape",...an,markup:Su(an.markup,Re)})}else J.push({kind:"clip-mask-run",directive:Re,open:`<g ${Re.attr}="url(#${Gg(Re.defId)})">`,close:"</g>",members:lt.map(te)});B=yt}let ke=TI(J),Le=(t.documentStyles??[]).map(B=>ba(B.css)),Be=va(t.templateVariables??[]),Ze=gu(t,ke,[...Le,Be,T.defsMarkup,V,X,K,z],hu(t.clipMaskGroups)),Rt={rootAttributes:id(t.documentMetadata),descriptive:od(t.documentMetadata),scripts:r?mu(t.documentScripts):"",styles:pu(t.templateVariables)+fu(t.documentStyles),trailingComments:(t.documentMetadata?.trailingComments??[]).map(B=>`<!--${B.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")},Oo={frame:{width:d,height:p,viewBox:f,preserveAspectRatio:g,...e.omitFrameAttributes?{omit:e.omitFrameAttributes}:{}},defs:{library:V,builtinMarkers:K,symbols:X,motionPaths:z,paintServers:Ze,clipMask:T.defsMarkup,inlineHoisted:""},body:J,motionOnlyShapes:S,backgroundRect:G,envelope:Rt,strippedCssTexts:Le,strippedDocumentCss:Le.join(`
43
+ `).trim(),symbols:_};return OO(Oo),Oo}function TI(t){let e="";for(let n of t)if(n.kind==="shape")e+=n.markup;else{e+=n.open;for(let r of n.members)e+=r.markup;e+=n.close}return e}var kI=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,RI=/<(?:use|mpath|textPath)\b[^>]*?\s(?:xlink:)?href\s*=\s*"#([^"]+)"/g,MO=/\sid\s*=\s*"([^"]+)"/g;function ka(t,e,n){for(let r of e.matchAll(t))n.add(r[1])}function OO(t){let e=new Set,n=[Et(t.defs),TI(t.body),t.envelope.descriptive,t.envelope.styles];for(let s of n)ka(MO,s,e);let r=(s,a)=>{for(let l of s)e.has(l)||$t({severity:"warning",code:"unresolved-reference",message:a?`Unresolved reference "#${l}" on shape "${a}"; no definition with that id is emitted`:`Unresolved reference "#${l}"; no definition with that id is emitted`,...a?{shapeId:a}:{}})},i=s=>{let a=new Set;ka(kI,s.markup,a),ka(RI,s.markup,a),r(a,s.shape.id)};for(let s of t.body)if(s.kind==="shape")i(s);else for(let a of s.members)i(a);let o=new Set;ka(kI,Et(t.defs),o),ka(RI,Et(t.defs),o),r(o)}function DO(t){let n=(Array.isArray(t.library)?t.library:[]).filter(r=>r.kind==="symbol");return n.length>0?n:t.symbols??[]}function zO(t){let n=(Array.isArray(t.library)?t.library:[]).filter(r=>r.kind==="marker");return n.length>0?n:t.markers}function _O(t){if(t.length===0)return"";let e=[];for(let n of t){let r=Ra(n);r&&e.push(`<path id="${Gg(n.id)}" d="${Gg(r)}"/>`)}return e.join("")}function Gg(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Ra(t){return Sc(t)}var FO=new Set(["id","href","xlink:href","fill","stroke","stop-color","flood-color","lighting-color","color","solid-color","text-decoration-color","caret-color","class","font-family","lang","xml:lang","style","keyTimes","keyPoints","keySplines","gradientTransform"]),NI=/([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function Vg(t,e){return t.length===0?t:t.replace(NI,(n,r,i)=>{if(FO.has(r)||r==="xmlns"||r.startsWith("xmlns:")||r.startsWith("data-")||!/\d/.test(i)||i.includes("url(")||i.charCodeAt(0)===35)return n;let o=sa(i,e);return o===i?n:`${r}="${o}"`})}var Co=/<\/?([A-Za-z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g;function Pa(t){let e=[],n=0,r=0,i="";Co.lastIndex=0;let o;for(;(o=Co.exec(t))!==null;){let s=o[0].startsWith("</"),a=o[3]==="/";if(s){if(n=Math.max(0,n-1),n===0){let l=t.slice(r,Co.lastIndex);e.push({markup:l,tag:i,id:PI(l)}),r=Co.lastIndex,i=""}continue}if(n===0&&(i=o[1].toLowerCase()),!a)n++;else if(n===0){let l=t.slice(r,Co.lastIndex);e.push({markup:l,tag:i,id:PI(l)}),r=Co.lastIndex,i=""}}if(r<t.length){let s=t.slice(r);s.trim().length>0&&e.push({markup:s,tag:"",id:null})}return e}function LO(t,e){let n=(e.paintServerDefs??[]).filter(d=>Array.isArray(d.definitionChildIds)&&d.definitionChildIds.length>0);if(n.length===0)return t;let r=new Map,i=new Map;for(let d of Jn){let p=Pa(t.defs[d]);r.set(d,p),p.forEach((f,g)=>{!f.id||i.has(f.id)||i.set(f.id,{channel:d,index:g,segment:f,key:`${d}:${g}`})})}let o=new Map(n.map(d=>[d.id,d])),s=new Set,a=new Map,l=new Map,c=(d,p)=>{let f=l.get(d);if(f)return f;if(p.has(d))return null;let g=o.get(d),m=i.get(d);if(!g||!m)return null;let h=m.segment.markup,b=h.indexOf(">"),S=h.lastIndexOf("</");if(b<0||S<=b)return h;let v=h.slice(b+1,S),I=g.sourceDefinitionChildIds??g.definitionChildIds,x=g.definitionChildIds,P=new Map(I.map(($,R)=>[$,R])),T=new Set(p);T.add(d);let k=Pa(v).map($=>{if(!$.id)return $.markup;let R=P.get($.id);if(R===void 0)return $.markup;let C=x[R],A=i.get(C);if(!A||A.key===m.key)return $.markup;let D=o.has(C)?c(C,T):A.segment.markup;return D?(s.add(A.key),$.markup.slice(0,$.markup.indexOf("<"))+D.trimStart()):$.markup}).join(""),w=h.slice(0,b+1)+k+h.slice(S);return l.set(d,w),w};for(let d of n){let p=i.get(d.id);if(!p)continue;let f=c(d.id,new Set);f&&a.set(p.key,f)}let u={...t.defs};for(let d of Jn)u[d]=(r.get(d)??[]).map((p,f)=>{let g=`${d}:${f}`;return s.has(g)?"":a.get(g)??p.markup}).join("");return{...t,defs:u}}function PI(t){let e=/^[^>]*>/.exec(t.trimStart()),n=e?e[0]:t,r=/\sid\s*=\s*"([^"]*)"/.exec(n);return r?r[1]:null}function jg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vu(t,e){if(e.size===0||t.length===0)return t;let n=t;for(let[r,i]of e){let o=jg(r);n=n.replace(new RegExp(`url\\(\\s*(['"]?)#${o}\\1\\s*\\)`,"g"),(s,a)=>`url(${a}#${i}${a})`),n=n.replace(new RegExp(`((?:xlink:)?href\\s*=\\s*)(["'])#${o}\\2`,"g"),(s,a,l)=>`${a}${l}#${i}${l}`)}return n}function BO(t,e,n){return t.replace(new RegExp(`(\\sid\\s*=\\s*")${jg(e)}(")`),`$1${n}$2`)}var Jn=["library","builtinMarkers","symbols","motionPaths","paintServers","clipMask","inlineHoisted"];function bu(t,e){let n={...t.defs};for(let r of Jn)n[r]=e(n[r]);return{...t,defs:n,backgroundRect:e(t.backgroundRect),body:t.body.map(r=>r.kind==="shape"?{...r,markup:e(r.markup)}:{...r,open:e(r.open),close:e(r.close),members:r.members.map(i=>({...i,markup:e(i.markup)}))}),envelope:{...t.envelope}}}function MI(t,e){let n=bu(t,e);return{...n,envelope:{...n.envelope,styles:e(n.envelope.styles)}}}function GO(t){let e=new Set,n=/\sid\s*=\s*"([^"]*)"/g,r=i=>{n.lastIndex=0;let o;for(;(o=n.exec(i))!==null;)e.add(o[1])};for(let i of Jn)r(t.defs[i]);for(let i of t.body)if(i.kind==="shape")r(i.markup);else{r(i.open);for(let o of i.members)r(o.markup)}return r(t.envelope.descriptive),e}function VO(t,e){let n=e.library??[];if(n.length===0)return t;let r=GO(t),i=new Map,o=new Set;for(let l of n){let c=l.sourceId,u=l.id;!c||!u||c===u||o.has(c)||r.has(c)||r.has(u)&&(i.set(u,c),o.add(c))}if(i.size===0)return t;let s=MI(t,l=>vu(l,i)),a={...s.defs};for(let l of Jn){let c=a[l];for(let[u,d]of i)c=BO(c,u,d);a[l]=c}return{...s,defs:a}}var jO=new Set(["lineargradient","radialgradient","pattern","marker"]);function UO(t,e){let n=t;return e&&(n=n.replace(new RegExp(`\\sid\\s*=\\s*"${jg(e)}"`),"")),n.replace(/\s+/g," ").trim()}function HO(t){let e=new Map,n=new Map,r={...t.defs};for(let o of Jn){let s=Pa(r[o]),a=!1,l=[];for(let c of s){if(!jO.has(c.tag)||!c.id){l.push(c.markup);continue}let u=`${c.tag}|${UO(c.markup,c.id)}`,d=e.get(u);if(d===void 0){e.set(u,c.id),l.push(c.markup);continue}if(d===c.id){a=!0;continue}n.set(c.id,d),a=!0}a&&(r[o]=l.join(""))}if(n.size===0&&r===t.defs)return t;let i={...t,defs:r};return n.size===0?i:MI(i,o=>vu(o,n))}var WO=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","inherit","initial","unset","revert"]);function CI(t){return t.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").split(",")[0].trim().replace(/^['"]|['"]$/g,"").trim()}function Ug(t){let e=new Set,n=r=>{if(!r.includes("font-family"))return;let i=/font-family\s*=\s*"([^"]*)"/g,o;for(;(o=i.exec(r))!==null;)e.add(CI(o[1]));let s=/font-family\s*:\s*([^;"}<]+)/g;for(;(o=s.exec(r))!==null;)e.add(CI(o[1]))};for(let r of Jn)n(t.defs[r]);for(let r of t.body)if(r.kind==="shape")n(r.markup);else for(let i of r.members)n(i.markup);return n(t.envelope.styles),[...e].filter(r=>r&&!WO.has(r.toLowerCase()))}function KO(t,e){let n=Ug(t);if(n.length===0)return t;let r=e(n);if(!r||r.trim().length===0)return t;let i=`<style type="text/css">
44
+ ${r.trim()}
45
+ </style>`;return{...t,envelope:{...t.envelope,styles:t.envelope.styles.length>0?`${i}
46
+ ${t.envelope.styles}`:i}}}var XO=new Set(["rect","image","svg","use","text"]),$I="Inter, sans-serif",YO=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 $o(t){let e=parseFloat(t);return Number.isFinite(e)&&Math.abs(e-1)<1e-6}function EI(t){let e=parseFloat(t);return Number.isFinite(e)&&e===0}function AI(t){return t===void 0||t==="normal"||t==="400"}var qO=/\s+([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function ZO(t,e,n){let r=t.toLowerCase();if(r==="g")return e;let i=r==="image"||r==="foreignobject";return e.replace(qO,(o,s,a)=>{switch(s){case"stroke":return i||a==="none"&&(n.stroke===void 0||n.stroke==="none")?"":o;case"fill":return i?"":o;case"stroke-width":return i||$o(a)&&(n.strokeWidth===void 0||$o(n.strokeWidth))?"":o;case"stroke-opacity":return $o(a)&&(n.strokeOpacity===void 0||$o(n.strokeOpacity))?"":o;case"fill-opacity":return $o(a)&&(n.fillOpacity===void 0||$o(n.fillOpacity))?"":o;case"x":case"y":return XO.has(r)&&EI(a)?"":o;case"font-weight":return AI(a)&&AI(n.fontWeight)?"":o;case"font-style":return a==="normal"&&(n.fontStyle===void 0||n.fontStyle==="normal")?"":o;case"text-anchor":return a==="start"&&(n.textAnchor===void 0||n.textAnchor==="start")?"":o;case"font-family":return a===$I&&(n.fontFamily===void 0||n.fontFamily===$I)?"":o;case"orient":return r==="marker"&&EI(a)?"":o;case"markerUnits":return r==="marker"&&a==="strokeWidth"?"":o;default:return o}})}function Ta(t,e){if(t.length===0)return t;let n=/<(\/?)([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,r="",i=0,o;for(;(o=n.exec(t))!==null;){let[s,a,l,c,u]=o;if(r+=t.slice(i,o.index),i=o.index+s.length,a==="/"){e.length>1&&e.pop(),r+=s;continue}let d=e[e.length-1],p=ZO(l,c,d);if(r+=`<${l}${p}${u}>`,u!=="/"){let f={...d};c.replace(NI,(g,m,h)=>{let b=YO.get(m);return b&&(f[b]=h),g}),e.push(f)}}return r+=t.slice(i),r}function JO(t){let e={...t.defs};for(let i of Jn)e[i]=Ta(e[i],[{}]);let n=[{}],r=t.body.map(i=>{if(i.kind==="shape")return{...i,markup:Ta(i.markup,n)};let o=Ta(i.open,n),s=i.members.map(l=>({...l,markup:Ta(l.markup,n)})),a=Ta(i.close,n);return{...i,open:o,members:s,close:a}});return{...t,defs:e,body:r}}function QO(t){let e="",n=i=>i.replace(/<defs>[\s\S]*?<\/defs>/g,o=>(e+=o.slice(6,-7),"")),r=t.body.map(i=>i.kind==="shape"?{...i,markup:n(i.markup)}:{...i,members:i.members.map(o=>({...o,markup:n(o.markup)}))});return e.length===0?t:{...t,body:r,defs:{...t.defs,inlineHoisted:t.defs.inlineHoisted+e}}}var eD=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"]]),tD=new Set(["xml","xmlns"]);function nD(t){let e=new Set,n=new Map,r=/<(\/)?([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i=/(?:^|\s)([A-Za-z_][\w.-]*):([A-Za-z_][\w.-]*)\s*=/g,o=/(?:^|\s)xmlns:([A-Za-z_][\w.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,s=(d,p)=>{o.lastIndex=0;let f;for(;(f=o.exec(d))!==null;){let g=f[1],m=f[2]??f[3]??"";p.add(g);let h=n.get(g);h||(h=new Set,n.set(g,h)),h.add(m)}},a=(d,p)=>{i.lastIndex=0;let f;for(;(f=i.exec(d))!==null;)f[1]!=="xmlns"&&!p.has(f[1])&&e.add(f[1])},l=new Set(tD);s(t.envelope.rootAttributes,l),a(t.envelope.rootAttributes,l);let c=d=>{if(d.length===0)return;let p=[new Set(l)];r.lastIndex=0;let f;for(;(f=r.exec(d))!==null;){if(f[1]){p.length>1&&p.pop();continue}let g=new Set(p[p.length-1]);s(f[3],g);let m=f[2].indexOf(":");if(m>0){let h=f[2].slice(0,m);g.has(h)||e.add(h)}a(f[3],g),f[4]||p.push(g)}};for(let d of Jn)c(t.defs[d]);for(let d of t.body)d.kind==="shape"?c(d.markup):c(`${d.open}${d.members.map(p=>p.markup).join("")}</g>`);c(t.backgroundRect),c(t.envelope.descriptive),c(t.envelope.scripts),c(t.envelope.styles);let u=[];for(let d of e){let p=n.get(d),f=p?.size===1?[...p][0]:void 0,g=eD.get(d)??f;if(!g){$t({severity:"warning",code:"undeclarable-namespace-prefix",message:`namespace prefix "${d}:" 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}u.push(` xmlns:${d}="${g}"`)}return u.length===0?t:(u.sort(),{...t,envelope:{...t.envelope,rootAttributes:t.envelope.rootAttributes+u.join("")}})}function xu(t,e,n={}){let r=QO(t);if(r=LO(r,e),(n.restoreSourceIds??!0)&&(r=VO(r,e)),(n.deduplicateDefs??!0)&&(r=HO(r)),n.shapeIdAttributes===!1&&(r=bu(r,i=>i.replace(/\sdata-shape-id="[^"]*"/g,""))),r=bu(r,i=>i.replace(/\sdata-source-id="[^"]*"/g,"")),n.resolveFontEmbedCss&&(r=KO(r,n.resolveFontEmbedCss)),n.precision!==null){let i=_d(n.precision??e.documentMetadata?.coordinatePrecision??oa);r=bu(r,o=>Vg(o,i))}return(n.elideInitialValues??!0)&&(r=JO(r)),r=nD(r),r}function Eo(t,e={}){return Ca(t,e).svg}function Ca(t,e={}){let n=new Io;return{svg:Bd(n,()=>Hg(xu(sn(t,e),t,e),e)),diagnostics:n.diagnostics}}function Hg(t,e={}){let{xmlDeclaration:n=!0,indent:r=!0,className:i}=e,o=r?`
47
+ `:"",s=r?" ":"",a=[];for(let g of t.body){if(g.kind==="shape"){a.push(`${s}${g.markup}`);continue}a.push(`${s}${g.open}`);for(let m of g.members)a.push(`${s}${s}${m.markup}`);a.push(`${s}${g.close}`)}let l=a.join(o),c=t.defs,u="";Et(c).length>0&&(u=`${o}${s}<defs>${o}`,c.library.length>0&&(u+=`${s}${s}${c.library}${o}`),c.builtinMarkers.length>0&&(u+=`${s}${s}${c.builtinMarkers}${o}`),c.symbols.length>0&&(u+=`${s}${s}${c.symbols}${o}`),c.motionPaths.length>0&&(u+=`${s}${s}${c.motionPaths}${o}`),c.paintServers.length>0&&(u+=`${s}${s}${c.paintServers}${o}`),c.clipMask.length>0&&(u+=`${s}${s}${c.clipMask}${o}`),c.inlineHoisted.length>0&&(u+=`${s}${s}${c.inlineHoisted}${o}`),u+=`${s}</defs>`);let d=t.backgroundRect.length>0?`${o}${s}${t.backgroundRect}`:"",p="";n&&(p+=`<?xml version="1.0" encoding="UTF-8"?>${o}`);let f=t.frame.omit;return p+='<svg xmlns="http://www.w3.org/2000/svg"',f?.width||(p+=` width="${t.frame.width}"`),f?.height||(p+=` height="${t.frame.height}"`),f?.viewBox||(p+=` viewBox="${t.frame.viewBox}"`),t.frame.preserveAspectRatio&&(p+=` preserveAspectRatio="${t.frame.preserveAspectRatio}"`),i&&(p+=` class="${i}"`),p+=t.envelope.rootAttributes,p+=">",t.envelope.descriptive.length>0&&(p+=`${o}${s}${t.envelope.descriptive}`),p+=u,p+=d,l.length>0&&(p+=`${o}${l}`),t.envelope.scripts.length>0&&(p+=`${o}${s}${t.envelope.scripts}`),t.envelope.styles.length>0&&(p+=`${o}${s}${t.envelope.styles}`),t.envelope.trailingComments.length>0&&(p+=`${o}${s}${t.envelope.trailingComments}`),p+=`${o}</svg>${o}`,p}function OI(t,e){return e?t.variants?.[e]??t.shapes:t.shapes}function DI(t,e){return!e||Object.keys(e).length===0?t:t.map(n=>{let r=e[n.id];return!r||Object.keys(r).length===0?n:{...n,state:{...n.state,...r}}})}function Kg(t){let e=[];for(let n of t.timeline.tracks){if(n.property!=="instanceVariant"||n.enabled===!1)continue;let r=t.instances.get(n.shapeId);if(!r)continue;let i=t.getSymbol(r.symbolId);if(!i)continue;let o=t.instanceSymbolIds.get(r.id);if(!o||!t.existingInnerIds.has(o))continue;let s=[...n.keyframes].sort((a,l)=>a.time-l.time);s.length<2||e.push({symbolId:o,def:i,overrides:r.symbolOverrides,keyframes:s})}return e}function Xg(t){let e=new Map;for(let[n,r]of t.existingInnerIds)e.set(n,new Set(r));return e}function rD(t){return t.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function Ao(t,e){let n=on(t),r=0;for(;n.startsWith("<!--",r);){let l=n.indexOf("-->",r);if(l===-1)return null;r=l+3}let i=n.indexOf("<",r);if(i===-1)return null;let o=n.indexOf(">",i);if(o===-1)return null;let s=n.slice(i,o+1),a=new RegExp(`\\s${e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}="([^"]*)"`).exec(s);return a?rD(a[1]):null}var Si=(t,e=0)=>typeof t=="number"&&Number.isFinite(t)?t:e;function iD(t,e,n){let r=t.transformMatrix;if(r&&r.length>=6)return{x:r[0]*e.x+r[2]*e.y+r[4],y:r[1]*e.x+r[3]*e.y+r[5]};let i=Si(t.translateX),o=Si(t.translateY),s=t.rawTransform;if(s){let m=it(Ot(s)),h=m[0]*e.x+m[2]*e.y+m[4],b=m[1]*e.x+m[3]*e.y+m[5];return{x:h+i,y:b+o}}let a=Si(t.rotation),l=Si(t.skewX),c=Si(t.skewY),u=Si(t.scaleX,1),d=Si(t.scaleY,1),p=u!==1||d!==1;if(a===0&&l===0&&c===0&&!p)return{x:e.x+i,y:e.y+o};let f=e.x-n.x,g=e.y-n.y;if(c!==0&&(g=g+f*Math.tan(c*Math.PI/180)),l!==0&&(f=f+g*Math.tan(l*Math.PI/180)),p&&(f*=u,g*=d),a!==0){let m=a*Math.PI/180,h=Math.cos(m),b=Math.sin(m),S=f*h-g*b,v=f*b+g*h;f=S,g=v}return{x:f+n.x+i,y:g+n.y+o}}function zI(t,e){let n=Vl(e);if(!n)return t.resolveShapeCenterFallback?.(e)??null;let r=e.state,i=r.customPivot??n;return iD(r,n,i)}var oD=[{key:"fillColor",attr:"fill"},{key:"borderColor",attr:"stroke"},{key:"borderWidth",attr:"stroke-width"},{key:"opacity",attr:"opacity"},{key:"fillOpacity",attr:"fill-opacity"},{key:"strokeOpacity",attr:"stroke-opacity"},{key:"fontSize",attr:"font-size"}],sD={circle:{x:"cx",y:"cy",radius:"r"},ellipse:{x:"cx",y:"cy",rx:"rx",ry:"ry"},rectangle:{x:"x",y:"y",width:"width",height:"height"},square:{x:"x",y:"y",width:"width",height:"height"},line:{x1:"x1",y1:"y1",x2:"x2",y2:"y2"},image:{x:"x",y:"y",width:"width",height:"height"},text:{x:"x",y:"y"}},_I=new Set(["triangle","polygon","star","diamond","ngon","cross","heart","gear","arrow","cloud","ring","lightning","speech-bubble","spiral"]),aD=[{key:"fillColor",prop:"fill"},{key:"borderColor",prop:"stroke"},{key:"borderWidth",prop:"stroke-width"},{key:"opacity",prop:"opacity"},{key:"fillOpacity",prop:"fill-opacity"},{key:"strokeOpacity",prop:"stroke-opacity"}],lD=[{key:"fillColor",prop:"fill"},{key:"borderColor",prop:"stroke"},{key:"borderWidth",prop:"strokeWidth"},{key:"opacity",prop:"opacity"},{key:"fillOpacity",prop:"fillOpacity"},{key:"strokeOpacity",prop:"strokeOpacity"}];function FI(t,e){return t+(((e-t)%360+540)%360-180)}function Xt(t,e,n,r,i){return{element:"animate",attributes:[["attributeName",t],["from",e],["to",n],["begin",r],["dur",i],["fill","freeze"]]}}function Wg(t,e,n,r,i,o){return{element:"animateTransform",attributes:[["attributeName","transform"],["type",t],["from",e],["to",n],["begin",r],["dur",i],["fill","freeze"],["additive",o]]}}function cD(t){let e=t.state.opacity;return e!==void 0?String(e):"1"}function LI(t){let e=t.state.opacity;return e!==void 0?String(Number(e)):"1"}function*Yg(t,e){let{keyframes:n,def:r,overrides:i}=t;for(let o=0;o<n.length-1;o++){let s=n[o],a=n[o+1],l=String(s.value??""),c=String(a.value??"");if(l===c)continue;let u=DI(OI(r,l),i),d=DI(OI(r,c),i);yield{treeA:u,treeB:d,aById:new Map(u.map(p=>[p.id,p])),bById:new Map(d.map(p=>[p.id,p])),index:o,beginSec:s.time/e,durSec:(a.time-s.time)/e}}}function BI(t){let e=Kg(t);if(e.length===0)return[];let n=t.timeline.duration>0?t.timeline.duration:1,r=Xg(t),i=[];for(let o of e){let s=r.get(o.symbolId),a=[];for(let l of Yg(o,n)){let c=`${l.beginSec}s`,u=`${l.durSec}s`;for(let d of l.treeB){let p=l.aById.get(d.id);if(!p||!s.has(d.id))continue;let f=p.state,g=d.state,m=[];for(let{key:b,attr:S}of oD){let v=f[b],I=g[b];v===void 0&&I===void 0||v!==I&&(v==null||I==null||m.push({action:"animate",spec:Xt(S,String(v),String(I),c,u)}))}let h=sD[d.type];if(h)for(let[b,S]of Object.entries(h)){let v=f[b],I=g[b];v===void 0&&I===void 0||v!==I&&(v==null||I==null||m.push({action:"animate",spec:Xt(S,String(v),String(I),c,u)}))}if(_I.has(d.type)){let b=Number(f.cx),S=Number(f.cy),v=Number(g.cx),I=Number(g.cy),x=Number(f.rotation??0),P=Number(g.rotation??0);if(Number.isFinite(b)&&Number.isFinite(S)&&Number.isFinite(v)&&Number.isFinite(I)&&Number.isFinite(x)&&Number.isFinite(P)&&(b!==v||S!==I||x!==P)){l.index===0&&m.push({action:"setBaseTransform",transform:`translate(${b}, ${S}) rotate(${x})`}),m.push({action:"animate",spec:Wg("translate",`${b} ${S}`,`${v} ${I}`,c,u,"replace")});let R=FI(x,P);m.push({action:"animate",spec:Wg("rotate",String(x),String(R),c,u,"sum")})}let k=f.sides,w=g.sides;if((f.radius!==g.radius||f.shiftAngle!==g.shiftAngle||f.cornerRadius!==g.cornerRadius)&&k===w){let R=Ao(p,"d"),C=Ao(d,"d");R&&C&&R!==C&&m.push({action:"animate",spec:Xt("d",R,C,c,u)})}else if(k!==w){let R=`${d.id}--xf`,C=1;for(;s.has(R);)R=`${d.id}--xf${C++}`;s.add(R),m.push({action:"crossfade",innerId:R,shape:d,fadeOut:Xt("opacity","1","0",c,u),fadeIn:Xt("opacity","0",cD(d),c,u)})}}if(d.type==="polyline"){let b=f.polylinePoints??null,S=g.polylinePoints??null;if(b&&S&&b.length===S.length){let v=Ao(p,"points"),I=Ao(d,"points");v&&I&&v!==I&&m.push({action:"animate",spec:Xt("points",v,I,c,u)})}}if(f.lineStyle!==g.lineStyle||f.dashLength!==g.dashLength||f.gapLength!==g.gapLength){let b=Ao(p,"stroke-dasharray"),S=Ao(d,"stroke-dasharray");b&&S&&b!==S&&m.push({action:"animate",spec:Xt("stroke-dasharray",b,S,c,u)})}if(!_I.has(d.type)){let b=Number(f.rotation??0),S=Number(g.rotation??0);if(Number.isFinite(b)&&Number.isFinite(S)&&b!==S){let v=zI(t,p),I=zI(t,d);if(v&&I){let x=FI(b,S);m.push({action:"animate",spec:Wg("rotate",`${b} ${v.x} ${v.y}`,`${x} ${I.x} ${I.y}`,c,u,"sum")})}}}for(let[b,S]of[["fillGradient","fill"],["strokeGradient","stroke"]]){let v=dD(f,g,b,S,c,u);v&&m.push(v)}a.push({op:"withInner",innerId:d.id,actions:m})}for(let d of l.treeA)l.bById.has(d.id)||s.has(d.id)&&a.push({op:"withInner",innerId:d.id,actions:[{action:"animate",spec:Xt("opacity","1","0",c,u)}]});for(let d of l.treeB)l.aById.has(d.id)||(s.add(d.id),a.push({op:"ensureInner",innerId:d.id,shape:d,animations:[Xt("opacity","0",LI(d),c,u)]}))}i.push({symbolId:o.symbolId,ops:a})}return i}function dD(t,e,n,r,i,o){let s=t[n],a=e[n];if(!s||!a||s.type!==a.type||!Array.isArray(s.stops)||!Array.isArray(a.stops)||s.stops.length!==a.stops.length)return null;let l=[];for(let d=0;d<s.stops.length;d++){let p=s.stops[d],f=a.stops[d],g=[];p.offset!==f.offset&&g.push(Xt("offset",String(p.offset),String(f.offset),i,o)),p.color!==f.color&&g.push(Xt("stop-color",p.color,f.color,i,o)),p.opacity!==f.opacity&&g.push(Xt("stop-opacity",String(p.opacity),String(f.opacity),i,o)),g.length>0&&l.push({index:d,animations:g})}let c=s.type==="linear-gradient"?["x1","y1","x2","y2"]:["cx","cy","fx","fy","r"],u=[];for(let d of c){let p=s[d],f=a[d];typeof p!="number"||typeof f!="number"||p===f||u.push(Xt(d,String(p),String(f),i,o))}return{action:"gradient",paintAttr:r,expectedStopCount:s.stops.length,stops:l,gradient:u}}var uD=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_");function GI(t){let e=Kg(t);if(e.length===0)return{stylesheet:null,symbols:[]};let n=t.timeline.duration>0?t.timeline.duration:1,r=Xg(t),i=[],o=0,s=[],a=new Map;for(let l of e){let c=r.get(l.symbolId),u=s.find(f=>f.symbolId===l.symbolId);u||(u={symbolId:l.symbolId,scopeClass:`svgsketch-variant-${uD(l.symbolId)}`,ensure:[],assignments:[]},s.push(u),a.set(u,new Map));let d=a.get(u),p=(f,g,m,h,b,S)=>{let v=`svgsketch-vt-${++o}`;i.push(`@keyframes ${v} { 0% { ${h}: ${g}; } 100% { ${h}: ${m}; } }`);let I=`${v} ${S}s linear ${b}s forwards`,x=d.get(f);x?x.push(I):d.set(f,[I])};for(let f of Yg(l,n))if(!(f.durSec<=0)){for(let g of f.treeB){let m=f.aById.get(g.id);if(!m||!c.has(g.id))continue;let h=m.state,b=g.state;for(let{key:S,prop:v}of aD){let I=h[S],x=b[S];I===void 0&&x===void 0||I!==x&&(I==null||x==null||p(g.id,String(I),String(x),v,f.beginSec,f.durSec))}}for(let g of f.treeA)f.bById.has(g.id)||c.has(g.id)&&p(g.id,"1","0","opacity",f.beginSec,f.durSec);for(let g of f.treeB)f.aById.has(g.id)||(c.has(g.id)||(u.ensure.push({innerId:g.id,shape:g}),c.add(g.id)),p(g.id,"0",LI(g),"opacity",f.beginSec,f.durSec))}}for(let[l,c]of a)for(let[u,d]of c)l.assignments.push({innerId:u,animation:d.join(", ")});return{stylesheet:i.length>0?i.join(`
48
+ `):null,symbols:s}}function VI(t){let e=Kg(t);if(e.length===0)return{scriptBody:null,symbols:[]};let n=t.timeline.duration>0?t.timeline.duration:1,r=Xg(t),i=[],o=[];for(let l of e){let c=r.get(l.symbolId),u=o.find(d=>d.symbolId===l.symbolId);u||(u={symbolId:l.symbolId,ensure:[]},o.push(u));for(let d of Yg(l,n)){let p=d.beginSec*1e3,f=d.durSec*1e3;if(f<=0)continue;let g=(m,h)=>{let b={},S={};for(let[v,[I,x]]of Object.entries(h))b[v]=I,S[v]=x;i.push({symbolId:l.symbolId,innerId:m,keyframes:[b,S],durationMs:f,delayMs:p})};for(let m of d.treeB){let h=d.aById.get(m.id);if(!h)continue;let b=h.state,S=m.state,v={};for(let{key:I,prop:x}of lD){let P=b[I],T=S[I];P===void 0&&T===void 0||P!==T&&(P==null||T==null||(v[x]=[P,T]))}Object.keys(v).length>0&&g(m.id,v)}for(let m of d.treeA)d.bById.has(m.id)||g(m.id,{opacity:[1,0]});for(let m of d.treeB){if(d.aById.has(m.id))continue;c.has(m.id)||(u.ensure.push({innerId:m.id,shape:m}),c.add(m.id));let h=m.state.opacity,b=h!==void 0?Number(h):1;g(m.id,{opacity:[0,b]})}}}return i.length===0?{scriptBody:null,symbols:o}:{scriptBody:`
49
+ (function () {
50
+ function start() {
51
+ var specs = ${JSON.stringify(i)};
52
+ for (var i = 0; i < specs.length; i++) {
53
+ var spec = specs[i];
54
+ var symbolEl = document.getElementById(spec.symbolId);
55
+ if (!symbolEl) continue;
56
+ var innerEl = symbolEl.querySelector('[data-svgsketch-inner-id="' + spec.innerId + '"]');
57
+ if (!innerEl || !innerEl.animate) continue;
58
+ try {
59
+ innerEl.animate(spec.keyframes, {
60
+ duration: spec.durationMs,
61
+ delay: spec.delayMs,
62
+ fill: 'forwards',
63
+ easing: 'linear'
64
+ });
65
+ } catch (err) {
66
+ // Element.animate may throw on unsupported property names; skip silently.
67
+ }
68
+ }
69
+ }
70
+ if (document.readyState === 'loading') {
71
+ document.addEventListener('DOMContentLoaded', start);
72
+ } else {
73
+ start();
74
+ }
75
+ })();
76
+ `,symbols:o}}function Iu(t,e){let n=Vv(t,e);return Eo(t,{width:n.width,height:n.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function pD(t){return t==="class"?"className":t==="for"?"htmlFor":t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function wu(t){return t.replace(/\s([a-z][a-z-]*?)=/g,(e,n)=>n.startsWith("data-")||n.startsWith("aria-")?e:` ${pD(n)}=`)}function ku(t,e){let n=e.componentName??"SvgComponent",r=e.indent??" ",i=e.typescript??!1,o=sn(t,{width:e.width,height:e.height}),s=[];for(let d of o.body){if(d.kind==="shape"){s.push(`${r}${r}${r}${wu(d.markup)}`);continue}s.push(`${r}${r}${r}${wu(d.open)}`);for(let p of d.members)s.push(`${r}${r}${r}${r}${wu(p.markup)}`);s.push(`${r}${r}${r}${d.close}`)}let a=Et(o.defs),l=a.length>0,c=o.strippedDocumentCss,u=[];u.push("import React from 'react';"),u.push(""),i?(u.push(`interface ${n}Props {`),u.push(`${r}className?: string;`),u.push(`${r}style?: React.CSSProperties;`),u.push("}"),u.push(""),u.push(`const ${n}: React.FC<${n}Props> = ({ className, style }) => {`)):u.push(`const ${n} = ({ className, style }) => {`),u.push(`${r}return (`),u.push(`${r}${r}<svg xmlns="http://www.w3.org/2000/svg" width="${o.frame.width}" height="${o.frame.height}" viewBox="${o.frame.viewBox}" className={className} style={style}>`),l&&(u.push(`${r}${r}${r}<defs>`),u.push(`${r}${r}${r}${r}${wu(a)}`),u.push(`${r}${r}${r}</defs>`));for(let d of s)u.push(d);return c.length>0&&u.push(`${r}${r}${r}<style>{${JSON.stringify(c)}}</style>`),u.push(`${r}${r}</svg>`),u.push(`${r});`),u.push("};"),u.push(""),u.push(`export default ${n};`),u.push(""),u.join(`
77
+ `)}function Ru(t,e){let n=e.componentName??"SvgComponent",r=e.indent??" ",i=e.typescript??!1,o=sn(t,{width:e.width,height:e.height}),s=[];for(let d of o.body){if(d.kind==="shape"){s.push(`${r}${r}${d.markup}`);continue}s.push(`${r}${r}${d.open}`);for(let p of d.members)s.push(`${r}${r}${r}${p.markup}`);s.push(`${r}${r}${d.close}`)}let a=Et(o.defs),l=a.length>0,c=o.strippedDocumentCss,u=[];u.push("<template>"),u.push(`${r}<svg xmlns="http://www.w3.org/2000/svg" width="${o.frame.width}" height="${o.frame.height}" viewBox="${o.frame.viewBox}" :class="className" :style="style">`),l&&(u.push(`${r}${r}<defs>`),u.push(`${r}${r}${r}${a}`),u.push(`${r}${r}</defs>`));for(let d of s)u.push(d);return c.length>0&&u.push(`${r}${r}<component :is="'style'">${c}</component>`),u.push(`${r}</svg>`),u.push("</template>"),u.push(""),i?u.push('<script setup lang="ts">'):u.push("<script setup>"),u.push(`// ${n}`),i?(u.push("defineProps<{"),u.push(`${r}className?: string;`),u.push(`${r}style?: Record<string, string>;`),u.push("}>();")):(u.push("defineProps({"),u.push(`${r}className: { type: String, default: '' },`),u.push(`${r}style: { type: Object, default: () => ({}) },`),u.push("});")),u.push("</script>"),u.push(""),u.join(`
78
+ `)}var fD=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function jI(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Tu(t){return t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function mD(t){let e=t.shape;if(!fD.has(e.type)||t.smil.length>0)return!0;let n=e.state.metadata;return!!(n?.title||n?.description||e.type==="text"&&e.state.isTextPath||/\s(?:clip-path|mask)="url\(#/u.test(t.markup))}function Pu(t,e){let n=e.componentName??"createSvg",r=e.indent??" ",i=e.typescript??!1,o=sn(t,{width:e.width,height:e.height}),s=[];s.push("import * as d3 from 'd3';"),s.push(""),i?s.push(`export function ${n}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):s.push(`export function ${n}(container) {`),s.push(`${r}const svg = d3.select(container)`),s.push(`${r}${r}.append('svg')`),s.push(`${r}${r}.attr('xmlns', 'http://www.w3.org/2000/svg')`),s.push(`${r}${r}.attr('width', ${o.frame.width})`),s.push(`${r}${r}.attr('height', ${o.frame.height})`),s.push(`${r}${r}.attr('viewBox', '${o.frame.viewBox}');`),s.push("");let a=Et(o.defs);a.length>0&&(s.push(`${r}svg.append('defs').html(\`${Tu(a)}\`);`),s.push(""));let l=o.strippedDocumentCss;l.length>0&&(s.push(`${r}svg.append('style').text(\`${Tu(l)}\`);`),s.push(""));let c=0;for(let u of o.body){if(c++,u.kind==="clip-mask-run"){s.push(`${r}// group`);let m=u.open+u.members.map(h=>h.markup).join("")+u.close;s.push(`${r}svg.append('g').html(\`${Tu(m)}\`);`),s.push("");continue}let d=u.shape;if(s.push(`${r}// ${d.type}${d.state.metadata?.name?` \u2014 ${d.state.metadata.name}`:""}`),mD(u)){s.push(`${r}svg.append('g').html(\`${Tu(u.markup)}\`);`),s.push("");continue}let p=Gv(d),f=Qc(d),g=`shape${c}`;s.push(`${r}const ${g} = svg.append('${p}')`);for(let[m,h]of f)s.push(`${r}${r}.attr('${m}', '${jI(h)}')`);d.type==="text"&&d.state.text&&s.push(`${r}${r}.text('${jI(d.state.text)}')`),s[s.length-1]=s[s.length-1]+";",s.push("")}return s.push(`${r}return svg;`),s.push("}"),s.push(""),s.join(`
79
+ `)}function gD(t,e){let n=t.state.metadata?.name;return n?n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${t.type}-${e+1}`}var hD=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function UI(t,e){let n=t.indexOf(" ");return n===-1?t:t.slice(0,n)+` class="${e}"`+t.slice(n)}function Cu(t,e){let n=e.indent??" ",r=sn(t,{width:e.width,height:e.height}),i=0,o=new Map,s=[],a=f=>{o.set(f,gD(f.shape,i)),s.push(f),i++};for(let f of r.body)f.kind==="shape"?a(f):f.members.forEach(a);let l=[];for(let f of s){let g=Qc(f.shape),m=[];for(let[h,b]of g)hD.has(h)&&m.push(`${n}${h}: ${b};`);m.length>0&&l.push(`.${o.get(f)} {
80
+ ${m.join(`
18
81
  `)}
19
- }`)}let o=[];for(let l=0;l<i.length;l++){let c=i[l],f=Ll(c,l),d=de(c),p=d.indexOf(" ");p!==-1&&(d=d.slice(0,p)+` class="${f}"`+d.slice(p)),o.push(`${r}${d}`)}let a=[];a.push("<style>");for(let l of s)a.push(l);a.push("</style>"),a.push(""),a.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}">`);for(let l of o)a.push(l);return a.push("</svg>"),a.push(""),a.join(`
20
- `)}function fi(n,e){let t=gp(n,e),r={...e};switch(r.format){case"svg":return oi(t,r);case"react":return li(t,r);case"vue":return ui(t,r);case"d3":return ci(t,r);case"css":return di(t,r);default:throw new Error(`Unsupported code format: ${r.format}`)}}function gp(n,e){return Array.isArray(n)?{shapes:n,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:n}var wn=class n{_snapshot;constructor(e={}){let{width:t=800,height:r=600,viewboxId:i}=e,s=fn(0,0,t,r,i);this._snapshot=lr({viewboxes:[s]})}static fromSnapshot(e){let t=new n;return t._snapshot=JSON.parse(JSON.stringify(e)),t}static fromJSON(e,t){let r=cr(e,t),i=new n;return i._snapshot=r,i}add(e){let t="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(t),this}addAll(...e){for(let t of e)this.add(t);return this}remove(e){let t=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(r=>r.id!==e),this._snapshot.shapes.length<t}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(t=>t.id===e)}size(e,t){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=t):this._snapshot.viewboxes=[fn(0,0,e,t)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,t){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,t!==void 0&&(this._snapshot.documentMetadata.licenseUrl=t),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,t,r){let i=_(),s=t.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"symbol",id:i,name:e,viewBox:r?.viewBox??"0 0 100 100",shapes:s};return r?.groups&&(o.groups=r.groups),r?.thumbnail&&(o.thumbnail=r.thumbnail),r?.defKind&&(o.defKind=r.defKind),r?.wrapperAttrs&&(o.wrapperAttrs=r.wrapperAttrs),r?.variantAxes&&(o.variantAxes=r.variantAxes),r?.variants&&(o.variants=r.variants),r?.variantThumbnails&&(o.variantThumbnails=r.variantThumbnails),this._pushLibraryDef(o),i}placeSymbolInstance(e,t,r,i,s){let o,a={};typeof i=="number"||i===void 0?o=i:(a=i,o=a.width,s=a.height??s);let l={symbolId:e,x:t,y:r,width:o??100,height:s??100};a.variantKey&&(l.variantKey=a.variantKey),a.symbolOverrides&&(l.symbolOverrides=a.symbolOverrides),a.instancePresentation&&(l.instancePresentation=a.instancePresentation);let c={id:_(),type:"symbol-instance",state:l};return this._snapshot.shapes.push(c),this}removeSymbol(e){if(!this._snapshot.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>!(r.kind==="symbol"&&r.id===e)),this._snapshot.library.length<t}get symbols(){return(this._snapshot.library??[]).filter(e=>e.kind==="symbol")}defineMarker(e,t,r){let i=_(),s=t.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"marker",id:i,name:e,viewBox:r?.viewBox??"0 0 10 10",refX:r?.refX??5,refY:r?.refY??5,markerWidth:r?.markerWidth??10,markerHeight:r?.markerHeight??10,markerUnits:r?.markerUnits??"strokeWidth",orient:r?.orient??"auto",shapes:s};return r?.groups&&(o.groups=r.groups),r?.thumbnail&&(o.thumbnail=r.thumbnail),this._pushLibraryDef(o),i}defineFilter(e,t,r){let i=_(),s={kind:"filter",id:i,name:e,filters:t};return r?.colorInterpolation&&(s.colorInterpolation=r.colorInterpolation),r?.filterUnits&&(s.filterUnits=r.filterUnits),r?.primitiveUnits&&(s.primitiveUnits=r.primitiveUnits),r?.x!==void 0&&(s.x=r.x),r?.y!==void 0&&(s.y=r.y),r?.width!==void 0&&(s.width=r.width),r?.height!==void 0&&(s.height=r.height),r?.thumbnail&&(s.thumbnail=r.thumbnail),this._pushLibraryDef(s),i}defineLinearGradientLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,...l}=s,c={kind:"linear-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,...l}=s,c={kind:"radial-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,customPatternId:l,...c}=s,f={kind:"pattern",id:i,name:e,pattern:c};return r?.thumbnail&&(f.thumbnail=r.thumbnail),this._pushLibraryDef(f),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>r.id!==e),this._snapshot.library.length<t}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let t=this._snapshot.library.findIndex(r=>r.id===e.id);t>=0?this._snapshot.library[t]=e:this._snapshot.library.push(e)}addClipGroup(e,t,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"clip",clipShapeIds:e,contentShapeIds:t,parentId:null};return r?.clipPathUnits&&(s.clipPathUnits=r.clipPathUnits),r?.clipRule&&(s.clipRule=r.clipRule),r?.rawDefinition&&(s.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}addMaskGroup(e,t,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"mask",clipShapeIds:e,contentShapeIds:t,parentId:null};return r?.maskUnits&&(s.maskUnits=r.maskUnits),r?.maskContentUnits&&(s.maskContentUnits=r.maskContentUnits),r?.maskBounds&&(s.maskBounds=r.maskBounds),r?.maskType&&(s.maskType=r.maskType),r?.rawDefinition&&(s.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let t=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(r=>r.id!==e),this._snapshot.clipMaskGroups.length<t}addGuide(e,t,r){this._snapshot.guides||(this._snapshot.guides=[]);let i=_(),s={id:i,orientation:e,position:t,controlPointOffset:0};return r?.color&&(s.color=r.color),r?.opacity!==void 0&&(s.opacity=r.opacity),this._snapshot.guides.push(s),i}removeGuide(e){if(!this._snapshot.guides)return!1;let t=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(r=>r.id!==e),this._snapshot.guides.length<t}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,t,r){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=_(),s={id:i,type:e,points:t,visible:r?.visible??!0,snapDivisions:r?.snapDivisions??1};return r?.color&&(s.color=r.color),r?.opacity!==void 0&&(s.opacity=r.opacity),this._snapshot.measurements.push(s),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let t=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(r=>r.id!==e),this._snapshot.measurements.length<t}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,t,r,i){let s=_();return this._pushLibraryDef(Ue({id:s,name:e,svgContent:t,width:r,height:i})),s}removeCustomPattern(e){let t=this._snapshot.library;if(!t)return!1;let r=t.length;return this._snapshot.library=t.filter(i=>!(i.kind==="pattern"&&i.id===e)),this._snapshot.library.length<r}get customPatterns(){let e=[];for(let t of this._snapshot.library??[]){if(t.kind!=="pattern")continue;let r=kt(t);r&&e.push(r)}return e}addGroup(e,t){this._snapshot.groups||(this._snapshot.groups=[]);let r=e??_();return this._snapshot.groups.push({id:r,parentId:t??null}),r}removeGroup(e){if(!this._snapshot.groups)return!1;let t=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(r=>r.id!==e);for(let r of this._snapshot.shapes)r.state.groupId===e&&delete r.state.groupId;return this._snapshot.groups.length<t}moveToGroup(e,t){let r=this._snapshot.shapes.find(i=>i.id===e);return r&&(r.state.groupId=t),this}removeFromGroup(e){let t=this._snapshot.shapes.find(r=>r.id===e);return t&&delete t.state.groupId,this}bringToFront(e){let t=this._snapshot.shapes.findIndex(r=>r.id===e);if(t>=0){let[r]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.push(r)}return this}sendToBack(e){let t=this._snapshot.shapes.findIndex(r=>r.id===e);if(t>=0){let[r]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.unshift(r)}return this}reorder(e,t){let r=this._snapshot.shapes.findIndex(i=>i.id===e);if(r>=0){let[i]=this._snapshot.shapes.splice(r,1),s=Math.max(0,Math.min(t,this._snapshot.shapes.length));this._snapshot.shapes.splice(s,0,i)}return this}defineVariable(e,t,r,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let s=this._snapshot.templateVariables.find(o=>o.name===e);if(s)s.type=t,s.defaultValue=r,i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description);else{let o={name:e,type:t,defaultValue:r};i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description),this._snapshot.templateVariables.push(o)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(t=>t.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return hr(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:t,...r}=e??{},i=mr(this._snapshot,t);return Et(i,r)}toJSON(e){return ur(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,t){return fi(this._snapshot,{...t,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var pi=class{_track;constructor(e,t){this._track={id:_(),shapeId:e,property:t,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,t,r="linear"){return this._track.keyframes.push({id:_(),time:e,value:t,easing:r}),this}keyframeBezier(e,t,r){return this._track.keyframes.push({id:_(),time:e,value:t,easing:"custom-bezier",customBezier:r}),this}keyframeLinear(e,t,r){return this._track.keyframes.push({id:_(),time:e,value:t,easing:"linear-function",linearPoints:r}),this}keyframes(...e){return this._track.keyframes.push(...e.map(t=>t.id?t:{...t,id:_()})),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(e){return this._track.motionPath=e,this}motionPathRef(e,t="trackShape"){return this._track.motionPathRef={shapeId:e,mode:t},this}beginTrigger(e,t){return this._track.beginTrigger={type:e,value:t},this}endTrigger(e,t){return this._track.endTrigger={type:e,value:t},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,t){return this._track.transformOrigin={x:e,y:t},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((t,r)=>t.time-r.time);return{...this._track,keyframes:e}}},mi=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(e){this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(t=>({id:t.id,shapeId:t.shapeId,property:t.property,enabled:t.enabled,locked:t.locked||void 0,motionPath:t.motionPath,motionPathRef:t.motionPathRef,beginTrigger:t.beginTrigger,endTrigger:t.endTrigger,cycleDuration:t.cycleDuration,cycleRepeats:t.cycleRepeats,cycleInfinite:t.cycleInfinite,cycleBehavior:t.cycleBehavior,transformOrigin:t.transformOrigin,motionRotate:t.motionRotate,additive:t.additive,keyframes:t.keyframes.map(r=>({...r.id?{id:r.id}:{},time:r.time,value:r.value,easing:r.easing,...r.customBezier?{customBezier:r.customBezier}:{},...r.linearPoints?{linearPoints:r.linearPoints}:{}}))}))}}};var ae=class{_id;_type;_state={};constructor(e,t){this._type=e,this._id=t??_()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}displayMode(e){return this._state.displayMode=e,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(e,t){return this._state.fillColor=e,this._state.fillType="solid",t!==void 0&&(this._state.fillOpacity=t),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let t="build"in e?e.build():e;return this._state.fillType=t.type,this._state.fillGradient=t,this}fillPattern(e){let t="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=t,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,t){return this._state.borderColor=e,t!==void 0&&(this._state.borderWidth=t),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let t="build"in e?e.build():e;return this._state.strokeType=t.type,this._state.strokeGradient=t,this}strokePattern(e){let t="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=t,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,t,r){return this._state.lineStyle=e,e==="custom"&&(t!==void 0&&(this._state.dashLength=t),r!==void 0&&(this._state.gapLength=r)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this.refreshTransformMatrix(),this}skew(e,t){return this._state.skewX=e,this._state.skewY=t,this.refreshTransformMatrix(),this}scale(e,t){return this._state.scaleX=e,this._state.scaleY=t??e,this.refreshTransformMatrix(),this}pivot(e,t){return this._state.customPivot={x:e,y:t},this.refreshTransformMatrix(),this}transformMatrix(e){if(e.length<6||!e.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=e.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=Ye(ln(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let e=this._state.customPivot;if(e)return e;let t=this._state.x,r=this._state.y,i=this._state.width,s=this._state.height;if(t!==void 0&&r!==void 0&&i!==void 0&&s!==void 0)return{x:t+i/2,y:r+s/2};let o=this._state.radius;if(t!==void 0&&r!==void 0&&o!==void 0)return{x:t,y:r};let a=this._state.cx,l=this._state.cy;if(a!==void 0&&l!==void 0)return{x:a,y:l};let c=this._state.x1,f=this._state.y1,d=this._state.x2,p=this._state.y2;if(c!==void 0&&f!==void 0&&d!==void 0&&p!==void 0)return{x:(c+d)/2,y:(f+p)/2};let m=this._state.pathPoints;if(m?.[0])return{x:m[0].x,y:m[0].y};let h=this._state.polylinePoints;if(h?.[0])return h[0]}filter(...e){let t=this._state.filters??[];return this._state.filters=[...t,...e],this}dropShadow(e={}){let t={id:`drop-shadow-${_()}`,type:"drop-shadow",enabled:!0,offsetX:e.offsetX??4,offsetY:e.offsetY??4,blurRadius:e.blurRadius??8,spread:e.spread??0,color:e.color??"#000000",opacity:e.opacity??.3};return this.filter(t)}innerShadow(e={}){let t={id:`inner-shadow-${_()}`,type:"inner-shadow",enabled:!0,offsetX:e.offsetX??2,offsetY:e.offsetY??2,blurRadius:e.blurRadius??4,choke:e.choke??0,color:e.color??"#000000",opacity:e.opacity??.5};return this.filter(t)}blur(e,t,r){let i=e??4,s=t??i,o={id:`gaussian-blur-${_()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:s,linked:i===s,quality:r?.quality??"normal"};return this.filter(o)}glow(e={}){let t={id:`glow-${_()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}innerGlow(e={}){let t={id:`inner-glow-${_()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}grayscale(e=1){let t={id:`grayscale-${_()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(t)}sepia(e=1){let t={id:`sepia-${_()}`,type:"sepia",enabled:!0,amount:e};return this.filter(t)}outline(e={}){return this.filter({id:`outline-${_()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let t={id:`motion-blur-${_()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(t)}pointLight(e={}){let t={id:`point-light-${_()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}spotLight(e={}){let t={id:`spot-light-${_()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}sharpen(e=1){let t={id:`sharpen-${_()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(t)}pixelate(e=8){let t={id:`pixelate-${_()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(t)}warp(e={}){let t={id:`warp-${_()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(t)}morphology(e={}){let t=e.radiusX??2,r=e.radiusY??t,i={id:`morphology-${_()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:t,radiusY:r,linked:e.linked??t===r};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${_()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let r={id:`contouring-discrete-${_()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(r)}roundEdges(e=4){let t={id:`round-edges-${_()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(t)}channelPainter(e={}){let t={id:`channel-painter-${_()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(t)}brightness(e=1){let t={id:`brightness-${_()}`,type:"brightness",enabled:!0,amount:e};return this.filter(t)}contrast(e=1){let t={id:`contrast-${_()}`,type:"contrast",enabled:!0,amount:e};return this.filter(t)}filterOpacity(e=1){let t={id:`opacity-${_()}`,type:"opacity",enabled:!0,amount:e};return this.filter(t)}invert(e=1){let t={id:`invert-${_()}`,type:"invert",enabled:!0,amount:e};return this.filter(t)}hueRotate(e=0){let t={id:`hue-rotate-${_()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(t)}saturate(e=1){let t={id:`saturate-${_()}`,type:"saturate",enabled:!0,amount:e};return this.filter(t)}blackAndWhite(e=.5){let t={id:`black-and-white-${_()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(t)}duotone(e={}){let t={id:`duotone-${_()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(t)}xray(e=1){let t={id:`xray-${_()}`,type:"xray",enabled:!0,intensity:e};return this.filter(t)}noise(e={}){let t={id:`noise-${_()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(t)}emboss(e={}){let t={id:`emboss-${_()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(t)}filmGrain(e={}){let t={id:`film-grain-${_()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(t)}watercolor(e={}){let t={id:`watercolor-${_()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(t)}gouache(e={}){let t={id:`gouache-${_()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(t)}inkBlot(e={}){let t={id:`ink-blot-${_()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(t)}crumpledPlastic(e={}){let t={id:`crumpled-plastic-${_()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(t)}riddled(e={}){let t={id:`riddled-${_()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(t)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}vectorEffect(e){return this._state.vectorEffect=e,this}transformBox(e){return this._state.transformBox=e,this}paintOrder(e){return this._state.paintOrder=e,this}blendMode(e){return this._state.blendMode=e,this}visibility(e){return this._state.visibility=e,this}shapeRendering(e){return this._state.shapeRendering=e,this}filterColorInterpolation(e){return this._state.filterColorInterpolation=e,this}inheritFill(e=!0){return this._state.inheritFill=e,this}inheritStroke(e=!0){return this._state.inheritStroke=e,this}systemLanguage(e){return this._state.systemLanguage=e,this}requiredExtensions(e){return this._state.requiredExtensions=e,this}fillLibrary(e,t="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=t,this}strokeLibrary(e,t="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=t,this}filterLibrary(...e){let t=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...t,...e],this}markerStartRef(e){return this._state.markerStart=e,this}markerMidRef(e){return this._state.markerMid=e,this}markerEndRef(e){return this._state.markerEnd=e,this}bind(e,t){let r=this._state.bindings??{};return this._state.bindings={...r,[e]:t},this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},hi=class extends ae{constructor(e,t,r){if(r<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=t,this._state.radius=r}position(e,t){return this._state.x=e,this._state.y=t,this}radius(e){return this._state.radius=e,this}},gi=class extends ae{constructor(e,t,r,i){if(r<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=t,this._state.rx=r,this._state.ry=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radii(e,t){return this._state.rx=e,this._state.ry=t,this}},yi=class extends ae{constructor(e,t,r,i){if(r<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=i}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},bi=class extends ae{constructor(e,t,r){if(r<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=r}position(e,t){return this._state.x=e,this._state.y=t,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},Si=class extends ae{constructor(e,t,r,i){super("line"),this._state.x1=e,this._state.y1=t,this._state.x2=r,this._state.y2=i}from(e,t){return this._state.x1=e,this._state.y1=t,this}to(e,t){return this._state.x2=e,this._state.y2=t,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},xi=class extends ae{constructor(e,t,r){super("text"),this._state.x=e,this._state.y=t,this._state.text=r}position(e,t){return this._state.x=e,this._state.y=t,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}fontVariant(e){return this._state.fontVariant=e,this}fontVariantLigatures(e){return this._state.fontVariantLigatures=e,this}fontVariantPosition(e){return this._state.fontVariantPosition=e,this}fontVariantCaps(e){return this._state.fontVariantCaps=e,this}fontVariantNumeric(e){return this._state.fontVariantNumeric=e,this}fontVariantEastAsian(e){return this._state.fontVariantEastAsian=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,t=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=t,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){let t=at(e);return this._state.richTextRuns=t,this._state.richTextData=Ve(t),this}richTextRuns(e){let t=st(e);return this._state.richTextRuns=t,this._state.richTextData=Ve(t),this}useRichText(e=!0){return this._state.useRichText=e,this}linePositions(e){return this._state.linePositions=e,this}textLength(e){return this._state.textLength=e,this}lengthAdjust(e){return this._state.lengthAdjust=e,this}},Se=class extends ae{constructor(e,t,r,i){super(e),this._state.cx=t,this._state.cy=r,this._state.radius=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},$i=class extends Se{constructor(e,t,r){super("triangle",e,t,r)}},vi=class extends Se{constructor(e,t,r,i=5){super("ngon",e,t,r),this._state.sides=i}sides(e){return this._state.sides=e,this}},ki=class extends Se{constructor(e,t,r){super("star",e,t,r),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Ti=class extends Se{constructor(e,t,r){super("cross",e,t,r),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},wi=class extends Se{constructor(e,t,r){super("ring",e,t,r),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Pi=class extends Se{constructor(e,t,r){super("spiral",e,t,r),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(e){return this._state.turns=e,this}thickness(e){return this._state.thicknessPercent=e,this}direction(e){return this._state.spiralDirection=e,this}},_i=class extends Se{constructor(e,t,r){super("gear",e,t,r),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(e){return this._state.teeth=e,this}toothDepth(e){return this._state.toothDepthPercent=e,this}holeRadius(e){return this._state.holeRadiusPercent=e,this}},Ri=class extends Se{constructor(e,t,r){super("arrow",e,t,r),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(e){return this._state.headWidthPercent=e,this}headLength(e){return this._state.headLengthPercent=e,this}shaftWidth(e){return this._state.shaftWidthPercent=e,this}},Ai=class extends Se{constructor(e,t,r){super("heart",e,t,r),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(e){return this._state.lobeRadiusPercent=e,this}cleftDepth(e){return this._state.cleftDepthPercent=e,this}},Ii=class extends Se{constructor(e,t,r){super("lightning",e,t,r),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(e){return this._state.boltSegments=e,this}jaggedness(e){return this._state.boltJaggednessPercent=e,this}thickness(e){return this._state.boltWidthPercent=e,this}},Mi=class extends Se{constructor(e,t,r){super("cloud",e,t,r),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(e){return this._state.cloudBumps=e,this}puffiness(e){return this._state.cloudPuffinessPercent=e,this}},Ci=class extends Se{constructor(e,t,r){super("speechBubble",e,t,r),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(e){return this._state.tailAngleDeg=e,this}tailLength(e){return this._state.tailLengthPercent=e,this}tailWidth(e){return this._state.tailWidthPercent=e,this}},tt=class extends ae{add(e){let t="build"in e&&typeof e.build=="function"?e.build():e,r=this._state.children??[];return this._state.children=[...r,t],this}addAll(...e){for(let t of e)this.add(t);return this}children(e){return this._state.children=e.map(t=>"build"in t&&typeof t.build=="function"?t.build():t),this}},Di=class extends tt{constructor(e){super("hyperlink"),e!==void 0&&(this._state.href=e)}href(e){return this._state.href=e,this}hrefXlink(e){return this._state.hrefXlink=e,this}target(e){return this._state.linkTarget=e,this}download(e){return this._state.linkDownload=e,this}rel(e){return this._state.linkRel=e,this}ping(e){return this._state.linkPing=e,this}hreflang(e){return this._state.linkHreflang=e,this}type(e){return this._state.linkType=e,this}referrerPolicy(e){return this._state.linkReferrerPolicy=e,this}},Fi=class extends tt{constructor(){super("switch")}},Ei=class extends tt{constructor(){super("container")}},Oi=class extends ae{constructor(e){super("view"),e&&(this._state.viewBoxX=e.x,this._state.viewBoxY=e.y,this._state.viewBoxWidth=e.width,this._state.viewBoxHeight=e.height)}viewBox(e,t,r,i){return this._state.viewBoxX=e,this._state.viewBoxY=t,this._state.viewBoxWidth=r,this._state.viewBoxHeight=i,this}name(e){return this._state.viewName=e,this}preserveAspectRatio(e){return this._state.viewPreserveAspectRatio=e,this}zoomAndPan(e){return this._state.viewZoomAndPan=e,this}viewTarget(e){return this._state.viewTarget=e,this}asHome(e=!0){return this}},Li=class extends tt{constructor(e=0,t=0,r=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=t,this._state.svgWidth=r,this._state.svgHeight=i}position(e,t){return this._state.svgX=e,this._state.svgY=t,this}size(e,t){return this._state.svgWidth=e,this._state.svgHeight=t,this}viewBox(e,t,r,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=t,this._state.svgViewBoxWidth=r,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(e){return this._state.svgPreserveAspectRatio=e,this}asRoot(e=!0){return this._state.isRootSvg=e,this}},Ni=class extends ae{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,t){return this._state.offsetX=e,this._state.offsetY=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}},Bi=class extends ae{position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}mimeType(e){return this._state.mediaMimeType=e,this}naturalDuration(e){return this._state.naturalDuration=e,this}begin(e){return this._state.begin=e,this}trim(e,t){return this._state.trimStart=e,this._state.trimEnd=t,this}volume(e){return this._state.volume=e,this}muted(e=!0){return this._state.muted=e,this}loop(e=!0){return this._state.loop=e,this}playbackRate(e){return this._state.playbackRate=e,this}fade(e,t){return this._state.fadeInDuration=e,this._state.fadeOutDuration=t,this}language(e){return this._state.systemLanguage=e,this}},zi=class extends Bi{constructor(e){super("video"),this._state.mediaKind="video",e!==void 0&&(this._state.href=e)}poster(e){return this._state.posterHref=e,this}sourceRect(e){return this._state.sourceRect=e,this}},Gi=class extends Bi{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},Vi=class extends ae{constructor(e=[]){super("path"),this._state.pathPoints=[...e],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(e){return this._state.pathPoints=[...e],this}addPoint(e,t){let r=this._state.pathPoints??[];return r.push({x:e,y:t}),this._state.pathPoints=r,this}curveType(e){return this._state.pathCurveType=e,this}closed(e=!0){return this._state.pathClosed=e,this}tension(e){return this._state.pathTension=e,this}arcParams(e){return this._state.pathArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}toD(){let e=this._state.pathPoints??[],t=this._state.pathCurveType??"CUBIC",r=this._state.pathClosed??!1,i=this._state.pathTension??.5,s=this._state.pathArcParams;return qe(e,t,r,i,s)}},Ui=class extends ae{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,t){let r=this._state.polylinePoints??[];return r.push({x:e,y:t}),this._state.polylinePoints=r,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},Wi=class extends ae{constructor(e,t,r,i,s){super("image"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=i,this._state.href=s}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var Pn=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,t=0,r=1,i=0){this._x1=e,this._y1=t,this._x2=r,this._y2=i,this._id=_()}stop(e,t,r=1){return this._stops.push({offset:e,color:t,opacity:r}),this}direction(e,t,r,i){return this._x1=e,this._y1=t,this._x2=r,this._y2=i,this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},_n=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=_()}center(e,t){return this._cx=e,this._cy=t,this}focus(e,t){return this._fx=e,this._fy=t,this}radius(e,t){return this._r=e,this._ry=t??e,this}rotation(e){return this._rotation=e,this}stop(e,t,r=1){return this._stops.push({offset:e,color:t,opacity:r}),this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Rn=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(e="stripes",t="#000000",r="#ffffff"){this._patternType=e,this._color=t,this._backgroundColor=r,this._id=_()}scale(e){return this._scale=e,this}rotation(e){return this._rotation=e,this}opacity(e){return this._opacity=e,this}params(e){return this._patternParams=e,this}svgContent(e){return this._svgContent=e,this}size(e,t){return this._width=e,this._height=t,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,t){return this._x=e,this._y=t,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,t,r;if(this._svgContent!==void 0)e=this._svgContent,t=this._width??10,r=this._height??10;else{let s=Or(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=s.svgContent,t=this._width??s.width,r=this._height??s.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:e,width:t,height:r,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function Nl(n=0,e=0,t=1,r=0){return new Pn(n,e,t,r)}function Bl(){return new _n}function zl(n="stripes",e="#000000",t="#ffffff"){return new Rn(n,e,t)}var ya={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},yp=.04,bp=0;function Sp(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function F(n){return Number(n.toFixed(3)).toString()}function xp(n,e,t,r,i,s,o,a,l,c,f,d){return[[0,0],[.2,a],[.5+l+f,-s+c],[.5-s+l,s+c],[.5-2*s+l-f,3*s+c],[.5+2*s+l-f,3*s+c],[.5+s+l,s+c],[.5+l+f,-s+c],[.8,d],[1,0]].map(([m,h])=>{let g=e+m*r,b=t+h*i*o;return n?{x:g,y:b}:{x:b,y:g}})}function Gl(n,e,t,r,i,s,o,a,l,c,f){let d=[],p=(v,w)=>l==="alternating"?0:v+c()*(w-v),m=()=>c()<.5,h=p(-a,a),g=l==="alternating"?f%2===0:m(),b=null,$=h,k=p(-a,a),S=p(-a,a),x=p(-a,a);h=p(-a,a);for(let v=0;v<n;v++){v>0&&(b=g,g=l==="alternating"?(f+v)%2===0:m(),$=g===b?-h:h,k=p(-a,a),S=p(-a,a),x=p(-a,a),h=p(-a,a));let w=g?-1:1,T=t+v*i;d.push(xp(e,T,r,i,s,o,w,$,k,S,x,h))}return d}function Vl(n,e,t,r,i,s,o){let a=2*s;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([c,f])=>{let d=e+c*r,p=t+f*i*o;return n?{x:d,y:p}:{x:p,y:d}})}function Ul(n,e){return n+` C ${F(e[1].x)} ${F(e[1].y)} ${F(e[2].x)} ${F(e[2].y)} ${F(e[3].x)} ${F(e[3].y)} C ${F(e[4].x)} ${F(e[4].y)} ${F(e[5].x)} ${F(e[5].y)} ${F(e[6].x)} ${F(e[6].y)} C ${F(e[7].x)} ${F(e[7].y)} ${F(e[8].x)} ${F(e[8].y)} ${F(e[9].x)} ${F(e[9].y)}`}function Wl(n,e){return n+` C ${F(e[8].x)} ${F(e[8].y)} ${F(e[7].x)} ${F(e[7].y)} ${F(e[6].x)} ${F(e[6].y)} C ${F(e[5].x)} ${F(e[5].y)} ${F(e[4].x)} ${F(e[4].y)} ${F(e[3].x)} ${F(e[3].y)} C ${F(e[2].x)} ${F(e[2].y)} ${F(e[1].x)} ${F(e[1].y)} ${F(e[0].x)} ${F(e[0].y)}`}function Hl(n,e={}){let t={...ya,...e};if(t.rows<1||t.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(n.width)||!Number.isFinite(n.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(n.width<=0||n.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:r,cols:i,style:s,tabDepthPercent:o,tabPattern:a,seed:l}=t,c=Sp(l),f=n.width/i,d=n.height/r,p=Math.max(0,Math.min(.4,o/200)),m=(s==="classic"||s==="curved")&&p>0,h=s==="square-tabs"&&p>0,g=s==="classic"&&a==="random"?yp:bp,b=[];for(let S=0;S<r-1;S++){let x=n.y+(S+1)*d;if(m)b.push(Gl(i,!0,n.x,x,f,d,p,g,a,c,S));else if(h){let v=[];for(let w=0;w<i;w++){let T=a==="alternating"?(S+w)%2===0?1:-1:c()<.5?1:-1;v.push(Vl(!0,n.x+w*f,x,f,d,p,T))}b.push(v)}else b.push(new Array(i).fill(null))}let $=[];for(let S=0;S<i-1;S++){let x=n.x+(S+1)*f;if(m)$.push(Gl(r,!1,n.y,x,d,f,p,g,a,c,S));else if(h){let v=[];for(let w=0;w<r;w++){let T=a==="alternating"?(w+S)%2===0?1:-1:c()<.5?1:-1;v.push(Vl(!1,n.y+w*d,x,d,f,p,T))}$.push(v)}else $.push(new Array(r).fill(null))}let k=[];for(let S=0;S<r;S++)for(let x=0;x<i;x++){let v=n.x+x*f,w=n.y+S*d,T=v+f,P=w+d,R=`M ${F(v)} ${F(w)}`;if(S===0)R+=` L ${F(T)} ${F(w)}`;else{let M=b[S-1][x];M?R=Ul(R,M):R+=` L ${F(T)} ${F(w)}`}if(x===i-1)R+=` L ${F(T)} ${F(P)}`;else{let M=$[x][S];M?R=Ul(R,M):R+=` L ${F(T)} ${F(P)}`}if(S===r-1)R+=` L ${F(v)} ${F(P)}`;else{let M=b[S][x];M?R=Wl(R,M):R+=` L ${F(v)} ${F(P)}`}if(x===0)R+=` L ${F(v)} ${F(w)}`;else{let M=$[x-1][S];M?R=Wl(R,M):R+=` L ${F(v)} ${F(w)}`}R+=" Z",k.push({id:`puzzle-${l}-r${S}-c${x}`,row:S,col:x,d:R})}return k}var Xl=[1,2,3,4,5,6,7,8,9],$p={easy:{minGivens:40,maxGivens:45,maxRating:"singles"},medium:{minGivens:34,maxGivens:39,maxRating:"hidden-singles"},hard:{minGivens:28,maxGivens:33,maxRating:"search"},expert:{minGivens:24,maxGivens:27,maxRating:"search"}};function An(n){return n.map(e=>[...e])}function vp(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function Yl(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function ql(n,e){let t=[...n];for(let r=t.length-1;r>0;r--){let i=Math.floor(e()*(r+1));[t[r],t[i]]=[t[i],t[r]]}return t}function Lt(n){return 1<<n-1}function Zl(n){let e=0,t=n;for(;t;)t&=t-1,e++;return e}function kp(n){for(let e=1;e<=9;e++)if(n===Lt(e))return e;return 0}function Sa(n,e){return Math.floor(n/3)*3+Math.floor(e/3)}function ba(n){let e=0;for(let t of n)for(let r of t)r!==0&&e++;return e}function Tp(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e===0?1:e}function Jl(n,e){if(!Array.isArray(n)||n.length!==9)return e.push("Grid must contain 9 rows."),!1;let t=!0;for(let r=0;r<9;r++){if(!Array.isArray(n[r])||n[r].length!==9){e.push(`Row ${r+1} must contain 9 cells.`),t=!1;continue}for(let i=0;i<9;i++){let s=n[r][i];(!Number.isInteger(s)||s<0||s>9)&&(e.push(`Cell R${r+1}C${i+1} must be a digit from 0 to 9.`),t=!1)}}return t}function Ql(n,e){let t=!0,r=(i,s)=>{let o=0;for(let a of s){if(a===0)continue;let l=Lt(a);if(o&l){e.push(`${i} contains duplicate ${a}.`),t=!1;return}o|=l}};for(let i=0;i<9;i++)r(`Row ${i+1}`,n[i]);for(let i=0;i<9;i++)r(`Column ${i+1}`,n.map(s=>s[i]));for(let i=0;i<9;i+=3)for(let s=0;s<9;s+=3){let o=[];for(let a=i;a<i+3;a++)for(let l=s;l<s+3;l++)o.push(n[a][l]);r(`Box ${Math.floor(i/3)*3+Math.floor(s/3)+1}`,o)}return t}function xa(n){let e=Array.from({length:9},()=>0),t=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let s=0;s<9;s++){let o=n[i][s];if(o===0)continue;let a=Lt(o),l=Sa(i,s);if(e[i]&a||t[s]&a||r[l]&a)return null;e[i]|=a,t[s]|=a,r[l]|=a}return{rows:e,cols:t,boxes:r}}function $a(n,e,t,r,i){return 511&~(t[n]|r[e]|i[Sa(n,e)])}function eu(n,e,t){let r=xa(n);if(!r)return[];let i=An(n),s=[],{rows:o,cols:a,boxes:l}=r,c=()=>{if(s.length>=e)return;let f=-1,d=-1,p=0,m=10;for(let g=0;g<9;g++){for(let b=0;b<9;b++){if(i[g][b]!==0)continue;let $=$a(g,b,o,a,l),k=Zl($);if(k===0)return;if(k<m&&(f=g,d=b,p=$,m=k,k===1))break}if(m===1)break}if(f===-1){s.push(An(i));return}let h=Xl.filter(g=>p&Lt(g));t&&(h=ql(h,t));for(let g of h){let b=Lt(g),$=Sa(f,d);if(i[f][d]=g,o[f]|=b,a[d]|=b,l[$]|=b,c(),l[$]&=~b,a[d]&=~b,o[f]&=~b,i[f][d]=0,s.length>=e)return}};return c(),s}function wp(n){let e=vp(),t=Yl(n),[r]=eu(e,1,t);if(!r)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return r}function Pp(n){let e=xa(n);if(!e)return null;for(let t=0;t<9;t++)for(let r=0;r<9;r++){if(n[t][r]!==0)continue;let i=$a(t,r,e.rows,e.cols,e.boxes);if(Zl(i)===1)return{row:t,col:r,value:kp(i)}}return null}function _p(n){let e=xa(n);if(!e)return null;let t=r=>{for(let i of Xl){let s=Lt(i),o=null;for(let a of r)if(!(n[a.row][a.col]!==0||!($a(a.row,a.col,e.rows,e.cols,e.boxes)&s))){if(o){o=null;break}o=a}if(o)return{...o,value:i}}return null};for(let r=0;r<9;r++){let i=t(Array.from({length:9},(s,o)=>({row:r,col:o})));if(i)return i}for(let r=0;r<9;r++){let i=t(Array.from({length:9},(s,o)=>({row:o,col:r})));if(i)return i}for(let r=0;r<9;r+=3)for(let i=0;i<9;i+=3){let s=[];for(let a=r;a<r+3;a++)for(let l=i;l<i+3;l++)s.push({row:a,col:l});let o=t(s);if(o)return o}return null}function jl(n){let e=An(n),t=!1;for(;ba(e)<81;){let r=Pp(e);if(r){e[r.row][r.col]=r.value;continue}let i=_p(e);if(i){t=!0,e[i.row][i.col]=i.value;continue}return"search"}return t?"hidden-singles":"singles"}function Kl(n,e){let t={singles:0,"hidden-singles":1,search:2};return t[n]<=t[e]}function In(n,e={}){let t=[];return Jl(n,t)?Ql(n,t)?eu(n,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function tu(n){let e=[];if(!Jl(n,e))return{valid:!1,unique:!1,solution:null,errors:e};if(Ql(n,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let r=In(n,{maxSolutions:2});return r.length===0?e.push("Puzzle has no solution."):r.length>1&&e.push("Puzzle has more than one solution."),{valid:e.length===0,unique:r.length===1,solution:r[0]?An(r[0]):null,errors:e}}function nu(n){let e=n.difficulty,t=$p[e];if(!t)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let r=Tp(n.seed);for(let i=0;i<30;i++){let s=r+i*104729>>>0,o=Yl(s),a=wp(s),l=An(a),c=t.minGivens+Math.floor(o()*(t.maxGivens-t.minGivens+1)),f=ql(Array.from({length:81},(h,g)=>({row:Math.floor(g/9),col:g%9})),o);for(let h of f){if(ba(l)<=c)break;let g=l[h.row][h.col];if(l[h.row][h.col]=0,In(l,{maxSolutions:2}).length!==1){l[h.row][h.col]=g;continue}let $=jl(l);Kl($,t.maxRating)||(l[h.row][h.col]=g)}let d=ba(l),p=jl(l);if(In(l,{maxSolutions:2}).length===1&&d>=t.minGivens&&d<=t.maxGivens&&Kl(p,t.maxRating))return{puzzle:l,solution:a,difficulty:e,seed:r,givens:d,rating:p}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}var ru="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Rp={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function su(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e===0?1:e}function au(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function Nt(n){let e=globalThis.Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(n),t=>t.segment.normalize("NFC")):Array.from(n.normalize("NFC"))}function Ap(n,e,t,r){return n>=0&&e>=0&&n<r&&e<t}function va(n,e){return Array.from({length:e},()=>Array.from({length:n},()=>!0))}function ou(n,e,t,r){if(!t)return va(n,e);if(!Array.isArray(t)||t.length!==e)return r.push(`Mask must contain exactly ${e} rows.`),va(n,e);let i=[];for(let s=0;s<e;s++){if(!Array.isArray(t[s])||t[s].length!==n)return r.push(`Mask row ${s+1} must contain exactly ${n} cells.`),va(n,e);i.push(t[s].map(Boolean))}return i}function Ip(n){let e=0;for(let t of n)for(let r of t)r&&e++;return e}function Mp(n){return n.trim().normalize("NFC")}function lu(n){return n.replace(/\r/g,"").split(/[,\n]+/).map(e=>e.trim()).filter(e=>e.length>0)}function ka(n,e){let t=[];return n.across&&(t.push("E"),e&&t.push("W")),n.down&&(t.push("S"),e&&t.push("N")),n.diagonal&&(t.push("SE","NE"),e&&t.push("NW","SW")),t}function Cp(n,e,t,r,i,s,o,a){let l=Nt(n),c=[];for(let f=0;f<l.length;f++){let d=e+r.dr*f,p=t+r.dc*f;if(!Ap(d,p,s,o)||!i[d][p])return null;c.push({row:d,col:p,grapheme:l[f]})}return{word:n,graphemes:l,row:e,col:t,direction:r.direction,dr:r.dr,dc:r.dc,cells:c,jitter:a}}function uu(n,e,t,r,i,s){let o=[];for(let a of e){let l=Rp[a];for(let c=0;c<i;c++)for(let f=0;f<r;f++){let d=Cp(n,c,f,l,t,r,i,s());d&&o.push(d)}}return o}function Ta(n){let e=[],t=[],r=[],i=Math.floor(n.width),s=Math.floor(n.height);(!Number.isInteger(i)||i<2||i>64)&&e.push("Width must be an integer from 2 to 64."),(!Number.isInteger(s)||s<2||s>64)&&e.push("Height must be an integer from 2 to 64.");let o=ka(n.axes,n.allowBackwards);o.length===0&&e.push("At least one word direction must be enabled.");let a=ou(Math.max(1,i),Math.max(1,s),n.mask,e),l=Ip(a);l===0&&e.push("Mask must contain at least one active cell.");let c=new Set,f=[];for(let m of n.words){let h=Mp(m);if(h){if(/\s/u.test(h)){r.push({input:m,reason:"Words cannot contain whitespace."});continue}if(c.has(h)){r.push({input:m,reason:"Duplicate word."});continue}c.add(h),f.push(h)}}f.length===0&&e.push("Enter at least one word.");let d=au(su(n.seed));if(e.length===0)for(let m=f.length-1;m>=0;m--){let h=f[m];uu(h,o,a,i,s,d).length===0&&(r.push({input:h,reason:"No legal placement exists for the current size, mask, and directions."}),f.splice(m,1))}r.length>0&&e.push(`${r.length} word${r.length===1?"":"s"} rejected.`);let p=Math.max(0,l);return f.length>p&&t.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:e.length===0,acceptedWords:f,rejectedWords:r,errors:e,warnings:t,minWords:1,maxWords:p,activeCells:l,directions:o}}function Dp(n,e){for(let t of e.cells){let r=n[t.row][t.col];if(r!==null&&r!==t.grapheme)return!0}return!1}function Fp(n,e){let t=[];for(let r of e.cells)n[r.row][r.col]===null&&(t.push({row:r.row,col:r.col}),n[r.row][r.col]=r.grapheme);return t}function Ep(n,e){for(let t of e)n[t.row][t.col]=null}function iu(n,e){let t=0;for(let r of e.cells)n[r.row][r.col]===r.grapheme&&t++;return t}function Op(n){return{word:n.word,row:n.row,col:n.col,direction:n.direction,path:n.cells.map(e=>({...e}))}}function Lp(n){let e=n.fillerAlphabet??ru,t=typeof e=="string"?Nt(e):e.flatMap(i=>Nt(i)),r=t.filter((i,s)=>i.trim()&&t.indexOf(i)===s);return r.length>0?r:Nt(ru)}function cu(n){let e=Math.floor(n.width),t=Math.floor(n.height),r=su(n.seed),i=Ta({...n,width:e,height:t,seed:r});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let s=ou(e,t,n.mask,[]),o=Math.max(1,Math.floor(n.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let l=au(r+a*104729>>>0),c=i.directions,f=new Map;for(let k of i.acceptedWords)f.set(k,uu(k,c,s,e,t,l));let d=[...i.acceptedWords].sort((k,S)=>{let x=f.get(k)?.length??0,v=f.get(S)?.length??0;return x!==v?x-v:Nt(S).length-Nt(k).length}),p=Array.from({length:t},(k,S)=>Array.from({length:e},(x,v)=>s[S][v]?null:"")),m=[],h=new Map,g=0,b=k=>{if(++g>o)return!1;if(k>=d.length)return!0;let S=d[k],x=[...f.get(S)??[]].filter(v=>!Dp(p,v)).sort((v,w)=>{let T=iu(p,w)-iu(p,v);if(T!==0)return T;let P=(h.get(v.direction)??0)-(h.get(w.direction)??0);return P!==0?P:v.jitter-w.jitter});for(let v of x){let w=Fp(p,v);if(m.push(Op(v)),h.set(v.direction,(h.get(v.direction)??0)+1),b(k+1))return!0;h.set(v.direction,(h.get(v.direction)??1)-1),m.pop(),Ep(p,w)}return!1};if(!b(0))continue;let $=Lp(n);for(let k=0;k<t;k++)for(let S=0;S<e;S++)s[k][S]?p[k][S]===null&&(p[k][S]=$[Math.floor(l()*$.length)]):p[k][S]="";return{width:e,height:t,grid:p,mask:s.map(k=>[...k]),normalizedWords:[...i.acceptedWords],placements:[...m],seed:r,title:n.title,creator:n.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function Np(n,e,t){let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){let o=t[i],a=t[s];o.y>e!=a.y>e&&n<(a.x-o.x)*(e-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Bp(){let n=[];for(let e=0;e<10;e++){let t=e%2===0?.5:.23,r=-Math.PI/2+e*Math.PI/5;n.push({x:.5+Math.cos(r)*t,y:.5+Math.sin(r)*t})}return n}function du(n,e,t){let r=Math.max(1,Math.floor(n)),i=Math.max(1,Math.floor(e)),s=Bp();return Array.from({length:i},(o,a)=>Array.from({length:r},(l,c)=>{let f=(c+.5)/r,d=(a+.5)/i,p=f*2-1,m=d*2-1;switch(t){case"rectangle":return!0;case"circle":return p*p+m*m<=1;case"triangle":return d>=.08&&d<=.95&&Math.abs(p)<=d;case"diamond":return Math.abs(p)+Math.abs(m)<=1;case"star":return Np(f,d,s);case"heart":{let h=p*1.25,g=-m*1.25;return Math.pow(h*h+g*g-1,3)-h*h*g*g*g<=0}case"cross":return Math.abs(p)<=.32||Math.abs(m)<=.32;default:return!0}}))}0&&(module.exports={Arrow,Audio,BUILTIN_MARKER_ID_MAP,COLLAB_PROTOCOL_VERSION,COMMON_PROP_DEFAULTS,COMMON_TRANSFORM_NODE_DEFAULTS,CURRENT_SCHEMA_VERSION,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DEFAULT_COORDINATE_PRECISION,DEFAULT_RICH_TEXT_STYLE,Document,DocumentBuilder,EASING_CURVES,EasingType,Ellipse,Gear,Heart,Hyperlink,IDENTITY_AFFINE,ImageShape,KNOWN_STATE_KEYS,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NON_WIRE_PROP_KEYS,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,NestedSvg,NodeSchemaRegistry,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RICH_TEXT_STYLE_KEYS,RadialGradientBuilder,Rectangle,Ring,SERIALIZED_SHAPE_STATE_KEYS,SHAPE_TRANSFORM_STATE_KEYS,SceneGraph,SceneNode,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,Switch,Text,Timeline,Track,Triangle,Video,View,affine,affineFromArray,affineToArray,almostEqualAffine,applyAffineToPoint,applyAffineToVector,applyOpToSnapshot,applyOpsInPlace,applyOpsToSnapshot,applyOpsToSnapshotWithAccepted,applyRichTextFormat,applyTextSplice,applyTextTransform,arcEndpointToCenter,areTracksTimingEquivalent,around,buildCompoundTransformValues,buildSmilKeyframeData,canonicalPolygonTransformString,canonicalTransformString,collaborationResourceKey,collectMarkerReferences,collectReferencedLibraryDefs,collectReferencedMarkerIds,compareOrderKeys,composeLegacyTransformMatrix,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeFlowchartBoxPath,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,createDocument,createSceneNode,createShape,createViewbox,createWordSearchPrimitiveMask,cubicBezierExtent1D,customPatternDefToLibraryDef,declaredRichTextDeltaKeys,decomposeAffine2D,defaultVariableMode,deriveRichTextFormatRanges,deriveSegments,deriveTextSplice,downTranslateAnimationKeyframeOps,downTranslateCollectionMoveOps,downTranslateDocumentFieldOps,downTranslateScenePlaceOps,downTranslateTextFormatOps,ellipticalArcBounds,escXml,extractVariables,filterAttr,findShapeById,flattenShapeStateTree,flattenStateExtra,foldLegacyAncestorTransformIntoMatrix,forEachLibraryRefInState,forEachMarkerRefInState,forEachReachableShape,forEachShapeInLibraryDefs,formatOperationValidationIssues,formatSmilKeySpline,formatSmilKeyTime,freezeSiblingOrderKeys,generateCode,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSudokuPuzzle,generateSvgCode,generateVueCode,generateWordSearch,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getKeyframeCubicBezier,getMarkerDescriptors,getPatternElements,getSmilAdditive,getSmilBeginValue,getSmilFillMode,getSmilMotionKeyPoints,getSmilRepeatCount,getSmilSetBeginValue,getSmilTrackDuration,getWordSearchDirections,initialOrderKeys,invertAffine,isDefaultKeyPoints,isDefaultKeyTimes,isFiniteAffineArray,isIdentityAffine,isIdentityLinearSplines,isIndefiniteSetTrack,isReusablePatternTile,isSetSequenceTrack,isValidOrderKey,keyBetween,keysBetween,legacyEndpointMarkerId,linearGradient,lintWordSearchOptions,materializeSceneTreeOrderKeys,matrixTransformPart,maxCollaborationTimestamp,mergeRichTextStyle,migrateSnapshot,moveResourceById,multiplyAffine,nodeSchemas,normalizeRichTextRuns,normalizeRichTextStyle,normalizeRichTextStyleDelta,orderSiblings,parseDocument,parseSvgTransformList,parseVariableArgs,parseWordSearchWords,partitionShapeStateTree,partitionStateExtra,pathDataBounds,pattern,patternLibraryDefToCustomPatternDef,patternTileSize,planTransformFusion,projectSceneTreeOntoClipMaskGroups,projectSceneTreeOntoShapes,promoteRebasedShapeUpdateClock,quadraticBezierExtent1D,radialGradient,rebaseRichTextFormatRanges,rebaseRichTextRuns,reflectCubicBezier,removeResourceById,removeResourceByKey,removeResourceByName,removeTrackKeyframe,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderEllipse,renderFilterDefs,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderFlowchartBox,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPatternLibraryDef,renderPolygonShape,renderPolyline,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderShape,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolInstance,renderSymbolLibraryDef,renderText,renderToSvg,resolveRichTextStyleAt,resolveSymbolInstanceShapes,rewriteDocumentEmbeddedPayloads,rewriteShapeStateEmbeddedPayloads,richTextFontVariantCss,richTextLineSpans,richTextRunsFromState,richTextStyleDelta,richTextStyleDeltasEqual,richTextStylesEqual,richTextTspanAttributes,rotateAffine,roundCoord,roundNumberString,roundSerializedShape,roundSnapshot,runsFromSegments,sanitizeRichTextFormatRanges,scaleAffine,senderCorrectionsForOp,skewXAffine,skewYAffine,smilKeyframeAttributes,solveCubicBezier,solveSudoku,splinePathBounds,stringifyDocument,substituteString,substituteVariables,symbolInstanceTargetId,transformSplice,translateAffine,tryParseSvgTransformList,upsertResourceById,upsertResourceByKey,upsertResourceByName,upsertTrackKeyframe,validateDocumentOperations,validateOperation,validatePresenceOperation,validateSnapshot,validateSudokuPuzzle,verticesToPath});
82
+ }`)}let c=[];for(let f of r.body){if(f.kind==="shape"){c.push(`${n}${UI(f.markup,o.get(f))}`);continue}c.push(`${n}${f.open}`);for(let g of f.members)c.push(`${n}${n}${UI(g.markup,o.get(g))}`);c.push(`${n}${f.close}`)}let u=Et(r.defs),d=r.strippedDocumentCss,p=[];p.push("<style>");for(let f of l)p.push(f);d.length>0&&p.push(d),p.push("</style>"),p.push(""),p.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${r.frame.width}" height="${r.frame.height}" viewBox="${r.frame.viewBox}">`),u.length>0&&p.push(`${n}<defs>${u}</defs>`);for(let f of c)p.push(f);return p.push("</svg>"),p.push(""),p.join(`
83
+ `)}function $u(t,e){return qg(t,e).code}function qg(t,e){let n=new Io;return{code:Bd(n,()=>yD(t,e)),diagnostics:n.diagnostics}}function yD(t,e){let n=SD(t,e),r={...e};switch(r.format){case"svg":return Iu(n,r);case"react":return ku(n,r);case"vue":return Ru(n,r);case"d3":return Pu(n,r);case"css":return Cu(n,r);default:throw new Error(`Unsupported code format: ${r.format}`)}}function SD(t,e){if(Array.isArray(t)){let n=gI(t);return{shapes:t,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}],...n.length>0?{library:n}:{}}}return t}var $a=class t{_snapshot;constructor(e={}){let{width:n=800,height:r=600,viewboxId:i}=e,o=ui(0,0,n,r,i);this._snapshot=co({viewboxes:[o]})}static fromSnapshot(e){let n=new t;return n._snapshot=JSON.parse(JSON.stringify(e)),n}static fromJSON(e,n){let r=Md(e,n),i=new t;return i._snapshot=r,i}static fromSVG(e,n){return t.fromSnapshot(Rd(e,n))}add(e){let n="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(n),this}addAll(...e){for(let n of e)this.add(n);return this}remove(e){let n=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(r=>r.id!==e),this._snapshot.shapes.length<n}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(n=>n.id===e)}size(e,n){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=n):this._snapshot.viewboxes=[ui(0,0,e,n)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,n){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,n!==void 0&&(this._snapshot.documentMetadata.licenseUrl=n),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,n,r){let i=W(),o=n.map(c=>"build"in c&&typeof c.build=="function"?c.build():c),s={kind:"symbol",id:i,name:e,shapes:Tr(o,r?.groups)};r?.thumbnail&&(s.thumbnail=r.thumbnail),r?.defKind&&(s.defKind=r.defKind);let a={...r?.wrapperAttrs??{},...r?.rootAttributes??{}},l=a.viewBox;delete a.viewBox,r?.viewBox!==null&&(s.viewBox=r?.viewBox??l??"0 0 100 100");for(let c of["preserveAspectRatio","x","y","width","height","refX","refY"])r?.[c]!==void 0?s[c]=r[c]:s[c]===void 0&&a[c]!==void 0&&(s[c]=a[c]),delete a[c];return Object.keys(a).length>0&&(s.rootAttributes=a),r?.variantAxes&&(s.variantAxes=r.variantAxes),r?.variants&&(s.variants=Object.fromEntries(Object.entries(r.variants).map(([c,u])=>[c,Tr(u,r.groups)]))),r?.variantThumbnails&&(s.variantThumbnails=r.variantThumbnails),this._pushLibraryDef(s),i}placeSymbolInstance(e,n,r,i,o){let s,a={},l=typeof i=="number"||i===void 0;l?s=i:(a=i,s=a.width,o=a.height??o);let c={symbolId:e,x:n,y:r,width:s??100,height:o??100},u=a.authoredUseGeometry??{x:String(n),y:String(r),...l?{width:String(s??100),height:String(o??100)}:{...s!==void 0?{width:String(s)}:{},...o!==void 0?{height:String(o)}:{}}};Object.keys(u).length>0&&(c.authoredUseGeometry=u),a.variantKey&&(c.variantKey=a.variantKey),a.symbolOverrides&&(c.symbolOverrides=a.symbolOverrides),a.instancePresentation&&(c.instancePresentation=a.instancePresentation);let d={id:W(),type:"symbol-instance",state:c};return this._snapshot.shapes.push(d),this}removeSymbol(e){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>!(r.kind==="symbol"&&r.id===e)),this._snapshot.library.length<n}get symbols(){return(this._snapshot.library??[]).filter(e=>e.kind==="symbol")}defineMarker(e,n,r){let i=W(),o=n.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),s={kind:"marker",id:i,name:e,viewBox:r?.viewBox??"0 0 10 10",refX:r?.refX??5,refY:r?.refY??5,markerWidth:r?.markerWidth??10,markerHeight:r?.markerHeight??10,markerUnits:r?.markerUnits??"strokeWidth",orient:r?.orient??"auto",shapes:o};return r?.groups&&(s.groups=r.groups),r?.preserveAspectRatio!==void 0&&(s.preserveAspectRatio=r.preserveAspectRatio),r?.authoredGeometry&&(s.authoredGeometry={...r.authoredGeometry}),r?.rootAttributes&&(s.rootAttributes={...r.rootAttributes}),r?.thumbnail&&(s.thumbnail=r.thumbnail),this._pushLibraryDef(s),i}defineFilter(e,n,r){let i=W(),o={kind:"filter",id:i,name:e,filters:n};return r?.colorInterpolation&&(o.colorInterpolation=r.colorInterpolation),r?.filterUnits&&(o.filterUnits=r.filterUnits),r?.primitiveUnits&&(o.primitiveUnits=r.primitiveUnits),r?.x!==void 0&&(o.x=r.x),r?.y!==void 0&&(o.y=r.y),r?.width!==void 0&&(o.width=r.width),r?.height!==void 0&&(o.height=r.height),r?.thumbnail&&(o.thumbnail=r.thumbnail),this._pushLibraryDef(o),i}defineLinearGradientLibrary(e,n,r){let i=W(),o="build"in n?n.build():n,{id:s,sourceId:a,...l}=o,c={kind:"linear-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,n,r){let i=W(),o="build"in n?n.build():n,{id:s,sourceId:a,...l}=o,c={kind:"radial-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,n,r){let i=W(),o="build"in n?n.build():n,{id:s,sourceId:a,customPatternId:l,...c}=o,u={kind:"pattern",id:i,name:e,pattern:c};return r?.thumbnail&&(u.thumbnail=r.thumbnail),this._pushLibraryDef(u),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>r.id!==e),this._snapshot.library.length<n}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let n=this._snapshot.library.findIndex(r=>r.id===e.id);n>=0?this._snapshot.library[n]=e:this._snapshot.library.push(e)}addClipGroup(e,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=W(),o={id:i,type:"clip",clipShapeIds:e,contentShapeIds:n,parentId:null};return r?.clipPathUnits&&(o.clipPathUnits=r.clipPathUnits),r?.clipRule&&(o.clipRule=r.clipRule),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}addMaskGroup(e,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=W(),o={id:i,type:"mask",clipShapeIds:e,contentShapeIds:n,parentId:null};return r?.maskUnits&&(o.maskUnits=r.maskUnits),r?.maskContentUnits&&(o.maskContentUnits=r.maskContentUnits),r?.maskBounds&&(o.maskBounds=r.maskBounds),r?.maskType&&(o.maskType=r.maskType),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let n=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(r=>r.id!==e),this._snapshot.clipMaskGroups.length<n}addGuide(e,n,r){this._snapshot.guides||(this._snapshot.guides=[]);let i=W(),o={id:i,orientation:e,position:n,controlPointOffset:0};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.guides.push(o),i}removeGuide(e){if(!this._snapshot.guides)return!1;let n=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(r=>r.id!==e),this._snapshot.guides.length<n}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,n,r){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=W(),o={id:i,type:e,points:n,visible:r?.visible??!0,snapDivisions:r?.snapDivisions??1};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.measurements.push(o),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let n=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(r=>r.id!==e),this._snapshot.measurements.length<n}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,n,r,i){let o=W();return this._pushLibraryDef(Bn({id:o,name:e,svgContent:n,width:r,height:i})),o}removeCustomPattern(e){let n=this._snapshot.library;if(!n)return!1;let r=n.length;return this._snapshot.library=n.filter(i=>!(i.kind==="pattern"&&i.id===e)),this._snapshot.library.length<r}get customPatterns(){let e=[];for(let n of this._snapshot.library??[]){if(n.kind!=="pattern")continue;let r=Ai(n);r&&e.push(r)}return e}addGroup(e,n){this._snapshot.groups||(this._snapshot.groups=[]);let r=e??W();return this._snapshot.groups.push({id:r,parentId:n??null}),r}removeGroup(e){if(!this._snapshot.groups)return!1;let n=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(r=>r.id!==e);for(let r of this._snapshot.shapes)r.state.groupId===e&&delete r.state.groupId;return this._snapshot.groups.length<n}moveToGroup(e,n){let r=this._snapshot.shapes.find(i=>i.id===e);return r&&(r.state.groupId=n),this}removeFromGroup(e){let n=this._snapshot.shapes.find(r=>r.id===e);return n&&delete n.state.groupId,this}bringToFront(e){let n=this._snapshot.shapes.findIndex(r=>r.id===e);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.push(r)}return this}sendToBack(e){let n=this._snapshot.shapes.findIndex(r=>r.id===e);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.unshift(r)}return this}reorder(e,n){let r=this._snapshot.shapes.findIndex(i=>i.id===e);if(r>=0){let[i]=this._snapshot.shapes.splice(r,1),o=Math.max(0,Math.min(n,this._snapshot.shapes.length));this._snapshot.shapes.splice(o,0,i)}return this}defineVariable(e,n,r,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let o=this._snapshot.templateVariables.find(s=>s.name===e);if(o)o.type=n,o.defaultValue=r,i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description);else{let s={name:e,type:n,defaultValue:r};i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description),this._snapshot.templateVariables.push(s)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(n=>n.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return Dd(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:n,...r}=e??{},i=ia(this._snapshot,n);return Eo(i,r)}toSVGWithDiagnostics(e){let{variables:n,...r}=e??{},i=ia(this._snapshot,n);return Ca(i,r)}toJSON(e){return Nd(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,n){return $u(this._snapshot,{...n,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var Eu=class{_track;constructor(e,n){this._track={id:W(),shapeId:e,property:n,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,n,r="linear"){return this._track.keyframes.push({id:W(),time:e,value:n,easing:r}),this}keyframeBezier(e,n,r){return this._track.keyframes.push({id:W(),time:e,value:n,easing:"custom-bezier",customBezier:r}),this}keyframeLinear(e,n,r){return this._track.keyframes.push({id:W(),time:e,value:n,easing:"linear-function",linearPoints:r}),this}keyframes(...e){return this._track.keyframes.push(...e.map(n=>n.id?n:{...n,id:W()})),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(e){return this._track.motionPath=e,this}motionPathRef(e,n="trackShape"){return this._track.motionPathRef={shapeId:e,mode:n},this}beginTrigger(e,n){return this._track.beginTrigger={type:e,value:n},this}endTrigger(e,n){return this._track.endTrigger={type:e,value:n},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,n){return this._track.transformOrigin={x:e,y:n},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}fill(e){return this._track.fill=e,this}fillBackwards(e=!0){return this._track.fillBackwards=e,this}build(){let e=[...this._track.keyframes].sort((n,r)=>n.time-r.time);return{...this._track,keyframes:e}}},Au=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(e){this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(n=>({id:n.id,shapeId:n.shapeId,property:n.property,enabled:n.enabled,locked:n.locked||void 0,motionPath:n.motionPath,motionPathRef:n.motionPathRef,beginTrigger:n.beginTrigger,endTrigger:n.endTrigger,cycleDuration:n.cycleDuration,cycleRepeats:n.cycleRepeats,cycleInfinite:n.cycleInfinite,cycleBehavior:n.cycleBehavior,fillBackwards:n.fillBackwards,transformOrigin:n.transformOrigin,motionRotate:n.motionRotate,additive:n.additive,fill:n.fill,keyframes:n.keyframes.map(r=>({...r.id?{id:r.id}:{},time:r.time,value:r.value,easing:r.easing,...r.customBezier?{customBezier:r.customBezier}:{},...r.linearPoints?{linearPoints:r.linearPoints}:{}}))}))}}};var at=class{_id;_type;_state={};constructor(e,n){this._type=e,this._id=n??W()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}displayMode(e){return this._state.displayMode=e,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(e,n){return this._state.fillColor=e,this._state.fillType="solid",n!==void 0&&(this._state.fillOpacity=n),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let n="build"in e?e.build():e;return this._state.fillType=n.type,this._state.fillGradient=n,this}fillPattern(e){let n="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=n,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,n){return this._state.borderColor=e,n!==void 0&&(this._state.borderWidth=n),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let n="build"in e?e.build():e;return this._state.strokeType=n.type,this._state.strokeGradient=n,this}strokePattern(e){let n="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=n,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,n,r){return this._state.lineStyle=e,e==="custom"&&(n!==void 0&&(this._state.dashLength=n),r!==void 0&&(this._state.gapLength=r)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this.refreshTransformMatrix(),this}skew(e,n){return this._state.skewX=e,this._state.skewY=n,this.refreshTransformMatrix(),this}scale(e,n){return this._state.scaleX=e,this._state.scaleY=n??e,this.refreshTransformMatrix(),this}pivot(e,n){return this._state.customPivot={x:e,y:n},this.refreshTransformMatrix(),this}transformMatrix(e){if(e.length<6||!e.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=e.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=it(ms(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let e=this._state.customPivot;if(e)return e;let n=this._state.x,r=this._state.y,i=this._state.width,o=this._state.height;if(n!==void 0&&r!==void 0&&i!==void 0&&o!==void 0)return{x:n+i/2,y:r+o/2};let s=this._state.radius;if(n!==void 0&&r!==void 0&&s!==void 0)return{x:n,y:r};let a=this._state.cx,l=this._state.cy;if(a!==void 0&&l!==void 0)return{x:a,y:l};let c=this._state.x1,u=this._state.y1,d=this._state.x2,p=this._state.y2;if(c!==void 0&&u!==void 0&&d!==void 0&&p!==void 0)return{x:(c+d)/2,y:(u+p)/2};let f=this._state.pathPoints;if(f?.[0])return{x:f[0].x,y:f[0].y};let g=this._state.polylinePoints;if(g?.[0])return g[0]}filter(...e){let n=this._state.filters??[];return this._state.filters=[...n,...e],this}dropShadow(e={}){let n={id:`drop-shadow-${W()}`,type:"drop-shadow",enabled:!0,offsetX:e.offsetX??4,offsetY:e.offsetY??4,blurRadius:e.blurRadius??8,spread:e.spread??0,color:e.color??"#000000",opacity:e.opacity??.3};return this.filter(n)}innerShadow(e={}){let n={id:`inner-shadow-${W()}`,type:"inner-shadow",enabled:!0,offsetX:e.offsetX??2,offsetY:e.offsetY??2,blurRadius:e.blurRadius??4,choke:e.choke??0,color:e.color??"#000000",opacity:e.opacity??.5};return this.filter(n)}blur(e,n,r){let i=e??4,o=n??i,s={id:`gaussian-blur-${W()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:o,linked:i===o,quality:r?.quality??"normal"};return this.filter(s)}glow(e={}){let n={id:`glow-${W()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(n)}innerGlow(e={}){let n={id:`inner-glow-${W()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(n)}grayscale(e=1){let n={id:`grayscale-${W()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(n)}sepia(e=1){let n={id:`sepia-${W()}`,type:"sepia",enabled:!0,amount:e};return this.filter(n)}outline(e={}){return this.filter({id:`outline-${W()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let n={id:`motion-blur-${W()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(n)}pointLight(e={}){let n={id:`point-light-${W()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(n)}spotLight(e={}){let n={id:`spot-light-${W()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(n)}sharpen(e=1){let n={id:`sharpen-${W()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(n)}pixelate(e=8){let n={id:`pixelate-${W()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(n)}warp(e={}){let n={id:`warp-${W()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(n)}morphology(e={}){let n=e.radiusX??2,r=e.radiusY??n,i={id:`morphology-${W()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:n,radiusY:r,linked:e.linked??n===r};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${W()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let r={id:`contouring-discrete-${W()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(r)}roundEdges(e=4){let n={id:`round-edges-${W()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(n)}channelPainter(e={}){let n={id:`channel-painter-${W()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(n)}brightness(e=1){let n={id:`brightness-${W()}`,type:"brightness",enabled:!0,amount:e};return this.filter(n)}contrast(e=1){let n={id:`contrast-${W()}`,type:"contrast",enabled:!0,amount:e};return this.filter(n)}filterOpacity(e=1){let n={id:`opacity-${W()}`,type:"opacity",enabled:!0,amount:e};return this.filter(n)}invert(e=1){let n={id:`invert-${W()}`,type:"invert",enabled:!0,amount:e};return this.filter(n)}hueRotate(e=0){let n={id:`hue-rotate-${W()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(n)}saturate(e=1){let n={id:`saturate-${W()}`,type:"saturate",enabled:!0,amount:e};return this.filter(n)}blackAndWhite(e=.5){let n={id:`black-and-white-${W()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(n)}duotone(e={}){let n={id:`duotone-${W()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(n)}xray(e=1){let n={id:`xray-${W()}`,type:"xray",enabled:!0,intensity:e};return this.filter(n)}noise(e={}){let n={id:`noise-${W()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(n)}emboss(e={}){let n={id:`emboss-${W()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(n)}filmGrain(e={}){let n={id:`film-grain-${W()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(n)}watercolor(e={}){let n={id:`watercolor-${W()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(n)}gouache(e={}){let n={id:`gouache-${W()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(n)}inkBlot(e={}){let n={id:`ink-blot-${W()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(n)}crumpledPlastic(e={}){let n={id:`crumpled-plastic-${W()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(n)}riddled(e={}){let n={id:`riddled-${W()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(n)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}vectorEffect(e){return this._state.vectorEffect=e,this}transformBox(e){return this._state.transformBox=e,this}paintOrder(e){return this._state.paintOrder=e,this}blendMode(e){return this._state.blendMode=e,this}visibility(e){return this._state.visibility=e,this}shapeRendering(e){return this._state.shapeRendering=e,this}filterColorInterpolation(e){return this._state.filterColorInterpolation=e,this}inheritFill(e=!0){return this._state.inheritFill=e,this}inheritStroke(e=!0){return this._state.inheritStroke=e,this}systemLanguage(e){return this._state.systemLanguage=e,this}requiredExtensions(e){return this._state.requiredExtensions=e,this}fillLibrary(e,n="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=n,this}strokeLibrary(e,n="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=n,this}filterLibrary(...e){let n=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...n,...e],this}markerStartRef(e){return this._state.markerStart=e,this}markerMidRef(e){return this._state.markerMid=e,this}markerEndRef(e){return this._state.markerEnd=e,this}bind(e,n){let r=this._state.bindings??{};return this._state.bindings={...r,[e]:n},this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},Nu=class extends at{constructor(e,n,r){if(r<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=n,this._state.radius=r}position(e,n){return this._state.x=e,this._state.y=n,this}radius(e){return this._state.radius=e,this}},Mu=class extends at{constructor(e,n,r,i){if(r<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=n,this._state.rx=r,this._state.ry=i}position(e,n){return this._state.cx=e,this._state.cy=n,this}radii(e,n){return this._state.rx=e,this._state.ry=n,this}},Ou=class extends at{constructor(e,n,r,i){if(r<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=n,this._state.width=r,this._state.height=i}position(e,n){return this._state.x=e,this._state.y=n,this}size(e,n){return this._state.width=e,this._state.height=n,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,n){return this._state.rx=e,this._state.ry=n,e===n&&(this._state.cornerRadius=e),this}},Du=class extends at{constructor(e,n,r){if(r<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=n,this._state.width=r,this._state.height=r}position(e,n){return this._state.x=e,this._state.y=n,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,n){return this._state.rx=e,this._state.ry=n,e===n&&(this._state.cornerRadius=e),this}},zu=class extends at{constructor(e,n,r,i){super("line"),this._state.x1=e,this._state.y1=n,this._state.x2=r,this._state.y2=i}from(e,n){return this._state.x1=e,this._state.y1=n,this}to(e,n){return this._state.x2=e,this._state.y2=n,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,n){return this._state.startEndpoint=e,this._state.endEndpoint=n,this}},_u=class extends at{constructor(e,n,r){super("text"),this._state.x=e,this._state.y=n,this._state.text=r}position(e,n){return this._state.x=e,this._state.y=n,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}fontVariant(e){return this._state.fontVariant=e,this}fontVariantLigatures(e){return this._state.fontVariantLigatures=e,this}fontVariantPosition(e){return this._state.fontVariantPosition=e,this}fontVariantCaps(e){return this._state.fontVariantCaps=e,this}fontVariantNumeric(e){return this._state.fontVariantNumeric=e,this}fontVariantEastAsian(e){return this._state.fontVariantEastAsian=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,n=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=n,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){let n=Lr(e);return this._state.richTextRuns=n,this._state.richTextData=Ln(n),this}richTextRuns(e){let n=Fr(e);return this._state.richTextRuns=n,this._state.richTextData=Ln(n),this}useRichText(e=!0){return this._state.useRichText=e,this}linePositions(e){return this._state.linePositions=e,this}textLength(e){return this._state.textLength=e,this}lengthAdjust(e){return this._state.lengthAdjust=e,this}},zt=class extends at{constructor(e,n,r,i){super(e),this._state.cx=n,this._state.cy=r,this._state.radius=i}position(e,n){return this._state.cx=e,this._state.cy=n,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},Fu=class extends zt{constructor(e,n,r){super("triangle",e,n,r)}},Lu=class extends zt{constructor(e,n,r,i=5){super("ngon",e,n,r),this._state.sides=i}sides(e){return this._state.sides=e,this}},Bu=class extends zt{constructor(e,n,r){super("star",e,n,r),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Gu=class extends zt{constructor(e,n,r){super("cross",e,n,r),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},Vu=class extends zt{constructor(e,n,r){super("ring",e,n,r),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},ju=class extends zt{constructor(e,n,r){super("spiral",e,n,r),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(e){return this._state.turns=e,this}thickness(e){return this._state.thicknessPercent=e,this}direction(e){return this._state.spiralDirection=e,this}},Uu=class extends zt{constructor(e,n,r){super("gear",e,n,r),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(e){return this._state.teeth=e,this}toothDepth(e){return this._state.toothDepthPercent=e,this}holeRadius(e){return this._state.holeRadiusPercent=e,this}},Hu=class extends zt{constructor(e,n,r){super("arrow",e,n,r),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(e){return this._state.headWidthPercent=e,this}headLength(e){return this._state.headLengthPercent=e,this}shaftWidth(e){return this._state.shaftWidthPercent=e,this}},Wu=class extends zt{constructor(e,n,r){super("heart",e,n,r),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(e){return this._state.lobeRadiusPercent=e,this}cleftDepth(e){return this._state.cleftDepthPercent=e,this}},Ku=class extends zt{constructor(e,n,r){super("lightning",e,n,r),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(e){return this._state.boltSegments=e,this}jaggedness(e){return this._state.boltJaggednessPercent=e,this}thickness(e){return this._state.boltWidthPercent=e,this}},Xu=class extends zt{constructor(e,n,r){super("cloud",e,n,r),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(e){return this._state.cloudBumps=e,this}puffiness(e){return this._state.cloudPuffinessPercent=e,this}},Yu=class extends zt{constructor(e,n,r){super("speechBubble",e,n,r),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(e){return this._state.tailAngleDeg=e,this}tailLength(e){return this._state.tailLengthPercent=e,this}tailWidth(e){return this._state.tailWidthPercent=e,this}},Nr=class extends at{add(e){let n="build"in e&&typeof e.build=="function"?e.build():e,r=this._state.children??[];return this._state.children=[...r,n],this}addAll(...e){for(let n of e)this.add(n);return this}children(e){return this._state.children=e.map(n=>"build"in n&&typeof n.build=="function"?n.build():n),this}},qu=class extends Nr{constructor(e){super("hyperlink"),e!==void 0&&(this._state.href=e)}href(e){return this._state.href=e,this}hrefXlink(e){return this._state.hrefXlink=e,this}target(e){return this._state.linkTarget=e,this}download(e){return this._state.linkDownload=e,this}rel(e){return this._state.linkRel=e,this}ping(e){return this._state.linkPing=e,this}hreflang(e){return this._state.linkHreflang=e,this}type(e){return this._state.linkType=e,this}referrerPolicy(e){return this._state.linkReferrerPolicy=e,this}},Zu=class extends Nr{constructor(){super("switch")}},Ju=class extends Nr{constructor(){super("container")}},Qu=class extends at{constructor(e){super("view"),e&&(this._state.viewBoxX=e.x,this._state.viewBoxY=e.y,this._state.viewBoxWidth=e.width,this._state.viewBoxHeight=e.height)}viewBox(e,n,r,i){return this._state.viewBoxX=e,this._state.viewBoxY=n,this._state.viewBoxWidth=r,this._state.viewBoxHeight=i,this}name(e){return this._state.viewName=e,this}preserveAspectRatio(e){return this._state.viewPreserveAspectRatio=e,this}zoomAndPan(e){return this._state.viewZoomAndPan=e,this}viewTarget(e){return this._state.viewTarget=e,this}asHome(e=!0){return this}},ep=class extends Nr{constructor(e=0,n=0,r=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=n,this._state.svgWidth=r,this._state.svgHeight=i}position(e,n){return this._state.svgX=e,this._state.svgY=n,this}size(e,n){return this._state.svgWidth=e,this._state.svgHeight=n,this}viewBox(e,n,r,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=n,this._state.svgViewBoxWidth=r,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(e){return this._state.svgPreserveAspectRatio=e,this}asRoot(e=!0){return this._state.isRootSvg=e,this}},tp=class extends at{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,n){return this._state.offsetX=e,this._state.offsetY=n,this}size(e,n){return this._state.width=e,this._state.height=n,this}},np=class extends at{position(e,n){return this._state.x=e,this._state.y=n,this}size(e,n){return this._state.width=e,this._state.height=n,this}src(e){return this._state.href=e,this}mimeType(e){return this._state.mediaMimeType=e,this}naturalDuration(e){return this._state.naturalDuration=e,this}begin(e){return this._state.begin=e,this}trim(e,n){return this._state.trimStart=e,this._state.trimEnd=n,this}volume(e){return this._state.volume=e,this}muted(e=!0){return this._state.muted=e,this}loop(e=!0){return this._state.loop=e,this}playbackRate(e){return this._state.playbackRate=e,this}fade(e,n){return this._state.fadeInDuration=e,this._state.fadeOutDuration=n,this}language(e){return this._state.systemLanguage=e,this}},rp=class extends np{constructor(e){super("video"),this._state.mediaKind="video",e!==void 0&&(this._state.href=e)}poster(e){return this._state.posterHref=e,this}sourceRect(e){return this._state.sourceRect=e,this}},ip=class extends np{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},op=class extends at{constructor(e=[]){super("path"),this._state.pathPoints=[...e],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(e){return this._state.pathPoints=[...e],this}addPoint(e,n){let r=this._state.pathPoints??[];return r.push({x:e,y:n}),this._state.pathPoints=r,this}curveType(e){return this._state.pathCurveType=e,this}closed(e=!0){return this._state.pathClosed=e,this}tension(e){return this._state.pathTension=e,this}arcParams(e){return this._state.pathArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,n){return this._state.startEndpoint=e,this._state.endEndpoint=n,this}toD(){let e=this._state.pathPoints??[],n=this._state.pathCurveType??"CUBIC",r=this._state.pathClosed??!1,i=this._state.pathTension??.5,o=this._state.pathArcParams;return cr(e,n,r,i,o)}},sp=class extends at{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,n){let r=this._state.polylinePoints??[];return r.push({x:e,y:n}),this._state.polylinePoints=r,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,n){return this._state.startEndpoint=e,this._state.endEndpoint=n,this}},ap=class extends at{constructor(e,n,r,i,o){super("image"),this._state.x=e,this._state.y=n,this._state.width=r,this._state.height=i,this._state.href=o}position(e,n){return this._state.x=e,this._state.y=n,this}size(e,n){return this._state.width=e,this._state.height=n,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var Ea=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,n=0,r=1,i=0){this._x1=e,this._y1=n,this._x2=r,this._y2=i,this._id=W()}stop(e,n,r=1){return this._stops.push({offset:e,color:n,opacity:r}),this}direction(e,n,r,i){return this._x1=e,this._y1=n,this._x2=r,this._y2=i,this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Aa=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=W()}center(e,n){return this._cx=e,this._cy=n,this}focus(e,n){return this._fx=e,this._fy=n,this}radius(e,n){return this._r=e,this._ry=n??e,this}rotation(e){return this._rotation=e,this}stop(e,n,r=1){return this._stops.push({offset:e,color:n,opacity:r}),this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Na=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(e="stripes",n="#000000",r="#ffffff"){this._patternType=e,this._color=n,this._backgroundColor=r,this._id=W()}scale(e){return this._scale=e,this}rotation(e){return this._rotation=e,this}opacity(e){return this._opacity=e,this}params(e){return this._patternParams=e,this}svgContent(e){return this._svgContent=e,this}size(e,n){return this._width=e,this._height=n,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,n){return this._x=e,this._y=n,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,n,r;if(this._svgContent!==void 0)e=this._svgContent,n=this._width??10,r=this._height??10;else{let o=Lc(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=o.svgContent,n=this._width??o.width,r=this._height??o.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:e,width:n,height:r,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function HI(t=0,e=0,n=1,r=0){return new Ea(t,e,n,r)}function WI(){return new Aa}function KI(t="stripes",e="#000000",n="#ffffff"){return new Na(t,e,n)}var Zg={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},bD=.04,vD=0;function xD(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ne(t){return Number(t.toFixed(3)).toString()}function ID(t,e,n,r,i,o,s,a,l,c,u,d){return[[0,0],[.2,a],[.5+l+u,-o+c],[.5-o+l,o+c],[.5-2*o+l-u,3*o+c],[.5+2*o+l-u,3*o+c],[.5+o+l,o+c],[.5+l+u,-o+c],[.8,d],[1,0]].map(([f,g])=>{let m=e+f*r,h=n+g*i*s;return t?{x:m,y:h}:{x:h,y:m}})}function XI(t,e,n,r,i,o,s,a,l,c,u){let d=[],p=(x,P)=>l==="alternating"?0:x+c()*(P-x),f=()=>c()<.5,g=p(-a,a),m=l==="alternating"?u%2===0:f(),h=null,b=g,S=p(-a,a),v=p(-a,a),I=p(-a,a);g=p(-a,a);for(let x=0;x<t;x++){x>0&&(h=m,m=l==="alternating"?(u+x)%2===0:f(),b=m===h?-g:g,S=p(-a,a),v=p(-a,a),I=p(-a,a),g=p(-a,a));let P=m?-1:1,T=n+x*i;d.push(ID(e,T,r,i,o,s,P,b,S,v,I,g))}return d}function YI(t,e,n,r,i,o,s){let a=2*o;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([c,u])=>{let d=e+c*r,p=n+u*i*s;return t?{x:d,y:p}:{x:p,y:d}})}function qI(t,e){return t+` C ${ne(e[1].x)} ${ne(e[1].y)} ${ne(e[2].x)} ${ne(e[2].y)} ${ne(e[3].x)} ${ne(e[3].y)} C ${ne(e[4].x)} ${ne(e[4].y)} ${ne(e[5].x)} ${ne(e[5].y)} ${ne(e[6].x)} ${ne(e[6].y)} C ${ne(e[7].x)} ${ne(e[7].y)} ${ne(e[8].x)} ${ne(e[8].y)} ${ne(e[9].x)} ${ne(e[9].y)}`}function ZI(t,e){return t+` C ${ne(e[8].x)} ${ne(e[8].y)} ${ne(e[7].x)} ${ne(e[7].y)} ${ne(e[6].x)} ${ne(e[6].y)} C ${ne(e[5].x)} ${ne(e[5].y)} ${ne(e[4].x)} ${ne(e[4].y)} ${ne(e[3].x)} ${ne(e[3].y)} C ${ne(e[2].x)} ${ne(e[2].y)} ${ne(e[1].x)} ${ne(e[1].y)} ${ne(e[0].x)} ${ne(e[0].y)}`}function JI(t,e={}){let n={...Zg,...e};if(n.rows<1||n.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(t.width)||!Number.isFinite(t.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(t.width<=0||t.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:r,cols:i,style:o,tabDepthPercent:s,tabPattern:a,seed:l}=n,c=xD(l),u=t.width/i,d=t.height/r,p=Math.max(0,Math.min(.4,s/200)),f=(o==="classic"||o==="curved")&&p>0,g=o==="square-tabs"&&p>0,m=o==="classic"&&a==="random"?bD:vD,h=[];for(let v=0;v<r-1;v++){let I=t.y+(v+1)*d;if(f)h.push(XI(i,!0,t.x,I,u,d,p,m,a,c,v));else if(g){let x=[];for(let P=0;P<i;P++){let T=a==="alternating"?(v+P)%2===0?1:-1:c()<.5?1:-1;x.push(YI(!0,t.x+P*u,I,u,d,p,T))}h.push(x)}else h.push(new Array(i).fill(null))}let b=[];for(let v=0;v<i-1;v++){let I=t.x+(v+1)*u;if(f)b.push(XI(r,!1,t.y,I,d,u,p,m,a,c,v));else if(g){let x=[];for(let P=0;P<r;P++){let T=a==="alternating"?(P+v)%2===0?1:-1:c()<.5?1:-1;x.push(YI(!1,t.y+P*d,I,d,u,p,T))}b.push(x)}else b.push(new Array(r).fill(null))}let S=[];for(let v=0;v<r;v++)for(let I=0;I<i;I++){let x=t.x+I*u,P=t.y+v*d,T=x+u,k=P+d,w=`M ${ne(x)} ${ne(P)}`;if(v===0)w+=` L ${ne(T)} ${ne(P)}`;else{let $=h[v-1][I];$?w=qI(w,$):w+=` L ${ne(T)} ${ne(P)}`}if(I===i-1)w+=` L ${ne(T)} ${ne(k)}`;else{let $=b[I][v];$?w=qI(w,$):w+=` L ${ne(T)} ${ne(k)}`}if(v===r-1)w+=` L ${ne(x)} ${ne(k)}`;else{let $=h[v][I];$?w=ZI(w,$):w+=` L ${ne(x)} ${ne(k)}`}if(I===0)w+=` L ${ne(x)} ${ne(P)}`;else{let $=b[I-1][v];$?w=ZI(w,$):w+=` L ${ne(x)} ${ne(P)}`}w+=" Z",S.push({id:`puzzle-${l}-r${v}-c${I}`,row:v,col:I,d:w})}return S}var tw=[1,2,3,4,5,6,7,8,9],wD={easy:{minGivens:40,maxGivens:45,maxRating:"singles"},medium:{minGivens:34,maxGivens:39,maxRating:"hidden-singles"},hard:{minGivens:28,maxGivens:33,maxRating:"search"},expert:{minGivens:24,maxGivens:27,maxRating:"search"}};function Ma(t){return t.map(e=>[...e])}function kD(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function nw(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function rw(t,e){let n=[...t];for(let r=n.length-1;r>0;r--){let i=Math.floor(e()*(r+1));[n[r],n[i]]=[n[i],n[r]]}return n}function No(t){return 1<<t-1}function iw(t){let e=0,n=t;for(;n;)n&=n-1,e++;return e}function RD(t){for(let e=1;e<=9;e++)if(t===No(e))return e;return 0}function Qg(t,e){return Math.floor(t/3)*3+Math.floor(e/3)}function Jg(t){let e=0;for(let n of t)for(let r of n)r!==0&&e++;return e}function TD(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function ow(t,e){if(!Array.isArray(t)||t.length!==9)return e.push("Grid must contain 9 rows."),!1;let n=!0;for(let r=0;r<9;r++){if(!Array.isArray(t[r])||t[r].length!==9){e.push(`Row ${r+1} must contain 9 cells.`),n=!1;continue}for(let i=0;i<9;i++){let o=t[r][i];(!Number.isInteger(o)||o<0||o>9)&&(e.push(`Cell R${r+1}C${i+1} must be a digit from 0 to 9.`),n=!1)}}return n}function sw(t,e){let n=!0,r=(i,o)=>{let s=0;for(let a of o){if(a===0)continue;let l=No(a);if(s&l){e.push(`${i} contains duplicate ${a}.`),n=!1;return}s|=l}};for(let i=0;i<9;i++)r(`Row ${i+1}`,t[i]);for(let i=0;i<9;i++)r(`Column ${i+1}`,t.map(o=>o[i]));for(let i=0;i<9;i+=3)for(let o=0;o<9;o+=3){let s=[];for(let a=i;a<i+3;a++)for(let l=o;l<o+3;l++)s.push(t[a][l]);r(`Box ${Math.floor(i/3)*3+Math.floor(o/3)+1}`,s)}return n}function eh(t){let e=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let o=0;o<9;o++){let s=t[i][o];if(s===0)continue;let a=No(s),l=Qg(i,o);if(e[i]&a||n[o]&a||r[l]&a)return null;e[i]|=a,n[o]|=a,r[l]|=a}return{rows:e,cols:n,boxes:r}}function th(t,e,n,r,i){return 511&~(n[t]|r[e]|i[Qg(t,e)])}function aw(t,e,n){let r=eh(t);if(!r)return[];let i=Ma(t),o=[],{rows:s,cols:a,boxes:l}=r,c=()=>{if(o.length>=e)return;let u=-1,d=-1,p=0,f=10;for(let m=0;m<9;m++){for(let h=0;h<9;h++){if(i[m][h]!==0)continue;let b=th(m,h,s,a,l),S=iw(b);if(S===0)return;if(S<f&&(u=m,d=h,p=b,f=S,S===1))break}if(f===1)break}if(u===-1){o.push(Ma(i));return}let g=tw.filter(m=>p&No(m));n&&(g=rw(g,n));for(let m of g){let h=No(m),b=Qg(u,d);if(i[u][d]=m,s[u]|=h,a[d]|=h,l[b]|=h,c(),l[b]&=~h,a[d]&=~h,s[u]&=~h,i[u][d]=0,o.length>=e)return}};return c(),o}function PD(t){let e=kD(),n=nw(t),[r]=aw(e,1,n);if(!r)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return r}function CD(t){let e=eh(t);if(!e)return null;for(let n=0;n<9;n++)for(let r=0;r<9;r++){if(t[n][r]!==0)continue;let i=th(n,r,e.rows,e.cols,e.boxes);if(iw(i)===1)return{row:n,col:r,value:RD(i)}}return null}function $D(t){let e=eh(t);if(!e)return null;let n=r=>{for(let i of tw){let o=No(i),s=null;for(let a of r)if(!(t[a.row][a.col]!==0||!(th(a.row,a.col,e.rows,e.cols,e.boxes)&o))){if(s){s=null;break}s=a}if(s)return{...s,value:i}}return null};for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:r,col:s})));if(i)return i}for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:s,col:r})));if(i)return i}for(let r=0;r<9;r+=3)for(let i=0;i<9;i+=3){let o=[];for(let a=r;a<r+3;a++)for(let l=i;l<i+3;l++)o.push({row:a,col:l});let s=n(o);if(s)return s}return null}function QI(t){let e=Ma(t),n=!1;for(;Jg(e)<81;){let r=CD(e);if(r){e[r.row][r.col]=r.value;continue}let i=$D(e);if(i){n=!0,e[i.row][i.col]=i.value;continue}return"search"}return n?"hidden-singles":"singles"}function ew(t,e){let n={singles:0,"hidden-singles":1,search:2};return n[t]<=n[e]}function Oa(t,e={}){let n=[];return ow(t,n)?sw(t,n)?aw(t,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function lw(t){let e=[];if(!ow(t,e))return{valid:!1,unique:!1,solution:null,errors:e};if(sw(t,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let r=Oa(t,{maxSolutions:2});return r.length===0?e.push("Puzzle has no solution."):r.length>1&&e.push("Puzzle has more than one solution."),{valid:e.length===0,unique:r.length===1,solution:r[0]?Ma(r[0]):null,errors:e}}function cw(t){let e=t.difficulty,n=wD[e];if(!n)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let r=TD(t.seed);for(let i=0;i<30;i++){let o=r+i*104729>>>0,s=nw(o),a=PD(o),l=Ma(a),c=n.minGivens+Math.floor(s()*(n.maxGivens-n.minGivens+1)),u=rw(Array.from({length:81},(g,m)=>({row:Math.floor(m/9),col:m%9})),s);for(let g of u){if(Jg(l)<=c)break;let m=l[g.row][g.col];if(l[g.row][g.col]=0,Oa(l,{maxSolutions:2}).length!==1){l[g.row][g.col]=m;continue}let b=QI(l);ew(b,n.maxRating)||(l[g.row][g.col]=m)}let d=Jg(l),p=QI(l);if(Oa(l,{maxSolutions:2}).length===1&&d>=n.minGivens&&d<=n.maxGivens&&ew(p,n.maxRating))return{puzzle:l,solution:a,difficulty:e,seed:r,givens:d,rating:p}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}var dw="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var ED={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function pw(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function fw(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function Mo(t){let e=globalThis.Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(t),n=>n.segment.normalize("NFC")):Array.from(t.normalize("NFC"))}function AD(t,e,n,r){return t>=0&&e>=0&&t<r&&e<n}function nh(t,e){return Array.from({length:e},()=>Array.from({length:t},()=>!0))}function mw(t,e,n,r){if(!n)return nh(t,e);if(!Array.isArray(n)||n.length!==e)return r.push(`Mask must contain exactly ${e} rows.`),nh(t,e);let i=[];for(let o=0;o<e;o++){if(!Array.isArray(n[o])||n[o].length!==t)return r.push(`Mask row ${o+1} must contain exactly ${t} cells.`),nh(t,e);i.push(n[o].map(Boolean))}return i}function ND(t){let e=0;for(let n of t)for(let r of n)r&&e++;return e}function MD(t){return t.trim().normalize("NFC")}function gw(t){return t.replace(/\r/g,"").split(/[,\n]+/).map(e=>e.trim()).filter(e=>e.length>0)}function rh(t,e){let n=[];return t.across&&(n.push("E"),e&&n.push("W")),t.down&&(n.push("S"),e&&n.push("N")),t.diagonal&&(n.push("SE","NE"),e&&n.push("NW","SW")),n}function OD(t,e,n,r,i,o,s,a){let l=Mo(t),c=[];for(let u=0;u<l.length;u++){let d=e+r.dr*u,p=n+r.dc*u;if(!AD(d,p,o,s)||!i[d][p])return null;c.push({row:d,col:p,grapheme:l[u]})}return{word:t,graphemes:l,row:e,col:n,direction:r.direction,dr:r.dr,dc:r.dc,cells:c,jitter:a}}function hw(t,e,n,r,i,o){let s=[];for(let a of e){let l=ED[a];for(let c=0;c<i;c++)for(let u=0;u<r;u++){let d=OD(t,c,u,l,n,r,i,o());d&&s.push(d)}}return s}function ih(t){let e=[],n=[],r=[],i=Math.floor(t.width),o=Math.floor(t.height);(!Number.isInteger(i)||i<2||i>64)&&e.push("Width must be an integer from 2 to 64."),(!Number.isInteger(o)||o<2||o>64)&&e.push("Height must be an integer from 2 to 64.");let s=rh(t.axes,t.allowBackwards);s.length===0&&e.push("At least one word direction must be enabled.");let a=mw(Math.max(1,i),Math.max(1,o),t.mask,e),l=ND(a);l===0&&e.push("Mask must contain at least one active cell.");let c=new Set,u=[];for(let f of t.words){let g=MD(f);if(g){if(/\s/u.test(g)){r.push({input:f,reason:"Words cannot contain whitespace."});continue}if(c.has(g)){r.push({input:f,reason:"Duplicate word."});continue}c.add(g),u.push(g)}}u.length===0&&e.push("Enter at least one word.");let d=fw(pw(t.seed));if(e.length===0)for(let f=u.length-1;f>=0;f--){let g=u[f];hw(g,s,a,i,o,d).length===0&&(r.push({input:g,reason:"No legal placement exists for the current size, mask, and directions."}),u.splice(f,1))}r.length>0&&e.push(`${r.length} word${r.length===1?"":"s"} rejected.`);let p=Math.max(0,l);return u.length>p&&n.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:e.length===0,acceptedWords:u,rejectedWords:r,errors:e,warnings:n,minWords:1,maxWords:p,activeCells:l,directions:s}}function DD(t,e){for(let n of e.cells){let r=t[n.row][n.col];if(r!==null&&r!==n.grapheme)return!0}return!1}function zD(t,e){let n=[];for(let r of e.cells)t[r.row][r.col]===null&&(n.push({row:r.row,col:r.col}),t[r.row][r.col]=r.grapheme);return n}function _D(t,e){for(let n of e)t[n.row][n.col]=null}function uw(t,e){let n=0;for(let r of e.cells)t[r.row][r.col]===r.grapheme&&n++;return n}function FD(t){return{word:t.word,row:t.row,col:t.col,direction:t.direction,path:t.cells.map(e=>({...e}))}}function LD(t){let e=t.fillerAlphabet??dw,n=typeof e=="string"?Mo(e):e.flatMap(i=>Mo(i)),r=n.filter((i,o)=>i.trim()&&n.indexOf(i)===o);return r.length>0?r:Mo(dw)}function yw(t){let e=Math.floor(t.width),n=Math.floor(t.height),r=pw(t.seed),i=ih({...t,width:e,height:n,seed:r});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let o=mw(e,n,t.mask,[]),s=Math.max(1,Math.floor(t.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let l=fw(r+a*104729>>>0),c=i.directions,u=new Map;for(let S of i.acceptedWords)u.set(S,hw(S,c,o,e,n,l));let d=[...i.acceptedWords].sort((S,v)=>{let I=u.get(S)?.length??0,x=u.get(v)?.length??0;return I!==x?I-x:Mo(v).length-Mo(S).length}),p=Array.from({length:n},(S,v)=>Array.from({length:e},(I,x)=>o[v][x]?null:"")),f=[],g=new Map,m=0,h=S=>{if(++m>s)return!1;if(S>=d.length)return!0;let v=d[S],I=[...u.get(v)??[]].filter(x=>!DD(p,x)).sort((x,P)=>{let T=uw(p,P)-uw(p,x);if(T!==0)return T;let k=(g.get(x.direction)??0)-(g.get(P.direction)??0);return k!==0?k:x.jitter-P.jitter});for(let x of I){let P=zD(p,x);if(f.push(FD(x)),g.set(x.direction,(g.get(x.direction)??0)+1),h(S+1))return!0;g.set(x.direction,(g.get(x.direction)??1)-1),f.pop(),_D(p,P)}return!1};if(!h(0))continue;let b=LD(t);for(let S=0;S<n;S++)for(let v=0;v<e;v++)o[S][v]?p[S][v]===null&&(p[S][v]=b[Math.floor(l()*b.length)]):p[S][v]="";return{width:e,height:n,grid:p,mask:o.map(S=>[...S]),normalizedWords:[...i.acceptedWords],placements:[...f],seed:r,title:t.title,creator:t.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function BD(t,e,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let s=n[i],a=n[o];s.y>e!=a.y>e&&t<(a.x-s.x)*(e-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function GD(){let t=[];for(let e=0;e<10;e++){let n=e%2===0?.5:.23,r=-Math.PI/2+e*Math.PI/5;t.push({x:.5+Math.cos(r)*n,y:.5+Math.sin(r)*n})}return t}function Sw(t,e,n){let r=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),o=GD();return Array.from({length:i},(s,a)=>Array.from({length:r},(l,c)=>{let u=(c+.5)/r,d=(a+.5)/i,p=u*2-1,f=d*2-1;switch(n){case"rectangle":return!0;case"circle":return p*p+f*f<=1;case"triangle":return d>=.08&&d<=.95&&Math.abs(p)<=d;case"diamond":return Math.abs(p)+Math.abs(f)<=1;case"star":return BD(u,d,o);case"heart":{let g=p*1.25,m=-f*1.25;return Math.pow(g*g+m*m-1,3)-g*g*m*m*m<=0}case"cross":return Math.abs(p)<=.32||Math.abs(f)<=.32;default:return!0}}))}0&&(module.exports={ANIMATION_MANAGER_INTERPOLATION_POLICY,Arrow,Audio,BROWSER_SVG_EXTENSION_URIS,BUILTIN_MARKER_ID_MAP,CANONICAL_NORMALIZATION_FAULT_POINTS,CC_NS,COLLAB_PROTOCOL_VERSION,COMMON_PROP_DEFAULTS,COMMON_TRANSFORM_NODE_DEFAULTS,CURRENT_SCHEMA_VERSION,CanonicalDocument,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DC_NS,DEFAULT_COORDINATE_PRECISION,DEFAULT_RICH_TEXT_STYLE,DOCUMENT_FIELDS,DOCUMENT_FIELD_LIVE_AUTHORITY,DOCUMENT_INGEST_POLICIES,DOCUMENT_SECTION_ORDER,Document,DocumentBuilder,DocumentModel,DocumentSession,EASING_CURVES,EasingType,Ellipse,Gear,HEADLESS_SVG_STYLE_ENVIRONMENT,Heart,Hyperlink,IDENTITY_AFFINE,INGEST_APPLY_STAGES,INGEST_DIAGNOSTIC_CODES,INGEST_DOCUMENT_ROOT_IDENTITY,INGEST_FEATURES,INGEST_FEATURE_CAPABILITIES,INGEST_PLAN_VERSION,INGRESS_INTENTS,INLINE_CHILD_CONTAINER_TYPES,ImageShape,IngestApplicationError,KNOWN_METADATA_PREFIXES,KNOWN_STATE_KEYS,LIBRARY_ASSEMBLY_KIND_ORDER,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MATHML_EXTENSION_URI,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NON_WIRE_PROP_KEYS,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,NestedSvg,NodeSchemaRegistry,PAINT_SERVER_PASSTHROUGH_ATTR,PRESENTATION_SEMANTICS,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RDF_NS,RENDER_DIAGNOSTIC_CODES,RENDER_FEATURES,RENDER_FEATURE_CAPABILITIES,RENDER_TARGETS,RICH_TEXT_STYLE_KEYS,RadialGradientBuilder,Rectangle,Ring,SAXES_SVG_XML_PARSER_HOST,SERIALIZED_SHAPE_STATE_KEYS,SHAPE_ENVELOPE_KEYS,SHAPE_TRANSFORM_STATE_KEYS,SVGSKETCH_NS,SVGSKETCH_PATH_EXTENSIONS,SVG_CONDITIONAL_PROCESSING_ATTRIBUTES,SVG_IMPORT_CAPABILITY_OWNERS,SVG_NAMESPACE,SVG_NS,SVG_PRESENTATION_PROPERTIES,SceneGraph,SceneNode,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,SvgImportError,SvgXmlParserHostError,Switch,TYPED_FIELD_PREDICATES,Text,TextLayoutEngine,Timeline,Track,Triangle,VARIANT_INTERPOLATION_POLICY,Video,View,XHTML_EXTENSION_URI,addSmilPointsValues,affine,affineFromArray,affineToArray,almostEqualAffine,animationBackwardsFillTrack,animationCycleDuration,animationTrackActiveEnd,animationTrackDocumentBegin,applyAffineToPoint,applyAffineToVector,applyClipMaskGroupDelta,applyClipMaskPlanToShapes,applyCssAnimationLonghandOverrides,applyGuideDeltaOp,applyIngestPlan,applyMeasurementDeltaOp,applyMetadataDeltaOp,applyOpToSnapshot,applyOpsInPlace,applyOpsToSnapshot,applyOpsToSnapshotWithAccepted,applyRichTextFormat,applyTextSplice,applyTextTransform,applyTimingFunctionToKeyframe,arcEndpointToCenter,areTracksTimingEquivalent,around,assembleLibraryDefs,assembleSvgFromPlan,assertIngestFeatureRegistry,assertIngestPolicyRegistry,assertSvgImportCapabilityOwners,buildCompoundTransformValues,buildFreshMetadataBlock,buildGuideDeltaOps,buildManagedChildren,buildManagedDescription,buildMeasurementDeltaOps,buildMetadataDeltaOps,buildRenderPlan,buildSmilKeyframeData,buildSmilKeyframes,buildSvgDestinationIdentityIndex,buildSymbolMaterializationPlan,canonicalPolygonTransformString,canonicalTransformMatrix,canonicalTransformString,classifySvgExternalAssetUrl,clipMaskDefinitionFromGroup,clipMaskDefinitionsFromGroups,clipMaskGroupDefId,clipMaskGroupDefinitionId,clipMaskGroupIsRawBacked,clipMaskGroupWithDefinition,clipMaskOwnedDefIds,collaborationResourceKey,collectDocumentEnvelopeLibraryReferenceIds,collectFontFamiliesFromPlan,collectMarkerReferences,collectReferencedLibraryDefs,collectReferencedMarkerIds,collectUnknownDocumentFields,compareOrderKeys,composeLegacyTransformMatrix,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeFlowchartBoxPath,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,computeSvgViewportMatrix,containerTransformNeedsContentPivot,createDocument,createSceneNode,createShape,createSvgDestinationIdAllocator,createViewbox,createWordSearchPrimitiveMask,cssAnimationFillField,cssNamedColorToRgb,cubicBezierExtent1D,cubicBezierToEasingFields,customPatternDefToLibraryDef,declaredRichTextDeltaKeys,decodeCssEscapes,decomposeAffine2D,defaultVariableMode,deriveRichTextFormatRanges,deriveSegments,deriveTextSplice,documentObjectBounds,downTranslateAnimationKeyframeOps,downTranslateCollectionMoveOps,downTranslateDocumentFieldOps,downTranslateScenePlaceOps,downTranslateTextFormatOps,ellipticalArcBounds,emptyDocumentMetadata,escXml,evaluateParsedTimingFunction,evaluateSvgConditionalProcessing,extractVariables,fillPaintServerReference,filterAttr,filterChainExtendsBounds,filterDefinitionEnvelope,filterReferenceValue,finalizeRenderPlan,findShapeById,fingerprintIngestSource,flattenShapeStateTree,flattenStateExtra,flattenUnknownDocumentFields,foldLegacyAncestorTransformIntoMatrix,forEachLibraryRefInState,forEachMarkerRefInState,forEachReachableShape,forEachShapeInLibraryDefs,formatOperationValidationIssues,formatSmilKeySpline,formatSmilKeyTime,freezeIngestPlan,freezeSiblingOrderKeys,generateCode,generateCodeWithDiagnostics,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSudokuPuzzle,generateSvgCode,generateVueCode,generateWordSearch,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getIngestFeatureCapability,getIngestFieldPolicy,getKeyframeCubicBezier,getLicenseLabel,getLicenseUrl,getMarkerDescriptors,getPatternElements,getShapeGeometryKernel,getSmilAdditive,getSmilBeginValue,getSmilFillMode,getSmilMotionKeyPoints,getSmilRepeatCount,getSmilSetBeginValue,getSmilTrackDuration,getSvgPropertySemantics,getSvgSourceAttribute,getSvgSourceHref,getWordSearchDirections,hasAnyTypedMetadataField,hasSvgSourceAttribute,importSvg,importSvgWithDiagnostics,indexLibraryDefinitions,initialOrderKeys,injectClipMaskReference,inspectCssTransformValue,interpolateAngle,interpolateCharOffsetArray,interpolateColor,interpolateDasharrayLists,interpolateGradient,interpolateNumericArray,interpolatePathData,interpolatePlainObject,interpolatePointArray,interpolatePolylinePoints,interpolateShapeTrees,interpolateSplinePointArray,invertAffine,isColorValue,isCssNamedColor,isDefaultKeyPoints,isDefaultKeyTimes,isFiniteAffineArray,isGradientLike,isIdentityAffine,isIdentityLinearSplines,isIndefiniteSetTrack,isNumericArray,isReusablePatternTile,isSetSequenceTrack,isSvgPresentationProperty,isValidOrderKey,keyBetween,keysBetween,layoutText,legacyEndpointMarkerId,lerpNumber,linearGradient,linearGradientEnvelope,lintWordSearchOptions,mapAnimationTrackTime,matchCubicBezierToPreset,materializeSceneTreeOrderKeys,matrixTransformPart,maxCollaborationTimestamp,mergeRichTextStyle,migrateLegacySplineShape,migrateLegacySplines,migrateLegacyViewboxesToViews,migrateSnapshot,migrateV6toV7,motionPathD,moveResourceById,multiplyAffine,mutateSvgClipMaskDefinitionMarkup,nodeSchemas,normalizeClipMaskGroups,normalizeLegacyShapeAliases,normalizePaintServerDef,normalizeRichTextRuns,normalizeRichTextStyle,normalizeRichTextStyleDelta,normalizeSmilPointsValue,normalizeSnapshotStructure,normalizeSnapshotToCanonicalDocument,normalizeSnapshotToInlineChildren,orderSiblings,paintServerDefsFromRawFragments,parseColor,parseCssAnimationShorthand,parseCssTimingFunction,parseCssTransformOrigin,parseDocument,parseDocumentWithDiagnostics,parseInterpolationNumbers,parsePreserveAspectRatio,parseSmilAdditive,parseSmilClockValue,parseSmilDuration,parseSmilFillField,parseSmilKeySplines,parseSmilKeyTimes,parseSmilRepeatSettings,parseSmilValues,parseSvgAbsoluteLength,parseSvgLength,parseSvgLengthList,parseSvgLengthToken,parseSvgPathData,parseSvgRootFrame,parseSvgSourceDocument,parseSvgStyleAttribute,parseSvgTransformList,parseSvgViewBox,parseVariableArgs,parseWordSearchWords,partitionShapeStateTree,partitionStateExtra,partitionUnknownDocumentFields,pathCommandStructuresMatch,pathDataBounds,pattern,patternDefinitionEnvelope,patternLibraryDefToCustomPatternDef,patternTileSize,pickCssAnimationListItem,planClipMaskGroups,planSnapshotExternalEffects,planSvgAnimations,planSvgAuthoredAttributes,planSvgClipMasks,planSvgConditionalProcessing,planSvgContainerHierarchy,planSvgEmbeddedFrames,planSvgExternalEffects,planSvgFilters,planSvgGradients,planSvgImport,planSvgLeafGeometry,planSvgMarkers,planSvgMetadata,planSvgPaintServerDefinitions,planSvgPatterns,planSvgResourceDependencies,planSvgScripts,planSvgSourceIdentifiers,planSvgStyleCascade,planSvgSymbolUses,planSvgUseOccurrences,planSvgViews,planTransformFusion,planVariantTransitionsCss,planVariantTransitionsSmil,planVariantTransitionsWaapi,prepareSvgAuthorCssForLiveProjection,prepareSvgExternalAssetUrlForLiveProjection,prepareSvgMarkupForLiveProjection,prepareSvgXmlSource,preserveAspectRatioAlignFactor,projectCssTransformStops,projectPresentation,projectPresentationEntry,projectSceneTreeOntoClipMaskGroups,projectSceneTreeOntoShapes,projectSvgAnimationPlan,projectSvgAnimationTimeline,projectSvgImportToSnapshot,promoteManagedDescription,promoteRebasedShapeUpdateClock,pruneAndWrapSubtree,quadraticBezierExtent1D,radialGradient,radialGradientEnvelope,rebaseRichTextFormatRanges,rebaseRichTextRuns,reflectCubicBezier,registeredShapeGeometryTypes,removeResourceById,removeResourceByKey,removeResourceByName,removeTrackKeyframe,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderDescriptiveElements,renderDocumentScripts,renderDocumentStyles,renderEllipse,renderFilterDefs,renderFilterElement,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderFlowchartBox,renderForeignObject,renderGradientDefs,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradient,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPaintServerDefs,renderPatternLibraryDef,renderPlanDefsBody,renderPolygonShape,renderPolyline,renderRadialGradient,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderResolvedSymbolLibraryDef,renderShape,renderShapeContextForLibrary,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolInstance,renderSymbolLibraryDef,renderTemplateVariablesStyle,renderText,renderToSvg,renderToSvgWithDiagnostics,replaceClipMaskDefinition,replaceClipMaskGroupsInSceneTree,replaySceneTreePlacements,resolveContainerTransform,resolveContainerTransformFromContentBounds,resolveCssAnimationEasingType,resolveEmbeddedSvgTransform,resolveEmbeddedSvgViewportFrameBounds,resolveInlineContainerTransform,resolveMetadataQName,resolveRichTextStyleAt,resolveShapeGeometry,resolveShapeLocalObjectBounds,resolveShapeObjectBounds,resolveShapeReferenceTransform,resolveSvgGradientGeometry,resolveSvgLengthToken,resolveSvgPatternTile,resolveSvgViewport,resolveSymbolInstanceContent,resolveSymbolInstanceShapes,resolveSymbolInstanceTransform,resolveSymbolViewport,rewriteDocumentEmbeddedPayloads,rewriteIdReferencesInMarkup,rewriteShapeStateEmbeddedPayloads,rewriteSvgResourceReferenceValue,richTextFontVariantCss,richTextLineSpans,richTextRunsFromState,richTextStyleDelta,richTextStyleDeltasEqual,richTextStylesEqual,richTextTspanAttributes,rootMetadataAttrs,rootPaintServerDefId,rotateAffine,roundCoord,roundMarkupCoordinates,roundNumberString,roundSerializedShape,roundSnapshot,runsFromSegments,sanitizeRichTextFormatRanges,sanitizeXmlId,scaleAffine,scanCssFunctionTokens,scanCssLocalUrlTokens,senderCorrectionsForOp,serializeSvgPathData,serializedPresentationReader,shapeLocalObjectBounds,shapeLocalObjectCenter,shapeObjectBoundsInSpace,skewXAffine,skewYAffine,smilKeyframeAttributes,snapshotBoundsView,solveCubicBezier,solveSudoku,splinePathBounds,splitCssAnimationList,splitCssTopLevel,splitCssTopLevelRanges,splitTopLevelElements,stringifyDocument,stripAnimationDeclarations,strokePaintServerReference,substituteString,substituteVariables,symbolInstanceTargetId,synthesizeCssAnimationShorthand,templateVariablesCss,transformSplice,transformSvgPathData,translateAffine,translateSvgPathData,tryParseSvgTransformList,upsertResourceById,upsertResourceByKey,upsertResourceByName,upsertTrackKeyframe,validateDocumentOperations,validateOperation,validatePresenceOperation,validateSnapshot,validateSudokuPuzzle,verticesToPath,visitShapeTree,visitSnapshotShapeTrees});