diff --git a/.changeset/stale-geckos-grab.md b/.changeset/stale-geckos-grab.md new file mode 100644 index 0000000..7d8fce5 --- /dev/null +++ b/.changeset/stale-geckos-grab.md @@ -0,0 +1,5 @@ +--- +"penpot-exporter": minor +--- + +Implement component instances translation diff --git a/plugin-src/transformers/index.ts b/plugin-src/transformers/index.ts index 3d11807..86abd9b 100644 --- a/plugin-src/transformers/index.ts +++ b/plugin-src/transformers/index.ts @@ -4,6 +4,7 @@ export * from './transformDocumentNode'; export * from './transformEllipseNode'; export * from './transformFrameNode'; export * from './transformGroupNode'; +export * from './transformInstanceNode'; export * from './transformPageNode'; export * from './transformPathNode'; export * from './transformRectangleNode'; diff --git a/plugin-src/transformers/partials/index.ts b/plugin-src/transformers/partials/index.ts index be9a740..1963ba1 100644 --- a/plugin-src/transformers/partials/index.ts +++ b/plugin-src/transformers/partials/index.ts @@ -3,6 +3,7 @@ export * from './transformChildren'; export * from './transformCornerRadius'; export * from './transformDimensionAndPosition'; export * from './transformEffects'; +export * from './transformFigmaIds'; export * from './transformFills'; export * from './transformProportion'; export * from './transformRotationAndPosition'; diff --git a/plugin-src/transformers/partials/transformFigmaIds.ts b/plugin-src/transformers/partials/transformFigmaIds.ts new file mode 100644 index 0000000..01034f7 --- /dev/null +++ b/plugin-src/transformers/partials/transformFigmaIds.ts @@ -0,0 +1,22 @@ +import { ShapeBaseAttributes } from '@ui/lib/types/shapes/shape'; + +export const transformFigmaIds = ( + node: SceneNode +): Pick => { + return { + figmaId: normalizeNodeId(node.id), + figmaRelatedId: getRelatedNodeId(node.id) + }; +}; + +const getRelatedNodeId = (nodeId: string): string | undefined => { + const ids = nodeId.split(';'); + + if (ids.length > 1) { + return ids.slice(1).join(';'); + } +}; + +const normalizeNodeId = (nodeId: string): string => { + return nodeId.replace('I', ''); +}; diff --git a/plugin-src/transformers/transformBooleanNode.ts b/plugin-src/transformers/transformBooleanNode.ts index 55a8234..5e92423 100644 --- a/plugin-src/transformers/transformBooleanNode.ts +++ b/plugin-src/transformers/transformBooleanNode.ts @@ -3,6 +3,7 @@ import { transformChildren, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformSceneNode, @@ -21,6 +22,7 @@ export const transformBooleanNode = async ( type: 'bool', name: node.name, boolType: translateBoolType(node.booleanOperation), + ...transformFigmaIds(node), ...(await transformChildren(node, baseX, baseY)), ...(await transformFills(node)), ...transformEffects(node), diff --git a/plugin-src/transformers/transformComponentNode.ts b/plugin-src/transformers/transformComponentNode.ts index b20f2e9..c4cf704 100644 --- a/plugin-src/transformers/transformComponentNode.ts +++ b/plugin-src/transformers/transformComponentNode.ts @@ -5,6 +5,7 @@ import { transformCornerRadius, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformSceneNode, @@ -22,6 +23,7 @@ export const transformComponentNode = async ( type: 'component', name: node.name, path: '', + ...transformFigmaIds(node), ...(await transformFills(node)), ...transformEffects(node), ...(await transformStrokes(node)), diff --git a/plugin-src/transformers/transformEllipseNode.ts b/plugin-src/transformers/transformEllipseNode.ts index 48100b7..a21d8ae 100644 --- a/plugin-src/transformers/transformEllipseNode.ts +++ b/plugin-src/transformers/transformEllipseNode.ts @@ -2,6 +2,7 @@ import { transformBlend, transformDimension, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformRotationAndPosition, @@ -19,6 +20,7 @@ export const transformEllipseNode = async ( return { type: 'circle', name: node.name, + ...transformFigmaIds(node), ...(await transformFills(node)), ...transformEffects(node), ...(await transformStrokes(node)), diff --git a/plugin-src/transformers/transformFrameNode.ts b/plugin-src/transformers/transformFrameNode.ts index fe81391..55282bc 100644 --- a/plugin-src/transformers/transformFrameNode.ts +++ b/plugin-src/transformers/transformFrameNode.ts @@ -4,6 +4,7 @@ import { transformCornerRadius, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformSceneNode, @@ -41,6 +42,7 @@ export const transformFrameNode = async ( type: 'frame', name: node.name, showContent: isSectionNode(node) ? true : !node.clipsContent, + ...transformFigmaIds(node), ...(await transformFills(node)), ...frameSpecificAttributes, ...(await transformChildren(node, baseX + node.x, baseY + node.y)), diff --git a/plugin-src/transformers/transformGroupNode.ts b/plugin-src/transformers/transformGroupNode.ts index 9f0546e..2968ccd 100644 --- a/plugin-src/transformers/transformGroupNode.ts +++ b/plugin-src/transformers/transformGroupNode.ts @@ -2,6 +2,7 @@ import { transformBlend, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformSceneNode } from '@plugin/transformers/partials'; import { transformChildren } from '@plugin/transformers/partials'; @@ -14,6 +15,7 @@ export const transformGroupNode = async ( baseY: number ): Promise => { return { + ...transformFigmaIds(node), ...transformGroupNodeLike(node, baseX, baseY), ...transformEffects(node), ...transformBlend(node), diff --git a/plugin-src/transformers/transformInstanceNode.ts b/plugin-src/transformers/transformInstanceNode.ts new file mode 100644 index 0000000..5a357d6 --- /dev/null +++ b/plugin-src/transformers/transformInstanceNode.ts @@ -0,0 +1,64 @@ +import { + transformBlend, + transformChildren, + transformCornerRadius, + transformDimensionAndPosition, + transformEffects, + transformFigmaIds, + transformFills, + transformProportion, + transformSceneNode, + transformStrokes +} from '@plugin/transformers/partials'; + +import { ComponentInstance } from '@ui/types'; + +export const transformInstanceNode = async ( + node: InstanceNode, + baseX: number, + baseY: number +): Promise => { + const mainComponent = await node.getMainComponentAsync(); + + /** + * We do not want to process component instances in the following scenarios: + * + * 1. If the component does not have a main component. + * 2. If the component does not have parent (it comes from an external design system). + * 3. If the component is inside a component set, (it is a variant component). + */ + if ( + !mainComponent || + mainComponent.parent === null || + mainComponent.parent.type === 'COMPONENT_SET' + ) { + return; + } + + return { + type: 'instance', + mainComponentFigmaId: mainComponent.id, + isComponentRoot: isComponentRoot(node), + ...transformFigmaIds(node), + ...(await transformFills(node)), + ...transformEffects(node), + ...(await transformStrokes(node)), + ...transformSceneNode(node), + ...transformBlend(node), + ...transformProportion(node), + ...transformCornerRadius(node), + ...transformDimensionAndPosition(node, baseX, baseY), + ...(await transformChildren(node, baseX + node.x, baseY + node.y)) + }; +}; + +const isComponentRoot = (node: InstanceNode): boolean => { + let parent = node.parent; + while (parent !== null) { + if (parent.type === 'COMPONENT' || parent.type === 'INSTANCE') { + return false; + } + parent = parent.parent; + } + return true; +}; diff --git a/plugin-src/transformers/transformPathNode.ts b/plugin-src/transformers/transformPathNode.ts index d31cc91..5457312 100644 --- a/plugin-src/transformers/transformPathNode.ts +++ b/plugin-src/transformers/transformPathNode.ts @@ -2,6 +2,7 @@ import { transformBlend, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformSceneNode, @@ -23,6 +24,7 @@ export const transformPathNode = async ( return { type: 'path', name: node.name, + ...transformFigmaIds(node), ...(hasFillGeometry(node) ? await transformFills(node) : []), ...(await transformStrokes(node)), ...transformEffects(node), diff --git a/plugin-src/transformers/transformRectangleNode.ts b/plugin-src/transformers/transformRectangleNode.ts index f478ef9..0e432ea 100644 --- a/plugin-src/transformers/transformRectangleNode.ts +++ b/plugin-src/transformers/transformRectangleNode.ts @@ -3,6 +3,7 @@ import { transformCornerRadius, transformDimension, transformEffects, + transformFigmaIds, transformFills, transformProportion, transformRotationAndPosition, @@ -20,6 +21,7 @@ export const transformRectangleNode = async ( return { type: 'rect', name: node.name, + ...transformFigmaIds(node), ...(await transformFills(node)), ...transformEffects(node), ...(await transformStrokes(node)), diff --git a/plugin-src/transformers/transformSceneNode.ts b/plugin-src/transformers/transformSceneNode.ts index e18a08c..3231636 100644 --- a/plugin-src/transformers/transformSceneNode.ts +++ b/plugin-src/transformers/transformSceneNode.ts @@ -6,6 +6,7 @@ import { transformEllipseNode, transformFrameNode, transformGroupNode, + transformInstanceNode, transformPathNode, transformRectangleNode, transformTextNode, @@ -39,6 +40,8 @@ export const transformSceneNode = async ( return await transformBooleanNode(node, baseX, baseY); case 'COMPONENT': return await transformComponentNode(node, baseX, baseY); + case 'INSTANCE': + return await transformInstanceNode(node, baseX, baseY); } console.error(`Unsupported node type: ${node.type}`); diff --git a/plugin-src/transformers/transformTextNode.ts b/plugin-src/transformers/transformTextNode.ts index c9987bf..8298d88 100644 --- a/plugin-src/transformers/transformTextNode.ts +++ b/plugin-src/transformers/transformTextNode.ts @@ -2,6 +2,7 @@ import { transformBlend, transformDimensionAndPosition, transformEffects, + transformFigmaIds, transformProportion, transformSceneNode, transformStrokes, @@ -18,6 +19,7 @@ export const transformTextNode = async ( return { type: 'text', name: node.name, + ...transformFigmaIds(node), ...(await transformText(node)), ...transformDimensionAndPosition(node, baseX, baseY), ...transformEffects(node), diff --git a/plugin-src/transformers/transformVectorNode.ts b/plugin-src/transformers/transformVectorNode.ts index 1193b79..29fab02 100644 --- a/plugin-src/transformers/transformVectorNode.ts +++ b/plugin-src/transformers/transformVectorNode.ts @@ -1,4 +1,4 @@ -import { transformVectorPaths } from '@plugin/transformers/partials'; +import { transformFigmaIds, transformVectorPaths } from '@plugin/transformers/partials'; import { GroupShape } from '@ui/lib/types/shapes/groupShape'; import { PathShape } from '@ui/lib/types/shapes/pathShape'; @@ -21,12 +21,14 @@ export const transformVectorNode = async ( if (children.length === 1) { return { ...children[0], - name: node.name + name: node.name, + ...transformFigmaIds(node) }; } return { ...transformGroupNodeLike(node, baseX, baseY), + ...transformFigmaIds(node), children }; }; diff --git a/ui-src/lib/penpot.js b/ui-src/lib/penpot.js index ff1d854..858f65b 100644 --- a/ui-src/lib/penpot.js +++ b/ui-src/lib/penpot.js @@ -3724,96 +3724,96 @@ GQ),c=a?.y1??B.j(a,HQ),e=a?.x2??B.j(a,EQ),h=a?.y2??B.j(a,FQ),I.U(a,ZP,Math.min(b M,[XP(b,c),XP(b+e,c),XP(b+e,c+a),XP(b,c+a)],null)):null},JQ=function(a){var b=a?.x??B.j(a,ZP),c=a?.y??B.j(a,YP),e=a?.width??B.j(a,xz);a=a?.height??B.j(a,DQ);return Qp(b,c,e,a)?XP(b+e/2,c+a/2):null},LQ=function(a){var b=p(a);if(b)for(var c=a=Infinity,e=-Infinity,h=-Infinity;;){var m=t(b);if(g(m)){var q=m;m=q?.x??B.j(q,ZP);q=q?.y??B.j(q,YP);a=Math.min(a,m);c=Math.min(c,q);e=Math.max(e,m);h=Math.max(h,q);b=ke(b)}else return Qp(a,c,e,h)?KQ.ba(a,c,e-a,h-c):null}else return null},OQ=function(a){if(p(a)){var b= Qf(Hoa,MQ,Infinity,a),c=Qf(Ioa,MQ,Infinity,a),e=Qf(Joa,NQ,-Infinity,a);a=Qf(Koa,NQ,-Infinity,a);return Qp(b,c,e,a)?KQ.ba(b,c,e-b,a-c):null}return null},PQ=function(a,b){var c=a?.x??B.j(a,ZP),e=a?.y??B.j(a,YP),h=c+(a?.width??B.j(a,xz));a=e+(a?.height??B.j(a,DQ));var m=b?.x??B.j(b,ZP),q=b?.y??B.j(b,YP),r=m+(b?.width??B.j(b,xz));b=q+(b?.height??B.j(b,DQ));return(h>m||Eo(h-m))&&(r>=c||Eo(r-c))&&(q<=a||Eo(q-a))&&(e<=b||Eo(e-b))},QQ=function(a,b){var c=ZP.J(a),e=YP.J(a),h=ZP.J(a)+xz.J(a);a=YP.J(a)+DQ.J(a); var m=ZP.J(b);b=YP.J(b);return(m>c||Eo(m-c))&&(me||Eo(b-e))&&(be?Yp.ba(I.N(a,DQ,h),YP,kJ,(h-e)/2):a;return heQ(a,b)},kpa=function(a,b,c){return new f(null,3,[UR,a,VR,b,nB,c],null)},lpa=function(a,b){b=x.j(WR,HR.J(b))?MR(UR.J(a)):b;var c=GR(b);return Yp.ba(I.N(a, -VR,c),nB,hg,b)},YR=function(a){var b=qc(function(c,e){var h=A(e,0,null),m=A(e,1,null);if(null!=m){e=hg.j;m=wq.J(m);var q=G(m);m=B.j(q,ZP);q=B.j(q,YP);var r=wq.J(h),u=G(r);r=B.j(u,NR);var w=B.j(u,OR),z=B.j(u,PR);u=B.j(u,QR);m=Yp.U(h,wq,I,ZP,m,YP,y([q]));h=x.j(RR,HR.J(h))?Yp.U(m,wq,I,NR,z,OR,y([u,PR,r,QR,w])):m;c=e.call(hg,c,h)}return c},new K(null,1,5,M,[KR(VR.J(a))],null),ig(Kp(nB.J(a))));return kpa(VR.J(a),UR.J(a),b)},ZR=function(a){return qc(function(b,c){var e=x.j(IR,HR.J(c)),h=He(b)-1;e?(e=hg.j, -h=GR(c),b=e.call(hg,b,kpa(h,h,new K(null,1,5,M,[c],null)))):b=0<=h?Yp.ba(b,h,lpa,c):b;return b},fi,a)},$R=function(a,b){return I.N(Yp.ba(a,nB,Lp,ke(nB.J(b))),VR,VR.J(b))},mpa=function(a,b){return qc(function(c,e){var h=A(c,0,null);c=A(c,1,null);return TR(VR.J(e),UR.J(e))?new K(null,2,5,M,[h,hg.j(c,e)],null):TR(VR.J(h),UR.J(e))?new K(null,2,5,M,[$R(h,e),c],null):TR(UR.J(h),VR.J(e))?new K(null,2,5,M,[$R(e,h),c],null):TR(VR.J(h),VR.J(e))?new K(null,2,5,M,[$R(h,YR(e)),c],null):TR(UR.J(h),UR.J(e))?new K(null, -2,5,M,[$R(YR(e),h),c],null):new K(null,2,5,M,[h,hg.j(c,e)],null)},new K(null,2,5,M,[a,fi],null),b)},npa=function(a){return TR(UR.J(a),VR.J(a))},aS=function(a){var b=ZR(a);a:{a=fi;var c=t(b);for(b=ke(b);;)if(null!=c){var e=npa(c)?new K(null,2,5,M,[c,b],null):mpa(c,b);b=A(e,0,null);e=A(e,1,null);x.j(c,b)?(a=hg.j(a,b),c=t(e),b=ke(e)):(c=b,b=e)}else break a}return Zi.j(fi,ai(nB,y([a])))},opa=function(a){a=nB.J(t(ZR(a)));var b=t(a);a=ke(a);for(var c=null,e=0;;){if(null==b)return 0h)return b=-b/3,b=Math.sqrt(b*b*b),c=-c/(2*b),c=Math.acos(-1>c?-1:1e?Bo(-e):-Bo(e),new K(null,2,5,M,[2*b-a/3,-b-a/3],null);c=Math.sqrt(h);b=Bo(c-e);return new K(null,1,5,M,[b-Bo(c+e)-a/3],null)},dS=function(a){var b=A(a,0,null),c=A(a,1,null),e=A(a,2,null);a=A(a,3,null);return wpa(b,c,e,a)},wpa=function(a,b,c,e){a=new K(null,2,5,M,[new K(null,4,5,M,[ZP.J(a),ZP.J(c),ZP.J(e),ZP.J(b)],null),new K(null,4,5,M,[YP.J(a),YP.J(c),YP.J(e),YP.J(b)],null)],null);return gi(function(h){return.01h},ai(function(h){var m=A(h,0,null),q=A(h,1,null),r=A(h, -2,null);h=A(h,3,null);return vpa(-3*m+9*q+-9*r+3*h,6*m+-12*q+6*r,3*q+-3*m,0)},y([a])))},xpa=function(a,b,c,e){a=new K(null,1,5,M,[new K(null,4,5,M,[B.j(a,YP),B.j(c,YP),B.j(e,YP),B.j(b,YP)],null)],null);return gi(function(h){return 0<=h&&1>=h},ai(function(h){var m=A(h,0,null),q=A(h,1,null),r=A(h,2,null);h=A(h,3,null);return vpa(3*m+-6*q+3*r,-3*m+3*q,m,-m+3*q+-3*r+h)},y([a])))},gS=function(a){var b=eS.J(a);return new K(null,2,5,M,[b,fS.J(a)],null)},hS=function(a){var b=eS.J(a);return new K(null,4,5, -M,[b,fS.J(a),aQ(NR.J(wq.J(a)),OR.J(wq.J(a))),aQ(PR.J(wq.J(a)),QR.J(wq.J(a)))],null)},iS=function(a){var b=function(){for(var c=ck,e=null,h=null,m=p(a);;)if(m){var q=t(m),r=fS.J(q),u=function(){var E=HR.J(q),H=E instanceof D?E.na:null;switch(H){case "move-to":return new K(null,3,5,M,[r,r,g(r)?new K(null,1,5,M,[r],null):null],null);case "close-path":return new K(null,3,5,M,[h,h,g(h)?new K(null,1,5,M,[h],null):null],null);case "line-to":return new K(null,3,5,M,[r,h,g(function(){var J=e;return g(J)?r: -J}())?new K(null,2,5,M,[e,r],null):null],null);case "curve-to":return new K(null,3,5,M,[r,h,function(){var J=fS.j(q,ypa),O=fS.j(q,zpa),P=new K(null,4,5,M,[e,r,J,O],null);return g(function(){var W=e;return g(W)?(W=r,g(W)?g(J)?O:J:W):W}())?Zi.j(new K(null,2,5,M,[e,r],null),Nh.j(function(W,V,Z,ba,qa,ra,sa){return function(Ea){return cS(sa,Ea)}}(c,e,h,m,J,O,P,E,H,q,r),dS(P))):null}()],null);default:return new K(null,3,5,M,[r,h,fi],null)}}(),w=A(u,0,null),z=A(u,1,null);u=A(u,2,null);u=Qg(hg,c,u);var C= -v(m);c=u;e=w;h=z;m=C}else return c}();b=Ye(b)?Gh(fS,a):b;return op(b)?LQ(b):KQ.aa()},Apa=function(a,b){function c(q){var r=G(q),u=B.j(r,ZP),w=B.j(r,YP),z=B.j(r,NR),C=B.j(r,OR);q=B.j(r,PR);var E=B.j(r,QR);r=Pp(u,w)?e(r,ZP,YP):r;z=Pp(z,C)?e(r,NR,OR):r;return Pp(q,E)?e(z,PR,QR):z}function e(q,r,u){q=g(yo(h))?Yp.ba(q,r,wy,h):q;return g(yo(m))?Yp.ba(q,u,wy,m):q}var h=ZP.J(b),m=YP.J(b);return Zi.N(fi,Nh.J(function(q){return Yp.N(q,wq,c)}),a)},jS=function(a,b){if(null!=b){var c=function(h,m,q){var r=jQ(aQ(B.j(h, -m),B.j(h,q)),b);return I.U(h,m,ZP.J(r),y([q,YP.J(r)]))},e=function(h){var m=G(h),q=B.j(m,ZP),r=B.j(m,NR);h=B.j(m,PR);m=null!=q?c(m,ZP,YP):m;r=null!=r?c(m,NR,OR):m;return null!=h?c(r,PR,QR):r};return Zi.N(fi,Nh.J(function(h){return Yp.N(h,wq,e)}),a)}return a},kS=function(a,b){var c=A(a,0,null),e=G(c);c=B.j(e,ZP);e=B.j(e,YP);a=A(a,1,null);var h=G(a);a=B.j(h,ZP);h=B.j(h,YP);var m=G(b);b=B.j(m,ZP);m=B.j(m,YP);return Eo(c-a)&&Eo(e-h)?Infinity:Eo(c-a)?(m-e)/(h-e):(b-c)/(a-c)},lS=function(a,b,c){var e=tpa(a, -b,c);a=A(e,0,null);b=A(e,1,null);c=nt.j(function(h){return cS(e,h)},dS(e));return LQ(Zi.j(new K(null,2,5,M,[a,b],null),c))},mS=function(a,b){var c=A(b,0,null),e=A(b,1,null);b=G(c);c=B.j(b,ZP);b=B.j(b,YP);var h=G(e);e=B.j(h,ZP);h=B.j(h,YP);var m=G(a);a=B.j(m,ZP);m=B.j(m,YP);h=Eo(c-e)?null:(h-b)/(e-c);b=null!=h?h*a+-h*c+b:null;return Eo(c-e)&&Eo(a-c)||null!=b&&Eo(m-b)},Bpa=function(a,b){return function m(e,h){var q=lS(b,e,h);if(QQ(q,a)){if(Eo(e-h))return.1>eQ(cS(b,e),a);q=e+(h-e)/2;e=m(e,q);return g(e)? -e:m(q,h)}return null}(0,1)},Cpa=function(a,b){var c=A(a,0,null),e=A(a,1,null),h=A(b,0,null),m=A(b,1,null),q=G(c),r=B.j(q,ZP);q=B.j(q,YP);var u=G(e),w=B.j(u,ZP);u=B.j(u,YP);var z=G(h),C=B.j(z,ZP);z=B.j(z,YP);var E=G(m),H=B.j(E,ZP),J=B.j(E,YP);E=(C-H)*(r*u-q*w)-(r-w)*(C*J-z*H);var O=(z-J)*(r*u-q*w)-(q-u)*(C*J-z*H);r=(r-w)*(z-J)-(q-u)*(C-H);if(Eo(r))return mS(h,a)?new K(null,2,5,M,[kS(a,h),0],null):mS(m,a)?new K(null,2,5,M,[kS(a,m),1],null):mS(e,b)?new K(null,2,5,M,[1,kS(b,e)],null):mS(c,b)?new K(null, -2,5,M,[0,kS(b,c)],null):null;c=XP(E/r,O/r);a=kS(a,c);b=kS(b,c);return new K(null,2,5,M,[a,b],null)},Dpa=function(a,b){var c=A(a,0,null),e=A(a,1,null);a=A(b,0,null);var h=A(b,1,null),m=A(b,2,null);b=A(b,3,null);var q=YP.J(e)-YP.J(c);e=ZP.J(e)-ZP.J(c);e=180*Math.atan2(q,e)/Math.PI;q=sQ.aa();e=uQ.j(q,nS.J(-e));c=yQ(e,dQ(c));m=new K(null,4,5,M,[jQ(a,c),jQ(h,c),jQ(m,c),jQ(b,c)],null);c=A(m,0,null);a=A(m,1,null);h=A(m,2,null);m=A(m,3,null);return xpa(c,a,h,m)},Epa=function(a,b){var c=gi(function(e){var h= -cS(b,e);e=qpa(b,e);e=uoa(e);return 0YP.J(e)?1:0;return new K(null,2,5,h,[m,e],null)},c)},Fpa=function(a,b){var c=gi(function(h){h=Eo(h)?0:h;var m=cS(b,h);m=kS(a,m);return 0<=h&&1>=h&&0<=m&&1>=m},Dpa(a,b)),e=nt.j(function(h){return cS(b,h)},c);e=nt.j(function(h){return kS(a,h)},e);return new K(null,2,5,M,[e,c],null)},Ipa=function(a,b){function c(e){e=G(e);var h=B.j(e,bM),m=B.j(e,$L); -return function(q){var r=G(q);q=B.j(r,bM);r=B.j(r,$L);return 2<=eQ(q,h)&&2<=eQ(r,m)}}return function(e){var h=t(e);e=ke(e);for(var m=fi,q=fi;;){if(null==h)return new K(null,2,5,M,[m,q],null);e=ci.j(c(h),e);m=hg.j(m,Gpa.J(h));q=hg.j(q,Hpa.J(h));h=t(e);e=ke(e)}}(kI.j(gy,function u(h,m,q,r){var w=lS(a,h,m),z=lS(b,q,r);if(PQ(w,z)){w=cS(a,h);z=cS(b,q);if(.1>eQ(w,z))return new K(null,1,5,M,[new f(null,5,[bM,w,$L,z,gy,eQ(w,z),Gpa,Co(h,4),Hpa,Co(q,4)],null)],null);z=h+(m-h)/2;var C=q+(r-q)/2;w=u(h,z,q,C); -h=u(h,z,C,r);q=u(z,m,q,C);m=u(z,m,C,r);return Lp.U(w,y([h,q,m]))}return null}(0,1,0,1)))},Jpa=function(a,b){return th(function(c){var e=HR.J(c);switch(e instanceof D?e.na:null){case "line-to":return c=gS(c),(e=mS(a,c))?(c=kS(c,a),c=(0c||Eo(c-1))):c=e,c;case "curve-to":return Bpa(a,hS(c));default:return!1}},b)},Kpa=function(a){return Zi.N(fi,$h(nB),ZR(aS(a)))},Lpa=function(a,b){b=G(b);b=B.j(b,UQ);return YP.J(a)>=HQ.J(b)&&YP.J(a)<=FQ.J(b)},qS=function(a){return nt.j(function(b){return new f(null, -4,[HR,HR.J(b),Mpa,b,oS,x.j(LR,HR.J(b))?gS(b):hS(b),UQ,pS.J(b)],null)},ci.j(function(b){return Xj.j(x.j(LR,HR.J(b)),x.j(RR,HR.J(b)))},Kpa(a)))},Npa=function(a,b){var c=new K(null,2,5,M,[a,aQ(ZP.J(a)+1,YP.J(a))],null);return Xj.j(0,Lf(wy,Nh.j(Oe,ai(function(e){var h=HR.J(e);switch(h instanceof D?h.na:null){case "line-to":e=oS.J(e);var m=A(e,0,null),q=A(e,1,null);h=new K(null,2,5,M,[a,aQ(ZP.J(a)+1,YP.J(a))],null);var r;if(r=null!=m){r=YP.J(m);var u=YP.J(a);r=Eo(r-u)}m=r?Yp.ba(m,YP,wy,10):m;if(r=null!= -q)r=YP.J(q),u=YP.J(a),r=Eo(r-u);q=r?Yp.ba(q,YP,wy,10):q;q=Cpa(h,new K(null,2,5,M,[m,q],null));h=A(q,0,null);var w=A(q,1,null);null!=w&&null!=h&&0w||Eo(w-1))?(q=h=M,m=bS(e,w),r=A(e,0,null),u=A(e,1,null),e=bS(e,w),e=YP.J(e),u=YP.J(u),r=YP.J(r),e=new K(null,1,5,h,[new K(null,2,5,q,[m,0e-u&&!Eo(e-u)?-1:0>e-r?1:0h},c);if(Ye(c))return new K(null,1,5,M,[b],null);var e=GR(b);b=Zi.j(hk(),hg.j(c,1));return nt.j(function(h){return MR(nQ(a,e,h))},b)},Ppa=function(a,b,c){c=ci.j(function(q){return 0q},c);if(Ye(c))return new K(null,1,5,M,[b],null);var e=GR(b);b=wq.J(b);var h=aQ(NR.J(b),OR.J(b)),m=aQ(PR.J(b),QR.J(b));b=Zi.j(hk(),hg.U(c,0,y([1])));return nt.j(function(q){var r=A(q,0,null);q=A(q,1,null);var u=spa(a,e,h,m,q,r);A(u,0,null);r=A(u,1,null);q=A(u,2,null);u=A(u,3,null);return SR(r,q,u)},ke(Kp(b)))}, -Qpa=function(a,b){var c=G(a),e=B.j(c,rS),h=B.j(c,sS),m=function(){var u=tS.j(a,sQ.aa());u=g(e)?wQ(u,XP(-1,1)):u;return g(h)?wQ(u,XP(1,-1)):u}();c=function(){var u=sQ.aa();u=g(e)?wQ(u,XP(-1,1)):u;u=g(h)?wQ(u,XP(1,-1)):u;return uQ.j(u,uS.j(a,sQ.aa()))}();var q=function(){var u=a?.bb??B.j(a,UQ);u=null==u?null:JQ(u);return g(u)?u:JQ(iS(b))}(),r=jS(b,AQ(q,c));m=WQ(IQ(iS(r)),q,m);q=TQ(m);c=LQ(WQ(m,q,c));return new K(null,2,5,M,[m,c],null)},xS=function(a){var b=yf(a,vS)?Of:aS,c;if(c=x.j(Ez,Q.J(a)))a=wS.J(a), -b=b.J?b.J(a):b(a),c=!sh(npa,ZR(b));return c},yS=function(a,b){return nt.j(function(c){var e=A(c,0,null);c=A(c,1,null);e=null==c&&null!=b?I.N(e,eS,b):e;return null!=c?I.N(e,eS,fS.J(c)):e},Kp(a))},Rpa=function(a){for(var b=t(a),c=ke(a),e=fi,h=a=null;;){if(null==b)return e;var m=fS.J(b);h=x.j(WR,HR.J(b))&&(null==h||.01>eQ(h,a))?null:x.j(WR,HR.J(b))?MR(a):b;b=t(c);c=ke(c);e=null!=h?hg.j(e,h):e;a=x.j(IR,HR.J(h))?m:a;h=m}},Spa=function(a,b){return x.j(LR,HR.J(a))&&x.j(LR,HR.J(b))?(a=gS(a),b=gS(b),a=Cpa(a, -b),b=A(a,0,null),a=A(a,1,null),null!=b&&null!=a&&(0b||Eo(b-1))&&(0a||Eo(a-1))?new K(null,2,5,M,[new K(null,1,5,M,[b],null),new K(null,1,5,M,[a],null)],null):null):x.j(LR,HR.J(a))&&x.j(RR,HR.J(b))?Fpa(gS(a),hS(b)):x.j(RR,HR.J(a))&&x.j(LR,HR.J(b))?(a=Fpa(gS(b),hS(a)),b=A(a,0,null),a=A(a,1,null),new K(null,2,5,M,[a,b],null)):x.j(RR,HR.J(a))&&x.j(RR,HR.J(b))?Ipa(hS(a),hS(b)):new K(null,2,5,M,[fi,fi],null)},Tpa=function(a,b,c,e){function h(w,z,C){return Zi.N(fi,$h(function(E){return m(E, -z,C)}),w)}function m(w,z,C){return g(r(w,C))?qc(function(E,H){return Zi.N(fi,$h(function(J){if(fc(q(J,H)))J=new K(null,1,5,M,[J],null);else{var O=Spa(J,H),P=A(O,0,null);A(O,1,null);b:switch(O=HR.J(J),O instanceof D?O.na:null){case "line-to":P=Opa(eS.J(J),J,P);break b;case "curve-to":P=Ppa(eS.J(J),J,P);break b;default:P=new K(null,1,5,M,[J],null)}J=yS(P,eS.J(J))}return J}),E)},new K(null,1,5,M,[w],null),ci.j(function(E){return q(w,E)},z)):new K(null,1,5,M,[w],null)}function q(w,z){if(x.j(IR,HR.J(w))|| -x.j(IR,HR.J(z)))return!1;w=u(w);z=u(z);return PQ(w,z)}function r(w,z){if(x.j(IR,HR.J(w)))return!1;w=u(w);return PQ(w,z)}var u=ml(pS);return new K(null,2,5,M,[h(a,b,e),h(b,a,c)],null)},Upa=function(a){return yf(a,eS)&&yf(new bk(null,new f(null,2,[LR,null,RR,null],null),null),HR.J(a))},zS=function(a,b,c,e){a:{var h=HR.J(a);h=h instanceof D?h.na:null;switch(h){case "line-to":a=bS(gS(a),.5);break a;case "curve-to":a=cS(hS(a),.5);break a;default:throw Error(["No matching clause: ",k.J(h)].join(""));}}return(c= -QQ(c,a))?(e=Npa(a,e))?e:Jpa(a,b):c},Vpa=function(a,b){return null!=tp(function(c){if(x.j(HR.J(a),HR.J(c))&&yf(new bk(null,new f(null,2,[LR,null,RR,null],null),null),HR.J(a))){var e=HR.J(a);e=e instanceof D?e.na:null;switch(e){case "line-to":var h=gS(a);e=A(h,0,null);h=A(h,1,null);var m=gS(c),q=A(m,0,null),r=A(m,1,null);return.1>eQ(e,q)&&.1>eQ(h,r)||.1>eQ(e,r)&&.1>eQ(h,q)?new K(null,2,5,M,[a,c],null):null;case "curve-to":q=hS(a);e=A(q,0,null);h=A(q,1,null);m=A(q,2,null);var u=A(q,3,null),w=hS(c);q= -A(w,0,null);r=A(w,1,null);var z=A(w,2,null);w=A(w,3,null);return.1>eQ(e,q)&&.1>eQ(h,r)&&.1>eQ(m,z)&&.1>eQ(u,w)||.1>eQ(e,r)&&.1>eQ(h,q)&&.1>eQ(m,w)&&.1>eQ(u,z)?new K(null,2,5,M,[a,c],null):null;default:throw Error(["No matching clause: ",k.J(e)].join(""));}}else return null},b)},Wpa=function(a){var b=t(a);a=ke(a);for(var c=null,e=fi;;){if(null==b)return e;var h=Xj.j(eS.J(b),c)?hg.j(e,KR(eS.J(b))):e;c=t(a);a=ke(a);e=fS.J(b);h=hg.j(h,ln.j(b,eS));b=c;c=e;e=h}},Xpa=function(a,b,c,e,h,m){var q=qS(a),r= -qS(c),u=zh.j(ci.j(function(C){return fc(zS(C,c,m,r))},b),ci.j(function(C){return fc(zS(C,a,h,q))},e)),w=qS(u),z=iS(Wpa(u));e=ci.j(function(C){var E=zS(C,a,h,q);if(g(E)){if(E=Vpa(C,b)){a:switch(E=HR.J(C),E=E instanceof D?E.na:null,E){case "line-to":C=bS(gS(C),.5);break a;case "curve-to":C=cS(hS(C),.5);break a;default:throw Error(["No matching clause: ",k.J(E)].join(""));}E=!(QQ(z,C)&&Npa(C,w))}C=E}else C=E;return C},e);return Lp.U(u,y([e]))},Ypa=function(a,b,c,e,h,m){var q=qS(a),r=qS(c);return Lp.U(ci.j(function(u){return fc(zS(u, -c,m,r))},b),y([ci.j(function(u){var w=zS(u,a,h,q);return g(w)?!Vpa(u,b):w},e)]))},Zpa=function(a,b,c,e,h,m){var q=qS(a),r=qS(c);return Lp.U(ci.j(function(u){return zS(u,c,m,r)},b),y([ci.j(function(u){return zS(u,a,h,q)},e)]))},$pa=function(a,b,c){var e=Xj.j(KE,a)&&x.j(opa(c),opa(b)),h=yS(Rpa(b),null),m=yS(function(){var C=Rpa(c);return e?Zi.j(fi,ai(nB,y([ig(nt.j(YR,ZR(C)))]))):C}(),null),q=iS(h),r=iS(m),u=Tpa(h,m,q,r);b=A(u,0,null);u=A(u,1,null);var w=ci.j(Upa,yS(b,null)),z=ci.j(Upa,yS(u,null));b= -function(){var C=a instanceof D?a.na:null;switch(C){case "union":return Xpa(h,w,m,z,q,r);case "difference":return Ypa(h,w,m,z,q,r);case "intersection":return Zpa(h,w,m,z,q,r);case "exclude":return Lp.U(w,y([z]));default:throw Error(["No matching clause: ",k.J(C)].join(""));}}();return aS(Wpa(b))},aqa=function(a,b){return p(b)?Zi.j(fi,Lf(xh($pa,a),b)):fi},AS=function(a,b){return Eo(b)?Infinity:a/b},bqa=function(a){a=G(a);var b=B.j(a,xz),c=B.j(a,DQ);a=B.j(a,BS);null==a||Eo(a)?a=0:(b=AS(b,2*a),b=1c?a*c:a);return a},cqa=function(a){var b=G(a),c=B.j(b,xz),e=B.j(b,DQ);a=B.j(b,CS);var h=B.j(b,DS),m=B.j(b,ES);b=B.j(b,FS);if(null!=a&&null!=h&&null!=m&&null!=b){var q=AS(c,a+h);q=1e?new K(null,4,5,M,[a*e,h*e,m*e,b*e],null):new K(null,4,5,M,[a,h,m,b],null)}else a=new K(null,4,5,M,[a,h,m,b],null);return a},GS=function(a,b,c,e){var h=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return ZP.J(a); -case "top-right":return ZP.J(a)-e;case "bottom-right":return ZP.J(b)-e;case "bottom-left":return ZP.J(b);default:throw Error(["No matching clause: ",k.J(E)].join(""));}}(),m=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return YP.J(a)-e;case "top-right":return YP.J(a);case "bottom-right":return YP.J(b)-2*e;case "bottom-left":return YP.J(b)-e;default:throw Error(["No matching clause: ",k.J(E)].join(""));}}(),q=2*e,r=2*e,u=h+q/2*.448084975506,w=h+q/2*1.5519150244939999,z=m+r/2* -.448084975506,C=m+r/2*1.5519150244939999;h=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return I.N(a,YP,z);case "top-right":return I.N(a,ZP,w);case "bottom-right":return I.N(a,YP,C);case "bottom-left":return I.N(a,ZP,u);default:throw Error(["No matching clause: ",k.J(E)].join(""));}}();m=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return I.N(b,ZP,u);case "top-right":return I.N(b,YP,z);case "bottom-right":return I.N(b,ZP,w);case "bottom-left":return I.N(b, -YP,C);default:throw Error(["No matching clause: ",k.J(E)].join(""));}}();return SR(b,h,m)},dqa=function(a){var b=G(a),c=B.j(b,ZP);a=B.j(b,YP);var e=B.j(b,xz),h=B.j(b,DQ),m=c+e/2,q=a+h/2;b=XP(m,a);var r=XP(c+e,q);m=XP(m,a+h);q=XP(c,q);var u=c+e/2*.448084975506;c+=e/2*1.5519150244939999;e=a+h/2*.448084975506;a+=h/2*1.5519150244939999;return new K(null,5,5,M,[KR(b),SR(r,I.N(b,ZP,c),I.N(r,YP,e)),SR(m,I.N(r,YP,a),I.N(m,ZP,c)),SR(q,I.N(m,ZP,u),I.N(q,YP,a)),SR(b,I.N(q,YP,e),I.N(b,ZP,u))],null)},iqa=function(a, -b,c,e,h,m,q,r){var u=XP(a,b+h),w=XP(a+h,b),z=XP(c+a+-m,b),C=XP(c+a,b+m),E=XP(c+a,e+b+-q),H=XP(c+a+-q,e+b);c=XP(a+r,e+b);b=XP(a,e+b+-r);var J=e=a=hg.j,O=hg.j,P=hg.j(fi,KR(u));h=Xj.j(u,w)?hg.j(P,GS(u,w,eqa,h)):P;h=O.call(hg,h,MR(z));m=Xj.j(z,C)?hg.j(h,GS(z,C,fqa,m)):h;m=J.call(hg,m,MR(E));q=Xj.j(E,H)?hg.j(m,GS(E,H,gqa,q)):m;q=e.call(hg,q,MR(c));r=Xj.j(c,b)?hg.j(q,GS(c,b,hqa,r)):q;return a.call(hg,r,MR(u))},lqa=function(a){var b=G(a);a=B.j(b,ZP);var c=B.j(b,YP),e=B.j(b,xz),h=B.j(b,DQ),m=g(CS.J(b))?jqa: -kqa;switch(m instanceof D?m.na:null){case "radius-1":return b=bqa(b),iqa(a,c,e,h,b,b,b,b);case "radius-4":var q=cqa(b);b=A(q,0,null);m=A(q,1,null);var r=A(q,2,null);q=A(q,3,null);return iqa(a,c,e,h,b,m,r,q);default:return fi}},oqa=function(a,b){var c=Zh.j(Nh.J(function(h){return B.j(b,h)}),Nh.J(function(h){return HS?HS(h,b):mqa(h,b)}));c=Zi.N(fi,c,xR.J(a));var e=Pe(c);e=Yj(e,nqa);c=Zi.N(fi,Zh.j(ci.J(function(h){return x.j(Ez,Q.J(h))}),$h(function(h){h=wS.J(h);var m=t(h);return g(g(m)?JR.J(m):m)?Yp.qa(h, -0,I,JR,!1):h})),c);return zp(Yg.U(y([I.N(I.N(a,Q,Ez),wS,c),e])),IS)},pqa=function(a,b){var c=Nh.j(function(h){return HS?HS(h,b):mqa(h,b)},Nh.j(function(h){return B.j(b,h)},xR.J(a))),e=JS.J(a);c=aqa(e,nt.j(wS,c));return zp(I.N(I.N(a,Q,Ez),wS,c),IS)},mqa=function(a){switch(arguments.length){case 1:return HS(arguments[0],F);case 2:return HS(arguments[0],arguments[1]);default:throw Error(["Invalid arity: ",k.J(arguments.length)].join(""));}},HS=function(a,b){var c=G(a),e=B.j(c,Q),h=B.j(c,KS);switch(e instanceof -D?e.na:null){case "group":case "frame":return oqa(c,b);case "bool":return pqa(c,b);case "rect":case "circle":case "image":case "text":a:switch(e instanceof D?e.na:null){case "circle":a=dqa(c);break a;default:a=lqa(c)}b=function(){var q=tS.j(c,sQ.aa());q=g(rS.J(c))?wQ(q,XP(-1,1)):q;return g(sS.J(c))?wQ(q,XP(1,-1)):q}();var m=null!=b?jS(a,AQ(VQ(c),b)):a;return zp(function(){var q=I.N(I.N(c,Q,Ez),wS,m);return x.j(LS,e)?I.N(q,MS,h):q}(),IS);default:return c}},OS=function(a,b){var c=Zh.U(Nh.J(xh(B,b)), -ci.J(Zh.j(fc,DR)),Jo.J(NS),y([Nh.J(function(e){return HS(e,b)}),Nh.J(wS)]));c=Zi.N(fi,c,xR.J(a));return aqa(JS.J(a),c)},qqa=function(a,b){return Yp.N(a,at,function(c){return nt.j(function(e){return Yp.ba(Yp.ba(Yp.ba(Yp.ba(e,PS,QS,b),RS,QS,b),SS,QS,b),TS,QS,b)},c)})},rqa=function(a,b){return Yp.N(a,US,function(c){return nt.j(function(e){return Yp.ba(e,VS,QS,b)},c)})},XS=function(a,b){return WS(Of,a,b)},WS=function(a,b,c){return HK(function(e){var h=(h=df(e))?a.J?a.J(e):a(e):h;return g(h)?b.J?b.J(e): -b(e):e},c)},YS=function(a,b){return p(ci.j(a,bi(df,fq,b)))},sqa=function(a){return"string"===typeof ZH.J(a)&&Xj.j(ZH.J(a),"")},tqa=function(a){return x.j("paragraph",Q.J(a))},aT=function(a){return FR.J(a)&&x.j(ZS,$S.J(a))},cT=function(a){return FR.J(a)&&x.j(bT,$S.J(a))},uqa=function(a){var b=FR.J(a);return b?(a=$S.J(a),x.j(ZS,a)||x.j(bT,a)):b},vqa=function(a){a=G(a);var b=B.j(a,dT);a=function(){var e=zo(eT.J(b),0);return g(e)?e:0}();var c=function(){var e=zo(fT.J(b),0);return g(e)?e:0}();return new K(null, -2,5,M,[a,c],null)},wqa=function(a){var b=G(a);a=B.j(b,gT);var c=G(a),e=B.j(c,hT),h=B.j(c,iT);a=B.j(c,jT);c=B.j(c,kT);b=B.j(b,lT);e=g(e)?e:0;h=g(h)?h:0;a=g(a)?a:0;c=g(c)?c:0;return x.j(b,mT)?new K(null,4,5,M,[e,h,a,c],null):new K(null,4,5,M,[e,h,e,h],null)},zqa=function(a){a=G(a);a=B.j(a,nT);return x.j(xqa,a)||x.j(yqa,a)},pT=function(a){a=oT.J(a);return g(a)?a:0},Aqa=function(a,b,c){var e=A(b,0,null);b=A(b,1,null);var h=A(c,0,null);c=A(c,1,null);return pT(b)>pT(c)?1:pT(b)h;return m?a:m}())?1:eh?-1:0},Bqa=function(a,b){function c(e){return x.j(Q.J(e),qT)?Yp.ba(e,ep,QS,b):e}return Yp.N(Yp.N(a,rT,function(e){return nt.j(c,e)}),sT,function(e){return nt.j(c,e)})},Dqa=function(a){var b=G(new f(null,1,[tT,!0],null)),c=B.N(b,tT,!1);b=B.N(b,Cqa,!1);b=g(b)?xh(Jo,Zh.j(Ye,xR)):Of;c=y([tT,c]);var e=G(a);a=B.j(e,uT);e=B.j(e,vT);c=G(c);c=B.N(c,tT,!1);e=x.j(e,LI)?yk(LI,uo):yk(uo,LI);c=g(c)?xh(kI,Zh.j(e,Oe)):Of;a=Nh.j(Oe,c.J?c.J(a): -c(a));return b.J?b.J(a):b(a)},Eqa=function(a,b){return Yp.ba(a,uT,sm,function(c){return Yp.N(c,xR,function(e){return Zi.N(fi,Fh(b),e)})})},wT=function(a,b,c,e,h,m,q,r){this.Vc=a;this.Uc=b;this.Tc=c;this.cd=e;this.bd=h;this.ga=m;this.W=q;this.ia=r;this.ea=2230716170;this.ka=139264},xT=function(a,b,c,e,h,m,q,r,u,w,z){this.order=a;this.type=b;this.Ub=c;this.origin=e;this.transform=h;this.Oa=m;this.rotation=q;this.center=r;this.ga=u;this.W=w;this.ia=z;this.ea=2230716170;this.ka=139264},Fqa=function(a){return!Eo(a?.x?? -B.j(a,ZP))||!Eo(a?.y??B.j(a,YP))},Gqa=function(a){return!Eo((a?.x??B.j(a,ZP))-1)||!Eo((a?.y??B.j(a,YP))-1)},Hqa=function(a,b){if(Ye(a))return new K(null,1,5,M,[b],null);var c=We(a),e=c?.type??B.j(c,Q),h=b?.type??B.j(b,Q);return x.j(yT,e)&&x.j(yT,h)?(e=c?.Ub??B.j(c,co),b=b?.Ub??B.j(b,co),b=bQ(e,b),c=I.N(c,co,b),a=Xe(a),Fqa(c?.Ub??B.j(c,co))?hg.j(a,c):a):hg.j(a,b)},zT=function(){return new wT(0,fi,fi,fi,fi,null,null,null)},Iqa=function(a,b){var c=a?a:zT();a=(c?.Vc??B.j(c,AT))+1;c=I.N(c,AT,a);return Fqa(b)? -Yp.ba(c,BT,Hqa,new xT(a,yT,b,null,null,null,null,null,null,null,null)):c},CT=function(a){return Iqa(zT(),a)},Jqa=function(a,b){var c=b?.type??B.j(b,Q);c=c instanceof D?c.na:null;switch(c){case "move":return tQ(xQ.J(b?.Ub??B.j(b,co)),a);case "resize":var e=b?.transform??B.j(b,tS);c=b?.Oa??B.j(b,uS);var h=b?.Ub??B.j(b,co);b=b?.origin??B.j(b,DT);b=null!=c?jQ(b,c):b;var m=sQ.aa();e=null!=e?tQ(m,e):m;e=zQ(e,b);h=tQ(e,vQ.J(h));h=zQ(h,dQ(b));c=null!=c?tQ(h,c):h;return tQ(c,a);case "rotation":return c=b?.center?? -B.j(b,ET),h=b?.rotation??B.j(b,FT),tQ(zQ(tQ(zQ(sQ.aa(),c),nS.J(h)),dQ(c)),a);default:throw Error(["No matching clause: ",k.J(c)].join(""));}},Kqa=function(a){return qc(Jqa,sQ.aa(),a)},Lqa=function(a){a=zh.j(a?.Uc??B.j(a,GT),a?.Tc??B.j(a,BT));a=kI.j(function(b){return b?.order??B.j(b,Kq)},a);return Kqa(a)},Mqa=function(a,b){var c=k.J(rQ.J(B.N(b,HT,14))*a);a=k.J(rQ.J(B.N(b,IT,0))*a);return Ip(b,new f(null,2,[HT,c,IT,a],null))},Nqa=function(a,b){a=k.J(rQ.J(B.N(b,HT,14))*a);return Ip(b,new f(null,1,[HT, -a],null))},Oqa=function(a,b){function c(q,r){var u=r?.type??B.j(r,Q);switch(u instanceof D?u.na:null){case "rotation":var w=r?.value??B.j(r,ep);return Yp.N(q,FT,function(E){return(((g(E)?E:0)+w)%360+360)%360});case "add-children":var z=r?.value??B.j(r,ep),C=r?.index??B.j(r,qR);q=null!=C?Yp.N(q,xR,function(E){return ff(E)?Mp(E,C,z):Lp.U(E,y([z]))}):Yp.ba(q,xR,Lp,z);return Yp.N(q,xR,function(E){return Zi.j(fi,Pg(JT,E))});case "remove-children":return z=r?.value??B.j(r,ep),Yp.ba(q,xR,e,z);case "scale-content":return z= -r?.value??B.j(r,ep),h(q,z);case "change-property":return u=r?.property??B.j(r,uu),z=r?.value??B.j(r,ep),I.N(q,u,z);default:return q}}function e(q,r){r=gk(r);return gi(Zh.j(fc,r),q)}function h(q,r){r=Ao(r);var u=vR(q)?Yp.ba(q,wS,m,r):q;var w=null!=BS.J(u)&&0a?cj.N(c,rS,fc(c.flip_x)):c,c=0>a?cj.N(c,FT,-c.rotation):c,c=0>m?cj.N(c,sS,fc(c.flip_y)):c,r=0>m?cj.N(c,FT,-c.rotation):c,a=TQ(e),c=Vqa(e,a),a=Wqa(e,a,c),m=null!=a?Eoa(a):null,null==m||null==a?b=r:(h=r?.type??B.j(r,Q),q=((Op(FT.J(r),0)+Op(B.j(B.j(r,ZT),FT),0))%360+360)%360,r=x.j(h,WT)?Yp.ba(r,XT,jS,b):r,b=x.j(h,Ez)?Yp.ba(r,wS,jS,b):Bd(Bd(Bd(Bd(r,ZP,c?.x??B.j(c,ZP)),YP,c?.y??B.j(c,YP)),xz,c?.width??B.j(c,xz)),DQ,c?.height??B.j(c,DQ)),b=Bd(Bd(Bd(Bd(Bd(b, -tS,a),uS,m),UQ,c),SQ,e),FT,q));return b},Yqa=function(a,b){a=G(a);var c=B.j(a,UQ),e=B.j(a,$T),h=new f(null,4,[ZP,ZP.j(b,0)-ZP.j(c,0),YP,YP.j(b,0)-YP.j(c,0),xz,xz.j(b,1)-xz.j(c,1),DQ,DQ.j(b,1)-DQ.j(c,1)],null);return null!=e&&null!=c&&null!=b?Yp.N(a,$T,function(m){return Yp.ba(Yp.ba(Yp.ba(Yp.ba(m,ZP,wy,ZP.J(h)),YP,wy,YP.J(h)),xz,wy,xz.J(h)),DQ,wy,DQ.J(h))}):a},aU=function(a,b){var c=ai(SQ,y([b]));b=TQ(c);c=Ye(c)?SQ.J(a):c;c=WQ(c,b,uS.j(a,sQ.aa()));b=WQ(IQ(LQ(c)),b,tS.j(a,sQ.aa()));c=AQ(TQ(b),uS.j(a, -sQ.aa()));c=LQ(XQ(b,c));return Xqa(I.N(I.N(I.N(I.N(Yqa(a,c),UQ,c),SQ,b),rS,!1),sS,!1),sQ.aa())},Zqa=function(a,b,c){c=OS(a,c);a=I.N(a,XT,c);var e=Qpa(a,c);c=A(e,0,null);e=A(e,1,null);return null!=e&&op(c)?I.N(I.N(a,UQ,e),SQ,c):aU(a,b)},$qa=function(a){var b=G(a);a=B.j(b,ZP);var c=B.j(b,YP),e=B.j(b,xz);b=B.j(b,DQ);return KQ.ba(a,c-b,e,b)},bU=function(a){var b=ai(Zh.j(IQ,$qa),y([YT.J(a)]));return p(b)?LQ(b):a?.bb??B.j(a,UQ)},ara=function(a,b){return!uh(He(gi(function(c){var e=G(a),h=B.j(e,ZP);e=B.j(e, -YP);var m=A(c,0,null),q=G(m);m=B.j(q,ZP);q=B.j(q,YP);c=A(c,1,null);var r=G(c);c=B.j(r,ZP);r=B.j(r,YP);return q<=e&&r>e||q>e&&r<=e?ha?.01:a):null},cra=function(a){var b=A(a,0,null);A(a,1,null);A(a,2,null);a=A(a,3,null);return null!=b&&null!=a?(b=fQ(cQ(a,b)),.01>b?.01:b):null},dra=function(a,b,c){var e=A(b,0,null),h=A(b,1,null);b=cQ(h,e);a=cU(a,bQ(a,c),e,h);return Eo(ZP.J(b))?Eo(YP.J(b))?0:(YP.J(a)-YP.J(e))/YP.J(b):(ZP.J(a)-ZP.J(e))/ZP.J(b)},era=function(a){var b= -A(a,0,null),c=A(a,1,null);A(a,2,null);var e=A(a,3,null);return(a=x.j(He(a),4))?(c=cQ(c,b),b=cQ(e,b),Eo(YP.J(c))&&Eo(ZP.J(b))&&0{HU(a,e,h)}):ja(b)&&IU(b.then)?b.then(e=>{HU(a,e,null)},e=>{HU(a,null,e)}):a.complete(b,null):a.type===yra?b instanceof GU?b.handle((e,h)=>{a.complete(e,h)}): -ja(b)&&IU(b.then)?b.then(e=>{a.complete(e,null)},e=>{a.complete(null,e)}):a.complete(null,new TypeError("expected thenable")):a.complete(null,new TypeError("internal: invalid resolve type")))},wra=function(a){if(0!==a[JU].length)for(var b=a[BU],c=a[DU],e,h,m;a[JU].length;){e=a[JU].shift();try{b===KU?h=e.resolve(c):b===LU?h=e.reject(c):m=new TypeError("invalid state")}catch(q){m=q}HU(e,h,m)}},MU=function(a){a[BU]!==CU&&zra(wra,a)},Ara=function(a){return(b,c)=>{c?a.reject(c):a.resolve(b)}},IU=function(a){return"function"=== -typeof a},Cra=function(a,b){var c=vU;const e=new GU;a[JU].push({type:yra,resolve:c??Bra,reject:b??NU,complete:Ara(e)});MU(a);return e},OU=function(a){if(null===a)return Dra;const b=new GU;b[BU]=KU;b[DU]=a;return b},Era=function(a){const b=new GU;b[BU]=LU;b[DU]=a;return b},Fra=function(a){if(a instanceof GU)return a;if(ja(a)&&IU(a.then)){const b=new GU;a.then(c=>{b.resolve(c)},c=>{b.reject(c)});return b}return a instanceof Error?Era(a):OU(a)},Pra=function(a){if(x.j(null,a))return l(PU);if(x.j(Gra, -a))return l(Hra);if(x.j(so,a))return l(PU);if(x.j(Ira,a))return l(Jra);if(x.j(Kra,a)||x.j(Lra,a)||x.j(Mra,a))return l(PU);if(x.j(Nra,a))return l(Jra);if(x.j(Ora,a))return l(PU);if(null!=a?Zd===a.Sl||(a.Pc?0:lc(vra,a)):lc(vra,a))return a;if(al(a))return Pra(l(a));throw new TypeError("invalid executor");},QU=function(a){var b=Qra;a=(Se(a),a);zU(Pra(b),a)},Sra=function(a,b,c){a=null==a||x.j(so,a)?l(Rra):al(a)?l(a):a;AU(a,b,c)},Tra=function(){},RU=function(a){for(var b=[],c=arguments.length,e=0;;)if(e< -c)b.push(arguments[e]),e+=1;else break;b=0=a},Wra=function(a){a=a instanceof D?a.na:null;switch(a){case "error":return"#c82829";case "warn":return"#f5871f";case "info":return"#4271ae";case "debug":return"#969896";case "trace":return"#8e908c";default:throw Error(["No matching clause: ",k.J(a)].join(""));}},Xra=function(a){a=a instanceof D?a.na:null;switch(a){case "debug":return"DBG";case "trace":return"TRC";case "info":return"INF";case "warn":return"WRN";case "error":return"ERR";default:throw Error(["No matching clause: ", +b)/2,(e+c)/2)},VQ=function(a){return JQ(a?.bb??B.j(a,UQ))},XQ=function(a,b){return WQ(a,null,b)},WQ=function(a,b,c){if(qQ(c)&&p(a)){var e=null!=b?xQ.J(b):vc(YQ);b=null!=b?Doa(b):YQ;var h=tQ(tQ(e,c),b);return nt.j(function(m){return jQ(m,h)},a)}return a},Ooa=function(a){var b=G(a);a=B.j(b,SQ);b=B.j(b,UQ);return isNaN(ZP.J(b))||isNaN(YP.J(b))||isNaN(xz.J(b))||isNaN(DQ.J(b))||th(function(c){return isNaN(ZP.J(c))||isNaN(YP.J(c))},a)},$Q=function(a){return null!=ZQ.J(a)},Qoa=function(a,b){return gk(ci.j(function(c){var e= +B.j(a,c),h=B.j(b,c);return!(x.j(c,bR)?x.j(cR(e),cR(h)):x.j(e,h))},ik(zh.j(Tj(a),Tj(b)))))},Soa=function(a){var b=G(null);b=B.N(b,Roa,!1);return g(b)?dR.J(a):eca(function(c){A(c,0,null);c=A(c,1,null);return eR.J(c)},dR.J(a))},fR=function(a){return Jo.j(eR,Vj(dR.J(a)))},Toa=function(a,b){b=G(b);var c=B.j(b,R),e=B.j(b,S),h=B.j(b,Ez),m=B.j(b,gR),q=B.j(b,hR),r=B.j(b,bR),u=B.j(b,iR),w=B.j(b,jR);return Dp(a,new K(null,2,5,M,[dR,c],null),function(z){var C=null==r?null:Of.J?Of.J(r):r,E=null!=e?I.N(z,S,e): +z;E=null!=h?I.N(E,Ez,h):E;E=null!=m?I.N(E,gR,m):E;E=null!=q?I.N(E,hR,q):E;C=null!=C?I.N(E,bR,C):E;C=null!=w?I.N(C,jR,w):C;C=null!=u?I.N(C,iR,u):C;C=null==u?ln.j(C,iR):C;z=kR.j(Qoa(z,C),new bk(null,new f(null,2,[jR,null,iR,null],null),null));return Ye(z)?C:I.N(C,jR,lR.local())})},Uoa=function(a,b){a=fp.j(a,new K(null,2,5,M,[dR,b],null));return g(g(!1)?!1:fc(eR.J(a)))?a:null},mR=function(a){for(var b=[],c=arguments.length,e=0;;)if(eeQ(a,b)},kpa=function(a,b,c){return new f(null,3,[UR,a,VR,b,nB,c],null)},lpa=function(a,b){b=x.j(WR,HR.J(b))?MR(UR.J(a)):b;var c=GR(b);return Yp.ba(I.N(a,VR,c),nB,hg,b)},YR=function(a){var b=qc(function(c,e){var h=A(e,0,null),m=A(e,1,null);if(null!=m){e= +hg.j;m=wq.J(m);var q=G(m);m=B.j(q,ZP);q=B.j(q,YP);var r=wq.J(h),u=G(r);r=B.j(u,NR);var w=B.j(u,OR),z=B.j(u,PR);u=B.j(u,QR);m=Yp.U(h,wq,I,ZP,m,YP,y([q]));h=x.j(RR,HR.J(h))?Yp.U(m,wq,I,NR,z,OR,y([u,PR,r,QR,w])):m;c=e.call(hg,c,h)}return c},new K(null,1,5,M,[KR(VR.J(a))],null),ig(Kp(nB.J(a))));return kpa(VR.J(a),UR.J(a),b)},ZR=function(a){return qc(function(b,c){var e=x.j(IR,HR.J(c)),h=He(b)-1;e?(e=hg.j,h=GR(c),b=e.call(hg,b,kpa(h,h,new K(null,1,5,M,[c],null)))):b=0<=h?Yp.ba(b,h,lpa,c):b;return b},fi, +a)},$R=function(a,b){return I.N(Yp.ba(a,nB,Lp,ke(nB.J(b))),VR,VR.J(b))},mpa=function(a,b){return qc(function(c,e){var h=A(c,0,null);c=A(c,1,null);return TR(VR.J(e),UR.J(e))?new K(null,2,5,M,[h,hg.j(c,e)],null):TR(VR.J(h),UR.J(e))?new K(null,2,5,M,[$R(h,e),c],null):TR(UR.J(h),VR.J(e))?new K(null,2,5,M,[$R(e,h),c],null):TR(VR.J(h),VR.J(e))?new K(null,2,5,M,[$R(h,YR(e)),c],null):TR(UR.J(h),UR.J(e))?new K(null,2,5,M,[$R(YR(e),h),c],null):new K(null,2,5,M,[h,hg.j(c,e)],null)},new K(null,2,5,M,[a,fi],null), +b)},npa=function(a){return TR(UR.J(a),VR.J(a))},aS=function(a){var b=ZR(a);a:{a=fi;var c=t(b);for(b=ke(b);;)if(null!=c){var e=npa(c)?new K(null,2,5,M,[c,b],null):mpa(c,b);b=A(e,0,null);e=A(e,1,null);x.j(c,b)?(a=hg.j(a,b),c=t(e),b=ke(e)):(c=b,b=e)}else break a}return Zi.j(fi,ai(nB,y([a])))},opa=function(a){a=nB.J(t(ZR(a)));var b=t(a);a=ke(a);for(var c=null,e=0;;){if(null==b)return 0h)return b=-b/3,b=Math.sqrt(b*b*b),c=-c/(2*b),c=Math.acos(-1>c?-1:1e?Bo(-e):-Bo(e),new K(null,2,5,M,[2*b-a/3,-b-a/3],null);c=Math.sqrt(h);b=Bo(c- +e);return new K(null,1,5,M,[b-Bo(c+e)-a/3],null)},dS=function(a){var b=A(a,0,null),c=A(a,1,null),e=A(a,2,null);a=A(a,3,null);return wpa(b,c,e,a)},wpa=function(a,b,c,e){a=new K(null,2,5,M,[new K(null,4,5,M,[ZP.J(a),ZP.J(c),ZP.J(e),ZP.J(b)],null),new K(null,4,5,M,[YP.J(a),YP.J(c),YP.J(e),YP.J(b)],null)],null);return gi(function(h){return.01h},ai(function(h){var m=A(h,0,null),q=A(h,1,null),r=A(h,2,null);h=A(h,3,null);return vpa(-3*m+9*q+-9*r+3*h,6*m+-12*q+6*r,3*q+-3*m,0)},y([a])))},xpa=function(a, +b,c,e){a=new K(null,1,5,M,[new K(null,4,5,M,[B.j(a,YP),B.j(c,YP),B.j(e,YP),B.j(b,YP)],null)],null);return gi(function(h){return 0<=h&&1>=h},ai(function(h){var m=A(h,0,null),q=A(h,1,null),r=A(h,2,null);h=A(h,3,null);return vpa(3*m+-6*q+3*r,-3*m+3*q,m,-m+3*q+-3*r+h)},y([a])))},gS=function(a){var b=eS.J(a);return new K(null,2,5,M,[b,fS.J(a)],null)},hS=function(a){var b=eS.J(a);return new K(null,4,5,M,[b,fS.J(a),aQ(NR.J(wq.J(a)),OR.J(wq.J(a))),aQ(PR.J(wq.J(a)),QR.J(wq.J(a)))],null)},iS=function(a){var b= +function(){for(var c=ck,e=null,h=null,m=p(a);;)if(m){var q=t(m),r=fS.J(q),u=function(){var E=HR.J(q),H=E instanceof D?E.na:null;switch(H){case "move-to":return new K(null,3,5,M,[r,r,g(r)?new K(null,1,5,M,[r],null):null],null);case "close-path":return new K(null,3,5,M,[h,h,g(h)?new K(null,1,5,M,[h],null):null],null);case "line-to":return new K(null,3,5,M,[r,h,g(function(){var J=e;return g(J)?r:J}())?new K(null,2,5,M,[e,r],null):null],null);case "curve-to":return new K(null,3,5,M,[r,h,function(){var J= +fS.j(q,ypa),O=fS.j(q,zpa),P=new K(null,4,5,M,[e,r,J,O],null);return g(function(){var W=e;return g(W)?(W=r,g(W)?g(J)?O:J:W):W}())?Zi.j(new K(null,2,5,M,[e,r],null),Nh.j(function(W,V,Z,ba,qa,ra,sa){return function(Ea){return cS(sa,Ea)}}(c,e,h,m,J,O,P,E,H,q,r),dS(P))):null}()],null);default:return new K(null,3,5,M,[r,h,fi],null)}}(),w=A(u,0,null),z=A(u,1,null);u=A(u,2,null);u=Qg(hg,c,u);var C=v(m);c=u;e=w;h=z;m=C}else return c}();b=Ye(b)?Gh(fS,a):b;return op(b)?LQ(b):KQ.aa()},Apa=function(a,b){function c(q){var r= +G(q),u=B.j(r,ZP),w=B.j(r,YP),z=B.j(r,NR),C=B.j(r,OR);q=B.j(r,PR);var E=B.j(r,QR);r=Pp(u,w)?e(r,ZP,YP):r;z=Pp(z,C)?e(r,NR,OR):r;return Pp(q,E)?e(z,PR,QR):z}function e(q,r,u){q=g(yo(h))?Yp.ba(q,r,wy,h):q;return g(yo(m))?Yp.ba(q,u,wy,m):q}var h=ZP.J(b),m=YP.J(b);return Zi.N(fi,Nh.J(function(q){return Yp.N(q,wq,c)}),a)},jS=function(a,b){if(null!=b){var c=function(h,m,q){var r=jQ(aQ(B.j(h,m),B.j(h,q)),b);return I.U(h,m,ZP.J(r),y([q,YP.J(r)]))},e=function(h){var m=G(h),q=B.j(m,ZP),r=B.j(m,NR);h=B.j(m,PR); +m=null!=q?c(m,ZP,YP):m;r=null!=r?c(m,NR,OR):m;return null!=h?c(r,PR,QR):r};return Zi.N(fi,Nh.J(function(h){return Yp.N(h,wq,e)}),a)}return a},kS=function(a,b){var c=A(a,0,null),e=G(c);c=B.j(e,ZP);e=B.j(e,YP);a=A(a,1,null);var h=G(a);a=B.j(h,ZP);h=B.j(h,YP);var m=G(b);b=B.j(m,ZP);m=B.j(m,YP);return Eo(c-a)&&Eo(e-h)?Infinity:Eo(c-a)?(m-e)/(h-e):(b-c)/(a-c)},lS=function(a,b,c){var e=tpa(a,b,c);a=A(e,0,null);b=A(e,1,null);c=nt.j(function(h){return cS(e,h)},dS(e));return LQ(Zi.j(new K(null,2,5,M,[a,b], +null),c))},mS=function(a,b){var c=A(b,0,null),e=A(b,1,null);b=G(c);c=B.j(b,ZP);b=B.j(b,YP);var h=G(e);e=B.j(h,ZP);h=B.j(h,YP);var m=G(a);a=B.j(m,ZP);m=B.j(m,YP);h=Eo(c-e)?null:(h-b)/(e-c);b=null!=h?h*a+-h*c+b:null;return Eo(c-e)&&Eo(a-c)||null!=b&&Eo(m-b)},Bpa=function(a,b){return function m(e,h){var q=lS(b,e,h);if(QQ(q,a)){if(Eo(e-h))return.1>eQ(cS(b,e),a);q=e+(h-e)/2;e=m(e,q);return g(e)?e:m(q,h)}return null}(0,1)},Cpa=function(a,b){var c=A(a,0,null),e=A(a,1,null),h=A(b,0,null),m=A(b,1,null),q= +G(c),r=B.j(q,ZP);q=B.j(q,YP);var u=G(e),w=B.j(u,ZP);u=B.j(u,YP);var z=G(h),C=B.j(z,ZP);z=B.j(z,YP);var E=G(m),H=B.j(E,ZP),J=B.j(E,YP);E=(C-H)*(r*u-q*w)-(r-w)*(C*J-z*H);var O=(z-J)*(r*u-q*w)-(q-u)*(C*J-z*H);r=(r-w)*(z-J)-(q-u)*(C-H);if(Eo(r))return mS(h,a)?new K(null,2,5,M,[kS(a,h),0],null):mS(m,a)?new K(null,2,5,M,[kS(a,m),1],null):mS(e,b)?new K(null,2,5,M,[1,kS(b,e)],null):mS(c,b)?new K(null,2,5,M,[0,kS(b,c)],null):null;c=XP(E/r,O/r);a=kS(a,c);b=kS(b,c);return new K(null,2,5,M,[a,b],null)},Dpa=function(a, +b){var c=A(a,0,null),e=A(a,1,null);a=A(b,0,null);var h=A(b,1,null),m=A(b,2,null);b=A(b,3,null);var q=YP.J(e)-YP.J(c);e=ZP.J(e)-ZP.J(c);e=180*Math.atan2(q,e)/Math.PI;q=sQ.aa();e=uQ.j(q,nS.J(-e));c=yQ(e,dQ(c));m=new K(null,4,5,M,[jQ(a,c),jQ(h,c),jQ(m,c),jQ(b,c)],null);c=A(m,0,null);a=A(m,1,null);h=A(m,2,null);m=A(m,3,null);return xpa(c,a,h,m)},Epa=function(a,b){var c=gi(function(e){var h=cS(b,e);e=qpa(b,e);e=uoa(e);return 0YP.J(e)?1:0;return new K(null,2,5,h,[m,e],null)},c)},Fpa=function(a,b){var c=gi(function(h){h=Eo(h)?0:h;var m=cS(b,h);m=kS(a,m);return 0<=h&&1>=h&&0<=m&&1>=m},Dpa(a,b)),e=nt.j(function(h){return cS(b,h)},c);e=nt.j(function(h){return kS(a,h)},e);return new K(null,2,5,M,[e,c],null)},Ipa=function(a,b){function c(e){e=G(e);var h=B.j(e,bM),m=B.j(e,$L);return function(q){var r=G(q);q=B.j(r,bM);r=B.j(r,$L);return 2<=eQ(q,h)&&2<=eQ(r,m)}}return function(e){var h=t(e); +e=ke(e);for(var m=fi,q=fi;;){if(null==h)return new K(null,2,5,M,[m,q],null);e=ci.j(c(h),e);m=hg.j(m,Gpa.J(h));q=hg.j(q,Hpa.J(h));h=t(e);e=ke(e)}}(kI.j(gy,function u(h,m,q,r){var w=lS(a,h,m),z=lS(b,q,r);if(PQ(w,z)){w=cS(a,h);z=cS(b,q);if(.1>eQ(w,z))return new K(null,1,5,M,[new f(null,5,[bM,w,$L,z,gy,eQ(w,z),Gpa,Co(h,4),Hpa,Co(q,4)],null)],null);z=h+(m-h)/2;var C=q+(r-q)/2;w=u(h,z,q,C);h=u(h,z,C,r);q=u(z,m,q,C);m=u(z,m,C,r);return Lp.U(w,y([h,q,m]))}return null}(0,1,0,1)))},Jpa=function(a,b){return th(function(c){var e= +HR.J(c);switch(e instanceof D?e.na:null){case "line-to":return c=gS(c),(e=mS(a,c))?(c=kS(c,a),c=(0c||Eo(c-1))):c=e,c;case "curve-to":return Bpa(a,hS(c));default:return!1}},b)},Kpa=function(a){return Zi.N(fi,$h(nB),ZR(aS(a)))},Lpa=function(a,b){b=G(b);b=B.j(b,UQ);return YP.J(a)>=HQ.J(b)&&YP.J(a)<=FQ.J(b)},qS=function(a){return nt.j(function(b){return new f(null,4,[HR,HR.J(b),Mpa,b,oS,x.j(LR,HR.J(b))?gS(b):hS(b),UQ,pS.J(b)],null)},ci.j(function(b){return Xj.j(x.j(LR,HR.J(b)),x.j(RR, +HR.J(b)))},Kpa(a)))},Npa=function(a,b){var c=new K(null,2,5,M,[a,aQ(ZP.J(a)+1,YP.J(a))],null);return Xj.j(0,Lf(wy,Nh.j(Oe,ai(function(e){var h=HR.J(e);switch(h instanceof D?h.na:null){case "line-to":e=oS.J(e);var m=A(e,0,null),q=A(e,1,null);h=new K(null,2,5,M,[a,aQ(ZP.J(a)+1,YP.J(a))],null);var r;if(r=null!=m){r=YP.J(m);var u=YP.J(a);r=Eo(r-u)}m=r?Yp.ba(m,YP,wy,10):m;if(r=null!=q)r=YP.J(q),u=YP.J(a),r=Eo(r-u);q=r?Yp.ba(q,YP,wy,10):q;q=Cpa(h,new K(null,2,5,M,[m,q],null));h=A(q,0,null);var w=A(q,1, +null);null!=w&&null!=h&&0w||Eo(w-1))?(q=h=M,m=bS(e,w),r=A(e,0,null),u=A(e,1,null),e=bS(e,w),e=YP.J(e),u=YP.J(u),r=YP.J(r),e=new K(null,1,5,h,[new K(null,2,5,q,[m,0e-u&&!Eo(e-u)?-1:0>e-r?1:0h},c);if(Ye(c))return new K(null,1,5,M,[b],null);var e=GR(b);b=Zi.j(hk(),hg.j(c,1));return nt.j(function(h){return MR(nQ(a, +e,h))},b)},Ppa=function(a,b,c){c=ci.j(function(q){return 0q},c);if(Ye(c))return new K(null,1,5,M,[b],null);var e=GR(b);b=wq.J(b);var h=aQ(NR.J(b),OR.J(b)),m=aQ(PR.J(b),QR.J(b));b=Zi.j(hk(),hg.U(c,0,y([1])));return nt.j(function(q){var r=A(q,0,null);q=A(q,1,null);var u=spa(a,e,h,m,q,r);A(u,0,null);r=A(u,1,null);q=A(u,2,null);u=A(u,3,null);return SR(r,q,u)},ke(Kp(b)))},Qpa=function(a,b){var c=G(a),e=B.j(c,rS),h=B.j(c,sS),m=function(){var u=tS.j(a,sQ.aa());u=g(e)?wQ(u,XP(-1,1)):u;return g(h)?wQ(u, +XP(1,-1)):u}();c=function(){var u=sQ.aa();u=g(e)?wQ(u,XP(-1,1)):u;u=g(h)?wQ(u,XP(1,-1)):u;return uQ.j(u,uS.j(a,sQ.aa()))}();var q=function(){var u=a?.bb??B.j(a,UQ);u=null==u?null:JQ(u);return g(u)?u:JQ(iS(b))}(),r=jS(b,AQ(q,c));m=WQ(IQ(iS(r)),q,m);q=TQ(m);c=LQ(WQ(m,q,c));return new K(null,2,5,M,[m,c],null)},xS=function(a){var b=yf(a,vS)?Of:aS,c;if(c=x.j(Ez,Q.J(a)))a=wS.J(a),b=b.J?b.J(a):b(a),c=!sh(npa,ZR(b));return c},yS=function(a,b){return nt.j(function(c){var e=A(c,0,null);c=A(c,1,null);e=null== +c&&null!=b?I.N(e,eS,b):e;return null!=c?I.N(e,eS,fS.J(c)):e},Kp(a))},Rpa=function(a){for(var b=t(a),c=ke(a),e=fi,h=a=null;;){if(null==b)return e;var m=fS.J(b);h=x.j(WR,HR.J(b))&&(null==h||.01>eQ(h,a))?null:x.j(WR,HR.J(b))?MR(a):b;b=t(c);c=ke(c);e=null!=h?hg.j(e,h):e;a=x.j(IR,HR.J(h))?m:a;h=m}},Spa=function(a,b){return x.j(LR,HR.J(a))&&x.j(LR,HR.J(b))?(a=gS(a),b=gS(b),a=Cpa(a,b),b=A(a,0,null),a=A(a,1,null),null!=b&&null!=a&&(0b||Eo(b-1))&&(0a||Eo(a-1))?new K(null, +2,5,M,[new K(null,1,5,M,[b],null),new K(null,1,5,M,[a],null)],null):null):x.j(LR,HR.J(a))&&x.j(RR,HR.J(b))?Fpa(gS(a),hS(b)):x.j(RR,HR.J(a))&&x.j(LR,HR.J(b))?(a=Fpa(gS(b),hS(a)),b=A(a,0,null),a=A(a,1,null),new K(null,2,5,M,[a,b],null)):x.j(RR,HR.J(a))&&x.j(RR,HR.J(b))?Ipa(hS(a),hS(b)):new K(null,2,5,M,[fi,fi],null)},Tpa=function(a,b,c,e){function h(w,z,C){return Zi.N(fi,$h(function(E){return m(E,z,C)}),w)}function m(w,z,C){return g(r(w,C))?qc(function(E,H){return Zi.N(fi,$h(function(J){if(fc(q(J,H)))J= +new K(null,1,5,M,[J],null);else{var O=Spa(J,H),P=A(O,0,null);A(O,1,null);b:switch(O=HR.J(J),O instanceof D?O.na:null){case "line-to":P=Opa(eS.J(J),J,P);break b;case "curve-to":P=Ppa(eS.J(J),J,P);break b;default:P=new K(null,1,5,M,[J],null)}J=yS(P,eS.J(J))}return J}),E)},new K(null,1,5,M,[w],null),ci.j(function(E){return q(w,E)},z)):new K(null,1,5,M,[w],null)}function q(w,z){if(x.j(IR,HR.J(w))||x.j(IR,HR.J(z)))return!1;w=u(w);z=u(z);return PQ(w,z)}function r(w,z){if(x.j(IR,HR.J(w)))return!1;w=u(w); +return PQ(w,z)}var u=ml(pS);return new K(null,2,5,M,[h(a,b,e),h(b,a,c)],null)},Upa=function(a){return yf(a,eS)&&yf(new bk(null,new f(null,2,[LR,null,RR,null],null),null),HR.J(a))},zS=function(a,b,c,e){a:{var h=HR.J(a);h=h instanceof D?h.na:null;switch(h){case "line-to":a=bS(gS(a),.5);break a;case "curve-to":a=cS(hS(a),.5);break a;default:throw Error(["No matching clause: ",k.J(h)].join(""));}}return(c=QQ(c,a))?(e=Npa(a,e))?e:Jpa(a,b):c},Vpa=function(a,b){return null!=tp(function(c){if(x.j(HR.J(a), +HR.J(c))&&yf(new bk(null,new f(null,2,[LR,null,RR,null],null),null),HR.J(a))){var e=HR.J(a);e=e instanceof D?e.na:null;switch(e){case "line-to":var h=gS(a);e=A(h,0,null);h=A(h,1,null);var m=gS(c),q=A(m,0,null),r=A(m,1,null);return.1>eQ(e,q)&&.1>eQ(h,r)||.1>eQ(e,r)&&.1>eQ(h,q)?new K(null,2,5,M,[a,c],null):null;case "curve-to":q=hS(a);e=A(q,0,null);h=A(q,1,null);m=A(q,2,null);var u=A(q,3,null),w=hS(c);q=A(w,0,null);r=A(w,1,null);var z=A(w,2,null);w=A(w,3,null);return.1>eQ(e,q)&&.1>eQ(h,r)&&.1>eQ(m, +z)&&.1>eQ(u,w)||.1>eQ(e,r)&&.1>eQ(h,q)&&.1>eQ(m,w)&&.1>eQ(u,z)?new K(null,2,5,M,[a,c],null):null;default:throw Error(["No matching clause: ",k.J(e)].join(""));}}else return null},b)},Wpa=function(a){var b=t(a);a=ke(a);for(var c=null,e=fi;;){if(null==b)return e;var h=Xj.j(eS.J(b),c)?hg.j(e,KR(eS.J(b))):e;c=t(a);a=ke(a);e=fS.J(b);h=hg.j(h,ln.j(b,eS));b=c;c=e;e=h}},Xpa=function(a,b,c,e,h,m){var q=qS(a),r=qS(c),u=zh.j(ci.j(function(C){return fc(zS(C,c,m,r))},b),ci.j(function(C){return fc(zS(C,a,h,q))}, +e)),w=qS(u),z=iS(Wpa(u));e=ci.j(function(C){var E=zS(C,a,h,q);if(g(E)){if(E=Vpa(C,b)){a:switch(E=HR.J(C),E=E instanceof D?E.na:null,E){case "line-to":C=bS(gS(C),.5);break a;case "curve-to":C=cS(hS(C),.5);break a;default:throw Error(["No matching clause: ",k.J(E)].join(""));}E=!(QQ(z,C)&&Npa(C,w))}C=E}else C=E;return C},e);return Lp.U(u,y([e]))},Ypa=function(a,b,c,e,h,m){var q=qS(a),r=qS(c);return Lp.U(ci.j(function(u){return fc(zS(u,c,m,r))},b),y([ci.j(function(u){var w=zS(u,a,h,q);return g(w)?!Vpa(u, +b):w},e)]))},Zpa=function(a,b,c,e,h,m){var q=qS(a),r=qS(c);return Lp.U(ci.j(function(u){return zS(u,c,m,r)},b),y([ci.j(function(u){return zS(u,a,h,q)},e)]))},$pa=function(a,b,c){var e=Xj.j(KE,a)&&x.j(opa(c),opa(b)),h=yS(Rpa(b),null),m=yS(function(){var C=Rpa(c);return e?Zi.j(fi,ai(nB,y([ig(nt.j(YR,ZR(C)))]))):C}(),null),q=iS(h),r=iS(m),u=Tpa(h,m,q,r);b=A(u,0,null);u=A(u,1,null);var w=ci.j(Upa,yS(b,null)),z=ci.j(Upa,yS(u,null));b=function(){var C=a instanceof D?a.na:null;switch(C){case "union":return Xpa(h, +w,m,z,q,r);case "difference":return Ypa(h,w,m,z,q,r);case "intersection":return Zpa(h,w,m,z,q,r);case "exclude":return Lp.U(w,y([z]));default:throw Error(["No matching clause: ",k.J(C)].join(""));}}();return aS(Wpa(b))},aqa=function(a,b){return p(b)?Zi.j(fi,Lf(xh($pa,a),b)):fi},AS=function(a,b){return Eo(b)?Infinity:a/b},bqa=function(a){a=G(a);var b=B.j(a,xz),c=B.j(a,DQ);a=B.j(a,BS);null==a||Eo(a)?a=0:(b=AS(b,2*a),b=1c?a*c:a);return a},cqa=function(a){var b=G(a),c= +B.j(b,xz),e=B.j(b,DQ);a=B.j(b,CS);var h=B.j(b,DS),m=B.j(b,ES);b=B.j(b,FS);if(null!=a&&null!=h&&null!=m&&null!=b){var q=AS(c,a+h);q=1e?new K(null,4,5,M,[a*e,h*e,m*e,b*e],null):new K(null,4,5,M,[a,h,m,b],null)}else a=new K(null,4,5,M,[a,h,m,b],null);return a},GS=function(a,b,c,e){var h=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return ZP.J(a);case "top-right":return ZP.J(a)-e;case "bottom-right":return ZP.J(b)- +e;case "bottom-left":return ZP.J(b);default:throw Error(["No matching clause: ",k.J(E)].join(""));}}(),m=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return YP.J(a)-e;case "top-right":return YP.J(a);case "bottom-right":return YP.J(b)-2*e;case "bottom-left":return YP.J(b)-e;default:throw Error(["No matching clause: ",k.J(E)].join(""));}}(),q=2*e,r=2*e,u=h+q/2*.448084975506,w=h+q/2*1.5519150244939999,z=m+r/2*.448084975506,C=m+r/2*1.5519150244939999;h=function(){var E=c instanceof +D?c.na:null;switch(E){case "top-left":return I.N(a,YP,z);case "top-right":return I.N(a,ZP,w);case "bottom-right":return I.N(a,YP,C);case "bottom-left":return I.N(a,ZP,u);default:throw Error(["No matching clause: ",k.J(E)].join(""));}}();m=function(){var E=c instanceof D?c.na:null;switch(E){case "top-left":return I.N(b,ZP,u);case "top-right":return I.N(b,YP,z);case "bottom-right":return I.N(b,ZP,w);case "bottom-left":return I.N(b,YP,C);default:throw Error(["No matching clause: ",k.J(E)].join("")); +}}();return SR(b,h,m)},dqa=function(a){var b=G(a),c=B.j(b,ZP);a=B.j(b,YP);var e=B.j(b,xz),h=B.j(b,DQ),m=c+e/2,q=a+h/2;b=XP(m,a);var r=XP(c+e,q);m=XP(m,a+h);q=XP(c,q);var u=c+e/2*.448084975506;c+=e/2*1.5519150244939999;e=a+h/2*.448084975506;a+=h/2*1.5519150244939999;return new K(null,5,5,M,[KR(b),SR(r,I.N(b,ZP,c),I.N(r,YP,e)),SR(m,I.N(r,YP,a),I.N(m,ZP,c)),SR(q,I.N(m,ZP,u),I.N(q,YP,a)),SR(b,I.N(q,YP,e),I.N(b,ZP,u))],null)},iqa=function(a,b,c,e,h,m,q,r){var u=XP(a,b+h),w=XP(a+h,b),z=XP(c+a+-m,b),C=XP(c+ +a,b+m),E=XP(c+a,e+b+-q),H=XP(c+a+-q,e+b);c=XP(a+r,e+b);b=XP(a,e+b+-r);var J=e=a=hg.j,O=hg.j,P=hg.j(fi,KR(u));h=Xj.j(u,w)?hg.j(P,GS(u,w,eqa,h)):P;h=O.call(hg,h,MR(z));m=Xj.j(z,C)?hg.j(h,GS(z,C,fqa,m)):h;m=J.call(hg,m,MR(E));q=Xj.j(E,H)?hg.j(m,GS(E,H,gqa,q)):m;q=e.call(hg,q,MR(c));r=Xj.j(c,b)?hg.j(q,GS(c,b,hqa,r)):q;return a.call(hg,r,MR(u))},lqa=function(a){var b=G(a);a=B.j(b,ZP);var c=B.j(b,YP),e=B.j(b,xz),h=B.j(b,DQ),m=g(CS.J(b))?jqa:kqa;switch(m instanceof D?m.na:null){case "radius-1":return b= +bqa(b),iqa(a,c,e,h,b,b,b,b);case "radius-4":var q=cqa(b);b=A(q,0,null);m=A(q,1,null);var r=A(q,2,null);q=A(q,3,null);return iqa(a,c,e,h,b,m,r,q);default:return fi}},oqa=function(a,b){var c=Zh.j(Nh.J(function(h){return B.j(b,h)}),Nh.J(function(h){return HS?HS(h,b):mqa(h,b)}));c=Zi.N(fi,c,xR.J(a));var e=Pe(c);e=Yj(e,nqa);c=Zi.N(fi,Zh.j(ci.J(function(h){return x.j(Ez,Q.J(h))}),$h(function(h){h=wS.J(h);var m=t(h);return g(g(m)?JR.J(m):m)?Yp.qa(h,0,I,JR,!1):h})),c);return zp(Yg.U(y([I.N(I.N(a,Q,Ez),wS, +c),e])),IS)},pqa=function(a,b){var c=Nh.j(function(h){return HS?HS(h,b):mqa(h,b)},Nh.j(function(h){return B.j(b,h)},xR.J(a))),e=JS.J(a);c=aqa(e,nt.j(wS,c));return zp(I.N(I.N(a,Q,Ez),wS,c),IS)},mqa=function(a){switch(arguments.length){case 1:return HS(arguments[0],F);case 2:return HS(arguments[0],arguments[1]);default:throw Error(["Invalid arity: ",k.J(arguments.length)].join(""));}},HS=function(a,b){var c=G(a),e=B.j(c,Q),h=B.j(c,KS);switch(e instanceof D?e.na:null){case "group":case "frame":return oqa(c, +b);case "bool":return pqa(c,b);case "rect":case "circle":case "image":case "text":a:switch(e instanceof D?e.na:null){case "circle":a=dqa(c);break a;default:a=lqa(c)}b=function(){var q=tS.j(c,sQ.aa());q=g(rS.J(c))?wQ(q,XP(-1,1)):q;return g(sS.J(c))?wQ(q,XP(1,-1)):q}();var m=null!=b?jS(a,AQ(VQ(c),b)):a;return zp(function(){var q=I.N(I.N(c,Q,Ez),wS,m);return x.j(LS,e)?I.N(q,MS,h):q}(),IS);default:return c}},OS=function(a,b){var c=Zh.U(Nh.J(xh(B,b)),ci.J(Zh.j(fc,DR)),Jo.J(NS),y([Nh.J(function(e){return HS(e, +b)}),Nh.J(wS)]));c=Zi.N(fi,c,xR.J(a));return aqa(JS.J(a),c)},qqa=function(a,b){return Yp.N(a,at,function(c){return nt.j(function(e){return Yp.ba(Yp.ba(Yp.ba(Yp.ba(e,PS,QS,b),RS,QS,b),SS,QS,b),TS,QS,b)},c)})},rqa=function(a,b){return Yp.N(a,US,function(c){return nt.j(function(e){return Yp.ba(e,VS,QS,b)},c)})},XS=function(a,b){return WS(Of,a,b)},WS=function(a,b,c){return HK(function(e){var h=(h=df(e))?a.J?a.J(e):a(e):h;return g(h)?b.J?b.J(e):b(e):e},c)},YS=function(a,b){return p(ci.j(a,bi(df,fq,b)))}, +sqa=function(a){return"string"===typeof ZH.J(a)&&Xj.j(ZH.J(a),"")},tqa=function(a){return x.j("paragraph",Q.J(a))},aT=function(a){return FR.J(a)&&x.j(ZS,$S.J(a))},cT=function(a){return FR.J(a)&&x.j(bT,$S.J(a))},uqa=function(a){var b=FR.J(a);return b?(a=$S.J(a),x.j(ZS,a)||x.j(bT,a)):b},vqa=function(a){a=G(a);var b=B.j(a,dT);a=function(){var e=zo(eT.J(b),0);return g(e)?e:0}();var c=function(){var e=zo(fT.J(b),0);return g(e)?e:0}();return new K(null,2,5,M,[a,c],null)},wqa=function(a){var b=G(a);a=B.j(b, +gT);var c=G(a),e=B.j(c,hT),h=B.j(c,iT);a=B.j(c,jT);c=B.j(c,kT);b=B.j(b,lT);e=g(e)?e:0;h=g(h)?h:0;a=g(a)?a:0;c=g(c)?c:0;return x.j(b,mT)?new K(null,4,5,M,[e,h,a,c],null):new K(null,4,5,M,[e,h,e,h],null)},zqa=function(a){a=G(a);a=B.j(a,nT);return x.j(xqa,a)||x.j(yqa,a)},pT=function(a){a=oT.J(a);return g(a)?a:0},Aqa=function(a,b,c){var e=A(b,0,null);b=A(b,1,null);var h=A(c,0,null);c=A(c,1,null);return pT(b)>pT(c)?1:pT(b)h;return m? +a:m}())?1:eh?-1:0},Bqa=function(a,b){function c(e){return x.j(Q.J(e),qT)?Yp.ba(e,ep,QS,b):e}return Yp.N(Yp.N(a,rT,function(e){return nt.j(c,e)}),sT,function(e){return nt.j(c,e)})},Dqa=function(a){var b=G(new f(null,1,[tT,!0],null)),c=B.N(b,tT,!1);b=B.N(b,Cqa,!1);b=g(b)?xh(Jo,Zh.j(Ye,xR)):Of;c=y([tT,c]);var e=G(a);a=B.j(e,uT);e=B.j(e,vT);c=G(c);c=B.N(c,tT,!1);e=x.j(e,LI)?yk(LI,uo):yk(uo,LI);c=g(c)?xh(kI,Zh.j(e,Oe)):Of;a=Nh.j(Oe,c.J?c.J(a):c(a));return b.J?b.J(a):b(a)},Eqa=function(a,b){return Yp.ba(a, +uT,sm,function(c){return Yp.N(c,xR,function(e){return Zi.N(fi,Fh(b),e)})})},wT=function(a,b,c,e,h,m,q,r){this.Vc=a;this.Uc=b;this.Tc=c;this.cd=e;this.bd=h;this.ga=m;this.W=q;this.ia=r;this.ea=2230716170;this.ka=139264},xT=function(a,b,c,e,h,m,q,r,u,w,z){this.order=a;this.type=b;this.Ub=c;this.origin=e;this.transform=h;this.Oa=m;this.rotation=q;this.center=r;this.ga=u;this.W=w;this.ia=z;this.ea=2230716170;this.ka=139264},Fqa=function(a){return!Eo(a?.x??B.j(a,ZP))||!Eo(a?.y??B.j(a,YP))},Gqa=function(a){return!Eo((a?.x?? +B.j(a,ZP))-1)||!Eo((a?.y??B.j(a,YP))-1)},Hqa=function(a,b){if(Ye(a))return new K(null,1,5,M,[b],null);var c=We(a),e=c?.type??B.j(c,Q),h=b?.type??B.j(b,Q);return x.j(yT,e)&&x.j(yT,h)?(e=c?.Ub??B.j(c,co),b=b?.Ub??B.j(b,co),b=bQ(e,b),c=I.N(c,co,b),a=Xe(a),Fqa(c?.Ub??B.j(c,co))?hg.j(a,c):a):hg.j(a,b)},zT=function(){return new wT(0,fi,fi,fi,fi,null,null,null)},Iqa=function(a,b){var c=a?a:zT();a=(c?.Vc??B.j(c,AT))+1;c=I.N(c,AT,a);return Fqa(b)?Yp.ba(c,BT,Hqa,new xT(a,yT,b,null,null,null,null,null,null, +null,null)):c},CT=function(a){return Iqa(zT(),a)},Jqa=function(a,b){var c=b?.type??B.j(b,Q);c=c instanceof D?c.na:null;switch(c){case "move":return tQ(xQ.J(b?.Ub??B.j(b,co)),a);case "resize":var e=b?.transform??B.j(b,tS);c=b?.Oa??B.j(b,uS);var h=b?.Ub??B.j(b,co);b=b?.origin??B.j(b,DT);b=null!=c?jQ(b,c):b;var m=sQ.aa();e=null!=e?tQ(m,e):m;e=zQ(e,b);h=tQ(e,vQ.J(h));h=zQ(h,dQ(b));c=null!=c?tQ(h,c):h;return tQ(c,a);case "rotation":return c=b?.center??B.j(b,ET),h=b?.rotation??B.j(b,FT),tQ(zQ(tQ(zQ(sQ.aa(), +c),nS.J(h)),dQ(c)),a);default:throw Error(["No matching clause: ",k.J(c)].join(""));}},Kqa=function(a){return qc(Jqa,sQ.aa(),a)},Lqa=function(a){a=zh.j(a?.Uc??B.j(a,GT),a?.Tc??B.j(a,BT));a=kI.j(function(b){return b?.order??B.j(b,Kq)},a);return Kqa(a)},Mqa=function(a,b){var c=k.J(rQ.J(B.N(b,HT,14))*a);a=k.J(rQ.J(B.N(b,IT,0))*a);return Ip(b,new f(null,2,[HT,c,IT,a],null))},Nqa=function(a,b){a=k.J(rQ.J(B.N(b,HT,14))*a);return Ip(b,new f(null,1,[HT,a],null))},Oqa=function(a,b){function c(q,r){var u=r?.type?? +B.j(r,Q);switch(u instanceof D?u.na:null){case "rotation":var w=r?.value??B.j(r,ep);return Yp.N(q,FT,function(E){return(((g(E)?E:0)+w)%360+360)%360});case "add-children":var z=r?.value??B.j(r,ep),C=r?.index??B.j(r,qR);q=null!=C?Yp.N(q,xR,function(E){return ff(E)?Mp(E,C,z):Lp.U(E,y([z]))}):Yp.ba(q,xR,Lp,z);return Yp.N(q,xR,function(E){return Zi.j(fi,Pg(JT,E))});case "remove-children":return z=r?.value??B.j(r,ep),Yp.ba(q,xR,e,z);case "scale-content":return z=r?.value??B.j(r,ep),h(q,z);case "change-property":return u= +r?.property??B.j(r,uu),z=r?.value??B.j(r,ep),I.N(q,u,z);default:return q}}function e(q,r){r=gk(r);return gi(Zh.j(fc,r),q)}function h(q,r){r=Ao(r);var u=vR(q)?Yp.ba(q,wS,m,r):q;var w=null!=BS.J(u)&&0a?cj.N(c,rS,fc(c.flip_x)): +c,c=0>a?cj.N(c,FT,-c.rotation):c,c=0>m?cj.N(c,sS,fc(c.flip_y)):c,r=0>m?cj.N(c,FT,-c.rotation):c,a=TQ(e),c=Vqa(e,a),a=Wqa(e,a,c),m=null!=a?Eoa(a):null,null==m||null==a?b=r:(h=r?.type??B.j(r,Q),q=((Op(FT.J(r),0)+Op(B.j(B.j(r,ZT),FT),0))%360+360)%360,r=x.j(h,WT)?Yp.ba(r,XT,jS,b):r,b=x.j(h,Ez)?Yp.ba(r,wS,jS,b):Bd(Bd(Bd(Bd(r,ZP,c?.x??B.j(c,ZP)),YP,c?.y??B.j(c,YP)),xz,c?.width??B.j(c,xz)),DQ,c?.height??B.j(c,DQ)),b=Bd(Bd(Bd(Bd(Bd(b,tS,a),uS,m),UQ,c),SQ,e),FT,q));return b},Yqa=function(a,b){a=G(a);var c= +B.j(a,UQ),e=B.j(a,$T),h=new f(null,4,[ZP,ZP.j(b,0)-ZP.j(c,0),YP,YP.j(b,0)-YP.j(c,0),xz,xz.j(b,1)-xz.j(c,1),DQ,DQ.j(b,1)-DQ.j(c,1)],null);return null!=e&&null!=c&&null!=b?Yp.N(a,$T,function(m){return Yp.ba(Yp.ba(Yp.ba(Yp.ba(m,ZP,wy,ZP.J(h)),YP,wy,YP.J(h)),xz,wy,xz.J(h)),DQ,wy,DQ.J(h))}):a},aU=function(a,b){var c=ai(SQ,y([b]));b=TQ(c);c=Ye(c)?SQ.J(a):c;c=WQ(c,b,uS.j(a,sQ.aa()));b=WQ(IQ(LQ(c)),b,tS.j(a,sQ.aa()));c=AQ(TQ(b),uS.j(a,sQ.aa()));c=LQ(XQ(b,c));return Xqa(I.N(I.N(I.N(I.N(Yqa(a,c),UQ,c),SQ,b), +rS,!1),sS,!1),sQ.aa())},Zqa=function(a,b,c){c=OS(a,c);a=I.N(a,XT,c);var e=Qpa(a,c);c=A(e,0,null);e=A(e,1,null);return null!=e&&op(c)?I.N(I.N(a,UQ,e),SQ,c):aU(a,b)},$qa=function(a){var b=G(a);a=B.j(b,ZP);var c=B.j(b,YP),e=B.j(b,xz);b=B.j(b,DQ);return KQ.ba(a,c-b,e,b)},bU=function(a){var b=ai(Zh.j(IQ,$qa),y([YT.J(a)]));return p(b)?LQ(b):a?.bb??B.j(a,UQ)},ara=function(a,b){return!uh(He(gi(function(c){var e=G(a),h=B.j(e,ZP);e=B.j(e,YP);var m=A(c,0,null),q=G(m);m=B.j(q,ZP);q=B.j(q,YP);c=A(c,1,null);var r= +G(c);c=B.j(r,ZP);r=B.j(r,YP);return q<=e&&r>e||q>e&&r<=e?ha?.01:a):null},cra=function(a){var b=A(a,0,null);A(a,1,null);A(a,2,null);a=A(a,3,null);return null!=b&&null!=a?(b=fQ(cQ(a,b)),.01>b?.01:b):null},dra=function(a,b,c){var e=A(b,0,null),h=A(b,1,null);b=cQ(h,e);a=cU(a,bQ(a,c),e,h);return Eo(ZP.J(b))?Eo(YP.J(b))?0:(YP.J(a)-YP.J(e))/YP.J(b):(ZP.J(a)-ZP.J(e))/ZP.J(b)},era=function(a){var b=A(a,0,null),c=A(a,1,null);A(a,2,null);var e=A(a,3,null); +return(a=x.j(He(a),4))?(c=cQ(c,b),b=cQ(e,b),Eo(YP.J(c))&&Eo(ZP.J(b))&&0{HU(a,e,h)}):ja(b)&&IU(b.then)?b.then(e=>{HU(a,e,null)},e=>{HU(a,null,e)}):a.complete(b,null):a.type===yra?b instanceof GU?b.handle((e,h)=>{a.complete(e,h)}):ja(b)&&IU(b.then)?b.then(e=> +{a.complete(e,null)},e=>{a.complete(null,e)}):a.complete(null,new TypeError("expected thenable")):a.complete(null,new TypeError("internal: invalid resolve type")))},wra=function(a){if(0!==a[JU].length)for(var b=a[BU],c=a[DU],e,h,m;a[JU].length;){e=a[JU].shift();try{b===KU?h=e.resolve(c):b===LU?h=e.reject(c):m=new TypeError("invalid state")}catch(q){m=q}HU(e,h,m)}},MU=function(a){a[BU]!==CU&&zra(wra,a)},Ara=function(a){return(b,c)=>{c?a.reject(c):a.resolve(b)}},IU=function(a){return"function"===typeof a}, +Cra=function(a,b){var c=vU;const e=new GU;a[JU].push({type:yra,resolve:c??Bra,reject:b??NU,complete:Ara(e)});MU(a);return e},OU=function(a){if(null===a)return Dra;const b=new GU;b[BU]=KU;b[DU]=a;return b},Era=function(a){const b=new GU;b[BU]=LU;b[DU]=a;return b},Fra=function(a){if(a instanceof GU)return a;if(ja(a)&&IU(a.then)){const b=new GU;a.then(c=>{b.resolve(c)},c=>{b.reject(c)});return b}return a instanceof Error?Era(a):OU(a)},Pra=function(a){if(x.j(null,a))return l(PU);if(x.j(Gra,a))return l(Hra); +if(x.j(so,a))return l(PU);if(x.j(Ira,a))return l(Jra);if(x.j(Kra,a)||x.j(Lra,a)||x.j(Mra,a))return l(PU);if(x.j(Nra,a))return l(Jra);if(x.j(Ora,a))return l(PU);if(null!=a?Zd===a.Sl||(a.Pc?0:lc(vra,a)):lc(vra,a))return a;if(al(a))return Pra(l(a));throw new TypeError("invalid executor");},QU=function(a){var b=Qra;a=(Se(a),a);zU(Pra(b),a)},Sra=function(a,b,c){a=null==a||x.j(so,a)?l(Rra):al(a)?l(a):a;AU(a,b,c)},Tra=function(){},RU=function(a){for(var b=[],c=arguments.length,e=0;;)if(e=a},Wra=function(a){a=a instanceof D?a.na:null;switch(a){case "error":return"#c82829";case "warn":return"#f5871f";case "info":return"#4271ae";case "debug":return"#969896";case "trace":return"#8e908c";default:throw Error(["No matching clause: ",k.J(a)].join(""));}},Xra=function(a){a=a instanceof D?a.na:null;switch(a){case "debug":return"DBG";case "trace":return"TRC";case "info":return"INF";case "warn":return"WRN";case "error":return"ERR";default:throw Error(["No matching clause: ", k.J(a)].join(""));}},WU=function(a){a=a instanceof D?a.na:null;switch(a){case "trace":return 10;case "debug":return 20;case "info":return 30;case "warn":return 40;case "error":return 50;default:throw Error(["No matching clause: ",k.J(a)].join(""));}},ZU=function(a){a=p(a);for(var b=fi;;){var c=t(a);if(g(c)){var e=c;c=A(e,0,null);e=A(e,1,null);qg(c)?(a=v(a),b=hg.j(b,[kk(c),"\x3d",fl.U(y([e]))].join(""))):a=v(a)}else return $o(", ",b)}},Yra=function(a){return Gh(function(b){var c=A(b,0,null);b=A(b, 1,null);return rg(c)?x.j("js",og(c))?new K(null,3,5,M,[bs,kk(c),hc(b)?b:Zo(b)],null):x.j("error",og(c))?new K(null,3,5,M,[$r,kk(c),b],null):null:null},p(a))},$U=function(){return Date.now()},Zra=function(a){return xp(new f(null,6,[aV,bV.J(a),cV,dV.J(a),eV,fV.J(a),LS,MS.J(a),gV,hV.J(a),iV,jV.J(a)],null))},$ra=function(a){return xp(new f(null,6,[aV,kV.J(a),cV,lV.J(a),eV,mV.J(a),LS,nV.J(a),gV,oV.J(a),iV,pV.J(a)],null))},asa=function(a){return xp(new f(null,5,[aV,aV.J(aV.J(a)),cV,cV.J(aV.J(a)),eV,eV.J(aV.J(a)), gV,R.J(aV.J(a)),iV,qV.J(aV.J(a))],null))},bsa=function(a){return xp(new f(null,5,[aV,aV.J(aV.J(wq.J(a))),cV,cV.J(aV.J(wq.J(a))),eV,eV.J(aV.J(wq.J(a))),gV,R.J(aV.J(wq.J(a))),iV,qV.J(aV.J(wq.J(a)))],null))},csa=function(a){return zh.U(Nh.j(Zra,rV.J(a)),Nh.j($ra,US.J(a)),y([Nh.j(asa,at.J(a)),x.j(Q.J(a),sR)?Nh.j(bsa,sV.J(a)):null,x.j(Q.J(a),ZH)?qc(function(b,c){var e=zh.j;c=zh.j(Nh.j(Zra,rV.J(c)),Nh.j($ra,US.J(c)));return e.call(zh,b,c)},je,YS(Of,wS.J(a))):null]))},dsa=function(a,b,c){a=csa(a);return th(function(e){return x.j(gV.J(e), @@ -3825,36 +3825,36 @@ B.j(m,ZP);r=m?.y??B.j(m,YP);u=q+(m?.width??B.j(m,xz));var w=r+(m?.height??B.j(m, w;return ra?FR.j(z,b):ra}())?b:null==w?B.N(B.j(z,b),uV,tR):w,H=p(xR.J(a)),J=fi,O=fi,P=fi;;){if(Ye(H)){var W=function(){var ra=I.U(a,R,C,y([AR,b,uV,E]));ra=Ue(ra,new f(null,1,[nsa,R.J(a)],null));return null!=xR.J(a)?I.N(ra,xR,nt.j(R,J)):ra}();c=cT(W)?function(){var ra=Zi.N(F,Nh.J(function(){return function(sa){return new K(null,2,5,M,[nsa.J(Ve(sa)),R.J(sa)],null)}}(H,J,O,P,W,C,E,e,h,m,q,r,u,w,z)),O);return Eqa(W,ra)}():W;c=m.j?m.j(c,a):m(c,a);var V=Zi.j(new K(null,1,5,M,[c],null),O),Z=q.j?q.j(a,c): q(a,c);Z=a===Z?P:Zi.j(new K(null,1,5,M,[Z],null),P);return new K(null,3,5,M,[c,V,Z],null)}V=t(H);V=B.j(c,V);Z=FR.J(a)?C:E;V=osa(V,C,c,y([yV,m,msa,q,zV,null,AV,u,uV,Z,BV,z]));var ba=A(V,0,null);Z=A(V,1,null);var qa=A(V,2,null);V=v(H);ba=Zi.j(J,new K(null,1,5,M,[ba],null));Z=Zi.j(O,Z);qa=Zi.j(P,qa);H=V;J=ba;O=Z;P=qa}},DV=function(a,b){return B.j(B.j(a,bR),b)},HV=function(a,b,c){c=G(c);var e=B.N(c,EV,!1),h=B.j(a,AR.J(b));return null==b?null:uR(b)?null:!0===FV.J(b)?b:!$Q(b)&&fc(e)?null:null==GV.J(b)|| $Q(h)?HV(a,h,c):b},qsa=function(a){var b=aT(a)&&x.j(IV,JV.J(a))?IV:null,c=aT(a)&&x.j(IV,KV.J(a))?IV:null;a=zp(a,psa);b=null!=b?I.N(a,JV,b):a;return null!=c?I.N(b,KV,c):b},ssa=function(a,b,c,e,h){return rsa(a,b,c,e,h)},rsa=function(a,b,c,e,h){function m(ba){var qa=Yp.N(ba,AR,function(ra){return g(ra)?ra:uV.J(ba)});return cT(ba)?Eqa(qa,l(Z)):qa}var q=G(F),r=B.N(q,tsa,!1),u=B.N(q,zV,null),w=B.N(q,usa,null);q=B.N(q,AV,!1);var z=g(h)?pR(c,hR.J(b)):null,C=g(h)?qsa(I.N(I.N(DV(z,gR.J(b)),AR,null),uV,tR)): -DV(b,R.J(b)),E=aQ(ZP.J(C),YP.J(C)),H=cQ(e,E),J=bR.J(a),O=Ch(gpa(J)),P=up(zR(J,R.J(C)));e=function(){return g(w)?w:lsa(J,bQ(E,H),new f(null,3,[vsa,!0,isa,!0,wV,function(ba){return null==B.j(P,R.J(ba))}],null))}();var W=DV(a,e),V=HV(J,W,new f(null,1,[EV,!0],null)),Z=Ch(F);a=osa(C,e,g(h)?bR.J(z):bR.J(b),y([yV,function(ba,qa){var ra=S.J(ba),sa=!0===FV.J(qa)||null==AR.J(qa),Ea=Poa(qa);sa&&O.oe(null,hg.j(O.Fb(null),ra));Z.oe(null,I.N(Z.Fb(null),R.J(qa),R.J(ba)));var Sa=ln.j;var Ia=ba?.type??B.j(ba,Q);var Wb= -H?.x??B.j(H,ZP),vb=H?.y??B.j(H,YP);Wb=zo(Wb,0);var cc=zo(vb,0);vb=XP(Wb,cc);ba=Fp(Fp(Fp(Yp.ba(Yp.ba(ba,UQ,Qqa,vb),SQ,Rqa,vb),ZP,Rp,y([Wb])),YP,Rp,y([cc])),YT,Sqa,y([vb]));ba=x.j(WT,Ia)?Yp.ba(ba,XT,Apa,vb):ba;Ia=x.j(Ez,Ia)?Yp.ba(ba,wS,Apa,vb):ba;Sa=Sa.call(ln,Ia,aR);Ea=null!=Ea?I.N(Sa,aR,dk([g(Ea)?Mk.J(["swap-slot-",k.J(Ea)].join("")):null])):Sa;sa=g(g(r)?sa:r)?I.N(Ea,LV,!0):Ea;sa=fc(r)?ln.j(sa,LV):sa;sa=g(r)?ln.j(sa,ZQ):sa;Ea=(Ea=fc(r))?g(h)?h:null==ZQ.J(qa):Ea;sa=g(Ea)?I.N(sa,ZQ,R.J(qa)):sa;ra=null== -AR.J(qa)?I.U(sa,GV,R.J(b),y([MV,R.J(c),FV,!0,S,ra])):sa;return null!=AR.J(qa)||null!=V?ln.j(ra,FV):ra},zV,u,AV,q,uV,e,BV,bR.J(a)]));u=A(a,0,null);q=A(a,1,null);A(a,2,null);return new K(null,2,5,M,[m(u),Nh.j(m,q)],null)},wsa=function(a){a=G(a);var b=B.j(a,KS),c=G(b);b=B.j(c,xz);c=B.j(c,DQ);return I.U(a,NV,b/c,y([OV,!0]))},xsa=function(a){a=G(a);var b=B.j(a,UQ),c=G(b);b=B.j(c,xz);c=B.j(c,DQ);return I.U(a,NV,b/c,y([OV,!0]))},ysa=function(a){a=G(a);var b=B.j(a,Q),c=op(rV.J(a))&&sh(function(e){return null!= -MS.J(e)},rV.J(a));return x.j(b,PV)?xsa(a):x.j(b,LS)?wsa(a):x.j(b,ZH)?a:c?xsa(a):I.U(a,NV,1,y([OV,!1]))},QV=function(a,b,c,e,h,m,q,r,u,w,z,C,E,H,J,O,P,W,V){this.id=a;this.name=b;this.type=c;this.x=e;this.y=h;this.width=m;this.height=q;this.rotation=r;this.bb=u;this.points=w;this.transform=z;this.Oa=C;this.Hb=E;this.Jb=H;this.flip_x=J;this.flip_y=O;this.Ma=P;this.ta=W;this.wc=V;this.ea=2230716170;this.ka=139280},RV=function(a){var b=new bk(null,new f(null,16,[YP,null,tS,null,FT,null,S,null,xz,null, -Q,null,SQ,null,uS,null,R,null,AR,null,uV,null,ZP,null,UQ,null,rS,null,DQ,null,sS,null],null),null),c=Nf(function(e,h,m){return yf(b,h)?e:I.N(e,h,m)},F,a);return new QV(B.j(a,R),B.j(a,S),B.j(a,Q),B.j(a,ZP),B.j(a,YP),B.j(a,xz),B.j(a,DQ),B.j(a,FT),B.j(a,UQ),B.j(a,SQ),B.j(a,tS),B.j(a,uS),B.j(a,AR),B.j(a,uV),B.j(a,rS),B.j(a,sS),null,bh(c),null)},Jsa=function(a){a=a instanceof D?a.na:null;switch(a){case "rect":return zsa;case "image":return Asa;case "circle":return Bsa;case "path":return Csa;case "frame":return Dsa; -case "bool":return Esa;case "group":return Fsa;case "text":return Gsa;case "svg-raw":return Hsa;case "multiple":return Isa;default:throw Error(["No matching clause: ",k.J(a)].join(""));}},Lsa=function(a){a=x.j(a,Ksa)?Ez:a;var b=Jsa(a);a=Xj.j(Ez,a)&&Xj.j(WT,a)?I.N(I.N(I.N(I.N(b,ZP,0),YP,0),xz,.01),DQ,.01):b;a=I.U(a,R,CV(),y([uV,tR,AR,tR,FT,0]));return RV(a)},Msa=function(a){a=G(a);var b=B.j(a,UQ),c=B.j(a,SQ);if(!g(b)){b=a?.x??B.j(a,ZP);var e=a?.y??B.j(a,YP),h=a?.width??B.j(a,xz),m=a?.height??B.j(a, -DQ);b=Qp(b,e,h,m)?KQ.ba(b,e,h,m):null}c=g(c)?c:IQ(b);return I.N(I.N(a,UQ,b),SQ,c)},SV=function(a){a=G(a);var b=B.j(a,Q);b=Lsa(b);a=xp(Zi.j(F,a));var c=Yg.U(y([b,xp(Zi.j(F,a))])),e=function(){var h=Q.J(c);switch(h instanceof D?h.na:null){case "bool":case "path":h=G(c);var m=B.j(h,wS),q=B.j(h,UQ),r=B.j(h,SQ);g(q)?m=q:(m=iS(m),m=g(m)?m:KQ.aa());r=g(r)?r:IQ(m);return I.N(I.N(h,UQ,m),SQ,r);case "image":return h=Msa(c),h=G(h),r=B.j(h,KS),I.N(I.N(h,NV,xz.J(r)/DQ.J(r)),OV,!0);default:return Msa(c)}}();return ysa(function(){var h= -null==tS.J(e)?I.N(e,tS,sQ.aa()):e;return null==uS.J(e)?I.N(h,uS,sQ.aa()):h}())},Osa=function(a){var b=G(a);a=B.j(b,R);b=B.j(b,S);return I.N(I.N(Nsa,R,g(a)?a:CV()),S,g(b)?b:"Page 1")},Psa=function(a,b,c){var e=Yg;return Dp(a,new K(null,2,5,M,[TV,b],null),function(h){return I.N(Qg(e,h,c),jR,lR.local())})},Qsa=function(a,b,c){return x.j(Q.J(a),ZH)&&YS(function(e){return x.j(UV.J(e),c)&&x.j(VV.J(e),b)},wS.J(a))},tX=function(a,b){var c=null!=b?Osa(new f(null,2,[R,b,S,"Page 1"],null)):null;a=I.N(BUa,R, -a);b=null!=b?Yoa(a,c):a;return yf(UU,"components/v2")?dp(b,new K(null,2,5,M,[Bq,WV],null),!0):b},XV=function(a,b){var c=B.j(B.j(a,Bq),WV);if(g(g(c)?g(b)?Ye(bR.J(b)):b:c)){a=pR(a,hR.J(b));var e=bR.J(a);a=up(Nh.j(function(h){return B.j(e,h)},kg(gR.J(b),yR(e,gR.J(b)))));return I.N(b,bR,a)}return b},Rsa=function(a,b,c,e){var h=B.j(B.j(a,Bq),WV);return g(function(){var m=fc(h);return m?m:c}())?Yp.ba(a,dR,ln,b):Woa(mR(mR(a,b,xh(XV,a)),b,function(m){return g(e)?dp(m,new K(null,2,5,M,[bR,gR.J(m)],null),e): -m}),b)},Ssa=function(a,b,c){var e=B.j(B.j(a,Bq),WV);e=g(e)?null!=c:e;a=Xoa(mR(a,b,function(h){return ln.j(h,bR)}),b);return g(e)?mR(a,b,function(h){return I.N(h,hR,c)}):a},Tsa=function(a,b){for(;;){if(yf(b,MV))return B.j(b,MV);if(yf(b,ZQ)){var c=a;b=B.j(a,AR.J(b));a=c}else return null}},Vsa=function(a,b){function c(m){return sm(m,function(q){return e(m,q)})}function e(m,q){if(YU("app.common.types.file",YV)){var r=function(){return l(new $k(function(){return new K(null,3,5,M,[new K(null,2,5,M,[fK, -"detach-shape"],null),new K(null,2,5,M,[qV,b],null),new K(null,2,5,M,[Usa,Tsa(m,q)],null)],null)}))}(),u=$U();(function(){var z=Zi.j(ZV,r),C=xp(Yg.U(y([null,null])));C=new f(null,7,[$V,C,aW,u,bW,z,cW,CV(),dW,new $k(function(){return ZU(z)}),eW,"app.common.types.file",fW,YV],null);return ll.j(gW,wh(C))})()}var w=Xj.j(b,jV.J(q))?ln.U(q,hV,y([jV])):q;w=Xj.j(b,pV.J(q))?ln.U(w,oV,y([pV])):w;w=Xj.j(b,Tsa(m,q))?ln.U(w,GV,y([MV,ZQ,FV])):w;return x.j(ZH,Q.J(q))?Yp.N(w,wS,h):w}function h(m){return XS(function(q){var r= -Xj.j(b,jV.J(q))?ln.U(q,hV,y([jV])):q;return Xj.j(b,VV.J(q))?ln.U(r,UV,y([VV])):r},m)}return jn.N(a,new K(null,2,5,M,[nB,oR],null),function(m){return sm(m,function(q){return Yp.N(q,bR,c)})})},hW=function(a,b){return null!=a?a[b]:null},iW=function(a){return Object.assign({},a)},jW=function(a,b,c){a[b]=c;return a},kW=function(a,b){delete a[b];return a},lW=function(a){a.prototype.Ai=function(){return Fra(this)}},Wsa=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}},mW=function(){return lb("iPhone")&& -!lb("iPod")&&!lb("iPad")},Xsa=function(){mW()||lb("iPad")||lb("iPod")},Zsa=function(a,b){cb(b,function(c,e){c&&"object"==typeof c&&c.hl&&(c=c.dl());"style"==e?a.style.cssText=c:"class"==e?a.className=c:"for"==e?a.htmlFor=c:Ysa.hasOwnProperty(e)?a.setAttribute(Ysa[e],c):Wa(e,"aria-")||Wa(e,"data-")?a.setAttribute(e,c):a[e]=c})},ata=function(a,b,c){function e(r){r&&b.appendChild("string"===typeof r?a.createTextNode(r):r)}for(var h=1;h = new Map(); + + public init() { + this.idMap.clear(); + } + + public get(figmaId: string): Uuid | undefined { + return this.idMap.get(figmaId); + } + + public register(figmaId: string, id: Uuid) { + this.idMap.set(figmaId, id); + } +} + +export const idLibrary = new IdLibrary(); diff --git a/ui-src/parser/creators/createArtboard.ts b/ui-src/parser/creators/createArtboard.ts index 76ddf69..3386235 100644 --- a/ui-src/parser/creators/createArtboard.ts +++ b/ui-src/parser/creators/createArtboard.ts @@ -1,14 +1,20 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { FrameShape } from '@ui/lib/types/shapes/frameShape'; +import { Uuid } from '@ui/lib/types/utils/uuid'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode, symbolFillGradients } from '@ui/parser/creators/symbols'; import { createItems } from '.'; export const createArtboard = ( file: PenpotFile, - { type, fills, blendMode, children = [], ...rest }: FrameShape -) => { + { type, fills, blendMode, children = [], figmaId, figmaRelatedId, shapeRef, ...rest }: FrameShape +): Uuid | undefined => { + const id = parseFigmaId(file, figmaId); + file.addArtboard({ + id, + shapeRef: shapeRef ?? parseFigmaId(file, figmaRelatedId, true), fills: symbolFillGradients(fills), blendMode: symbolBlendMode(blendMode), ...rest @@ -17,4 +23,6 @@ export const createArtboard = ( createItems(file, children); file.closeArtboard(); + + return id; }; diff --git a/ui-src/parser/creators/createBool.ts b/ui-src/parser/creators/createBool.ts index 7276186..8e0e4f1 100644 --- a/ui-src/parser/creators/createBool.ts +++ b/ui-src/parser/creators/createBool.ts @@ -1,14 +1,17 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { BoolShape } from '@ui/lib/types/shapes/boolShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode, symbolBoolType, symbolFillGradients } from '@ui/parser/creators/symbols'; import { createItems } from '.'; export const createBool = ( file: PenpotFile, - { type, fills, boolType, blendMode, children = [], ...rest }: BoolShape + { type, fills, boolType, blendMode, figmaId, figmaRelatedId, children = [], ...rest }: BoolShape ) => { file.addBool({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), fills: symbolFillGradients(fills), blendMode: symbolBlendMode(blendMode), boolType: symbolBoolType(boolType), diff --git a/ui-src/parser/creators/createCircle.ts b/ui-src/parser/creators/createCircle.ts index 36f790a..436b612 100644 --- a/ui-src/parser/creators/createCircle.ts +++ b/ui-src/parser/creators/createCircle.ts @@ -1,12 +1,15 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { CircleShape } from '@ui/lib/types/shapes/circleShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode, symbolFillGradients } from '@ui/parser/creators/symbols'; export const createCircle = ( file: PenpotFile, - { type, fills, blendMode, ...rest }: CircleShape + { type, fills, blendMode, figmaId, figmaRelatedId, ...rest }: CircleShape ) => { file.createCircle({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), fills: symbolFillGradients(fills), blendMode: symbolBlendMode(blendMode), ...rest diff --git a/ui-src/parser/creators/createComponent.ts b/ui-src/parser/creators/createComponent.ts index a2c1179..4799e5f 100644 --- a/ui-src/parser/creators/createComponent.ts +++ b/ui-src/parser/creators/createComponent.ts @@ -7,24 +7,28 @@ import { ComponentRoot } from '@ui/types'; import { createArtboard } from '.'; export const createComponent = (file: PenpotFile, { figmaId }: ComponentRoot) => { - const frameId = file.newId(); - const componentId = file.newId(); - const component = componentsLibrary.get(figmaId); if (!component) { return; } - createArtboard(file, { + const uiComponent = uiComponents.get(figmaId); + const componentId = uiComponent?.componentId ?? file.newId(); + + const frameId = createArtboard(file, { ...component, + showContent: true, componentFile: file.getId(), - componentId: componentId, + componentId, componentRoot: true, mainInstance: true, - id: frameId, type: 'frame' }); + if (!frameId) { + return; + } + uiComponents.register(figmaId, { componentId, mainInstancePage: file.getCurrentPageId(), diff --git a/ui-src/parser/creators/createComponentInstance.ts b/ui-src/parser/creators/createComponentInstance.ts new file mode 100644 index 0000000..c93d081 --- /dev/null +++ b/ui-src/parser/creators/createComponentInstance.ts @@ -0,0 +1,44 @@ +import { PenpotFile } from '@ui/lib/types/penpotFile'; +import { parseFigmaId } from '@ui/parser'; +import { uiComponents } from '@ui/parser/libraries'; +import { ComponentInstance } from '@ui/types'; + +import { createArtboard } from '.'; + +export const createComponentInstance = ( + file: PenpotFile, + { + type, + mainComponentFigmaId, + figmaId, + figmaRelatedId, + isComponentRoot, + ...rest + }: ComponentInstance +) => { + let uiComponent = uiComponents.get(mainComponentFigmaId); + + if (!uiComponent) { + const mainInstanceId = parseFigmaId(file, mainComponentFigmaId); + if (!mainInstanceId) { + return; + } + + uiComponent = { + componentId: file.newId(), + componentFigmaId: mainComponentFigmaId, + mainInstanceId + }; + uiComponents.register(mainComponentFigmaId, uiComponent); + } + + createArtboard(file, { + ...rest, + showContent: true, + shapeRef: uiComponent.mainInstanceId, + componentFile: file.getId(), + componentRoot: isComponentRoot, + componentId: uiComponent.componentId, + type: 'frame' + }); +}; diff --git a/ui-src/parser/creators/createGroup.ts b/ui-src/parser/creators/createGroup.ts index 26fcca9..5abcd3e 100644 --- a/ui-src/parser/creators/createGroup.ts +++ b/ui-src/parser/creators/createGroup.ts @@ -1,14 +1,17 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { GroupShape } from '@ui/lib/types/shapes/groupShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode } from '@ui/parser/creators/symbols'; import { createItems } from '.'; export const createGroup = ( file: PenpotFile, - { type, blendMode, children = [], ...rest }: GroupShape + { type, blendMode, children = [], figmaId, figmaRelatedId, ...rest }: GroupShape ) => { file.addGroup({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), blendMode: symbolBlendMode(blendMode), ...rest }); diff --git a/ui-src/parser/creators/createItems.ts b/ui-src/parser/creators/createItems.ts index e257f58..874eccc 100644 --- a/ui-src/parser/creators/createItems.ts +++ b/ui-src/parser/creators/createItems.ts @@ -6,6 +6,7 @@ import { createBool, createCircle, createComponent, + createComponentInstance, createGroup, createPath, createRectangle, @@ -36,5 +37,7 @@ const createItem = (file: PenpotFile, node: PenpotNode) => { return createBool(file, node); case 'component': return createComponent(file, node); + case 'instance': + return createComponentInstance(file, node); } }; diff --git a/ui-src/parser/creators/createPath.ts b/ui-src/parser/creators/createPath.ts index c67d50b..a5990be 100644 --- a/ui-src/parser/creators/createPath.ts +++ b/ui-src/parser/creators/createPath.ts @@ -1,5 +1,6 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { PathShape } from '@ui/lib/types/shapes/pathShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode, symbolFillGradients, @@ -8,9 +9,11 @@ import { export const createPath = ( file: PenpotFile, - { type, fills, blendMode, content, ...rest }: PathShape + { type, fills, blendMode, content, figmaId, figmaRelatedId, ...rest }: PathShape ) => { file.createPath({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), fills: symbolFillGradients(fills), blendMode: symbolBlendMode(blendMode), content: symbolPathContent(content), diff --git a/ui-src/parser/creators/createRectangle.ts b/ui-src/parser/creators/createRectangle.ts index a19a9b8..9583aa8 100644 --- a/ui-src/parser/creators/createRectangle.ts +++ b/ui-src/parser/creators/createRectangle.ts @@ -1,12 +1,15 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { RectShape } from '@ui/lib/types/shapes/rectShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode, symbolFillGradients } from '@ui/parser/creators/symbols'; export const createRectangle = ( file: PenpotFile, - { type, fills, blendMode, ...rest }: RectShape + { type, fills, blendMode, figmaId, figmaRelatedId, ...rest }: RectShape ) => { file.createRect({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), fills: symbolFillGradients(fills), blendMode: symbolBlendMode(blendMode), ...rest diff --git a/ui-src/parser/creators/createText.ts b/ui-src/parser/creators/createText.ts index 92a8c1d..e0a0143 100644 --- a/ui-src/parser/creators/createText.ts +++ b/ui-src/parser/creators/createText.ts @@ -1,9 +1,15 @@ import { PenpotFile } from '@ui/lib/types/penpotFile'; import { TextShape } from '@ui/lib/types/shapes/textShape'; +import { parseFigmaId } from '@ui/parser'; import { symbolBlendMode } from '@ui/parser/creators/symbols'; -export const createText = (file: PenpotFile, { type, blendMode, ...rest }: TextShape) => { +export const createText = ( + file: PenpotFile, + { type, blendMode, figmaId, figmaRelatedId, ...rest }: TextShape +) => { file.createText({ + id: parseFigmaId(file, figmaId), + shapeRef: parseFigmaId(file, figmaRelatedId, true), blendMode: symbolBlendMode(blendMode), ...rest }); diff --git a/ui-src/parser/creators/index.ts b/ui-src/parser/creators/index.ts index 3392e91..bdcd5a3 100644 --- a/ui-src/parser/creators/index.ts +++ b/ui-src/parser/creators/index.ts @@ -1,8 +1,9 @@ -export * from './createComponentLibrary'; export * from './createArtboard'; export * from './createBool'; export * from './createCircle'; export * from './createComponent'; +export * from './createComponentInstance'; +export * from './createComponentLibrary'; export * from './createGroup'; export * from './createItems'; export * from './createPage'; diff --git a/ui-src/parser/index.ts b/ui-src/parser/index.ts index dd1a55c..6ce32a0 100644 --- a/ui-src/parser/index.ts +++ b/ui-src/parser/index.ts @@ -1 +1,3 @@ +export * from './IdLibrary'; export * from './parse'; +export * from './parseFigmaId'; diff --git a/ui-src/parser/libraries/UiComponents.ts b/ui-src/parser/libraries/UiComponents.ts index 358cd7a..5e0bbe1 100644 --- a/ui-src/parser/libraries/UiComponents.ts +++ b/ui-src/parser/libraries/UiComponents.ts @@ -2,7 +2,7 @@ import { Uuid } from '@ui/lib/types/utils/uuid'; type UiComponent = { componentId: Uuid; - mainInstancePage: Uuid; + mainInstancePage?: Uuid; mainInstanceId: Uuid; componentFigmaId: string; }; diff --git a/ui-src/parser/parse.ts b/ui-src/parser/parse.ts index 8becd82..39cf229 100644 --- a/ui-src/parser/parse.ts +++ b/ui-src/parser/parse.ts @@ -5,9 +5,12 @@ import { createComponentLibrary, createPage } from '@ui/parser/creators'; import { uiComponents } from '@ui/parser/libraries/UiComponents'; import { PenpotDocument } from '@ui/types'; +import { idLibrary } from '.'; + export const parse = ({ name, children = [], components }: PenpotDocument) => { componentsLibrary.init(components); uiComponents.init(); + idLibrary.init(); const file = createFile(name); diff --git a/ui-src/parser/parseFigmaId.ts b/ui-src/parser/parseFigmaId.ts new file mode 100644 index 0000000..5a248ac --- /dev/null +++ b/ui-src/parser/parseFigmaId.ts @@ -0,0 +1,27 @@ +import { PenpotFile } from '@ui/lib/types/penpotFile'; +import { Uuid } from '@ui/lib/types/utils/uuid'; + +import { idLibrary } from '.'; + +export const parseFigmaId = ( + file: PenpotFile, + figmaId?: string, + shapeRef: boolean = false +): Uuid | undefined => { + if (!figmaId) { + if (shapeRef) { + return; + } + + return file.newId(); + } + + const id = idLibrary.get(figmaId); + if (id) { + return id; + } + + const newId = file.newId(); + idLibrary.register(figmaId, newId); + return newId; +}; diff --git a/ui-src/types/component.ts b/ui-src/types/component.ts new file mode 100644 index 0000000..8a172dc --- /dev/null +++ b/ui-src/types/component.ts @@ -0,0 +1,19 @@ +import { LayoutAttributes, LayoutChildAttributes } from '@ui/lib/types/shapes/layout'; +import { ShapeGeomAttributes } from '@ui/lib/types/shapes/shape'; +import { Children } from '@ui/lib/types/utils/children'; + +export type ComponentRoot = { + figmaId: string; + type: 'component'; +}; + +export type ComponentInstance = ShapeGeomAttributes & + LayoutAttributes & + LayoutChildAttributes & + Children & { + mainComponentFigmaId: string; + figmaId?: string; + figmaRelatedId?: string; + isComponentRoot: boolean; + type: 'instance'; + }; diff --git a/ui-src/types/componentRoot.ts b/ui-src/types/componentRoot.ts deleted file mode 100644 index 4036e9a..0000000 --- a/ui-src/types/componentRoot.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type ComponentRoot = { - figmaId: string; - type: 'component'; -}; diff --git a/ui-src/types/index.ts b/ui-src/types/index.ts index 3eb2105..f818e76 100644 --- a/ui-src/types/index.ts +++ b/ui-src/types/index.ts @@ -1,3 +1,3 @@ -export * from './componentRoot'; +export * from './component'; export * from './penpotDocument'; export * from './penpotNode'; diff --git a/ui-src/types/penpotNode.ts b/ui-src/types/penpotNode.ts index e5d52a5..5dd62f4 100644 --- a/ui-src/types/penpotNode.ts +++ b/ui-src/types/penpotNode.ts @@ -5,7 +5,7 @@ import { GroupShape } from '@ui/lib/types/shapes/groupShape'; import { PathShape } from '@ui/lib/types/shapes/pathShape'; import { RectShape } from '@ui/lib/types/shapes/rectShape'; import { TextShape } from '@ui/lib/types/shapes/textShape'; -import { ComponentRoot } from '@ui/types'; +import { ComponentInstance, ComponentRoot } from '@ui/types'; export type PenpotNode = | FrameShape @@ -15,4 +15,5 @@ export type PenpotNode = | CircleShape | TextShape | BoolShape + | ComponentInstance | ComponentRoot;