@phin-tech/dottie 0.3.0 → 0.5.1
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/PARITY.md +6 -2
- package/README.md +9 -2
- package/dist/compile.js +99 -5
- package/dist/dottie-compile.mjs +100 -6
- package/dist/dottie-player.js +1167 -653
- package/dist/dottie-player.min.js +61 -41
- package/dist/dottie.js +1166 -653
- package/dist/types/clicks.d.ts +30 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model.d.ts +35 -1
- package/dist/types/player.d.ts +35 -0
- package/dist/types/symbols.d.ts +20 -0
- package/dist/types/timeline.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,43 +1,54 @@
|
|
|
1
|
-
/*! dottie.js 0.
|
|
2
|
-
"use strict";(()=>{var He=Object.defineProperty;var Zn=(t,e,n)=>e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Jn=(t,e)=>{for(var n in e)He(t,n,{get:e[n],enumerable:!0})};var k=(t,e,n)=>Zn(t,typeof e!="symbol"?e+"":e,n);var Fe={};Jn(Fe,{BOIL_DRAWINGS:()=>he,DottieFormatError:()=>q,DottiePlayer:()=>wt,KINDS:()=>je,KNOWN_FIELDS:()=>_e,MAX_DURATION:()=>mt,MAX_MARCH:()=>ce,Playback:()=>Vt,SUPPORTED_VERSION:()=>or,VERSION:()=>ir,black:()=>st,bounds:()=>rt,cameraView:()=>bt,clampFPS:()=>ft,clampMarch:()=>qe,clampTime:()=>ot,clear:()=>Ue,cloneElement:()=>B,definePlayer:()=>oe,elementIndex:()=>ni,frameTimes:()=>ne,inkOnDark:()=>Ke,inspect:()=>Qn,inspectFrame:()=>Ge,inspectPage:()=>Be,isAutomaticInk:()=>me,luminance:()=>pt,orderedElements:()=>At,pageIndex:()=>Dt,parseDottie:()=>Rt,plan:()=>kt,posterTime:()=>it,render:()=>er,repeatIsValid:()=>Ct,resolved:()=>W,sameColor:()=>dt,sampleTimes:()=>Ce,sceneAt:()=>qn,stableSortBy:()=>zt,still:()=>_n,svg:()=>re,svgParts:()=>Lt,themeNamed:()=>ht,themes:()=>De,transientElements:()=>Un,withRoughness:()=>Wt});var or=2,je=["rectangle","ellipse","diamond","text","connector","freehand","path","note","image"],ti=["linear","easeIn","easeOut","easeInOut","hold","spring","bounce","elastic"],_e={file:["version","pages","images"],page:["id","name","layers","elements","theme","guidesX","guidesY","guidesLocked","timeline"],layer:["id","name","visible","locked"],rgba:["r","g","b","a"],style:["stroke","fill","fillStyle","strokeWidth","dash","roughness","bowing","fontSize","gridSize","opacity","dashOffset"],element:["id","kind","x","y","width","height","style","seed","layerID","text","connector","groupID","points","path","subpaths","evenOdd","rotation","link","anchor","image","reveal"],strokePoint:["x","y"],subpath:["closed","coords"],inlineImage:["data","format"],endpoint:["elementID","port","x","y"],connector:["start","end","routing","startHead","endHead"],timeline:["fps","duration","boil","settle","poster","tracks","camera","markers"],track:["element","keys","boil","follow","repeats","march"],keyframe:["t","x","y","width","height","rotation","strokeWidth","stroke","fill","visible","reveal","opacity","ease"],follow:["path","start","end","ease","reverse","orient","laps"],repeat:["start","end","count"],cameraKey:["t","x","y","width","height","ease"],marker:["t","name"]},mt=3600,ce=1e4,qe=t=>t===void 0||!Number.isFinite(t)||t===0?null:Math.min(Math.max(t,-ce),ce),he=3,st={r:.12,g:.12,b:.13,a:1},Ue={r:0,g:0,b:0,a:0},Ke={r:.93,g:.93,b:.94,a:1},q=class extends Error{},E=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),w=t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,$=t=>typeof t=="string"?t:void 0,j=t=>typeof t=="boolean"?t:void 0,_=t=>typeof t=="string"?t.toUpperCase():void 0;function ot(t){return Number.isFinite(t)?Math.min(Math.max(t,0),mt):t===1/0?mt:0}function ft(t){return Number.isFinite(t)?Math.min(Math.max(t,1),60):12}function Ot(t){if(!E(t))return;let e=w(t.r),n=w(t.g),i=w(t.b);if(!(e===void 0||n===void 0||i===void 0))return{r:e,g:n,b:i,a:w(t.a)??1}}var ue=class{constructor(){k(this,"warnings",[]);k(this,"seen",new Set)}warn(e){this.seen.has(e)||(this.seen.add(e),this.warnings.push(e))}fields(e,n){let i=_e[n];for(let r of Object.keys(e))i.includes(r)||this.warn(`Unknown field "${r}" on ${n}, ignored`)}style(e){let n=E(e)?e:{};this.fields(n,"style");let i=$(n.fillStyle)??"solid",r=$(n.dash)??"solid";return["solid","hachure","crossHatch","grid"].includes(i)||this.warn(`Unknown fill style "${i}", drawn solid`),["solid","dashed","dotted"].includes(r)||this.warn(`Unknown dash "${r}", drawn solid`),{stroke:Ot(n.stroke)??{...st},fill:Ot(n.fill)??{...Ue},fillStyle:["solid","hachure","crossHatch","grid"].includes(i)?i:"solid",strokeWidth:w(n.strokeWidth)??2,dash:["solid","dashed","dotted"].includes(r)?r:"solid",roughness:w(n.roughness)??1,bowing:w(n.bowing)??1,fontSize:w(n.fontSize)??18,gridSize:w(n.gridSize)??null,opacity:w(n.opacity)??null,dashOffset:w(n.dashOffset)??null}}endpoint(e){let n=E(e)?e:{},i=$(n.port);return{elementID:_(n.elementID)??null,port:i&&["top","right","bottom","left"].includes(i)?i:null,x:w(n.x)??0,y:w(n.y)??0}}connector(e){if(!E(e))return null;this.fields(e,"connector");let n=(r,o)=>{let s=$(r);return s&&["none","arrow","triangle","dot","bar"].includes(s)?s:o},i=$(e.routing);return{start:this.endpoint(e.start),end:this.endpoint(e.end),routing:i&&["straight","curved","elbow"].includes(i)?i:"straight",startHead:n(e.startHead,"none"),endHead:n(e.endHead,"arrow")}}image(e,n){if(!E(e))return null;let i=$(e.ref);if(i!==void 0)return n[i]??{data:"",format:"png"};let r=$(e.data);return r===void 0?null:this.picture(r,$(e.format))}picture(e,n){return ei.test(e)?{data:e.replace(/\s+/g,""),format:n==="jpeg"?"jpeg":"png"}:(this.warn("Skipped a picture whose data isn't base64"),{data:"",format:"png"})}element(e,n){if(!E(e))return null;this.fields(e,"element");let i=_(e.id),r=$(e.kind),o=_(e.layerID);if(!i||!r||!o)return this.warn("Skipped an element without an id, kind or layer"),null;je.includes(r)||this.warn(`Unknown element kind "${r}", drawn as a placeholder`);let s=Array.isArray(e.subpaths)?e.subpaths.filter(E).map(l=>({closed:j(l.closed)??!1,coords:Array.isArray(l.coords)?l.coords.filter(a=>typeof a=="number"):[]})):null;return{id:i,kind:r,layerID:o,x:w(e.x)??0,y:w(e.y)??0,width:w(e.width)??0,height:w(e.height)??0,style:this.style(e.style),seed:(w(e.seed)??1)>>>0,text:$(e.text)??null,connector:this.connector(e.connector),groupID:_(e.groupID)??null,points:Array.isArray(e.points)?e.points.filter(E).map(l=>({x:w(l.x)??0,y:w(l.y)??0})):null,path:Array.isArray(e.path)?e.path.filter(l=>typeof l=="number"):null,subpaths:s,evenOdd:j(e.evenOdd)??null,rotation:w(e.rotation)??null,link:_(e.link)??null,anchor:$(e.anchor)??null,image:this.image(e.image,n),reveal:w(e.reveal)??null}}ease(e){let n=$(e);return n===void 0?null:ti.includes(n)?n:(this.warn(`Unknown ease "${n}", played linear`),null)}keyframe(e){if(!E(e))return null;this.fields(e,"keyframe");let n=w(e.t);if(n===void 0)return null;let i={t:n};for(let a of["x","y","width","height","rotation","strokeWidth","reveal","opacity"]){let c=w(e[a]);c!==void 0&&(i[a]=c)}let r=Ot(e.stroke),o=Ot(e.fill),s=j(e.visible),l=this.ease(e.ease);return r&&(i.stroke=r),o&&(i.fill=o),s!==void 0&&(i.visible=s),l&&(i.ease=l),i}track(e){if(!E(e))return null;this.fields(e,"track");let n=_(e.element);if(!n)return null;let i=(Array.isArray(e.keys)?e.keys:[]).map(s=>this.keyframe(s)).filter(s=>s!==null&&s.t>=0&&s.t<=mt);zt(i,s=>s.t);let r=Array.isArray(e.follow)?e.follow.filter(E).flatMap(s=>{let l=_(s.path),a=w(s.start),c=w(s.end);return!l||a===void 0||c===void 0||a<0||c>mt?[]:[{path:l,start:a,end:c,ease:this.ease(s.ease),reverse:j(s.reverse)??null,orient:j(s.orient)??null,laps:w(s.laps)??null}]}):null,o=Array.isArray(e.repeats)?e.repeats.filter(E).flatMap(s=>{let l=w(s.start),a=w(s.end);if(l===void 0||a===void 0)return[];let c=w(s.count),u={start:l,end:a,count:c===void 0?null:Math.trunc(c)};return Ct(u)?[u]:[]}):null;return{element:n,keys:i,boil:j(e.boil)??null,follow:r,repeats:o,march:qe(w(e.march))}}timeline(e){if(!E(e))return null;this.fields(e,"timeline");let n=w(e.boil),i=Array.isArray(e.camera)?e.camera.filter(E).flatMap(s=>{let l=w(s.t),a=w(s.x),c=w(s.y),u=w(s.width),d=w(s.height);return l===void 0||a===void 0||c===void 0||u===void 0||d===void 0?[]:u>1&&d>1&&l>=0?[{t:l,x:a,y:c,width:u,height:d,ease:this.ease(s.ease)}]:[]}):null;i&&zt(i,s=>s.t);let r=Array.isArray(e.markers)?e.markers.filter(E).flatMap(s=>{let l=w(s.t);return l!==void 0&&l>=0?[{t:l,name:$(s.name)??""}]:[]}):null;r&&zt(r,s=>s.t);let o=w(e.poster);return{fps:ft(w(e.fps)??12),duration:ot(w(e.duration)??0),boil:n!==void 0&&Number.isInteger(n)&&n>0?Math.min(n,1e4):null,settle:j(e.settle)??null,poster:o===void 0?null:ot(o),tracks:(Array.isArray(e.tracks)?e.tracks:[]).map(s=>this.track(s)).filter(s=>s!==null),camera:i,markers:r}}page(e,n,i){if(!E(e))throw new q(`Page ${i} is not an object`);this.fields(e,"page");let r=(Array.isArray(e.layers)?e.layers:[]).filter(E).flatMap(o=>{let s=_(o.id);return s?[{id:s,name:$(o.name)??"",visible:j(o.visible)??!0,locked:j(o.locked)??!1}]:[]});return r.length===0&&(this.warn(`Page ${i} has no layers`),r.push({id:"LAYER",name:"Layer 1",visible:!0,locked:!1})),{id:_(e.id)??`PAGE-${i}`,name:$(e.name)??`Page ${i}`,layers:r,elements:(Array.isArray(e.elements)?e.elements:[]).map(o=>this.element(o,n)).filter(o=>o!==null),theme:$(e.theme)??null,timeline:this.timeline(e.timeline)}}},ei=/^[A-Za-z0-9+/=\s]*$/;function Ct(t){return Number.isFinite(t.start)&&Number.isFinite(t.end)&&t.start>=0&&t.end-t.start>.001&&t.end<=mt&&(t.count===null||t.count>=1&&t.count<=1e4)}function zt(t,e){let n=t.map((i,r)=>[i,r]);n.sort((i,r)=>e(i[0])-e(r[0])||i[1]-r[1]);for(let i=0;i<t.length;i++)t[i]=n[i][0]}function Rt(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new q(`Not JSON: ${s.message}`)}if(!E(e))throw new q("Not a Dottie drawing");let n=w(e.version);if(n===void 0)throw new q("Not a Dottie drawing (no version)");if(!Array.isArray(e.pages)||e.pages.length===0)throw new q("A drawing needs at least one page");let i=new ue;i.fields(e,"file"),n>2&&i.warn(`File version ${n} is newer than this player knows (2); some things may not show`);let r={};if(E(e.images))for(let[s,l]of Object.entries(e.images))E(l)&&typeof l.data=="string"&&(r[s]=i.picture(l.data,$(l.format)));let o=e.pages.map((s,l)=>i.page(s,r,l+1));if(new Set(o.map(s=>s.id)).size!==o.length)throw new q("Two pages share an id");return{version:n,pages:o,warnings:i.warnings}}function pt(t){return .2126*t.r+.7152*t.g+.0722*t.b}function dt(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a}function me(t){return dt(t,st)||dt(t,Ke)}function B(t){return{...t,style:{...t.style,stroke:{...t.style.stroke},fill:{...t.style.fill}},connector:t.connector?{...t.connector,start:{...t.connector.start},end:{...t.connector.end}}:null}}function At(t){if(t.layers.length<=1)return t.elements;let e=new Map;t.layers.forEach((i,r)=>{e.has(i.id)||e.set(i.id,r)});let n=t.layers.map(()=>[]);for(let i of t.elements)n[e.get(i.layerID)??0].push(i);return n.flat()}function ni(t){let e=new Map;for(let n of t.elements)e.has(n.id)||e.set(n.id,n);return e}var Xe=.5522847498307936,R=class t{constructor(){k(this,"segments",[])}get isEmpty(){return this.segments.length===0}moveTo(e){return this.segments.push({op:"M",p:e}),this}lineTo(e){return this.segments.push({op:"L",p:e}),this}quadTo(e,n){return this.segments.push({op:"Q",c:n,p:e}),this}curveTo(e,n,i){return this.segments.push({op:"C",c1:n,c2:i,p:e}),this}close(){return this.segments.push({op:"Z"}),this}addPath(e){return this.segments.push(...e.segments),this}addLines(e){return e.forEach((n,i)=>i===0?this.moveTo(n):this.lineTo(n)),this}static rect(e){return new t().addLines([{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]).close()}addEllipse(e){let n=e.x+e.width/2,i=e.y+e.height/2,r=e.width/2,o=e.height/2,s=r*Xe,l=o*Xe;return this.moveTo({x:n+r,y:i}),this.curveTo({x:n,y:i+o},{x:n+r,y:i+l},{x:n+s,y:i+o}),this.curveTo({x:n-r,y:i},{x:n-s,y:i+o},{x:n-r,y:i+l}),this.curveTo({x:n,y:i-o},{x:n-r,y:i-l},{x:n-s,y:i-o}),this.curveTo({x:n+r,y:i},{x:n+s,y:i-o},{x:n+r,y:i-l}),this.close()}static ellipse(e){return new t().addEllipse(e)}translated(e,n){let i=o=>({x:o.x+e,y:o.y+n}),r=new t;return r.segments=this.segments.map(o=>{switch(o.op){case"M":case"L":return{op:o.op,p:i(o.p)};case"Q":return{op:"Q",c:i(o.c),p:i(o.p)};case"C":return{op:"C",c1:i(o.c1),c2:i(o.c2),p:i(o.p)};case"Z":return o}}),r}contours(){let e=[],n=[],i={x:0,y:0};for(let r of this.segments){let o=n.length?n[n.length-1]:i;switch(r.op){case"M":n.length>1&&e.push(n),i=r.p,n=[r.p];break;case"L":n.push(r.p);break;case"Q":for(let s=1;s<=12;s++){let l=s/12,a=1-l;n.push({x:a*a*o.x+2*a*l*r.c.x+l*l*r.p.x,y:a*a*o.y+2*a*l*r.c.y+l*l*r.p.y})}break;case"C":for(let s=1;s<=16;s++){let l=s/16,a=1-l;n.push({x:a*a*a*o.x+3*a*a*l*r.c1.x+3*a*l*l*r.c2.x+l*l*l*r.p.x,y:a*a*a*o.y+3*a*a*l*r.c1.y+3*a*l*l*r.c2.y+l*l*l*r.p.y})}break;case"Z":n.push(i),n.length>1&&e.push(n),n=[i];break}}return n.length>1&&e.push(n),e}trimmed(e){let n=this.contours().map(o=>new yt(o)),i=Math.min(Math.max(e,0),1)*n.reduce((o,s)=>o+s.length,0),r=new t;for(let o of n){if(!(i>0))break;r.moveTo(o.points[0]);for(let s=1;s<o.points.length;s++){let l=o.lengths[s]-o.lengths[s-1];if(l<=i){r.lineTo(o.points[s]),i-=l;continue}let a=o.points[s-1],c=o.points[s],u=i/l;r.lineTo({x:a.x+(c.x-a.x)*u,y:a.y+(c.y-a.y)*u}),i=0;break}}return r}data(){let e=[];for(let n of this.segments)switch(n.op){case"M":e.push(`M${y(n.p.x)} ${y(n.p.y)}`);break;case"L":e.push(`L${y(n.p.x)} ${y(n.p.y)}`);break;case"Q":e.push(`Q${y(n.c.x)} ${y(n.c.y)} ${y(n.p.x)} ${y(n.p.y)}`);break;case"C":e.push(`C${y(n.c1.x)} ${y(n.c1.y)} ${y(n.c2.x)} ${y(n.c2.y)} ${y(n.p.x)} ${y(n.p.y)}`);break;case"Z":e.push("Z");break}return e.join(" ")}};function Tt(t){return t<0?-Math.round(-t):Math.round(t)}function y(t){let e=Tt(t*100)/100;return Number.isInteger(e)?String(e===0?0:e):String(e)}var yt=class{constructor(e){k(this,"points");k(this,"lengths");this.points=e;let n=0;this.lengths=e.map((i,r)=>(r>0&&(n+=Math.hypot(i.x-e[r-1].x,i.y-e[r-1].y)),n))}get length(){return this.lengths.length?this.lengths[this.lengths.length-1]:0}point(e){if(this.points.length<=1||!(this.length>0))return this.points[0]??{x:0,y:0};let n=Math.min(Math.max(e,0),1)*this.length,i=1;for(;i<this.lengths.length-1&&this.lengths[i]<n;)i++;let r=this.lengths[i]-this.lengths[i-1],o=r>0?(n-this.lengths[i-1])/r:0,s=this.points[i-1],l=this.points[i];return{x:s.x+(l.x-s.x)*o,y:s.y+(l.y-s.y)*o}}},z=t=>t.x+t.width/2,C=t=>t.y+t.height/2,Y=t=>t.x+t.width,O=t=>t.y+t.height;function de(t,e){if(!t)return{...e};let n=Math.min(t.x,e.x),i=Math.min(t.y,e.y);return{x:n,y:i,width:Math.max(Y(t),Y(e))-n,height:Math.max(O(t),O(e))-i}}function gt(t,e,n){return{x:t.x+e,y:t.y+n,width:t.width-2*e,height:t.height-2*n}}function fe(t,e,n){if(n===0)return t;let i=t.x-e.x,r=t.y-e.y;return{x:e.x+i*Math.cos(n)-r*Math.sin(n),y:e.y+i*Math.sin(n)+r*Math.cos(n)}}function ii(t,e){let n=1-e;return{x:t[0].x*(n*n*n)+t[1].x*(3*e*n*n)+t[2].x*(3*e*e*n)+t[3].x*(e*e*e),y:t[0].y*(n*n*n)+t[1].y*(3*e*n*n)+t[2].y*(3*e*e*n)+t[3].y*(e*e*e)}}function Qe(t,e){let n=[t[0]];for(let i=0;i<Math.floor((t.length-1)/3);i++){let r=t.slice(3*i,3*i+4),o=0;for(let l=1;l<r.length;l++)o+=Math.hypot(r[l].x-r[l-1].x,r[l].y-r[l-1].y);let s=Math.min(400,Math.max(4,Math.ceil(o/Math.max(e,.5))));for(let l=1;l<=s;l++)n.push(ii(r,l/s))}return n}var L=t=>({x:t.x,y:t.y,width:t.width,height:t.height}),F=t=>t.rotation??0,vt=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),Q=(t,e)=>fe(e,vt(t),F(t)),Ze=(t,e)=>fe(e,vt(t),-F(t));function Je(t){let e=L(t);if(F(t)===0)return e;let n=[{x:e.x,y:e.y},{x:Y(e),y:e.y},{x:Y(e),y:O(e)},{x:e.x,y:O(e)}].map(l=>Q(t,l)),i=n.map(l=>l.x),r=n.map(l=>l.y),o=Math.min(...i),s=Math.min(...r);return{x:o,y:s,width:Math.max(...i)-o,height:Math.max(...r)-s}}function tn(t,e){if(!me(t.style.stroke))return t;let n=B(t),r=(t.style.fillStyle==="solid"||t.style.fillStyle==="grid")&&t.style.fill.a>=.5&&pt(t.style.fill)>.5;return n.style.stroke=pt(e)>.5&&r?{...st}:{...e},n}function Gt(t){if(t.kind!=="path"||!t.subpaths)return[];let e=[];for(let n of t.subpaths){if(n.coords.length<8||(n.coords.length-2)%6!==0)continue;let i=[];for(let r=0;r<n.coords.length;r+=2)i.push({x:t.x+n.coords[r]*t.width,y:t.y+n.coords[r+1]*t.height});e.push({closed:n.closed,points:i})}return e}function pe(t){let e=new R;for(let n of Gt(t)){e.moveTo(n.points[0]);for(let i=0;i<(n.points.length-1)/3;i++)e.curveTo(n.points[3*i+3],n.points[3*i+1],n.points[3*i+2]);n.closed&&e.close()}return e}function ri(t,e){let n=L(t),i=e==="top"?{x:z(n),y:n.y}:e==="right"?{x:Y(n),y:C(n)}:e==="bottom"?{x:z(n),y:O(n)}:{x:n.x,y:C(n)};return Q(t,i)}function oi(t,e){let n=L(t),i=vt(t),r=Ze(t,e),o=r.x-i.x,s=r.y-i.y;if(!((o!==0||s!==0)&&n.width>0&&n.height>0))return i;let l=n.width/2,a=n.height/2,c;return t.kind==="ellipse"?c=1/Math.sqrt(o*o/(l*l)+s*s/(a*a)):t.kind==="diamond"?c=1/(Math.abs(o)/l+Math.abs(s)/a):c=Math.min(o!==0?l/Math.abs(o):1/0,s!==0?a/Math.abs(s):1/0),Q(t,{x:i.x+o*c,y:i.y+s*c})}function en(t,e){let n=t.elementID?e.get(t.elementID):void 0;return n?vt(n):{x:t.x,y:t.y}}function nn(t,e,n){let i=t.elementID?n.get(t.elementID):void 0;return i?t.port?ri(i,t.port):oi(i,e):{x:t.x,y:t.y}}function lt(t,e){let n=t.connector;return n?[nn(n.start,en(n.end,e),e),nn(n.end,en(n.start,e),e)]:[{x:0,y:0},{x:0,y:0}]}function Z(t){if(t.kind==="polyline")return t.points;let e=[];for(let n=0;n<=24;n++){let i=n/24,r=1-i;e.push({x:r*r*r*t.a.x+3*r*r*i*t.b.x+3*r*i*i*t.c.x+i*i*i*t.d.x,y:r*r*r*t.a.y+3*r*r*i*t.b.y+3*r*i*i*t.c.y+i*i*i*t.d.y})}return e}function J(t,e){let n=t.connector;if(!n)return{kind:"polyline",points:[]};let[i,r]=lt(t,e),o=r.x-i.x,s=r.y-i.y,l=Math.abs(o)>=Math.abs(s);switch(n.routing){case"straight":return{kind:"polyline",points:[i,r]};case"curved":return l?{kind:"cubic",a:i,b:{x:i.x+o/2,y:i.y},c:{x:r.x-o/2,y:r.y},d:r}:{kind:"cubic",a:i,b:{x:i.x,y:i.y+s/2},c:{x:r.x,y:r.y-s/2},d:r};case"elbow":{let a=d=>d===null?null:d==="top"||d==="bottom",c=a(n.start.port)??!l,u=a(n.end.port)??!l;if(c&&u){let d=i.y+s/2;return{kind:"polyline",points:[i,{x:i.x,y:d},{x:r.x,y:d},r]}}if(!c&&!u){let d=i.x+o/2;return{kind:"polyline",points:[i,{x:d,y:i.y},{x:d,y:r.y},r]}}return c?{kind:"polyline",points:[i,{x:i.x,y:r.y},r]}:{kind:"polyline",points:[i,{x:r.x,y:i.y},r]}}}}function rn(t,e,n){let i=Math.atan2(t.y-e.y,t.x-e.x),r=Math.PI/7,o=s=>({x:t.x-n*Math.cos(i+s),y:t.y-n*Math.sin(i+s)});return[o(r),o(-r)]}function on(t,e){let n=Z(J(t,e));if(n.length===0)return{x:0,y:0,width:0,height:0};let i=n[0].x,r=n[0].y,o=i,s=r;for(let l of n)i=Math.min(i,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),s=Math.max(s,l.y);return{x:i,y:r,width:o-i,height:s-r}}function sn(t,e){let n=Z(J(t,e));if(n.length<=1)return n[0]??{x:0,y:0};let i=[],r=0;for(let s=0;s<n.length-1;s++){let l=Math.hypot(n[s+1].x-n[s].x,n[s+1].y-n[s].y);i.push(l),r+=l}let o=r/2;for(let s=0;s<i.length;s++){let l=i[s];if(o<=l||s===i.length-1){let a=l===0?0:o/l;return{x:n[s].x+(n[s+1].x-n[s].x)*a,y:n[s].y+(n[s+1].y-n[s].y)*a}}o-=l}return n[0]}function tt(t){let e=new Map;for(let n of t.elements)e.has(n.id)||e.set(n.id,n);return e}function ge(t,e,n){let i=t[1]+n>>>0,r=i<t[1]?1:0;return[t[0]+e+r>>>0,i]}function si(t,e){let n=t&65535,i=t>>>16,r=e&65535,o=e>>>16,s=n*r,l=n*o,a=i*r,c=i*o,u=l+a,d=s+u%65536*65536;return[c+Math.floor(u/65536)+Math.floor(d/4294967296)>>>0,d>>>0]}function xe(t,e,n){let i=si(t[1],n);return[i[0]+Math.imul(t[0],n)+Math.imul(t[1],e)>>>0,i[1]]}function ye(t,e){let n=(t[1]>>>e|t[0]<<32-e)>>>0;return[(t[0]^t[0]>>>e)>>>0,(t[1]^n)>>>0]}function ln(t){return t=xe(ye(t,30),3210233709,484763065),t=xe(ye(t,27),2496678331,321982955),ye(t,31)}var et=class{constructor(e){k(this,"state");this.state=ge([0,e>>>0],2654435769,2135587861)}next(){return this.state=ge(this.state,2654435769,2135587861),ln(this.state)}top53(){let[e,n]=this.next();return e*2097152+(n>>>11)}signed(){return Math.floor(this.top53())/2**52-1}unit(){return this.top53()/2**53}};function an(t,e){let n=ge([0,t>>>0],...li(e));return n=ln(n),Math.max(1,n[1]>>>0)}function li(t){let e=xe([0,t>>>0],2654435769,2135587861);return[e[0],e[1]]}var cn=(t,e,n)=>t.signed()*e*n;function U(t,e,n,i,r,o,s){let l=Math.hypot(e.x-t.x,e.y-t.y);if(!(l>.5))return;let a=l<200?1:l>500?.4:-.0016668*l+1.233334,c=l<20?l/10:2;for(let u=0;u<2;u++){let d=(u===0?1:.5)*a,f=()=>cn(n,c,i)*d,m=n.unit()*.4+.3,h=cn(n,l/60,i)*r*a,p=e.x-t.x,x=e.y-t.y,M=-x/l,b=p/l,g=o?t:{x:t.x+f(),y:t.y+f()},A=o?e:{x:e.x+f(),y:e.y+f()},v=t.x+p*m*.66+M*h+f()*.5,S=t.y+x*m*.66+b*h+f()*.5,P=t.x+p*(.5+m*.5)+M*h+f()*.5,I=t.y+x*(.5+m*.5)+b*h+f()*.5;s.moveTo(g),s.curveTo(A,{x:v,y:S},{x:P,y:I})}}function be(t,e,n,i){let r=new R;for(let o=0;o<t.length;o++)U(t[o],t[(o+1)%t.length],e,n,i,!1,r);return r}function un(t,e,n){let i=new R,r=t.x+t.width/2,o=t.y+t.height/2,s=t.width/2,l=t.height/2;if(!(s>.5&&l>.5))return i;let a=Math.max(8,Math.min(24,Math.trunc((s+l)/6))),c=Math.min(2.5,(s+l)/25)*n;for(let u=0;u<2;u++){let d=e.unit()*2*Math.PI,f=2*Math.PI*(u===0?1:1.04),m=Math.trunc(a*f/(2*Math.PI))+1,h=[];for(let p=0;p<m;p++){let x=d+f*p/a,M=e.signed()*c,b=e.signed()*c;h.push({x:r+s*Math.cos(x)+M,y:o+l*Math.sin(x)+b})}ai(h,i)}return i}function ai(t,e){if(!(t.length<=2)){e.moveTo(t[0]);for(let n=0;n<t.length-1;n++){let i=t[Math.max(n-1,0)],r=t[n],o=t[n+1],s=t[Math.min(n+2,t.length-1)];e.curveTo(o,{x:r.x+(o.x-i.x)/6,y:r.y+(o.y-i.y)/6},{x:o.x-(s.x-r.x)/6,y:o.y-(s.y-r.y)/6})}}}var ke=-41*Math.PI/180;function hn(t,e,n){if(!(n>0))return[];let i=Math.cos(e),r=Math.sin(e),o=t.filter(f=>f.length>=3).map(f=>f.map(m=>({x:m.x*i+m.y*r,y:-m.x*r+m.y*i}))),s=o.flat();if(s.length===0)return[];let l=1/0,a=-1/0;for(let f of s)l=Math.min(l,f.y),a=Math.max(a,f.y);let c=(f,m)=>({x:f*i-m*r,y:f*r+m*i}),u=[],d=l+n/2;for(;d<a;){let f=[];for(let m of o)for(let h=0;h<m.length;h++){let p=m[h],x=m[(h+1)%m.length];(p.y<=d&&d<x.y||x.y<=d&&d<p.y)&&f.push(p.x+(d-p.y)/(x.y-p.y)*(x.x-p.x))}f.sort((m,h)=>m-h);for(let m=0;m+1<f.length;m+=2)f[m+1]-f[m]>.5&&u.push([c(f[m],d),c(f[m+1],d)]);d+=n}return u}var Bt=class{constructor(e=6e3){k(this,"map",new Map);k(this,"limit");this.limit=e}get(e,n){let i=this.map.get(e);if(i!==void 0)return i;let r=n();return this.map.size>=this.limit&&this.map.clear(),this.map.set(e,r),r}},fn=new Bt,ci=new Bt;function pn(t,e){let n=t.style;return[e,t.kind,t.x,t.y,t.width,t.height,t.seed,n.roughness,n.bowing,n.strokeWidth,n.fillStyle,n.fillStyle==="grid"?at(t):0,t.path?t.path.join(","):t.subpaths?JSON.stringify(t.subpaths):""].join("|")}var at=t=>Math.max(8,t.style.gridSize??50);function ct(t){return t.kind==="freehand"&&t.path===null?dn(t):fn.get(pn(t,0),()=>dn(t))}function yn(t){return[{x:t.x,y:t.y},{x:Y(t),y:t.y},{x:Y(t),y:O(t)},{x:t.x,y:O(t)}]}function Ft(t){return[{x:z(t),y:t.y},{x:Y(t),y:C(t)},{x:z(t),y:O(t)},{x:t.x,y:C(t)}]}function dn(t){let e=L(t),n=new et(t.seed),i=t.style.roughness;switch(t.kind){case"ellipse":return i<=0?R.ellipse(e):un(e,n,i);case"diamond":return i<=0?new R().addLines(Ft(e)).close():be(Ft(e),n,i,t.style.bowing);case"text":case"connector":return R.rect(e);case"freehand":return hi(t);case"path":return i<=0?pe(t):ui(t,n);default:return i<=0?R.rect(e):be(yn(e),n,i,t.style.bowing)}}function ui(t,e){let n=t.style.roughness,i=new R;for(let r of Gt(t)){let o=r.points;for(let s=0;s<(o.length-1)/3;s++){let l=o[3*s],a=o[3*s+1],c=o[3*s+2],u=o[3*s+3];if(a.x===l.x&&a.y===l.y&&c.x===u.x&&c.y===u.y){U(l,u,e,n,t.style.bowing,!0,i);continue}let d=Math.hypot(a.x-l.x,a.y-l.y)+Math.hypot(c.x-a.x,c.y-a.y)+Math.hypot(u.x-c.x,u.y-c.y),f=Math.min(2.5,d/30)*n;for(let m=0;m<2;m++){let h=m===0?1:.5,p=()=>e.signed()*f*h;i.moveTo(l);let x=a.x+p(),M=a.y+p(),b=c.x+p(),g=c.y+p();i.curveTo(u,{x,y:M},{x:b,y:g})}}}return i}function hi(t){let e=L(t),n=t.path;if(n&&n.length>=8&&(n.length-2)%6===0){let o=l=>({x:e.x+n[2*l]*e.width,y:e.y+n[2*l+1]*e.height}),s=new R().moveTo(o(0));for(let l=0;l<Math.floor((n.length/2-1)/3);l++)s.curveTo(o(3*l+3),o(3*l+1),o(3*l+2));return s}let i=(t.points??[]).map(o=>({x:e.x+o.x*e.width,y:e.y+o.y*e.height})),r=new R;if(i.length===0)return r;if(r.moveTo(i[0]),i.length===1)return r.lineTo(i[0]);if(i.length===2)return r.lineTo(i[1]);for(let o=1;o<i.length-1;o++)r.quadTo({x:(i[o].x+i[o+1].x)/2,y:(i[o].y+i[o+1].y)/2},i[o]);return r.lineTo(i[i.length-1])}function we(t){return t.kind!=="path"?[mi(t)]:Gt(t).map(e=>Qe(e.points,3))}function mi(t){let e=L(t);if(t.kind==="ellipse"){let n=[];for(let i=0;i<48;i++){let r=2*Math.PI*i/48;n.push({x:z(e)+e.width/2*Math.cos(r),y:C(e)+e.height/2*Math.sin(r)})}return n}return t.kind==="diamond"?Ft(e):yn(e)}function Nt(t){let e=L(t);return t.kind==="ellipse"?R.ellipse(e):t.kind==="path"?pe(t):t.kind==="diamond"?new R().addLines(Ft(e)).close():R.rect(e)}function Pe(t){return t.style.fillStyle==="solid"||["freehand","connector","text","image"].includes(t.kind)?new R:fn.get(pn(t,1),()=>di(t))}function di(t){let e=we(t),n=new et((t.seed^1540483477)>>>0),i=new R;if(t.style.fillStyle==="grid"){for(let[s,l]of gn(e,at(t)))t.style.roughness<=0?i.moveTo(s).lineTo(l):U(s,l,n,t.style.roughness*.3,.3,!1,i);return i}let r=Math.max(4,t.style.strokeWidth*4),o=[ke];t.style.fillStyle==="crossHatch"&&o.push(ke+Math.PI/2);for(let s of o)for(let[l,a]of hn(e,s,r))t.style.roughness<=0?i.moveTo(l).lineTo(a):U(l,a,n,t.style.roughness*.6,.5,!1,i);return i}function Ht(t,e){switch(t){case"solid":return null;case"dashed":return[Math.max(8,e*4),Math.max(6,e*3)];case"dotted":return[.01,Math.max(5,e*2.6)]}}function Me(t,e){let n=t.connector;if(!n)return[new R,new R];let[i,r]=lt(t,e),o=[t.seed,t.style.roughness,t.style.bowing,t.style.strokeWidth,n.routing,n.startHead,n.endHead,n.start.port,n.end.port,i.x,i.y,r.x,r.y].join("|");return ci.get(o,()=>fi(t,e))}function fi(t,e){let n=t.connector,i=new et(t.seed),r=t.style.roughness,o=t.style.bowing,s=new R,l=new R,a=J(t,e);if(a.kind==="polyline"){let m=a.points;for(let h=0;h<Math.max(m.length-1,0);h++)r<=0?s.moveTo(m[h]).lineTo(m[h+1]):U(m[h],m[h+1],i,r,o,!0,s)}else{s.moveTo(a.a);let m=r*3,h=()=>i.signed()*m,p=a.b.x+h(),x=a.b.y+h(),M=a.c.x+h(),b=a.c.y+h();s.curveTo(a.d,{x:p,y:x},{x:M,y:b})}let c=Z(a),u=Math.max(10,t.style.strokeWidth*5),d=(m,h)=>{r<=0?s.moveTo(m).lineTo(h):U(m,h,i,r*.5,0,!0,s)},f=(m,h,p)=>{let[x,M]=rn(h,p,u);switch(m){case"arrow":d(x,h),d(M,h);break;case"triangle":d(x,h),d(M,h),d(x,M),l.moveTo(h).lineTo(x).lineTo(M).close();break;case"dot":{let b=u*.32,g=Math.atan2(h.y-p.y,h.x-p.x),A=h.x-b*Math.cos(g),v=h.y-b*Math.sin(g);l.addEllipse({x:A-b,y:v-b,width:2*b,height:2*b});break}case"bar":{let b=Math.atan2(h.y-p.y,h.x-p.x)+Math.PI/2,g=u*.5;d({x:h.x-g*Math.cos(b),y:h.y-g*Math.sin(b)},{x:h.x+g*Math.cos(b),y:h.y+g*Math.sin(b)});break}}};return c.length>1&&(f(n.endHead,c[c.length-1],c[c.length-2]),f(n.startHead,c[0],c[1])),[s,l]}var kn=2,Re=.75,pi=.8,xn=.6;function gn(t,e){return[...bn(t,e,!1),...bn(t,e,!0)]}function bn(t,e,n){if(!(e>0))return[];let i=c=>n?{x:c.y,y:c.x}:c,r=t.filter(c=>c.length>=3).map(c=>c.map(i)),o=r.flat().map(c=>c.y);if(o.length===0)return[];let s=Math.min(...o),l=Math.max(...o),a=[];for(let c=Math.floor(s/e)*e;c<l-.5;c+=e){if(!(c>s+.5))continue;let u=[];for(let d of r)for(let f=0;f<d.length;f++){let m=d[f],h=d[(f+1)%d.length];(m.y<=c&&c<h.y||h.y<=c&&c<m.y)&&u.push(m.x+(c-m.y)/(h.y-m.y)*(h.x-m.x))}u.sort((d,f)=>d-f);for(let d=0;d+1<u.length;d+=2)u[d+1]-u[d]>.5&&a.push([i({x:u[d],y:c}),i({x:u[d+1],y:c})])}return a}function wn(t){return .2126*t.r+.7152*t.g+.0722*t.b>.5?{r:t.r*.84,g:t.g*.84,b:t.b*.8,a:t.a}:{r:t.r+(1-t.r)*.25,g:t.g+(1-t.g)*.25,b:t.b+(1-t.b)*.25,a:t.a}}function Ae(t){return t.style.fillStyle==="grid"&&t.style.fill.a>0&&["rectangle","ellipse","diamond","path"].includes(t.kind)}function _t(t,e,n){let i=(Math.imul(t,668265261)^Math.imul(e,374761393)^Math.imul(n,2654435761))>>>0;return i=Math.imul(i^i>>>15,2246822507)>>>0,i=Math.imul(i^i>>>13,3266489909)>>>0,i=(i^i>>>16)>>>0,i/4294967296}function Pn(t,e,n){let i=n/kn;return{x:(t+.5+(_t(t,e,1)-.5)*xn)*i,y:(e+.5+(_t(t,e,2)-.5)*xn)*i}}function yi(t,e,n,i){let r=1/0;for(let o=-1;o<=1;o++)for(let s=-1;s<=1;s++){if(o===0&&s===0)continue;let l=Pn(t+o,e+s,i);r=Math.min(r,Math.hypot(l.x-n.x,l.y-n.y))}return r*pi}function gi(t,e,n){let i=Math.cos(e),r=Math.sin(e),o=n*.8,s=n*.5;return[-1,0,1].map(l=>{let a=t.x-r*s*l,c=t.y+i*s*l;return[{x:a-i*o,y:c-r*o},{x:a+i*o,y:c+r*o}]})}function xi(t,e){let n=!1;for(let i of t){if(i.length<3)continue;let r=i.length-1;for(let o=0;o<i.length;o++){let s=i[o],l=i[r];s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(n=!n),r=o}}return n}function bi(t,e){let n=1/0;for(let i of e)if(!(i.length<2))for(let r=0;r<i.length;r++){let o=i[r],s=i[(r+1)%i.length],l=s.x-o.x,a=s.y-o.y,c=l*l+a*a,u=c>0?Math.max(0,Math.min(1,((t.x-o.x)*l+(t.y-o.y)*a)/c)):0;n=Math.min(n,Math.hypot(t.x-(o.x+u*l),t.y-(o.y+u*a)))}return n}var ki=(t,e)=>e.x>=t.x&&e.x<t.x+t.width&&e.y>=t.y&&e.y<t.y+t.height,jt=new Map;function Mn(t){if(t.length===0)return[];let e=t.map(r=>[r.kind,r.x,r.y,r.width,r.height,r.rotation??0,at(r),JSON.stringify(r.subpaths??null),r.style.stroke.r,r.style.stroke.g,r.style.stroke.b,r.style.stroke.a,r.style.roughness,r.style.strokeWidth].join(",")).join(";"),n=jt.get(e);if(n)return n;let i=wi(t);return jt.size>=16&&jt.clear(),jt.set(e,i),i}function wi(t){let e=t.map(o=>{let s=we(o).map(m=>m.map(h=>Q(o,h))),l=s.flat(),a=l.map(m=>m.x),c=l.map(m=>m.y),u=a.length?Math.min(...a):0,d=c.length?Math.min(...c):0,f={x:u,y:d,width:(a.length?Math.max(...a):0)-u,height:(c.length?Math.max(...c):0)-d};return{contours:s,box:f,cell:at(o),element:o}}),n=e.map(()=>[]),i=new Set;for(let o of e){let s=o.cell/kn,l=gt(o.box,-o.cell,-o.cell),a=Math.floor(l.x/s),c=Math.ceil((l.x+l.width)/s),u=Math.floor(l.y/s),d=Math.ceil((l.y+l.height)/s),f=Re*o.cell;for(let m=a;m<c;m++)for(let h=u;h<d;h++){let p=`${o.cell}|${m}|${h}`;if(i.has(p))continue;i.add(p);let x=Pn(m,h,o.cell),M=1/0,b=-1;for(let S=0;S<e.length;S++){let P=e[S];if(!ki(gt(P.box,-f,-f),x))continue;if(xi(P.contours,x)){M=0;break}let I=bi(x,P.contours);I<M&&(M=I,b=S)}if(!(M>0&&M<=f&&b>=0))continue;let g=_t(m,h,3)*Math.PI,A=yi(m,h,x,o.cell),v=Math.trunc(_t(m,h,4)*4294967296)>>>0;for(let[S,P]of gi(x,g,A))n[b].push([S,P,v])}}let r=[];return e.forEach((o,s)=>{if(n[s].length===0)return;let l=o.element,a=new R;for(let[c,u,d]of n[s])l.style.roughness<=0?a.moveTo(c).lineTo(u):U(c,u,new et(d),l.style.roughness*.35,.2,!1,a);r.push({ink:{...l.style.stroke,a:l.style.stroke.a*.6},width:Math.max(.8,l.style.strokeWidth*.45),path:a})}),r}var qt=.951995849609375,Ut=.2129974365234375,Kt=.0279998779296875,Rn=.975006103515625,An=.2169952392578125,Tn=.0290069580078125,vn=.957000732421875,En=.2129974365234375,Sn=.0279998779296875,In=.975006103515625,$n=.2169952392578125,Ln=.0290069580078125,Vn=.60205078125,Dn=.92822265625,Wn=.23583984375,xt={bold:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-30,fi:20,fl:20,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":407,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":278,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':463,"\u201C":463,"\u201D":463,"(":296,")":296,"[":333,"]":333,"{":333,"}":333,"@":800,"*":407,"/":371,"\\":371,"&":685,"#":556,"%":1e3,"\u2022":350,"`":259,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":722.66,"\u2193":722.66,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":223,"~":600,"\u25E6":608.4,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:574,A:685,b:611,B:704,c:574,C:741,d:611,D:741,e:574,E:648,\u00E9:574,f:333,F:593,g:611,G:759,h:593,H:741,i:258,I:295,j:278,J:556,k:574,K:722,l:258,L:593,m:906,M:907,n:593,N:741,o:611,O:778,p:611,P:667,q:611,Q:778,r:389,R:722,s:537,S:649,t:352,T:611,u:593,U:741,v:520,V:630,w:814,W:944,x:537,X:667,y:519,Y:667,z:519,Z:648}},boldItalic:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-68,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":407,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":296,"?":574,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':481,"\u201C":481,"\u201D":481,"(":296,")":296,"[":333,"]":333,"{":333,"}":333,"@":800,"*":407,"/":389,"\\":389,"&":685,"#":556,"%":963,"\u2022":350,"`":259,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":722.66,"\u2193":722.66,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":608.4,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:574,A:685,b:611,B:722,c:556,C:741,d:611,D:741,e:574,E:667,\u00E9:574,f:352,F:593,g:611,G:759,h:611,H:741,i:259,I:296,j:259,J:556,k:556,K:722,l:259,L:574,m:907,M:907,n:611,N:741,o:593,O:778,p:611,P:667,q:611,Q:778,r:389,R:722,s:519,S:648,t:370,T:611,u:611,U:741,v:519,V:630,w:815,W:944,x:519,X:667,y:519,Y:648,z:500,Z:648}},italic:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-15,fi:1,fl:1,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":389,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":259,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':426,"\u201C":426,"\u201D":426,"(":259,")":259,"[":259,"]":259,"{":333,"}":333,"@":800,"*":352,"/":333,"\\":333,"&":630,"#":556,"%":926,"\u2022":500,"`":222,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":645.02,"\u2193":645.02,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":578.13,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:519,A:667,b:593,B:685,c:537,C:722,d:593,D:704,e:537,E:611,\u00E9:537,f:296,F:574,g:574,G:759,h:556,H:722,i:222,I:259,j:222,J:519,k:481,K:667,l:222,L:556,m:852,M:870,n:556,N:722,o:574,O:759,p:593,P:648,q:593,Q:759,r:333,R:685,s:481,S:648,t:315,T:574,u:556,U:722,v:481,V:611,w:759,W:926,x:481,X:611,y:481,Y:611,z:444,Z:611}},regular:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-15,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":389,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":259,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':426,"\u201C":426,"\u201D":426,"(":259,")":259,"[":259,"]":259,"{":333,"}":333,"@":800,"*":352,"/":333,"\\":333,"&":630,"#":556,"%":1e3,"\u2022":350,"`":222,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":645.02,"\u2193":645.02,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":578.13,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:537,A:648,b:593,B:685,c:537,C:722,d:593,D:704,e:537,E:611,\u00E9:537,f:296,F:574,g:574,G:759,h:556,H:722,i:222,I:259,j:222,J:519,k:519,K:667,l:222,L:556,m:853,M:871,n:556,N:722,o:574,O:760,p:593,P:648,q:593,Q:760,r:333,R:685,s:500,S:648,t:315,T:574,u:556,U:722,v:500,V:611,w:758,W:926,x:518,X:611,y:500,Y:648,z:480,Z:611}}},Xt={"\u2190":[.966796875,.2109375,0],"\u2192":[.966796875,.2109375,0],"\u2191":[.966796875,.2109375,0],"\u2193":[.966796875,.2109375,0],"\u25E6":[.966796875,.2109375,0],"\u2610":[.66650390625,.25,.08349609375],"\u2611":[.66650390625,.25,.08349609375],"\u2713":[.966796875,.2109375,0]};function V(t){let e=n=>Math.round(Math.min(Math.max(n,0),1)*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function Qt(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Zt(t,e,n="regular"){let i=xt[n],r=i.w.n,o=0,s="";for(let l of t)o+=i.w[l]??r,s&&(o+=i.k[s+l]??0),s=l;return o*e/1e3}function Pi(t){let e=Math.round(qt*t),n=Math.round(Ut*t),i=Math.round(Kt*t);return[e+n,e+n+i]}function Te(t,e){return t===" "?!0:(t==="/"||t==="-")&&e!==""&&!/[\d\s/-]/.test(e)}function Mi(t){let e=[...t],n=[],i="";return e.forEach((r,o)=>{i+=r;let s=e[o+1]??"";Te(r,s)&&s!==" "&&(n.push(i),i="")}),(i||n.length===0)&&n.push(i),n}function Ri(t,e,n,i="regular"){let r=[];for(let o of t.split(/\r\n|\n|\r|\u2028|\u2029/)){let s="";for(let l of Mi(o)){let a=s+l;for(s===""||Zt(a.trimEnd(),e,i)<=n?s=a:(r.push(s),s=l);Zt(s.trimEnd(),e,i)>n&&[...s.trimEnd()].length>1;){let c=[...s],u=c.length-1;for(;u>1&&Zt(c.slice(0,u).join(""),e,i)>n;)u--;r.push(c.slice(0,u).join("")),s=c.slice(u).join("")}}r.push(s)}return r}function Yn(t,e,n){if(t==="")return{width:0,height:0};let i=Ri(t,e,n),r=Math.max(...i.map(l=>Zt(l.trimEnd(),e))),[o,s]=Pi(e);return{width:Math.ceil(r-1e-9),height:Math.ceil(o+s*(i.length-1)-1e-9)}}var On=12,ut="\u2028";function Ai(t){let e=Math.min(On,t.width/2),n=Math.min(On,t.height/2);return{x:t.x+e,y:t.y+n,width:t.width-2*e,height:t.height-2*n}}var Ee=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?(?:[ \t]+#+)?[ \t]*$/,Bn=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/,Se=/^ {0,3}(`{3,}|~{3,})/,Et=/^( *)([-*+]|\d{1,9}[.)])([ \t]+|$)(.*)$/,Jt=/^ {0,3}> ?(.*)$/,Ti=/^ *\|? *:?-+:? *(\| *:?-+:? *)*\|? *$/;function ve(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?<!\\)\|/).map(n=>n.trim())}function vi(t){return Ve(t.replace(/\r\n?/g,`
|
|
1
|
+
/*! dottie.js 0.5.1 | Apache-2.0 | https://github.com/phin-tech/dottie */
|
|
2
|
+
"use strict";(()=>{var nn=Object.defineProperty;var xi=(t,e,n)=>e in t?nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ki=(t,e)=>{for(var n in e)nn(t,n,{get:e[n],enumerable:!0})};var P=(t,e,n)=>xi(t,typeof e!="symbol"?e+"":e,n);var tn={};ki(tn,{BOIL_DRAWINGS:()=>ke,DottieFormatError:()=>Q,DottiePlayer:()=>Tt,KINDS:()=>rn,KNOWN_FIELDS:()=>on,MAX_DURATION:()=>gt,MAX_MARCH:()=>be,Playback:()=>Yt,SUPPORTED_VERSION:()=>Lr,VERSION:()=>Ir,allowedURL:()=>Ht,black:()=>ut,bounds:()=>tt,cameraView:()=>Mt,clampFPS:()=>xt,clampMarch:()=>sn,clampTime:()=>O,clear:()=>ln,cloneElement:()=>V,definePlayer:()=>fe,elementIndex:()=>Mi,frameTimes:()=>ee,inkOnDark:()=>an,inspect:()=>bi,inspectFrame:()=>Ze,inspectPage:()=>Je,isAutomaticInk:()=>we,luminance:()=>kt,orderedElements:()=>ht,pageIndex:()=>Bt,parseDottie:()=>St,plan:()=>At,posterTime:()=>at,render:()=>Rr,repeatIsValid:()=>jt,resolved:()=>U,sameColor:()=>bt,sampleTimes:()=>Qe,sceneAt:()=>zn,stableSortBy:()=>Nt,still:()=>Wn,svg:()=>me,svgParts:()=>ct,themeNamed:()=>pt,themes:()=>Ke,transientElements:()=>Yn,withRoughness:()=>Gt});var Lr=2,rn=["rectangle","ellipse","diamond","text","connector","freehand","path","note","image","symbol"],wi=["linear","easeIn","easeOut","easeInOut","hold","spring","bounce","elastic"],on={file:["version","pages","images"],page:["id","name","layers","elements","theme","guidesX","guidesY","guidesLocked","timeline","symbols"],symbol:["id","name","width","height","layers","elements","timeline","button"],layer:["id","name","visible","locked"],rgba:["r","g","b","a"],style:["stroke","fill","fillStyle","strokeWidth","dash","roughness","bowing","fontSize","gridSize","opacity","dashOffset"],element:["id","kind","x","y","width","height","style","seed","layerID","text","connector","groupID","points","path","subpaths","evenOdd","rotation","link","anchor","click","hover","symbol","playback","offset","image","reveal"],strokePoint:["x","y"],subpath:["closed","coords"],inlineImage:["data","format"],endpoint:["elementID","port","x","y"],connector:["start","end","routing","startHead","endHead"],timeline:["fps","duration","boil","settle","poster","tracks","camera","markers"],track:["element","keys","boil","follow","repeats","march"],keyframe:["t","x","y","width","height","rotation","strokeWidth","stroke","fill","visible","reveal","opacity","ease"],follow:["path","start","end","ease","reverse","orient","laps"],repeat:["start","end","count"],cameraKey:["t","x","y","width","height","ease"],marker:["t","name"],click:["scene","url"],hover:["stroke","fill","opacity"]},gt=3600,be=1e4,sn=t=>t===void 0||!Number.isFinite(t)||t===0?null:Math.min(Math.max(t,-be),be),ke=3,ut={r:.12,g:.12,b:.13,a:1},ln={r:0,g:0,b:0,a:0},an={r:.93,g:.93,b:.94,a:1},Q=class extends Error{},S=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),A=t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,$=t=>typeof t=="string"?t:void 0,z=t=>typeof t=="boolean"?t:void 0,Y=t=>typeof t=="string"?t.toUpperCase():void 0;function O(t){return Number.isFinite(t)?Math.min(Math.max(t,0),gt):t===1/0?gt:0}function xt(t){return Number.isFinite(t)?Math.min(Math.max(t,1),60):12}function Ht(t){let e=t.trim();return!/^(https?:\/\/|mailto:)/i.test(e)||[...e].length<=7||/[\u0000-\u001f\u007f-\u009f]/.test(e)?null:e}function yt(t){if(!S(t))return;let e=A(t.r),n=A(t.g),i=A(t.b);if(!(e===void 0||n===void 0||i===void 0))return{r:e,g:n,b:i,a:A(t.a)??1}}var xe=class{constructor(){P(this,"warnings",[]);P(this,"seen",new Set)}warn(e){this.seen.has(e)||(this.seen.add(e),this.warnings.push(e))}fields(e,n){let i=on[n];for(let r of Object.keys(e))i.includes(r)||this.warn(`Unknown field "${r}" on ${n}, ignored`)}style(e){let n=S(e)?e:{};this.fields(n,"style");let i=$(n.fillStyle)??"solid",r=$(n.dash)??"solid";return["solid","hachure","crossHatch","grid"].includes(i)||this.warn(`Unknown fill style "${i}", drawn solid`),["solid","dashed","dotted"].includes(r)||this.warn(`Unknown dash "${r}", drawn solid`),{stroke:yt(n.stroke)??{...ut},fill:yt(n.fill)??{...ln},fillStyle:["solid","hachure","crossHatch","grid"].includes(i)?i:"solid",strokeWidth:A(n.strokeWidth)??2,dash:["solid","dashed","dotted"].includes(r)?r:"solid",roughness:A(n.roughness)??1,bowing:A(n.bowing)??1,fontSize:A(n.fontSize)??18,gridSize:A(n.gridSize)??null,opacity:A(n.opacity)??null,dashOffset:A(n.dashOffset)??null}}endpoint(e){let n=S(e)?e:{},i=$(n.port);return{elementID:Y(n.elementID)??null,port:i&&["top","right","bottom","left"].includes(i)?i:null,x:A(n.x)??0,y:A(n.y)??0}}connector(e){if(!S(e))return null;this.fields(e,"connector");let n=(r,o)=>{let s=$(r);return s&&["none","arrow","triangle","dot","bar"].includes(s)?s:o},i=$(e.routing);return{start:this.endpoint(e.start),end:this.endpoint(e.end),routing:i&&["straight","curved","elbow"].includes(i)?i:"straight",startHead:n(e.startHead,"none"),endHead:n(e.endHead,"arrow")}}image(e,n){if(!S(e))return null;let i=$(e.ref);if(i!==void 0)return n[i]??{data:"",format:"png"};let r=$(e.data);return r===void 0?null:this.picture(r,$(e.format))}picture(e,n){return Pi.test(e)?{data:e.replace(/\s+/g,""),format:n==="jpeg"?"jpeg":"png"}:(this.warn("Skipped a picture whose data isn't base64"),{data:"",format:"png"})}element(e,n){if(!S(e))return null;this.fields(e,"element");let i=Y(e.id),r=$(e.kind),o=Y(e.layerID);if(!i||!r||!o)return this.warn("Skipped an element without an id, kind or layer"),null;rn.includes(r)||this.warn(`Unknown element kind "${r}", drawn as a placeholder`);let s=Array.isArray(e.subpaths)?e.subpaths.filter(S).map(l=>({closed:z(l.closed)??!1,coords:Array.isArray(l.coords)?l.coords.filter(a=>typeof a=="number"):[]})):null;return{id:i,kind:r,layerID:o,x:A(e.x)??0,y:A(e.y)??0,width:A(e.width)??0,height:A(e.height)??0,style:this.style(e.style),seed:(A(e.seed)??1)>>>0,text:$(e.text)??null,connector:this.connector(e.connector),groupID:Y(e.groupID)??null,points:Array.isArray(e.points)?e.points.filter(S).map(l=>({x:A(l.x)??0,y:A(l.y)??0})):null,path:Array.isArray(e.path)?e.path.filter(l=>typeof l=="number"):null,subpaths:s,evenOdd:z(e.evenOdd)??null,rotation:A(e.rotation)??null,link:Y(e.link)??null,anchor:$(e.anchor)??null,click:this.click(e.click),hover:this.hover(e.hover),symbol:Y(e.symbol)??null,playback:this.playback(e.playback),offset:A(e.offset)??null,image:this.image(e.image,n),reveal:A(e.reveal)??null}}click(e){if(!S(e))return null;this.fields(e,"click");let n=$(e.url),i=n===void 0?null:Ht(n);return n!==void 0&&i===null&&this.warn("Skipped a click link that isn't http, https or mailto"),{scene:$(e.scene)??null,url:i}}playback(e){let n=$(e);return n===void 0?null:["loop","once","still","click"].includes(n)?n:"loop"}symbol(e,n){if(!S(e))return null;this.fields(e,"symbol");let i=Y(e.id);if(!i)return this.warn("Skipped a symbol without an id"),null;let r=s=>{let l=A(s);return Math.max(1,l??100)},o=(Array.isArray(e.layers)?e.layers:[]).filter(S).flatMap(s=>{let l=Y(s.id);return l?[{id:l,name:$(s.name)??"",visible:z(s.visible)??!0,locked:z(s.locked)??!1}]:[]});return o.length===0&&o.push({id:`${i}-LAYER`,name:"Layer 1",visible:!0,locked:!1}),{id:i,name:$(e.name)??"Symbol",width:r(e.width),height:r(e.height),layers:o,elements:(Array.isArray(e.elements)?e.elements:[]).map(s=>this.element(s,n)).filter(s=>s!==null),timeline:this.timeline(e.timeline),button:z(e.button)??null}}hover(e){return S(e)?(this.fields(e,"hover"),{stroke:yt(e.stroke)??null,fill:yt(e.fill)??null,opacity:A(e.opacity)??null}):null}ease(e){let n=$(e);return n===void 0?null:wi.includes(n)?n:(this.warn(`Unknown ease "${n}", played linear`),null)}keyframe(e){if(!S(e))return null;this.fields(e,"keyframe");let n=A(e.t);if(n===void 0)return null;let i={t:n};for(let a of["x","y","width","height","rotation","strokeWidth","reveal","opacity"]){let u=A(e[a]);u!==void 0&&(i[a]=u)}let r=yt(e.stroke),o=yt(e.fill),s=z(e.visible),l=this.ease(e.ease);return r&&(i.stroke=r),o&&(i.fill=o),s!==void 0&&(i.visible=s),l&&(i.ease=l),i}track(e){if(!S(e))return null;this.fields(e,"track");let n=Y(e.element);if(!n)return null;let i=(Array.isArray(e.keys)?e.keys:[]).map(s=>this.keyframe(s)).filter(s=>s!==null&&s.t>=0&&s.t<=gt);Nt(i,s=>s.t);let r=Array.isArray(e.follow)?e.follow.filter(S).flatMap(s=>{let l=Y(s.path),a=A(s.start),u=A(s.end);return!l||a===void 0||u===void 0||a<0||u>gt?[]:[{path:l,start:a,end:u,ease:this.ease(s.ease),reverse:z(s.reverse)??null,orient:z(s.orient)??null,laps:A(s.laps)??null}]}):null,o=Array.isArray(e.repeats)?e.repeats.filter(S).flatMap(s=>{let l=A(s.start),a=A(s.end);if(l===void 0||a===void 0)return[];let u=A(s.count),c={start:l,end:a,count:u===void 0?null:Math.trunc(u)};return jt(c)?[c]:[]}):null;return{element:n,keys:i,boil:z(e.boil)??null,follow:r,repeats:o,march:sn(A(e.march))}}timeline(e){if(!S(e))return null;this.fields(e,"timeline");let n=A(e.boil),i=Array.isArray(e.camera)?e.camera.filter(S).flatMap(s=>{let l=A(s.t),a=A(s.x),u=A(s.y),c=A(s.width),h=A(s.height);return l===void 0||a===void 0||u===void 0||c===void 0||h===void 0?[]:c>1&&h>1&&l>=0?[{t:l,x:a,y:u,width:c,height:h,ease:this.ease(s.ease)}]:[]}):null;i&&Nt(i,s=>s.t);let r=Array.isArray(e.markers)?e.markers.filter(S).flatMap(s=>{let l=A(s.t);return l!==void 0&&l>=0?[{t:l,name:$(s.name)??""}]:[]}):null;r&&Nt(r,s=>s.t);let o=A(e.poster);return{fps:xt(A(e.fps)??12),duration:O(A(e.duration)??0),boil:n!==void 0&&Number.isInteger(n)&&n>0?Math.min(n,1e4):null,settle:z(e.settle)??null,poster:o===void 0?null:O(o),tracks:(Array.isArray(e.tracks)?e.tracks:[]).map(s=>this.track(s)).filter(s=>s!==null),camera:i,markers:r}}page(e,n,i){if(!S(e))throw new Q(`Page ${i} is not an object`);this.fields(e,"page");let r=(Array.isArray(e.layers)?e.layers:[]).filter(S).flatMap(o=>{let s=Y(o.id);return s?[{id:s,name:$(o.name)??"",visible:z(o.visible)??!0,locked:z(o.locked)??!1}]:[]});return r.length===0&&(this.warn(`Page ${i} has no layers`),r.push({id:"LAYER",name:"Layer 1",visible:!0,locked:!1})),{id:Y(e.id)??`PAGE-${i}`,name:$(e.name)??`Page ${i}`,layers:r,elements:(Array.isArray(e.elements)?e.elements:[]).map(o=>this.element(o,n)).filter(o=>o!==null),theme:$(e.theme)??null,timeline:this.timeline(e.timeline),symbols:Array.isArray(e.symbols)?e.symbols.map(o=>this.symbol(o,n)).filter(o=>o!==null):null}}},Pi=/^[A-Za-z0-9+/=\s]*$/;function jt(t){return Number.isFinite(t.start)&&Number.isFinite(t.end)&&t.start>=0&&t.end-t.start>.001&&t.end<=gt&&(t.count===null||t.count>=1&&t.count<=1e4)}function Nt(t,e){let n=t.map((i,r)=>[i,r]);n.sort((i,r)=>e(i[0])-e(r[0])||i[1]-r[1]);for(let i=0;i<t.length;i++)t[i]=n[i][0]}function St(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new Q(`Not JSON: ${s.message}`)}if(!S(e))throw new Q("Not a Dottie drawing");let n=A(e.version);if(n===void 0)throw new Q("Not a Dottie drawing (no version)");if(!Array.isArray(e.pages)||e.pages.length===0)throw new Q("A drawing needs at least one page");let i=new xe;i.fields(e,"file"),n>2&&i.warn(`File version ${n} is newer than this player knows (2); some things may not show`);let r={};if(S(e.images))for(let[s,l]of Object.entries(e.images))S(l)&&typeof l.data=="string"&&(r[s]=i.picture(l.data,$(l.format)));let o=e.pages.map((s,l)=>i.page(s,r,l+1));if(new Set(o.map(s=>s.id)).size!==o.length)throw new Q("Two pages share an id");return{version:n,pages:o,warnings:i.warnings}}function kt(t){return .2126*t.r+.7152*t.g+.0722*t.b}function bt(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a}function we(t){return bt(t,ut)||bt(t,an)}function V(t){return{...t,style:{...t.style,stroke:{...t.style.stroke},fill:{...t.style.fill}},connector:t.connector?{...t.connector,start:{...t.connector.start},end:{...t.connector.end}}:null}}function ht(t){if(t.layers.length<=1)return t.elements;let e=new Map;t.layers.forEach((i,r)=>{e.has(i.id)||e.set(i.id,r)});let n=t.layers.map(()=>[]);for(let i of t.elements)n[e.get(i.layerID)??0].push(i);return n.flat()}function Mi(t){let e=new Map;for(let n of t.elements)e.has(n.id)||e.set(n.id,n);return e}var cn=.5522847498307936,R=class t{constructor(){P(this,"segments",[])}get isEmpty(){return this.segments.length===0}moveTo(e){return this.segments.push({op:"M",p:e}),this}lineTo(e){return this.segments.push({op:"L",p:e}),this}quadTo(e,n){return this.segments.push({op:"Q",c:n,p:e}),this}curveTo(e,n,i){return this.segments.push({op:"C",c1:n,c2:i,p:e}),this}close(){return this.segments.push({op:"Z"}),this}addPath(e){return this.segments.push(...e.segments),this}addLines(e){return e.forEach((n,i)=>i===0?this.moveTo(n):this.lineTo(n)),this}static rect(e){return new t().addLines([{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]).close()}addEllipse(e){let n=e.x+e.width/2,i=e.y+e.height/2,r=e.width/2,o=e.height/2,s=r*cn,l=o*cn;return this.moveTo({x:n+r,y:i}),this.curveTo({x:n,y:i+o},{x:n+r,y:i+l},{x:n+s,y:i+o}),this.curveTo({x:n-r,y:i},{x:n-s,y:i+o},{x:n-r,y:i+l}),this.curveTo({x:n,y:i-o},{x:n-r,y:i-l},{x:n-s,y:i-o}),this.curveTo({x:n+r,y:i},{x:n+s,y:i-o},{x:n+r,y:i-l}),this.close()}static ellipse(e){return new t().addEllipse(e)}translated(e,n){let i=o=>({x:o.x+e,y:o.y+n}),r=new t;return r.segments=this.segments.map(o=>{switch(o.op){case"M":case"L":return{op:o.op,p:i(o.p)};case"Q":return{op:"Q",c:i(o.c),p:i(o.p)};case"C":return{op:"C",c1:i(o.c1),c2:i(o.c2),p:i(o.p)};case"Z":return o}}),r}contours(){let e=[],n=[],i={x:0,y:0};for(let r of this.segments){let o=n.length?n[n.length-1]:i;switch(r.op){case"M":n.length>1&&e.push(n),i=r.p,n=[r.p];break;case"L":n.push(r.p);break;case"Q":for(let s=1;s<=12;s++){let l=s/12,a=1-l;n.push({x:a*a*o.x+2*a*l*r.c.x+l*l*r.p.x,y:a*a*o.y+2*a*l*r.c.y+l*l*r.p.y})}break;case"C":for(let s=1;s<=16;s++){let l=s/16,a=1-l;n.push({x:a*a*a*o.x+3*a*a*l*r.c1.x+3*a*l*l*r.c2.x+l*l*l*r.p.x,y:a*a*a*o.y+3*a*a*l*r.c1.y+3*a*l*l*r.c2.y+l*l*l*r.p.y})}break;case"Z":n.push(i),n.length>1&&e.push(n),n=[i];break}}return n.length>1&&e.push(n),e}trimmed(e){let n=this.contours().map(o=>new wt(o)),i=Math.min(Math.max(e,0),1)*n.reduce((o,s)=>o+s.length,0),r=new t;for(let o of n){if(!(i>0))break;r.moveTo(o.points[0]);for(let s=1;s<o.points.length;s++){let l=o.lengths[s]-o.lengths[s-1];if(l<=i){r.lineTo(o.points[s]),i-=l;continue}let a=o.points[s-1],u=o.points[s],c=i/l;r.lineTo({x:a.x+(u.x-a.x)*c,y:a.y+(u.y-a.y)*c}),i=0;break}}return r}data(){let e=[];for(let n of this.segments)switch(n.op){case"M":e.push(`M${x(n.p.x)} ${x(n.p.y)}`);break;case"L":e.push(`L${x(n.p.x)} ${x(n.p.y)}`);break;case"Q":e.push(`Q${x(n.c.x)} ${x(n.c.y)} ${x(n.p.x)} ${x(n.p.y)}`);break;case"C":e.push(`C${x(n.c1.x)} ${x(n.c1.y)} ${x(n.c2.x)} ${x(n.c2.y)} ${x(n.p.x)} ${x(n.p.y)}`);break;case"Z":e.push("Z");break}return e.join(" ")}};function It(t){return t<0?-Math.round(-t):Math.round(t)}function x(t){let e=It(t*100)/100;return Number.isInteger(e)?String(e===0?0:e):String(e)}var wt=class{constructor(e){P(this,"points");P(this,"lengths");this.points=e;let n=0;this.lengths=e.map((i,r)=>(r>0&&(n+=Math.hypot(i.x-e[r-1].x,i.y-e[r-1].y)),n))}get length(){return this.lengths.length?this.lengths[this.lengths.length-1]:0}point(e){if(this.points.length<=1||!(this.length>0))return this.points[0]??{x:0,y:0};let n=Math.min(Math.max(e,0),1)*this.length,i=1;for(;i<this.lengths.length-1&&this.lengths[i]<n;)i++;let r=this.lengths[i]-this.lengths[i-1],o=r>0?(n-this.lengths[i-1])/r:0,s=this.points[i-1],l=this.points[i];return{x:s.x+(l.x-s.x)*o,y:s.y+(l.y-s.y)*o}}},N=t=>t.x+t.width/2,H=t=>t.y+t.height/2,G=t=>t.x+t.width,F=t=>t.y+t.height;function Pe(t,e){if(!t)return{...e};let n=Math.min(t.x,e.x),i=Math.min(t.y,e.y);return{x:n,y:i,width:Math.max(G(t),G(e))-n,height:Math.max(F(t),F(e))-i}}function Pt(t,e,n){return{x:t.x+e,y:t.y+n,width:t.width-2*e,height:t.height-2*n}}function nt(t,e,n){if(n===0)return t;let i=t.x-e.x,r=t.y-e.y;return{x:e.x+i*Math.cos(n)-r*Math.sin(n),y:e.y+i*Math.sin(n)+r*Math.cos(n)}}function vi(t,e){let n=1-e;return{x:t[0].x*(n*n*n)+t[1].x*(3*e*n*n)+t[2].x*(3*e*e*n)+t[3].x*(e*e*e),y:t[0].y*(n*n*n)+t[1].y*(3*e*n*n)+t[2].y*(3*e*e*n)+t[3].y*(e*e*e)}}function un(t,e){let n=[t[0]];for(let i=0;i<Math.floor((t.length-1)/3);i++){let r=t.slice(3*i,3*i+4),o=0;for(let l=1;l<r.length;l++)o+=Math.hypot(r[l].x-r[l-1].x,r[l].y-r[l-1].y);let s=Math.min(400,Math.max(4,Math.ceil(o/Math.max(e,.5))));for(let l=1;l<=s;l++)n.push(vi(r,l/s))}return n}var L=t=>({x:t.x,y:t.y,width:t.width,height:t.height}),W=t=>t.rotation??0,$t=t=>({x:t.x+t.width/2,y:t.y+t.height/2}),it=(t,e)=>nt(e,$t(t),W(t)),hn=(t,e)=>nt(e,$t(t),-W(t));function dn(t){let e=L(t);if(W(t)===0)return e;let n=[{x:e.x,y:e.y},{x:G(e),y:e.y},{x:G(e),y:F(e)},{x:e.x,y:F(e)}].map(l=>it(t,l)),i=n.map(l=>l.x),r=n.map(l=>l.y),o=Math.min(...i),s=Math.min(...r);return{x:o,y:s,width:Math.max(...i)-o,height:Math.max(...r)-s}}function mn(t,e){if(!we(t.style.stroke))return t;let n=V(t),r=(t.style.fillStyle==="solid"||t.style.fillStyle==="grid")&&t.style.fill.a>=.5&&kt(t.style.fill)>.5;return n.style.stroke=kt(e)>.5&&r?{...ut}:{...e},n}function _t(t){if(t.kind!=="path"||!t.subpaths)return[];let e=[];for(let n of t.subpaths){if(n.coords.length<8||(n.coords.length-2)%6!==0)continue;let i=[];for(let r=0;r<n.coords.length;r+=2)i.push({x:t.x+n.coords[r]*t.width,y:t.y+n.coords[r+1]*t.height});e.push({closed:n.closed,points:i})}return e}function Me(t){let e=new R;for(let n of _t(t)){e.moveTo(n.points[0]);for(let i=0;i<(n.points.length-1)/3;i++)e.curveTo(n.points[3*i+3],n.points[3*i+1],n.points[3*i+2]);n.closed&&e.close()}return e}function Ai(t,e){let n=L(t),i=e==="top"?{x:N(n),y:n.y}:e==="right"?{x:G(n),y:H(n)}:e==="bottom"?{x:N(n),y:F(n)}:{x:n.x,y:H(n)};return it(t,i)}function Ti(t,e){let n=L(t),i=$t(t),r=hn(t,e),o=r.x-i.x,s=r.y-i.y;if(!((o!==0||s!==0)&&n.width>0&&n.height>0))return i;let l=n.width/2,a=n.height/2,u;return t.kind==="ellipse"?u=1/Math.sqrt(o*o/(l*l)+s*s/(a*a)):t.kind==="diamond"?u=1/(Math.abs(o)/l+Math.abs(s)/a):u=Math.min(o!==0?l/Math.abs(o):1/0,s!==0?a/Math.abs(s):1/0),it(t,{x:i.x+o*u,y:i.y+s*u})}function fn(t,e){let n=t.elementID?e.get(t.elementID):void 0;return n?$t(n):{x:t.x,y:t.y}}function pn(t,e,n){let i=t.elementID?n.get(t.elementID):void 0;return i?t.port?Ai(i,t.port):Ti(i,e):{x:t.x,y:t.y}}function Z(t,e){let n=t.connector;return n?[pn(n.start,fn(n.end,e),e),pn(n.end,fn(n.start,e),e)]:[{x:0,y:0},{x:0,y:0}]}function rt(t){if(t.kind==="polyline")return t.points;let e=[];for(let n=0;n<=24;n++){let i=n/24,r=1-i;e.push({x:r*r*r*t.a.x+3*r*r*i*t.b.x+3*r*i*i*t.c.x+i*i*i*t.d.x,y:r*r*r*t.a.y+3*r*r*i*t.b.y+3*r*i*i*t.c.y+i*i*i*t.d.y})}return e}function ot(t,e){let n=t.connector;if(!n)return{kind:"polyline",points:[]};let[i,r]=Z(t,e),o=r.x-i.x,s=r.y-i.y,l=Math.abs(o)>=Math.abs(s);switch(n.routing){case"straight":return{kind:"polyline",points:[i,r]};case"curved":return l?{kind:"cubic",a:i,b:{x:i.x+o/2,y:i.y},c:{x:r.x-o/2,y:r.y},d:r}:{kind:"cubic",a:i,b:{x:i.x,y:i.y+s/2},c:{x:r.x,y:r.y-s/2},d:r};case"elbow":{let a=h=>h===null?null:h==="top"||h==="bottom",u=a(n.start.port)??!l,c=a(n.end.port)??!l;if(u&&c){let h=i.y+s/2;return{kind:"polyline",points:[i,{x:i.x,y:h},{x:r.x,y:h},r]}}if(!u&&!c){let h=i.x+o/2;return{kind:"polyline",points:[i,{x:h,y:i.y},{x:h,y:r.y},r]}}return u?{kind:"polyline",points:[i,{x:i.x,y:r.y},r]}:{kind:"polyline",points:[i,{x:r.x,y:i.y},r]}}}}function yn(t,e,n){let i=Math.atan2(t.y-e.y,t.x-e.x),r=Math.PI/7,o=s=>({x:t.x-n*Math.cos(i+s),y:t.y-n*Math.sin(i+s)});return[o(r),o(-r)]}function gn(t,e){let n=rt(ot(t,e));if(n.length===0)return{x:0,y:0,width:0,height:0};let i=n[0].x,r=n[0].y,o=i,s=r;for(let l of n)i=Math.min(i,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),s=Math.max(s,l.y);return{x:i,y:r,width:o-i,height:s-r}}function bn(t,e){let n=rt(ot(t,e));if(n.length<=1)return n[0]??{x:0,y:0};let i=[],r=0;for(let s=0;s<n.length-1;s++){let l=Math.hypot(n[s+1].x-n[s].x,n[s+1].y-n[s].y);i.push(l),r+=l}let o=r/2;for(let s=0;s<i.length;s++){let l=i[s];if(o<=l||s===i.length-1){let a=l===0?0:o/l;return{x:n[s].x+(n[s+1].x-n[s].x)*a,y:n[s].y+(n[s+1].y-n[s].y)*a}}o-=l}return n[0]}function q(t){let e=new Map;for(let n of t.elements)e.has(n.id)||e.set(n.id,n);return e}function Ae(t,e,n){let i=t[1]+n>>>0,r=i<t[1]?1:0;return[t[0]+e+r>>>0,i]}function Ei(t,e){let n=t&65535,i=t>>>16,r=e&65535,o=e>>>16,s=n*r,l=n*o,a=i*r,u=i*o,c=l+a,h=s+c%65536*65536;return[u+Math.floor(c/65536)+Math.floor(h/4294967296)>>>0,h>>>0]}function Te(t,e,n){let i=Ei(t[1],n);return[i[0]+Math.imul(t[0],n)+Math.imul(t[1],e)>>>0,i[1]]}function ve(t,e){let n=(t[1]>>>e|t[0]<<32-e)>>>0;return[(t[0]^t[0]>>>e)>>>0,(t[1]^n)>>>0]}function xn(t){return t=Te(ve(t,30),3210233709,484763065),t=Te(ve(t,27),2496678331,321982955),ve(t,31)}var st=class{constructor(e){P(this,"state");this.state=Ae([0,e>>>0],2654435769,2135587861)}next(){return this.state=Ae(this.state,2654435769,2135587861),xn(this.state)}top53(){let[e,n]=this.next();return e*2097152+(n>>>11)}signed(){return Math.floor(this.top53())/2**52-1}unit(){return this.top53()/2**53}};function qt(t,e){let n=Ae([0,t>>>0],...Ri(e));return n=xn(n),Math.max(1,n[1]>>>0)}function Ri(t){let e=Te([0,t>>>0],2654435769,2135587861);return[e[0],e[1]]}var kn=(t,e,n)=>t.signed()*e*n;function J(t,e,n,i,r,o,s){let l=Math.hypot(e.x-t.x,e.y-t.y);if(!(l>.5))return;let a=l<200?1:l>500?.4:-.0016668*l+1.233334,u=l<20?l/10:2;for(let c=0;c<2;c++){let h=(c===0?1:.5)*a,f=()=>kn(n,u,i)*h,m=n.unit()*.4+.3,d=kn(n,l/60,i)*r*a,p=e.x-t.x,g=e.y-t.y,v=-g/l,w=p/l,y=o?t:{x:t.x+f(),y:t.y+f()},M=o?e:{x:e.x+f(),y:e.y+f()},T=t.x+p*m*.66+v*d+f()*.5,b=t.y+g*m*.66+w*d+f()*.5,k=t.x+p*(.5+m*.5)+v*d+f()*.5,E=t.y+g*(.5+m*.5)+w*d+f()*.5;s.moveTo(y),s.curveTo(M,{x:T,y:b},{x:k,y:E})}}function Ee(t,e,n,i){let r=new R;for(let o=0;o<t.length;o++)J(t[o],t[(o+1)%t.length],e,n,i,!1,r);return r}function wn(t,e,n){let i=new R,r=t.x+t.width/2,o=t.y+t.height/2,s=t.width/2,l=t.height/2;if(!(s>.5&&l>.5))return i;let a=Math.max(8,Math.min(24,Math.trunc((s+l)/6))),u=Math.min(2.5,(s+l)/25)*n;for(let c=0;c<2;c++){let h=e.unit()*2*Math.PI,f=2*Math.PI*(c===0?1:1.04),m=Math.trunc(a*f/(2*Math.PI))+1,d=[];for(let p=0;p<m;p++){let g=h+f*p/a,v=e.signed()*u,w=e.signed()*u;d.push({x:r+s*Math.cos(g)+v,y:o+l*Math.sin(g)+w})}Si(d,i)}return i}function Si(t,e){if(!(t.length<=2)){e.moveTo(t[0]);for(let n=0;n<t.length-1;n++){let i=t[Math.max(n-1,0)],r=t[n],o=t[n+1],s=t[Math.min(n+2,t.length-1)];e.curveTo(o,{x:r.x+(o.x-i.x)/6,y:r.y+(o.y-i.y)/6},{x:o.x-(s.x-r.x)/6,y:o.y-(s.y-r.y)/6})}}}var Re=-41*Math.PI/180;function Pn(t,e,n){if(!(n>0))return[];let i=Math.cos(e),r=Math.sin(e),o=t.filter(f=>f.length>=3).map(f=>f.map(m=>({x:m.x*i+m.y*r,y:-m.x*r+m.y*i}))),s=o.flat();if(s.length===0)return[];let l=1/0,a=-1/0;for(let f of s)l=Math.min(l,f.y),a=Math.max(a,f.y);let u=(f,m)=>({x:f*i-m*r,y:f*r+m*i}),c=[],h=l+n/2;for(;h<a;){let f=[];for(let m of o)for(let d=0;d<m.length;d++){let p=m[d],g=m[(d+1)%m.length];(p.y<=h&&h<g.y||g.y<=h&&h<p.y)&&f.push(p.x+(h-p.y)/(g.y-p.y)*(g.x-p.x))}f.sort((m,d)=>m-d);for(let m=0;m+1<f.length;m+=2)f[m+1]-f[m]>.5&&c.push([u(f[m],h),u(f[m+1],h)]);h+=n}return c}var Tn=2,Se=.75,Ii=.8,vn=.6;function En(t,e){return[...An(t,e,!1),...An(t,e,!0)]}function An(t,e,n){if(!(e>0))return[];let i=u=>n?{x:u.y,y:u.x}:u,r=t.filter(u=>u.length>=3).map(u=>u.map(i)),o=r.flat().map(u=>u.y);if(o.length===0)return[];let s=Math.min(...o),l=Math.max(...o),a=[];for(let u=Math.floor(s/e)*e;u<l-.5;u+=e){if(!(u>s+.5))continue;let c=[];for(let h of r)for(let f=0;f<h.length;f++){let m=h[f],d=h[(f+1)%h.length];(m.y<=u&&u<d.y||d.y<=u&&u<m.y)&&c.push(m.x+(u-m.y)/(d.y-m.y)*(d.x-m.x))}c.sort((h,f)=>h-f);for(let h=0;h+1<c.length;h+=2)c[h+1]-c[h]>.5&&a.push([i({x:c[h],y:u}),i({x:c[h+1],y:u})])}return a}function Rn(t){return .2126*t.r+.7152*t.g+.0722*t.b>.5?{r:t.r*.84,g:t.g*.84,b:t.b*.8,a:t.a}:{r:t.r+(1-t.r)*.25,g:t.g+(1-t.g)*.25,b:t.b+(1-t.b)*.25,a:t.a}}function Ie(t){return t.style.fillStyle==="grid"&&t.style.fill.a>0&&["rectangle","ellipse","diamond","path"].includes(t.kind)}function Kt(t,e,n){let i=(Math.imul(t,668265261)^Math.imul(e,374761393)^Math.imul(n,2654435761))>>>0;return i=Math.imul(i^i>>>15,2246822507)>>>0,i=Math.imul(i^i>>>13,3266489909)>>>0,i=(i^i>>>16)>>>0,i/4294967296}function Sn(t,e,n){let i=n/Tn;return{x:(t+.5+(Kt(t,e,1)-.5)*vn)*i,y:(e+.5+(Kt(t,e,2)-.5)*vn)*i}}function $i(t,e,n,i){let r=1/0;for(let o=-1;o<=1;o++)for(let s=-1;s<=1;s++){if(o===0&&s===0)continue;let l=Sn(t+o,e+s,i);r=Math.min(r,Math.hypot(l.x-n.x,l.y-n.y))}return r*Ii}function Li(t,e,n){let i=Math.cos(e),r=Math.sin(e),o=n*.8,s=n*.5;return[-1,0,1].map(l=>{let a=t.x-r*s*l,u=t.y+i*s*l;return[{x:a-i*o,y:u-r*o},{x:a+i*o,y:u+r*o}]})}function Di(t,e){let n=!1;for(let i of t){if(i.length<3)continue;let r=i.length-1;for(let o=0;o<i.length;o++){let s=i[o],l=i[r];s.y>e.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(n=!n),r=o}}return n}function Ci(t,e){let n=1/0;for(let i of e)if(!(i.length<2))for(let r=0;r<i.length;r++){let o=i[r],s=i[(r+1)%i.length],l=s.x-o.x,a=s.y-o.y,u=l*l+a*a,c=u>0?Math.max(0,Math.min(1,((t.x-o.x)*l+(t.y-o.y)*a)/u)):0;n=Math.min(n,Math.hypot(t.x-(o.x+c*l),t.y-(o.y+c*a)))}return n}var Oi=(t,e)=>e.x>=t.x&&e.x<t.x+t.width&&e.y>=t.y&&e.y<t.y+t.height,Ut=new Map;function In(t){if(t.length===0)return[];let e=t.map(r=>[r.kind,r.x,r.y,r.width,r.height,r.rotation??0,dt(r),JSON.stringify(r.subpaths??null),r.style.stroke.r,r.style.stroke.g,r.style.stroke.b,r.style.stroke.a,r.style.roughness,r.style.strokeWidth].join(",")).join(";"),n=Ut.get(e);if(n)return n;let i=Vi(t);return Ut.size>=16&&Ut.clear(),Ut.set(e,i),i}function Vi(t){let e=t.map(o=>{let s=$e(o).map(m=>m.map(d=>it(o,d))),l=s.flat(),a=l.map(m=>m.x),u=l.map(m=>m.y),c=a.length?Math.min(...a):0,h=u.length?Math.min(...u):0,f={x:c,y:h,width:(a.length?Math.max(...a):0)-c,height:(u.length?Math.max(...u):0)-h};return{contours:s,box:f,cell:dt(o),element:o}}),n=e.map(()=>[]),i=new Set;for(let o of e){let s=o.cell/Tn,l=Pt(o.box,-o.cell,-o.cell),a=Math.floor(l.x/s),u=Math.ceil((l.x+l.width)/s),c=Math.floor(l.y/s),h=Math.ceil((l.y+l.height)/s),f=Se*o.cell;for(let m=a;m<u;m++)for(let d=c;d<h;d++){let p=`${o.cell}|${m}|${d}`;if(i.has(p))continue;i.add(p);let g=Sn(m,d,o.cell),v=1/0,w=-1;for(let b=0;b<e.length;b++){let k=e[b];if(!Oi(Pt(k.box,-f,-f),g))continue;if(Di(k.contours,g)){v=0;break}let E=Ci(g,k.contours);E<v&&(v=E,w=b)}if(!(v>0&&v<=f&&w>=0))continue;let y=Kt(m,d,3)*Math.PI,M=$i(m,d,g,o.cell),T=Math.trunc(Kt(m,d,4)*4294967296)>>>0;for(let[b,k]of Li(g,y,M))n[w].push([b,k,T])}}let r=[];return e.forEach((o,s)=>{if(n[s].length===0)return;let l=o.element,a=new R;for(let[u,c,h]of n[s])l.style.roughness<=0?a.moveTo(u).lineTo(c):J(u,c,new st(h),l.style.roughness*.35,.2,!1,a);r.push({ink:{...l.style.stroke,a:l.style.stroke.a*.6},width:Math.max(.8,l.style.strokeWidth*.45),path:a})}),r}var Xt=class{constructor(e=6e3){P(this,"map",new Map);P(this,"limit");this.limit=e}get(e,n){let i=this.map.get(e);if(i!==void 0)return i;let r=n();return this.map.size>=this.limit&&this.map.clear(),this.map.set(e,r),r}},Ln=new Xt,Wi=new Xt;function Dn(t,e){let n=t.style;return[e,t.kind,t.x,t.y,t.width,t.height,t.seed,n.roughness,n.bowing,n.strokeWidth,n.fillStyle,n.fillStyle==="grid"?dt(t):0,t.path?t.path.join(","):t.subpaths?JSON.stringify(t.subpaths):""].join("|")}var dt=t=>Math.max(8,t.style.gridSize??50);function mt(t){return t.kind==="freehand"&&t.path===null?$n(t):Ln.get(Dn(t,0),()=>$n(t))}function Cn(t){return[{x:t.x,y:t.y},{x:G(t),y:t.y},{x:G(t),y:F(t)},{x:t.x,y:F(t)}]}function Qt(t){return[{x:N(t),y:t.y},{x:G(t),y:H(t)},{x:N(t),y:F(t)},{x:t.x,y:H(t)}]}function $n(t){let e=L(t),n=new st(t.seed),i=t.style.roughness;switch(t.kind){case"ellipse":return i<=0?R.ellipse(e):wn(e,n,i);case"diamond":return i<=0?new R().addLines(Qt(e)).close():Ee(Qt(e),n,i,t.style.bowing);case"text":case"connector":return R.rect(e);case"freehand":return Yi(t);case"path":return i<=0?Me(t):zi(t,n);default:return i<=0?R.rect(e):Ee(Cn(e),n,i,t.style.bowing)}}function zi(t,e){let n=t.style.roughness,i=new R;for(let r of _t(t)){let o=r.points;for(let s=0;s<(o.length-1)/3;s++){let l=o[3*s],a=o[3*s+1],u=o[3*s+2],c=o[3*s+3];if(a.x===l.x&&a.y===l.y&&u.x===c.x&&u.y===c.y){J(l,c,e,n,t.style.bowing,!0,i);continue}let h=Math.hypot(a.x-l.x,a.y-l.y)+Math.hypot(u.x-a.x,u.y-a.y)+Math.hypot(c.x-u.x,c.y-u.y),f=Math.min(2.5,h/30)*n;for(let m=0;m<2;m++){let d=m===0?1:.5,p=()=>e.signed()*f*d;i.moveTo(l);let g=a.x+p(),v=a.y+p(),w=u.x+p(),y=u.y+p();i.curveTo(c,{x:g,y:v},{x:w,y})}}}return i}function Yi(t){let e=L(t),n=t.path;if(n&&n.length>=8&&(n.length-2)%6===0){let o=l=>({x:e.x+n[2*l]*e.width,y:e.y+n[2*l+1]*e.height}),s=new R().moveTo(o(0));for(let l=0;l<Math.floor((n.length/2-1)/3);l++)s.curveTo(o(3*l+3),o(3*l+1),o(3*l+2));return s}let i=(t.points??[]).map(o=>({x:e.x+o.x*e.width,y:e.y+o.y*e.height})),r=new R;if(i.length===0)return r;if(r.moveTo(i[0]),i.length===1)return r.lineTo(i[0]);if(i.length===2)return r.lineTo(i[1]);for(let o=1;o<i.length-1;o++)r.quadTo({x:(i[o].x+i[o+1].x)/2,y:(i[o].y+i[o+1].y)/2},i[o]);return r.lineTo(i[i.length-1])}function $e(t){return t.kind!=="path"?[Bi(t)]:_t(t).map(e=>un(e.points,3))}function Bi(t){let e=L(t);if(t.kind==="ellipse"){let n=[];for(let i=0;i<48;i++){let r=2*Math.PI*i/48;n.push({x:N(e)+e.width/2*Math.cos(r),y:H(e)+e.height/2*Math.sin(r)})}return n}return t.kind==="diamond"?Qt(e):Cn(e)}function Zt(t){let e=L(t);return t.kind==="ellipse"?R.ellipse(e):t.kind==="path"?Me(t):t.kind==="diamond"?new R().addLines(Qt(e)).close():R.rect(e)}function Le(t){return t.style.fillStyle==="solid"||["freehand","connector","text","image"].includes(t.kind)?new R:Ln.get(Dn(t,1),()=>Gi(t))}function Gi(t){let e=$e(t),n=new st((t.seed^1540483477)>>>0),i=new R;if(t.style.fillStyle==="grid"){for(let[s,l]of En(e,dt(t)))t.style.roughness<=0?i.moveTo(s).lineTo(l):J(s,l,n,t.style.roughness*.3,.3,!1,i);return i}let r=Math.max(4,t.style.strokeWidth*4),o=[Re];t.style.fillStyle==="crossHatch"&&o.push(Re+Math.PI/2);for(let s of o)for(let[l,a]of Pn(e,s,r))t.style.roughness<=0?i.moveTo(l).lineTo(a):J(l,a,n,t.style.roughness*.6,.5,!1,i);return i}function Jt(t,e){switch(t){case"solid":return null;case"dashed":return[Math.max(8,e*4),Math.max(6,e*3)];case"dotted":return[.01,Math.max(5,e*2.6)]}}function De(t,e){let n=t.connector;if(!n)return[new R,new R];let[i,r]=Z(t,e),o=[t.seed,t.style.roughness,t.style.bowing,t.style.strokeWidth,n.routing,n.startHead,n.endHead,n.start.port,n.end.port,i.x,i.y,r.x,r.y].join("|");return Wi.get(o,()=>Fi(t,e))}function Fi(t,e){let n=t.connector,i=new st(t.seed),r=t.style.roughness,o=t.style.bowing,s=new R,l=new R,a=ot(t,e);if(a.kind==="polyline"){let m=a.points;for(let d=0;d<Math.max(m.length-1,0);d++)r<=0?s.moveTo(m[d]).lineTo(m[d+1]):J(m[d],m[d+1],i,r,o,!0,s)}else{s.moveTo(a.a);let m=r*3,d=()=>i.signed()*m,p=a.b.x+d(),g=a.b.y+d(),v=a.c.x+d(),w=a.c.y+d();s.curveTo(a.d,{x:p,y:g},{x:v,y:w})}let u=rt(a),c=Math.max(10,t.style.strokeWidth*5),h=(m,d)=>{r<=0?s.moveTo(m).lineTo(d):J(m,d,i,r*.5,0,!0,s)},f=(m,d,p)=>{let[g,v]=yn(d,p,c);switch(m){case"arrow":h(g,d),h(v,d);break;case"triangle":h(g,d),h(v,d),h(g,v),l.moveTo(d).lineTo(g).lineTo(v).close();break;case"dot":{let w=c*.32,y=Math.atan2(d.y-p.y,d.x-p.x),M=d.x-w*Math.cos(y),T=d.y-w*Math.sin(y);l.addEllipse({x:M-w,y:T-w,width:2*w,height:2*w});break}case"bar":{let w=Math.atan2(d.y-p.y,d.x-p.x)+Math.PI/2,y=c*.5;h({x:d.x-y*Math.cos(w),y:d.y-y*Math.sin(w)},{x:d.x+y*Math.cos(w),y:d.y+y*Math.sin(w)});break}}};return u.length>1&&(f(n.endHead,u[u.length-1],u[u.length-2]),f(n.startHead,u[0],u[1])),[s,l]}function Ve(t,e){switch(t){case"linear":return e;case"easeIn":return e*e*e;case"easeOut":return 1-Math.pow(1-e,3);case"easeInOut":return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;case"hold":return 0;case"spring":return Ni(e);case"bounce":return Hi(e);case"elastic":return ji(e)}}function Ni(t){if(t<=0)return 0;if(t>=1)return 1;let e=n=>1-Math.exp(-6*n)*(Math.cos(3*Math.PI*n)+6/(3*Math.PI)*Math.sin(3*Math.PI*n));return e(t)+t*(1-e(1))}function Hi(t){if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,n=2.75;if(t<1/n)return e*t*t;if(t<2/n){let r=t-1.5/n;return e*r*r+.75}if(t<2.5/n){let r=t-2.25/n;return e*r*r+.9375}let i=t-2.625/n;return e*i*i+.984375}function ji(t){return t<=0?0:t>=1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*(2*Math.PI/3))+1}var Lt=(t,e)=>t%e;function Dt(t,e){let n=(t.repeats??[]).filter(jt).slice().sort((i,r)=>i.start-r.start);if(n.length===0)return e;for(let i of n){if(!(e>=i.end))continue;let r=i.end-i.start;if(i.count===null)return i.start+Lt(e-i.start,r);let o=r*i.count;if(e<i.start+o)return i.start+Lt(e-i.start,r);e-=o-r}return e}function Ce(t,e,n,i,r){e=Dt(t,e);let o,s;for(let c of t.keys)if(n(c)!==void 0)if(c.t<=e)o=c;else{s=c;break}if(!o&&!s)return i;if(o&&!s)return n(o);if(!o&&s)return n(s);let l=o,a=s,u=a.t-l.t>0?(e-l.t)/(a.t-l.t):1;return r(n(l),n(a),Ve(l.ease??"linear",u))}var _i=(t,e,n)=>t+(e-t)*n,te=(t,e,n)=>Math.min(Math.max(t+(e-t)*n,0),1),On=(t,e,n)=>({r:te(t.r,e.r,n),g:te(t.g,e.g,n),b:te(t.b,e.b,n),a:te(t.a,e.a,n)});function lt(t,e,n,i){return Ce(t,e,r=>r[n],i,_i)}function qi(t,e){e=Dt(t,e);let n=(r,o)=>{let s;for(let a of t.keys)a.t<=e&&r(a)!==void 0&&(s=a);let l=t.keys.find(a=>a.t>e&&r(a)!==void 0);return!s||!l?!1:s.ease!=="hold"&&!o(r(s),r(l))},i=r=>n(o=>o[r],(o,s)=>o===s);return i("x")||i("y")||i("width")||i("height")||i("rotation")||i("strokeWidth")||n(r=>r.stroke,bt)||n(r=>r.fill,bt)||i("reveal")||i("opacity")}function Oe(t,e){e=Dt(t,e);let n=t.keys.filter(r=>r.visible!==void 0);if(n.length===0)return!0;let i;for(let r of n)r.t<=e&&(i=r);return i?i.visible:!n[0].visible}function Ui(t,e,n){if(e=V(e),t.keys.some(i=>i.reveal!==void 0)){let i=lt(t,n,"reveal",e.reveal??1);e.reveal=i>=1?null:Math.max(0,i)}if(t.keys.some(i=>i.opacity!==void 0)){let i=Math.min(Math.max(lt(t,n,"opacity",e.style.opacity??1),0),1);e.style.opacity=i>=1?null:i}return e.kind==="connector"||(e.x=lt(t,n,"x",e.x),e.y=lt(t,n,"y",e.y),e.width=Math.max(0,lt(t,n,"width",e.width)),e.height=Math.max(0,lt(t,n,"height",e.height)),t.keys.some(i=>i.rotation!==void 0)&&(e.rotation=lt(t,n,"rotation",W(e))),e.style.strokeWidth=Math.max(0,lt(t,n,"strokeWidth",e.style.strokeWidth)),e.style.stroke=Ce(t,n,i=>i.stroke,e.style.stroke,On),e.style.fill=Ce(t,n,i=>i.fill,e.style.fill,On)),e}function Ki(t,e){e=Dt(t,e);let n=null;for(let r of t.follow??[])r.start<=e&&(n===null||r.start>n.start)&&(n=r);if(!n)return null;let i=n;return t.keys.some(r=>r.t>=i.end&&r.t<=e&&(r.x!==void 0||r.y!==void 0))?null:n}function Xi(t,e){if(t.kind==="connector")return new wt(rt(ot(t,q(e))));let n=V(t);n.style.roughness=0;let i=mt(n).contours()[0]??[];return new wt(W(t)===0?i:i.map(r=>it(t,r)))}function Qi(t,e,n,i){let r=Ki(t,n);if(!r)return e;n=Dt(t,n);let o=i.elements.find(h=>h.id===r.path);if(!o||o.id===e.id)return e;let s=Xi(o,i),l=r.end-r.start,a=Math.min(Math.max(Ve(r.ease??"easeInOut",l>0?Math.min(1,(n-r.start)/l):1),0),1)*(r.laps??1);a>1&&(a=Lt(a,1)===0?1:Lt(a,1)),r.reverse===!0&&(a=1-a);let u=s.point(a),c=V(e);if(c.x=u.x-e.width/2,c.y=u.y-e.height/2,r.orient===!0){let h=r.reverse===!0?-.01:.01,f=s.point(a-h/2),m=s.point(a+h/2);(f.x!==m.x||f.y!==m.y)&&(c.rotation=Math.atan2(m.y-f.y,m.x-f.x))}return c}function Zi(t,e,n,i){if(!(n>0))return 0;let r=O(t.duration);if(r>0){let s=It(e*r/n);s!==0&&(e=s*n/r)}let o=Lt(e*i,n);return o<0?-o:o===0?0:n-o}function Ji(t){let e=new Map;for(let n of t.tracks)e.has(n.element)||e.set(n.element,n);return e}function U(t,e){return j(Ct(t,e),O(e))}function Ct(t,e){let n=t.timeline;if(!n)return t;e=O(e);let i=Ji(n),r=n.boil===null?null:Math.trunc(Math.floor(e*xt(n.fps)+1e-9)/Math.max(1,n.boil))%ke>>>0,o=new Set;for(let m of i.values())Oe(m,e)||o.add(m.element);let s=null;if(n.settle===!0){s=new Set;for(let m of i.values())qi(m,e)&&s.add(m.element)}let l=m=>{let d=i.get(m.id)?.boil;return d??(s?m.connector?[m.connector.start.elementID,m.connector.end.elementID].some(p=>p!==null&&s.has(p)):s.has(m.id):!0)},a=t.elements.map(m=>{let d=i.get(m.id),p=d?Ui(d,m,e):m;r!==null&&r>0&&l(m)&&(p===m&&(p=V(m)),p.seed=qt(m.seed,r));let g=d?.march!=null?Jt(p.style.dash,p.style.strokeWidth):null;return d?.march!=null&&g&&(p===m&&(p=V(m)),p.style.dashOffset=Zi(n,d.march,g.reduce((v,w)=>v+w,0),e)),p});a=a.map((m,d)=>o.has(m.id)?t.elements[d]:m);let u={...t,elements:a,timeline:null};a=a.map(m=>{let d=i.get(m.id);return d?Qi(d,m,e,u):m});let c={...t,elements:a,timeline:null},h=q(c),f=new Set(o);return a=a.map(m=>{let d=m.connector;if(!d||![d.start.elementID,d.end.elementID].some(w=>w!==null&&o.has(w)))return m;if(!(i.get(m.id)?.keys.some(w=>w.visible!==void 0)??!1))return f.add(m.id),m;let[p,g]=Z(m,h),v=V(m);return v.connector.start={elementID:null,port:d.start.port,x:p.x,y:p.y},v.connector.end={elementID:null,port:d.end.port,x:g.x,y:g.y},v}),{...t,elements:a.filter(m=>!f.has(m.id)),timeline:null}}function at(t){return t.timeline?t.timeline.poster??t.timeline.duration:0}function Wn(t){return t.timeline?U(t,at(t)):j(t,0)}function tr(t,e){let n=t.camera??[];if(n.length===0)return null;let i;for(let l of n)l.t<=e&&(i=l);let r=n.find(l=>l.t>e);if(!i)return Vn(n[0]);if(!r)return Vn(i);let o=Ve(i.ease??"easeInOut",(e-i.t)/Math.max(r.t-i.t,1e-9)),s=(l,a)=>l+(a-l)*o;return{x:s(i.x,r.x),y:s(i.y,r.y),width:Math.max(1,s(i.width,r.width)),height:Math.max(1,s(i.height,r.height))}}var Vn=t=>({x:t.x,y:t.y,width:t.width,height:t.height});function Mt(t,e){let n=t.camera?.[0],i=tr(t,e);return!n||!i||!(i.width>0&&i.height>0)?null:er(i,n.width/n.height)}function er(t,e){if(!(t.width>0&&t.height>0&&e>0))return t;let n=t.width,i=t.height;return t.width/t.height<e?n=t.height*e:i=t.width/e,{x:t.x+t.width/2-n/2,y:t.y+t.height/2-i/2,width:n,height:i}}function nr(t){return Math.max(1,Math.ceil(O(t.duration)*xt(t.fps)))}function ee(t){let e=xt(t.fps),n=[];for(let r=0;r<nr(t);r++)n.push(r/e);let i=n[n.length-1];return t.duration-i>1e-6&&n.push(t.duration),n}function zn(t,e){let n=-1;return(t.markers??[]).forEach((i,r)=>{i.t<=e&&(n=r)}),n}function Yn(t){let e=t.timeline;if(!e)return new Set;let n=e.poster??e.duration;return new Set(e.tracks.filter(i=>!Oe(i,0)&&!Oe(i,n)).map(i=>i.element))}var ir=8,rr=2e4,We=1e-9;function ne(t,e){let n=(t.timeline?.markers??[]).find(i=>i.name.toLowerCase()===e);return n?Math.min(Math.max(n.t,0),O(t.timeline?.duration??0)):null}function Vt(t,e){switch(e){case"up":return ne(t,"up")??0;case"over":return ne(t,"over")??Vt(t,"up");case"down":return ne(t,"down")??Vt(t,"over");default:return ne(t,"hit")}}function or(t,e,n,i){let r=O(t.timeline?.duration??0);if(t.button===!0)return Vt(t,"up")??0;let o=i!==null&&Number.isFinite(i)?i:0;switch(n??"loop"){case"still":return Math.min(t.timeline?.poster??r,r);case"click":return Math.min(Math.max(o,0),r);case"once":return Math.min(Math.max(e+o,0),r);default:{if(r<=0)return 0;let s=e+o,l=s%r;return l<0&&(l+=r),s>We&&(l<We||r-l<We)?r:l}}}function Bn(t){return{id:t.id,name:t.name,layers:t.layers,elements:t.elements,theme:null,timeline:t.timeline,symbols:null}}function ie(t){return t.elements.some(e=>e.kind==="symbol")}function j(t,e,n=!0,i=new Map){if(!ie(t))return t;let r={left:rr};return{...t,elements:Fn(t.elements,t,e,Be(t),[],n,r,i)}}function Be(t){let e=new Map;for(let n of t.symbols??[])e.has(n.id)||e.set(n.id,n);return e}function Fn(t,e,n,i,r,o,s,l=new Map){let a=new Set(t.filter(h=>h.kind==="symbol").map(h=>h.id));if(a.size===0)return s.left-=t.length,t;let u=q(e),c=[];for(let h of t){if(s.left<=0)break;let f=h.connector;if(h.kind==="connector"&&f&&[f.start.elementID,f.end.elementID].some(M=>M!==null&&a.has(M))){let[M,T]=Z(h,u),b=V(h);f.start.elementID!==null&&a.has(f.start.elementID)&&(b.connector.start={elementID:null,port:f.start.port,x:M.x,y:M.y}),f.end.elementID!==null&&a.has(f.end.elementID)&&(b.connector.end={elementID:null,port:f.end.port,x:T.x,y:T.y}),c.push(b),s.left-=1;continue}if(h.kind!=="symbol"){c.push(h),s.left-=1;continue}s.left-=1;let m=h.symbol,d=m===null?void 0:i.get(m);if(m===null||!d||r.includes(m)||r.length>=ir)continue;let p=r.length===0?l.get(h.id):void 0,g=p!==void 0?Math.min(Math.max(p,0),O(d.timeline?.duration??0)):or(d,n,h.playback,h.offset),v=o?Ct(Bn(d),g):Bn(d),w=new Set(v.layers.filter(M=>M.visible).map(M=>M.id)),y={...v,elements:ht(v).filter(M=>w.has(M.layerID)),layers:[{id:h.layerID,name:"",visible:!0,locked:!1}]};for(let M of Fn(y.elements,y,g,i,[...r,m],o,s))c.push(sr(M,h,d))}return c}function sr(t,e,n){let i={x:e.x,y:e.y,width:e.width,height:e.height},r=i.width/n.width,o=i.height/n.height,s=Math.sqrt(Math.abs(r*o)),l={x:i.x+i.width/2,y:i.y+i.height/2},a=W(e),u=m=>nt({x:i.x+m.x*r,y:i.y+m.y*o},l,a),c=V(t);c.id=Ye(e.id,t.id),c.layerID=e.layerID,c.groupID=null,c.link=t.link===null?null:Ye(e.id,t.link),c.seed=qt(t.seed,e.seed),c.click=null,c.hover=null;let h={x:i.x+t.x*r,y:i.y+t.y*o,width:t.width*r,height:t.height*o},f=nt({x:h.x+h.width/2,y:h.y+h.height/2},l,a);if(c.x=f.x-h.width/2,c.y=f.y-h.height/2,c.width=h.width,c.height=h.height,(a!==0||t.rotation!==null)&&(c.rotation=W(t)+a),c.style.strokeWidth=t.style.strokeWidth*s,c.style.fontSize=t.style.fontSize*s,t.style.gridSize!==null&&(c.style.gridSize=t.style.gridSize*s),e.style.opacity!==null&&(c.style.opacity=(t.style.opacity??1)*e.style.opacity),t.connector){let m=d=>{if(d.elementID!==null)return{elementID:Ye(e.id,d.elementID),port:d.port,x:d.x,y:d.y};let p=u(d);return{elementID:null,port:d.port,x:p.x,y:p.y}};c.connector={...t.connector,start:m(t.connector.start),end:m(t.connector.end)}}return c}var ze=(1n<<64n)-1n;function Ot(t){let e=t+0x9e3779b97f4a7c15n&ze;return e=(e^e>>30n)*0xbf58476d1ce4e5b9n&ze,e=(e^e>>27n)*0x94d049bb133111ebn&ze,e^e>>31n}function Gn(t){let e=t.replace(/-/g,"").padStart(32,"0").slice(-32);return[BigInt(`0x${e.slice(0,16)}`),BigInt(`0x${e.slice(16)}`)]}function Ye(t,e){let[n,i]=Gn(t),[r,o]=Gn(e),s=Ot(Ot(Ot(Ot(n)^i)^r)^o),l=Ot(s^0x6a09e667f3bcc909n),a=s.toString(16).padStart(16,"0")+l.toString(16).padStart(16,"0");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`.toUpperCase()}function lr(t,e){let n=e.findIndex(i=>i.name===t);return n>=0?n:e.findIndex(i=>i.name.toLowerCase()===t.toLowerCase())}function Nn(t,e){let n=t.timeline?.markers??[],i=new Map,r=null;for(let o of t.elements){let s=o.click;if(s?.scene){let a=lr(s.scene,n);if(a>=0){i.set(o.id,{scene:a});continue}}let l=s?.url?Ht(s.url):null;if(l){i.set(o.id,{url:l});continue}if(o.link&&e&&e.pages.length>1){r||(r=new Map,e.pages.forEach((u,c)=>{for(let h of u.elements)r.has(h.id)||r.set(h.id,c)}));let a=r.get(o.link);a!==void 0&&e.pages[a]!==t&&i.set(o.id,{page:a})}}return i}function ar(t){let e=t.hover;if(!e)return t;let n={...t.style};if(e.stroke&&(n.stroke=e.stroke),e.fill&&(n.fill=e.fill),e.opacity!==null&&Number.isFinite(e.opacity)){let i=Math.min(Math.max(e.opacity,0),1);n.opacity=i>=1?null:i}return{...t,style:n}}function Hn(t,e){return{...t,elements:t.elements.map(n=>e.has(n.id)?ar(n):n)}}function jn(t){return!!t.hover&&(t.hover.stroke!==null||t.hover.fill!==null||t.hover.opacity!==null)}function _n(t,e){let n=(t.text??"").split(`
|
|
3
|
+
`).find(i=>i.length>0);return n||(t.anchor?t.anchor:e||t.kind)}function qn(t,e){let n=new Map;for(let i of t.elements){if(!e.has(i.id)||i.kind!=="symbol")continue;let r={...t,layers:[{id:i.layerID,name:"",visible:!0,locked:!1}],elements:[i]};for(let o of j(r,0,!1).elements)n.set(o.id,i.id)}return n}var Un=`
|
|
4
|
+
.dottie-a { cursor: pointer; outline: none; }
|
|
5
|
+
.dottie-a .dottie-h { display: none; }
|
|
6
|
+
.dottie-a:hover .dottie-h, .dottie-a.dottie-hover .dottie-h, .dottie-a:focus-visible .dottie-h { display: inline; }
|
|
7
|
+
.dottie-a:hover .dottie-n, .dottie-a.dottie-hover .dottie-n, .dottie-a:focus-visible .dottie-n { display: none; }
|
|
8
|
+
.dottie-a:focus-visible { filter: drop-shadow(0 0 3px var(--dottie-focus, #3b82f6)); }
|
|
9
|
+
.dottie-a:not(.dottie-b):active, .dottie-a.dottie-press:not(.dottie-b) { transform: translate(1px, 1px); }
|
|
10
|
+
.dottie-a .dottie-d { display: none; }
|
|
11
|
+
.dottie-b:active .dottie-n, .dottie-b:active .dottie-h, .dottie-b.dottie-press .dottie-n, .dottie-b.dottie-press .dottie-h { display: none; }
|
|
12
|
+
.dottie-b:active .dottie-d, .dottie-b.dottie-press .dottie-d { display: inline; }
|
|
13
|
+
`;var re=.951995849609375,oe=.2129974365234375,se=.0279998779296875,Kn=.975006103515625,Xn=.2169952392578125,Qn=.0290069580078125,Zn=.957000732421875,Jn=.2129974365234375,ti=.0279998779296875,ei=.975006103515625,ni=.2169952392578125,ii=.0290069580078125,ri=.60205078125,oi=.92822265625,si=.23583984375,vt={bold:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-30,fi:20,fl:20,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":407,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":278,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':463,"\u201C":463,"\u201D":463,"(":296,")":296,"[":333,"]":333,"{":333,"}":333,"@":800,"*":407,"/":371,"\\":371,"&":685,"#":556,"%":1e3,"\u2022":350,"`":259,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":722.66,"\u2193":722.66,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":223,"~":600,"\u25E6":608.4,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:574,A:685,b:611,B:704,c:574,C:741,d:611,D:741,e:574,E:648,\u00E9:574,f:333,F:593,g:611,G:759,h:593,H:741,i:258,I:295,j:278,J:556,k:574,K:722,l:258,L:593,m:906,M:907,n:593,N:741,o:611,O:778,p:611,P:667,q:611,Q:778,r:389,R:722,s:537,S:649,t:352,T:611,u:593,U:741,v:520,V:630,w:814,W:944,x:537,X:667,y:519,Y:667,z:519,Z:648}},boldItalic:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-68,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":407,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":296,"?":574,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':481,"\u201C":481,"\u201D":481,"(":296,")":296,"[":333,"]":333,"{":333,"}":333,"@":800,"*":407,"/":389,"\\":389,"&":685,"#":556,"%":963,"\u2022":350,"`":259,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":722.66,"\u2193":722.66,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":608.4,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:574,A:685,b:611,B:722,c:556,C:741,d:611,D:741,e:574,E:667,\u00E9:574,f:352,F:593,g:611,G:759,h:611,H:741,i:259,I:296,j:259,J:556,k:556,K:722,l:259,L:574,m:907,M:907,n:611,N:741,o:593,O:778,p:611,P:667,q:611,Q:778,r:389,R:722,s:519,S:648,t:370,T:611,u:611,U:741,v:519,V:630,w:815,W:944,x:519,X:667,y:519,Y:648,z:500,Z:648}},italic:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-15,fi:1,fl:1,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":389,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":259,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':426,"\u201C":426,"\u201D":426,"(":259,")":259,"[":259,"]":259,"{":333,"}":333,"@":800,"*":352,"/":333,"\\":333,"&":630,"#":556,"%":926,"\u2022":500,"`":222,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":645.02,"\u2193":645.02,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":578.13,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:519,A:667,b:593,B:685,c:537,C:722,d:593,D:704,e:537,E:611,\u00E9:537,f:296,F:574,g:574,G:759,h:556,H:722,i:222,I:259,j:222,J:519,k:481,K:667,l:222,L:556,m:852,M:870,n:556,N:722,o:574,O:759,p:593,P:648,q:593,Q:759,r:333,R:685,s:481,S:648,t:315,T:574,u:556,U:722,v:481,V:611,w:759,W:926,x:481,X:611,y:481,Y:611,z:444,Z:611}},regular:{k:{"\u2018\u2018":-95,"\u2019\u2019":-95,"\u2019s":-74,"\u2019t":-18,"A\u2019":-74,AT:-92,Av:-18,AV:-46,Aw:-18,AW:-24,Ay:-18,AY:-74,"F,":-157,"F.":-157,"f\u2019":18,FA:-55,ff:-15,"L\u2019":-74,LT:-92,LV:-92,LW:-55,Ly:-37,LY:-111,"P,":-179,"P.":-179,PA:-74,"r-":-55,"r,":-92,"r.":-92,rc:-18,rd:-18,re:-18,rg:-28,rn:18,ro:-18,rq:-18,RT:-18,RV:-18,RW:-18,RY:-37,"T-":-129,"T,":-111,"T;":-111,"T:":-111,"T.":-111,Ta:-111,TA:-92,Tc:-111,Te:-111,To:-111,Tr:-92,Ts:-111,Tu:-92,Tw:-111,Ty:-111,"V-":-55,"v,":-74,"V,":-129,"V;":-46,"V:":-46,"v.":-74,"V.":-129,Va:-55,VA:-46,Ve:-55,Vi:-18,Vo:-55,Vr:-37,Vu:-37,Vy:-18,"w,":-55,"W,":-74,"W;":-18,"W:":-18,"w.":-55,"W.":-74,Wa:-37,WA:-24,We:-57,Wo:-57,Wr:-18,Wu:-18,"Y-":-111,"y,":-74,"Y,":-139,"Y;":-92,"Y:":-92,"y.":-74,"Y.":-139,Ya:-92,YA:-74,Ye:-111,Yi:-37,Yo:-111,Yp:-74,Yq:-92,Yu:-74,Yv:-55},w:{" ":278,_:500,"-":389,"\u2013":500,"\u2014":1e3,",":278,";":278,":":278,"!":259,"?":556,".":278,"\u2026":1e3,"\xB7":278,"'":278,"\u2018":278,"\u2019":278,'"':426,"\u201C":426,"\u201D":426,"(":259,")":259,"[":259,"]":259,"{":333,"}":333,"@":800,"*":352,"/":333,"\\":333,"&":630,"#":556,"%":1e3,"\u2022":350,"`":222,"^":600,"\u2190":1e3,"\u2192":1e3,"\u2191":645.02,"\u2193":645.02,"+":600,"\xD7":600,"<":600,"=":600,">":600,"|":222,"~":600,"\u25E6":578.13,"\u2610":830.08,"\u2611":830.08,"\u2713":764.16,$:556,0:556,1:556,2:556,3:556,4:556,5:556,6:556,7:556,8:556,9:556,a:537,A:648,b:593,B:685,c:537,C:722,d:593,D:704,e:537,E:611,\u00E9:537,f:296,F:574,g:574,G:759,h:556,H:722,i:222,I:259,j:222,J:519,k:519,K:667,l:222,L:556,m:853,M:871,n:556,N:722,o:574,O:760,p:593,P:648,q:593,Q:760,r:333,R:685,s:500,S:648,t:315,T:574,u:556,U:722,v:500,V:611,w:758,W:926,x:518,X:611,y:500,Y:648,z:480,Z:611}}},le={"\u2190":[.966796875,.2109375,0],"\u2192":[.966796875,.2109375,0],"\u2191":[.966796875,.2109375,0],"\u2193":[.966796875,.2109375,0],"\u25E6":[.966796875,.2109375,0],"\u2610":[.66650390625,.25,.08349609375],"\u2611":[.66650390625,.25,.08349609375],"\u2713":[.966796875,.2109375,0]};function C(t){let e=n=>Math.round(Math.min(Math.max(n,0),1)*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function ae(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ce(t,e,n="regular"){let i=vt[n],r=i.w.n,o=0,s="";for(let l of t)o+=i.w[l]??r,s&&(o+=i.k[s+l]??0),s=l;return o*e/1e3}function cr(t){let e=Math.round(re*t),n=Math.round(oe*t),i=Math.round(se*t);return[e+n,e+n+i]}function Ge(t,e){return t===" "?!0:(t==="/"||t==="-")&&e!==""&&!/[\d\s/-]/.test(e)}function ur(t){let e=[...t],n=[],i="";return e.forEach((r,o)=>{i+=r;let s=e[o+1]??"";Ge(r,s)&&s!==" "&&(n.push(i),i="")}),(i||n.length===0)&&n.push(i),n}function hr(t,e,n,i="regular"){let r=[];for(let o of t.split(/\r\n|\n|\r|\u2028|\u2029/)){let s="";for(let l of ur(o)){let a=s+l;for(s===""||ce(a.trimEnd(),e,i)<=n?s=a:(r.push(s),s=l);ce(s.trimEnd(),e,i)>n&&[...s.trimEnd()].length>1;){let u=[...s],c=u.length-1;for(;c>1&&ce(u.slice(0,c).join(""),e,i)>n;)c--;r.push(u.slice(0,c).join("")),s=u.slice(c).join("")}}r.push(s)}return r}function li(t,e,n){if(t==="")return{width:0,height:0};let i=hr(t,e,n),r=Math.max(...i.map(l=>ce(l.trimEnd(),e))),[o,s]=cr(e);return{width:Math.ceil(r-1e-9),height:Math.ceil(o+s*(i.length-1)-1e-9)}}var ai=12,ft="\u2028";function dr(t){let e=Math.min(ai,t.width/2),n=Math.min(ai,t.height/2);return{x:t.x+e,y:t.y+n,width:t.width-2*e,height:t.height-2*n}}var Ne=/^ {0,3}(#{1,6})(?:[ \t]+(.*?))?(?:[ \t]+#+)?[ \t]*$/,di=/^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/,He=/^ {0,3}(`{3,}|~{3,})/,Wt=/^( *)([-*+]|\d{1,9}[.)])([ \t]+|$)(.*)$/,ue=/^ {0,3}> ?(.*)$/,mr=/^ *\|? *:?-+:? *(\| *:?-+:? *)*\|? *$/;function Fe(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?<!\\)\|/).map(n=>n.trim())}function fr(t){return Ue(t.replace(/\r\n?/g,`
|
|
3
14
|
`).split(`
|
|
4
|
-
`))}function
|
|
5
|
-
`))}),i=null)};for(;n<t.length;){let o=t[n];if(o.trim()===""){r(),n++;continue}let s=
|
|
6
|
-
`)});continue}let l=
|
|
7
|
-
`))}),i=null,n++;continue}if(
|
|
8
|
-
`)){for(o+=
|
|
9
|
-
`){for(o=o.replace(/ +$/,""),o+=
|
|
10
|
-
`,size:i,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1}]:l.runs,
|
|
11
|
-
`){p.push({ch:
|
|
12
|
-
`&&
|
|
13
|
-
`,"").replaceAll(
|
|
14
|
-
`)}let a=
|
|
15
|
-
`;return s}function
|
|
16
|
-
`;return n&&e&&(i+=`<rect x="${
|
|
17
|
-
`),i}function
|
|
18
|
-
`).join("");m&&
|
|
19
|
-
${
|
|
20
|
-
`),
|
|
21
|
-
${
|
|
22
|
-
`:
|
|
23
|
-
`}function
|
|
24
|
-
`:`<path d="${
|
|
25
|
-
`;switch(t.kind){case"connector":{let[a,
|
|
26
|
-
`;if(
|
|
27
|
-
`),s){let
|
|
28
|
-
`),
|
|
29
|
-
`}return t.style.stroke.a>0&&t.style.strokeWidth>0&&(
|
|
30
|
-
`),
|
|
31
|
-
`;case"rectangle":case"ellipse":case"diamond":case"path":case"note":{let a="";if(t.kind==="note"&&t.style.fill.a>0&&(a+=`<path d="${
|
|
32
|
-
`),t.style.fill.a>0){let
|
|
33
|
-
`;else if(t.style.fillStyle==="grid"){let
|
|
34
|
-
`,a+=`<path d="${
|
|
35
|
-
`}else a+=`<path d="${
|
|
36
|
-
`}return a+=`<path d="${
|
|
37
|
-
`,s&&(a+=t.kind==="note"?
|
|
38
|
-
`+
|
|
39
|
-
`),s=r*1.2,l=s*o.length,a=i?
|
|
40
|
-
`}var
|
|
15
|
+
`))}function Ue(t){let e=[],n=0,i=null,r=()=>{i&&(e.push({kind:"paragraph",inline:K(i.join(`
|
|
16
|
+
`))}),i=null)};for(;n<t.length;){let o=t[n];if(o.trim()===""){r(),n++;continue}let s=He.exec(o);if(s){r();let u=new RegExp(`^ {0,3}${s[1][0]==="`"?"`":"~"}{${s[1].length},}[ \\t]*$`),c=[];for(n++;n<t.length&&!u.test(t[n]);)c.push(t[n++]);n++,e.push({kind:"code",text:c.join(`
|
|
17
|
+
`)});continue}let l=Ne.exec(o);if(l){r(),e.push({kind:"heading",level:l[1].length,inline:K(l[2]??"")}),n++;continue}if(i&&/^ {0,3}(=+|-+)[ \t]*$/.test(o)){let u=o.trim()[0]==="="?1:2;e.push({kind:"heading",level:u,inline:K(i.join(`
|
|
18
|
+
`))}),i=null,n++;continue}if(di.test(o)){r(),e.push({kind:"rule"}),n++;continue}if(ue.test(o)){r();let u=[];for(;n<t.length&&t[n].trim()!=="";){let c=ue.exec(t[n]);u.push(c?c[1]:t[n]),n++}e.push({kind:"quote",children:Ue(u)});continue}let a=Wt.exec(o);if(a&&(!i||a[4].trim()!=="")){r();let u=pr(t,n);e.push(u.block),n=u.next;continue}if(!i&&o.includes("|")&&n+1<t.length&&mr.test(t[n+1])&&t[n+1].includes("-")){let u=Fe(o),c=Fe(t[n+1]).map(f=>f.startsWith(":")&&f.endsWith(":")?"center":f.endsWith(":")?"right":f.startsWith(":")?"left":null),h=[];for(n+=2;n<t.length&&t[n].trim()!==""&&!Ne.test(t[n])&&!ue.test(t[n])&&!He.test(t[n]);)h.push(Fe(t[n]).slice(0,u.length).map(f=>K(f))),n++;e.push({kind:"table",align:c,head:u.map(f=>K(f)),rows:h});continue}i||(i=[]),i.push(o.replace(/^ +/,"")),n++}return r(),e}function pr(t,e){let n=Wt.exec(t[e]),i=n[1].length,r=/^\d/.test(n[2])?null:n[2],o=r===null?parseInt(n[2],10):null,s=[],l=e;for(;l<t.length;){let a=Wt.exec(t[l]);if(!a||a[1].length!==i||r===null!==/^\d/.test(a[2])||r!==null&&a[2]!==r)break;let u=a[1].length+a[2].length+Math.max(1,Math.min(a[3].length,4)),c=[a[4]];l++;let h=!1;for(;l<t.length;){let d=t[l];if(d.trim()===""){h=!0,c.push(""),l++;continue}if(d.length-d.trimStart().length>=u){c.push(d.slice(u)),h=!1,l++;continue}if(!h&&!Wt.test(d)&&!Ne.test(d)&&!ue.test(d)&&!He.test(d)&&!di.test(d)){c.push(d.trimStart()),l++;continue}break}for(;c.length&&c[c.length-1].trim()==="";)c.pop();let f=null,m=/^\[([ xX])\](?:[ \t]+|$)/.exec(c[0]??"");if(m&&(f=m[1]!==" ",c[0]=c[0].slice(m[0].length)),s.push({checkbox:f,children:Ue(c)}),h&&l<t.length&&t[l-1]?.trim()===""){let d=Wt.exec(t[l]);if(!d||d[1].length!==i)break}}return{block:{kind:"list",ordered:o,items:s},next:l}}function K(t,e={}){let n=[],i=(l,a)=>{l&&n.push({...a,text:l})},r=0,o="",s=()=>{i(o,e),o=""};for(;r<t.length;){let l=t.slice(r),a;if(l[0]==="\\"&&/^\\[\\`*_{}[\]()#+\-.!|~>]/.test(l)){o+=l[1],r+=2;continue}if(l.startsWith(`\\
|
|
19
|
+
`)){for(o+=ft,r+=2;t[r]===" ";)r++;continue}if(l[0]===`
|
|
20
|
+
`){for(o=o.replace(/ +$/,""),o+=ft,r++;t[r]===" ";)r++;continue}if(a=/^(`+)([\s\S]*?[^`])\1(?!`)/.exec(l)){s();let u=a[2].replace(/\n/g," ");/^ .* $/.test(u)&&(u=u.slice(1,-1)),i(u,{...e,mono:!0}),r+=a[0].length;continue}if(a=/^!\[([^\]]*)\]\([^)]*\)/.exec(l)){s(),n.push(...K(a[1],e)),r+=a[0].length;continue}if(a=/^\[([^\]]+)\]\([^)]*\)/.exec(l)){s(),n.push(...K(a[1],{...e,link:!0})),r+=a[0].length;continue}if(a=/^<((?:https?|ftp|mailto):[^>\s]+)>/.exec(l)){s(),i(a[1],{...e,link:!0}),r+=a[0].length;continue}if(a=/^~~(?=\S)([\s\S]*?\S)~~/.exec(l)){s(),n.push(...K(a[1],{...e,strike:!0})),r+=a[0].length;continue}if(a=/^(\*\*|__)(?=\S)([\s\S]*?\S)\1/.exec(l)){s(),n.push(...K(a[2],{...e,bold:!0})),r+=a[0].length;continue}if((a=/^(\*|_)(?=\S)([\s\S]*?\S)\1(?!\1)/.exec(l))&&(a[1]==="*"||!/\w/.test(t[r-1]??""))){s(),n.push(...K(a[2],{...e,italic:!0})),r+=a[0].length;continue}o+=l[0],r++}return s(),yr(n)}function yr(t){let e=/\b(?:(?:https?|ftp):\/\/|www\.)[^\s<]*[^\s<.,:;"')\]!?]/g;return t.flatMap(n=>{if(n.link||n.mono||!(n.text.includes("://")||n.text.includes("www.")))return[n];let i=[],r=0;for(let o of n.text.matchAll(e))o.index>r&&i.push({...n,text:n.text.slice(r,o.index)}),i.push({...n,text:o[0],link:!0}),r=o.index+o[0].length;return r<n.text.length&&i.push({...n,text:n.text.slice(r)}),i})}function mi(t){return t.bold?t.italic?"boldItalic":"bold":t.italic?"italic":"regular"}function he(t,e){if(e.mono&&le[t]===void 0)return ri*e.size;let n=vt[mi(e)];return(n.w[t]??vt.regular.w[t]??n.w.n)*e.size/1e3}function je(t,e,n){return n.mono?0:(vt[mi(n)].k[t+e]??0)*n.size/1e3}function _e(t,e){let n=le[t];return n?[n[0]*e.size,n[1]*e.size,n[2]*e.size]:e.mono?[oi*e.size,si*e.size,0]:e.bold&&e.italic?[ei*e.size,ni*e.size,ii*e.size]:e.bold?[Kn*e.size,Xn*e.size,Qn*e.size]:e.italic?[Zn*e.size,Jn*e.size,ti*e.size]:[re*e.size,oe*e.size,se*e.size]}var qe=class{constructor(e,n){P(this,"paras",[]);P(this,"nextSpacing",null);P(this,"fontSize");P(this,"width");this.fontSize=e,this.width=n}get gap(){return this.fontSize*.5}spacing(e){return this.paras.length===0?0:this.nextSpacing??e}run(e,n,i,r={}){let o=!!e.mono;return{text:e.text,size:o?n*.9:n,bold:!!(e.bold||r.bold),italic:!!(e.italic||r.italic),mono:o,strike:!!e.strike,underline:!!e.link,alpha:i}}paragraph(e,n){this.paras.push({tabs:[],rule:null,tableRule:null,...e,quote:n}),this.nextSpacing=null}text(e,n,i,r={}){if(n.marker){let o={text:n.marker.text+" ",size:this.fontSize,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1};this.paragraph({runs:[o,...e],spacing:i,firstIndent:n.marker.start,indent:n.marker.hang,tabs:[{align:"left",x:n.marker.hang}],...r},n.quote)}else this.paragraph({runs:e,spacing:i,firstIndent:n.indent,indent:n.indent,...r},n.quote)}block(e,n){let i=n.quote!==null,r=i?.7:1;switch(e.kind){case"heading":{let o=[1.5,1.3,1.15,1.05,1,1][Math.min(Math.max(e.level,1),6)-1];this.text(e.inline.map(s=>this.run(s,this.fontSize*o,r,{bold:!0,italic:i})),n,this.spacing(this.gap*1.4));break}case"paragraph":this.text(e.inline.map(o=>this.run(o,this.fontSize,r,{italic:i})),n,this.spacing(this.gap));break;case"list":{let o=e.items.map((u,c)=>u.checkbox===!0?"\u2611":u.checkbox===!1?"\u2610":e.ordered!==null?`${e.ordered+c}.`:n.listDepth%2===0?"\u2022":"\u25E6"),s=u=>ci({text:u,size:this.fontSize,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1}),l=Math.max(0,...o.map(s)),a=n.indent+Math.max(l+this.fontSize*.45,this.fontSize*1.2);e.items.forEach((u,c)=>{(c>0||n.listDepth>0||n.marker)&&(this.nextSpacing=this.fontSize*.15);let h={...n,marker:{text:o[c],start:n.indent,hang:a},indent:a,listDepth:n.listDepth+1};u.children.length===0&&this.text([],h,this.spacing(this.gap));for(let f of u.children)this.block(f,h),h.marker=null,this.nextSpacing=this.fontSize*.3;this.nextSpacing=null});break}case"quote":{let o={...n,quote:n.indent+3,indent:n.indent+this.fontSize};for(let s of e.children)this.block(s,o);break}case"code":{let s={text:e.text===""?" ":e.text.replace(/\n/g,ft),size:this.fontSize*.85,bold:!1,italic:!1,mono:!0,strike:!1,underline:!1,alpha:r};this.text([s],{...n,indent:n.indent+this.fontSize*.5},this.spacing(this.gap));break}case"rule":{let o={text:" ",size:this.fontSize*.6,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1};this.text([o],n,this.spacing(this.gap),{rule:n.indent});break}case"table":this.table(e,n);break}}table(e,n){let i=[{cells:e.head,header:!0},...e.rows.map(y=>({cells:y,header:!1}))],r=Math.max(1,...i.map(y=>y.cells.length)),o=n.quote!==null,s=(y,M,T)=>y.map(b=>({...this.run({...b,text:b.text.replaceAll(ft," ")},T,o?.7:1,{bold:M,italic:o})})),l=y=>{let M=new Array(r).fill(0);for(let T of i)T.cells.forEach((b,k)=>{k<r&&(M[k]=Math.max(M[k],s(b,T.header,y).reduce((E,D)=>E+ci(D),0)))});return M},a=Math.max(this.width-n.indent,1),u=this.fontSize,c=l(u),h=u*1.2,f=c.reduce((y,M)=>y+M,0)+h*(r-1);f>a&&(u=Math.max(this.fontSize*a/f,Math.min(this.fontSize,9)),c=l(u),h=u*1.2);let m=[],d=n.indent;for(let y of c)m.push(d),d+=y+h;let p=d-h-n.indent,g=[],v=!1;for(let y=0;y<r;y++){let M=e.align[y]??null;M==="center"?g.push({align:"center",x:m[y]+c[y]/2}):M==="right"?g.push({align:"right",x:m[y]+c[y]}):y>0&&g.push({align:"left",x:m[y]}),y===0&&(M==="center"||M==="right")&&(v=!0)}let w=y=>({text:y,size:u,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1});i.forEach((y,M)=>{let T=[];v&&T.push(w(" "));for(let k=0;k<r;k++)k>0&&T.push(w(" ")),k<y.cells.length&&T.push(...s(y.cells[k],y.header,u));T.length===0&&T.push(w(" "));let b=M===0?this.spacing(this.gap):M===1?u*.45:u*.2;this.paragraph({runs:T,spacing:b,firstIndent:n.indent,indent:n.indent,tabs:g,tableRule:y.header?[n.indent,p]:null},n.quote)})}};function ci(t){let e=0,n="";for(let i of t.text)e+=he(i,t),n&&(e+=je(n,i,t)),n=i;return e}var ui=28;function gr(t,e,n,i){let r=[],o=0,s=null;return t.forEach((l,a)=>{let u=a<t.length-1?[...l.runs,{text:`
|
|
21
|
+
`,size:i,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1}]:l.runs,c=[];u.forEach((m,d)=>{for(let p of m.text)c.push({ch:p,run:d})});let h=0,f=!0;for(;h<c.length||f&&c.length===0;){let m=f?l.firstIndent:l.indent,d=e,p=[],g=m,v=-1,w=h;for(;w<c.length;w++){let{ch:k,run:E}=c[w],D=u[E];if(k===ft||k===`
|
|
22
|
+
`){p.push({ch:k,run:E,x:g,w:0}),w++;break}if(k===" "){let et=l.tabs.find(Rt=>Rt.x>g+.01),Et;if(et)if(et.align==="left")Et=et.x;else{let Rt=0,ge="";for(let X=w+1;X<c.length&&c[X].ch!==" "&&c[X].ch!==`
|
|
23
|
+
`&&c[X].ch!==ft;X++){let en=u[c[X].run];Rt+=he(c[X].ch,en)+(ge?je(ge,c[X].ch,en):0),ge=c[X].ch}Et=Math.max(g,et.align==="right"?et.x-Rt:et.x-Rt/2)}else Et=(Math.floor(g/ui)+1)*ui;p.push({ch:k,run:E,x:g,w:Et-g}),g=Et;continue}let _=p[p.length-1],pe=_&&_.run===E&&_.ch!==" "?je(_.ch,k,D):0;_&&(_.w+=pe,g+=pe);let ye=he(k,D);if(k!==" "&&g+ye>d+.01&&p.some(et=>et.ch!==" ")){v>=0&&(p.length=v+1,w=h+v+1),_&&(_.w-=pe);break}p.push({ch:k,run:E,x:g,w:ye}),g+=ye,Ge(k,c[w+1]?.ch??"")&&(v=p.length-1)}if(p.length===0&&w===h&&h<c.length){let{ch:k,run:E}=c[h];p.push({ch:k,run:E,x:m,w:he(k,u[E])}),w=h+1}let y=0,M=0,T=0;for(let k of p){let[E,D,_]=_e(k.ch,u[k.run]);y=Math.max(y,E),M=Math.max(M,D),T=Math.max(T,_)}if(p.length===0&&([y,M,T]=_e(" ",u[0]??{text:" ",size:i,bold:!1,italic:!1,mono:!1,strike:!1,underline:!1,alpha:1})),o=s?o+Math.round(s.desc)+Math.round(s.lead)+(f?l.spacing:0)+Math.round(y):Math.round(y),o+M>n+.5)return;let b={glyphs:p,asc:y,desc:M,lead:T,baseline:o,para:l,first:f};if(b.glyphs.forEach(k=>{k.r=u[k.run]}),r.push(b),s=b,f=!1,h=w,c.length===0)break}}),r}function fi(t,e){let n=dr({x:e.x,y:e.y,width:e.width,height:e.height});if(!(n.width>1&&n.height>1))return"";let i=new qe(e.style.fontSize,n.width);for(let u of fr(t))i.block(u,{indent:0,marker:null,quote:null,listDepth:0});let r=gr(i.paras,n.width,n.height,e.style.fontSize),o=C(e.style.stroke),s="",l=[];for(let u of r){let c=u.para;if(c.quote!==null&&l.push([n.x+c.quote,n.y+u.baseline-u.asc,n.x+c.quote,n.y+u.baseline+u.desc]),c.rule!==null&&l.push([n.x+c.rule,n.y+u.baseline-3,n.x+n.width,n.y+u.baseline-3]),c.tableRule){let d=n.y+u.baseline+u.desc+2;l.push([n.x+c.tableRule[0],d,Math.min(n.x+n.width,n.x+c.tableRule[0]+c.tableRule[1]),d])}let h="",f=0,m=u.glyphs;for(;f<m.length;){let d=m[f].r,p=f,g="",v=hi(m[f].ch);for(;p<m.length&&br(m[p].r,d)&&m[p].ch!==" "&&hi(m[p].ch)===v;)g+=m[p].ch,p++;let w=g.replaceAll(`
|
|
24
|
+
`,"").replaceAll(ft,"");if(w.trim()!==""){let y=`font-size="${x(d.size)}"`;d.mono&&(y+=' font-family="Menlo, Consolas, monospace"'),d.bold&&(y+=' font-weight="bold"'),d.italic&&(y+=' font-style="italic"'),d.underline&&(y+=' text-decoration="underline"'),d.alpha<1&&(y+=` fill-opacity="${x(d.alpha*e.style.stroke.a)}"`),h+=`<tspan x="${x(n.x+m[f].x)}" ${y}>${ae(w)}</tspan>`}if(d.strike&&p>f){let y=u.baseline-_e(m[f].ch,d)[0]*.32;l.push([n.x+m[f].x,n.y+y,n.x+m[p-1].x+m[p-1].w,n.y+y])}p===f&&p++,f=p}h&&(s+=`<text y="${x(n.y+u.baseline)}" font-family="Helvetica Neue, Helvetica, Arial, sans-serif" fill="${o}" xml:space="preserve">${h}</text>
|
|
25
|
+
`)}let a=x(Math.max(1,e.style.fontSize/14));for(let[u,c,h,f]of l)s+=`<line x1="${x(u)}" y1="${x(c)}" x2="${x(h)}" y2="${x(f)}" stroke="${o}" stroke-width="${a}"/>
|
|
26
|
+
`;return s}function hi(t){return le[t]?`fb:${t}`:""}function br(t,e){return t===e||t.size===e.size&&t.bold===e.bold&&t.italic===e.italic&&t.mono===e.mono&&t.strike===e.strike&&t.underline===e.underline&&t.alpha===e.alpha}var B=(t,e,n)=>({r:t,g:e,b:n,a:1}),Ke=[{id:"paper",name:"Paper",background:B(.984,.98,.965),ink:B(.12,.12,.13)},{id:"white",name:"White",background:B(1,1,1),ink:B(.12,.12,.13)},{id:"sepia",name:"Sepia",background:B(.953,.914,.824),ink:B(.23,.18,.13)},{id:"blueprint",name:"Blueprint",background:B(.106,.227,.361),ink:B(.91,.945,.984)},{id:"chalkboard",name:"Chalkboard",background:B(.169,.227,.2),ink:B(.945,.945,.918)},{id:"midnight",name:"Midnight",background:B(.082,.086,.102),ink:B(.925,.925,.94)}];function pt(t){return Ke.find(e=>e.id===t)??null}function tt(t,e=24){if(ie(t))return tt(j(t,0),e);let n=q(t),i=s=>{if(s.kind==="connector")return gn(s,n);let l=Ie(s)?(Se+.25)*dt(s):0;return Pt(dn(s),-l,-l)};if(t.elements.length===0)return{x:0,y:0,width:200,height:200};let r=t.elements.filter(s=>(s.style.opacity??1)>0),o=null;for(let s of r.length?r:t.elements)o=Pe(o,i(s));return Pt(o,-e,-e)}function At(t){let e=t.timeline??{fps:12,duration:0,boil:null,settle:null,poster:null,tracks:[],camera:null,markers:null},n=ee(e),i=e.camera?.find(o=>o.width>1&&o.height>1);if(i){let o=i.width/i.height,s=n.map(a=>Mt(e,a)??{x:i.x,y:i.y,width:i.width,height:i.height}),l=Math.min(Math.max(...s.map(a=>a.width)),4096);return{times:n,rects:s,size:{width:l,height:l/o}}}let r=null;for(let o of n){let s=U(t,o);s.elements.length>0&&(r=Pe(r,tt(s)))}return r||(r=tt(U(t,n[0]))),{times:n,rects:n.map(()=>r),size:{width:r.width,height:r.height}}}var zt=(t,e)=>t.a<1?` ${e}="${x(t.a)}"`:"";function xr(t,e,n){let i=`<svg xmlns="http://www.w3.org/2000/svg" width="${x(t.width)}" height="${x(t.height)}" viewBox="${x(t.x)} ${x(t.y)} ${x(t.width)} ${x(t.height)}">
|
|
27
|
+
`;return n&&e&&(i+=`<rect x="${x(t.x)}" y="${x(t.y)}" width="${x(t.width)}" height="${x(t.height)}" fill="${C(e)}"/>
|
|
28
|
+
`),i}function ct(t,e,n){if(ie(t))return ct(j(t,0),e,n);let i=pt(t.theme),r=e?i?.background??e:null,o=i?.ink??ut,s={...t,elements:t.elements.map(d=>mn(d,o))},l=n??tt(s),a=new Set(s.layers.filter(d=>d.visible).map(d=>d.id)),u=[],c=q(s),h=ht(s),f=h.filter(d=>a.has(d.layerID)&&Ie(d)),m=In(f).map(d=>`<path d="${d.path.data()}" fill="none" stroke="${C(d.ink)}"${zt(d.ink,"stroke-opacity")} stroke-width="${x(d.width)}" stroke-linecap="round"/>
|
|
29
|
+
`).join("");m&&u.push({key:"rock",markup:m});for(let d of h){if(!a.has(d.layerID))continue;let p=Math.min(Math.max(d.style.opacity??1,0),1);if(p<=0)continue;let g=Mr(d,c,r);W(d)!==0&&d.kind!=="connector"&&(g=`<g transform="rotate(${x(W(d)*180/Math.PI)} ${x(N(L(d)))} ${x(H(L(d)))})">
|
|
30
|
+
${g}</g>
|
|
31
|
+
`),u.push({key:d.id,markup:p<1?`<g opacity="${x(p)}">
|
|
32
|
+
${g}</g>
|
|
33
|
+
`:g})}return{bounds:l,parts:u}}function me(t,e={r:1,g:1,b:1,a:1},n){let{bounds:i,parts:r}=ct(t,e,n);return xr(i,pt(t.theme)?.background??e,e!==null)+r.map(o=>o.markup).join("")+`</svg>
|
|
34
|
+
`}function kr(t,e){let n=bn(t,e),i=t.text??"",r=li(i===""?"Label":i,t.style.fontSize,200),o=Math.max(r.width+12,44),s=r.height+6;return{x:n.x-o/2,y:n.y-s/2,width:o,height:s}}function wr(t,e){let n=[...t];return n.slice(0,Math.floor(n.length*e)).join("")}function Pr(t){return t.reveal!==null&&t.reveal<1?Math.max(0,t.reveal):null}function Mr(t,e,n){let i=C(t.style.stroke),r=`stroke="${i}" stroke-width="${x(t.style.strokeWidth)}" stroke-linecap="round" stroke-linejoin="round"`,o=Jt(t.style.dash,t.style.strokeWidth);o&&(r+=` stroke-dasharray="${o.map(x).join(" ")}"`),o&&t.style.dashOffset!==null&&x(t.style.dashOffset)!=="0"&&(r+=` stroke-dashoffset="${x(t.style.dashOffset)}"`);let s=t.text,l=Pr(t);if(l!==null)if(t.kind==="text")s=wr(s??"",l);else return t.kind==="connector"?`<path d="${De(t,e)[0].trimmed(l).data()}" fill="none" ${r}/>
|
|
35
|
+
`:`<path d="${mt(t).trimmed(l).data()}" fill="none" ${r}/>
|
|
36
|
+
`;switch(t.kind){case"connector":{let[a,u]=De(t,e),c=`<path d="${a.data()}" fill="none" ${r}/>
|
|
37
|
+
`;if(u.isEmpty||(c+=`<path d="${u.data()}" fill="${i}" stroke="none"/>
|
|
38
|
+
`),s){let h=kr(t,e);n&&(c+=`<rect x="${x(h.x)}" y="${x(h.y)}" width="${x(h.width)}" height="${x(h.height)}" fill="${C(n)}"/>
|
|
39
|
+
`),c+=de(s,h,t,!0)}return c}case"text":return de(s??"",L(t),t,!1);case"image":{let a=L(t),u="";if(t.image){let c=t.image.format==="jpeg"?"image/jpeg":"image/png";u+=`<image x="${x(a.x)}" y="${x(a.y)}" width="${x(a.width)}" height="${x(a.height)}" preserveAspectRatio="none" href="data:${c};base64,${t.image.data}"/>
|
|
40
|
+
`}return t.style.stroke.a>0&&t.style.strokeWidth>0&&(u+=`<path d="${mt(t).data()}" fill="none" ${r}/>
|
|
41
|
+
`),u}case"freehand":return`<path d="${mt(t).data()}" fill="none" ${r}/>
|
|
42
|
+
`;case"rectangle":case"ellipse":case"diamond":case"path":case"note":{let a="";if(t.kind==="note"&&t.style.fill.a>0&&(a+=`<path d="${Zt(t).translated(2,3).data()}" fill="#000000" fill-opacity="${x(.14*t.style.fill.a)}" stroke="none"/>
|
|
43
|
+
`),t.style.fill.a>0){let u=t.evenOdd===!0?' fill-rule="evenodd"':"";if(t.style.fillStyle==="solid")a+=`<path d="${Zt(t).data()}" fill="${C(t.style.fill)}"${zt(t.style.fill,"fill-opacity")}${u} stroke="none"/>
|
|
44
|
+
`;else if(t.style.fillStyle==="grid"){let c=Rn(t.style.fill);a+=`<path d="${Zt(t).data()}" fill="${C(t.style.fill)}"${zt(t.style.fill,"fill-opacity")}${u} stroke="none"/>
|
|
45
|
+
`,a+=`<path d="${Le(t).data()}" fill="none" stroke="${C(c)}"${zt(c,"stroke-opacity")} stroke-width="1" stroke-linecap="round"/>
|
|
46
|
+
`}else a+=`<path d="${Le(t).data()}" fill="none" stroke="${C(t.style.fill)}"${zt(t.style.fill,"stroke-opacity")} stroke-width="${x(Math.max(1,t.style.strokeWidth/2))}" stroke-linecap="round"/>
|
|
47
|
+
`}return a+=`<path d="${mt(t).data()}" fill="none" ${r}/>
|
|
48
|
+
`,s&&(a+=t.kind==="note"?fi(s,t):de(s,L(t),t,!0)),a}default:return vr(t,r)}}function vr(t,e){let n=L(t);return`<path d="${R.rect(n).moveTo({x:n.x,y:n.y}).lineTo({x:n.x+n.width,y:n.y+n.height}).data()}" fill="none" ${e} stroke-opacity="0.5" stroke-dasharray="6 4"/>
|
|
49
|
+
`+de(`${t.kind}${t.text?`: ${t.text}`:""}`,n,{...t,style:{...t.style,fontSize:Math.min(t.style.fontSize,12)}},!0)}function de(t,e,n,i){let r=n.style.fontSize,o=t.split(`
|
|
50
|
+
`),s=r*1.2,l=s*o.length,a=i?N(e):e.x,u=i?H(e)-l/2:e.y,c=`<text x="${x(a)}" font-family="Helvetica Neue, Helvetica, Arial, sans-serif" font-size="${x(r)}" fill="${C(n.style.stroke)}"${i?' text-anchor="middle"':""}>`;return o.forEach((h,f)=>{c+=`<tspan x="${x(a)}" y="${x(u+s*(f+.8))}">${ae(h)}</tspan>`}),c+`</text>
|
|
51
|
+
`}var Ar={r:1,g:1,b:1,a:1};function Bt(t,e){let n=(e??"").trim();if(!n)return 0;let i=t.pages.findIndex(o=>o.name.toLowerCase()===n.toLowerCase());if(i>=0)return i;let r=Number(n);return Number.isInteger(r)&&r>=1&&r<=t.pages.length?r-1:0}function Gt(t,e){return{...t,elements:t.elements.map(n=>({...n,style:{...n.style,roughness:e}}))}}var Tr=`
|
|
41
52
|
:host { display: block; position: relative; color: var(--dottie-ink); background: var(--dottie-page);
|
|
42
53
|
font: 14px -apple-system, system-ui, sans-serif; border-radius: var(--dottie-radius, 0); }
|
|
43
54
|
:host([hidden]) { display: none; }
|
|
@@ -52,7 +63,16 @@ input[type=range] { flex: 1; min-width: 60px; accent-color: currentColor; }
|
|
|
52
63
|
output { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
|
|
53
64
|
.scene { min-width: 0; flex: 0 1 auto; text-align: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
54
65
|
.error { padding: 16px; font-family: ui-monospace, Menlo, monospace; white-space: pre-wrap; }
|
|
55
|
-
`,
|
|
66
|
+
${Un}`,Yt=class{constructor(e,n,i={}){P(this,"page");P(this,"plan");P(this,"scenes");P(this,"sceneNames");P(this,"background");P(this,"ink");P(this,"clicks");P(this,"replays",new Map);P(this,"replayStarts",new Map);P(this,"hoverIDs");P(this,"labels",new Map);P(this,"owner",new Map);P(this,"partsOfOwner",new Map);P(this,"overTimes",new Map);P(this,"downTimes",new Map);P(this,"hitTimes",new Map);P(this,"last",{t:0,i:0});P(this,"svg");P(this,"groups",new Map);P(this,"order",[]);P(this,"frame",-1);P(this,"onFrame",null);this.page=i.clean?Gt(e,0):e,this.plan=At(this.page),this.clicks=Nn(e,i.file);let r=Be(this.page);for(let c of this.page.elements){let h=c.kind==="symbol"&&c.symbol!==null?r.get(c.symbol):void 0;if(h)if(h.button===!0)for(let[f,m]of[["over",this.overTimes],["down",this.downTimes],["hit",this.hitTimes]]){let d=Vt(h,f);d!==null&&m.set(c.id,d)}else c.playback==="click"&&(h.timeline?.duration??0)>0&&this.replays.set(c.id,h.timeline.duration)}let o=new Set([...this.clicks.keys(),...this.replays.keys()]);this.hoverIDs=new Set(this.page.elements.filter(c=>o.has(c.id)&&c.kind!=="symbol"&&jn(c)).map(c=>c.id));let s=new Set(this.page.elements.filter(c=>o.has(c.id)&&c.kind==="symbol").map(c=>c.id));for(let c of this.page.elements)o.has(c.id)&&(this.labels.set(c.id,_n(c,c.symbol!==null?r.get(c.symbol)?.name:void 0)),c.kind!=="symbol"&&this.owner.set(c.id,c.id));for(let[c,h]of qn(this.page,s))this.owner.set(c,h);for(let[c,h]of this.owner)this.partsOfOwner.set(h,[...this.partsOfOwner.get(h)??[],c]);let l=c=>{let h=0;return this.plan.times.forEach((f,m)=>{Math.abs(f-c)<Math.abs(this.plan.times[h]-c)&&(h=m)}),h};this.scenes=(e.timeline?.markers??[]).map(c=>l(c.t)),this.sceneNames=(e.timeline?.markers??[]).map(c=>c.name);let a=pt(e.theme);this.background=a?.background??Ar,this.ink=a?.ink??{r:.12,g:.12,b:.13,a:1};let u="http://www.w3.org/2000/svg";this.svg=document.createElementNS(u,"svg"),this.svg.setAttribute("width",x(this.plan.size.width)),this.svg.setAttribute("height",x(this.plan.size.height)),this.svg.style.maxWidth=`${Math.ceil(this.plan.size.width)}px`,n.replaceChildren(this.svg)}get frameCount(){return this.plan.times.length}get posterFrame(){let e=at(this.page),n=0;return this.plan.times.forEach((i,r)=>{Math.abs(i-e)<Math.abs(this.plan.times[n]-e)&&(n=r)}),n}show(e){let n=this.frameCount;e=(e%n+n)%n,this.drawAt(this.plan.times[e],e),this.frame=e,this.onFrame?.(e)}replay(e,n){this.replays.has(e)&&this.replayStarts.set(e,n)}replaying(e=performance.now()){for(let[n,i]of this.replayStarts)if(e-i<(this.replays.get(n)??0)*1e3)return!0;return!1}redraw(){this.drawAt(this.last.t,this.last.i)}drawAt(e,n=0){this.last={t:e,i:n};let i=this.plan.rects[Math.min(n,this.plan.rects.length-1)],r=typeof performance>"u"?0:performance.now(),o=new Map;for(let[b,k]of this.replayStarts)o.set(b,Math.min((r-k)/1e3,this.replays.get(b)??0));let s=O(e),l=Ct(this.page,s),a=j(l,s,!0,o),{parts:u}=ct(a,this.background,i),c=(b,k)=>{for(let E of k)this.owner.has(E.key)&&b.set(E.key,E.markup);return b},h=b=>b.size===0?new Map:c(new Map,ct(j(l,s,!0,new Map([...o,...b])),this.background,i).parts.filter(k=>b.has(this.owner.get(k.key)??""))),f=this.hoverIDs.size===0?new Map:c(new Map,ct(Hn(a,this.hoverIDs),this.background,i).parts.filter(b=>this.hoverIDs.has(b.key))),m=h(this.overTimes),d=h(this.downTimes),p=h(this.hitTimes),g=c(new Map,u),v=[],w=new Set;for(let b of u){let k=this.owner.get(b.key);if(k===void 0){v.push(b);continue}w.has(k)||(w.add(k),v.push(this.buttonPart(k,g,f,m,d,p,l)))}this.svg.setAttribute("viewBox",`${x(i.x)} ${x(i.y)} ${x(i.width)} ${x(i.height)}`);let y="http://www.w3.org/2000/svg",M=v.map(b=>b.key);for(let b of v){let k=b.markup,E=this.groups.get(b.key);if(E)E.markup!==k&&(E.g.innerHTML=k,E.markup=k),b.button!==void 0&&E.g.classList.toggle("dottie-b",b.button);else{let D=document.createElementNS(y,"g");D.innerHTML=k,b.button!==void 0&&(D.setAttribute("class",b.button?"dottie-a dottie-b":"dottie-a"),D.setAttribute("data-a",b.key),D.setAttribute("tabindex","0"),D.setAttribute("role","button"),D.setAttribute("aria-label",this.labels.get(b.key)??"")),this.groups.set(b.key,{g:D,markup:k})}}let T=new Set(M);for(let[b,k]of this.groups)T.has(b)||(k.g.remove(),this.groups.delete(b));if(M.length!==this.order.length||M.some((b,k)=>b!==this.order[k])){let b=this.svg.firstChild;for(let k of M){let E=this.groups.get(k).g;E===b?b=b.nextSibling:this.svg.insertBefore(E,b)}for(;b;){let k=b.nextSibling;b.remove(),b=k}this.order=M}}buttonPart(e,n,i,r,o,s,l){let a=this.partsOfOwner.get(e)??[e],u=w=>{let y=a.map(M=>w.get(M)??"").join("");return y===""?null:y},c=u(n)??"",h=l.elements.find(w=>w.id===e&&w.kind==="symbol"),f=u(h?r:i),m=h?u(o):null,d=f!==null&&f!==c?f:null,p=m!==null&&m!==(f??c)?m:null;if(!h&&d===null)return{key:e,markup:c,button:!1};let g=h?' pointer-events="none"':"",v=`<g class="dottie-n"${g}>
|
|
67
|
+
${c}</g>
|
|
68
|
+
`;if(d!==null&&(v+=`<g class="dottie-h"${g}>
|
|
69
|
+
${d}</g>
|
|
70
|
+
`),p!==null&&(v+=`<g class="dottie-d"${g}>
|
|
71
|
+
${p}</g>
|
|
72
|
+
`),h){let w=u(s);if(w!==null)v+=`<g class="dottie-hit" opacity="0" pointer-events="all">
|
|
73
|
+
${w}</g>
|
|
74
|
+
`;else{let y={x:h.x+h.width/2,y:h.y+h.height/2},M=h.rotation??0,T=[[h.x,h.y],[h.x+h.width,h.y],[h.x+h.width,h.y+h.height],[h.x,h.y+h.height]].map(([k,E])=>nt({x:k,y:E},y,M)),b=new R().moveTo(T[0]).lineTo(T[1]).lineTo(T[2]).lineTo(T[3]).close();v+=`<path class="dottie-hit" d="${b.data()}" fill="none" stroke="none" pointer-events="all"/>
|
|
75
|
+
`}}return{key:e,markup:v,button:p!==null}}sceneAt(e){let n=-1;return this.scenes.forEach((i,r)=>{i<=e&&(n=r)}),n}},Er=typeof HTMLElement>"u"?class{}:HTMLElement,Tt=class extends Er{constructor(){super();P(this,"file",null);P(this,"playback",null);P(this,"root");P(this,"stage");P(this,"bar");P(this,"playButton");P(this,"scrub");P(this,"time");P(this,"sceneLabel");P(this,"prev");P(this,"next");P(this,"playing",!1);P(this,"last",0);P(this,"acc",0);P(this,"raf",0);P(this,"replayRaf",0);P(this,"loadToken",0);P(this,"visible",!0);P(this,"observer",null);this.root=this.attachShadow({mode:"open"}),this.root.innerHTML=`<style>${Tr}</style><div class="stage" part="stage" role="img"></div>
|
|
56
76
|
<div class="bar" part="controls" hidden>
|
|
57
77
|
<button class="play" aria-label="Play">\u25B6</button>
|
|
58
78
|
<button class="prev" aria-label="Previous scene" hidden>\u23EE</button>
|
|
@@ -60,4 +80,4 @@ output { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right
|
|
|
60
80
|
<button class="next" aria-label="Next scene" hidden>\u23ED</button>
|
|
61
81
|
<input class="scrub" type="range" min="0" max="0" value="0" aria-label="Frame">
|
|
62
82
|
<output class="time">0.0s</output>
|
|
63
|
-
</div>`;let n=i=>this.root.querySelector(i);this.stage=n(".stage"),this.bar=n(".bar"),this.playButton=n(".play"),this.scrub=n(".scrub"),this.time=n(".time"),this.sceneLabel=n(".scene"),this.prev=n(".prev"),this.next=n(".next"),this.playButton.onclick=()=>{let i=this.playback;i&&!this.playing&&i.scenes.length&&i.frame>=i.frameCount-1&&i.show(0),this.setPlaying(!this.playing)},this.scrub.oninput=()=>{this.setPlaying(!1),this.playback?.show(Number(this.scrub.value))},this.next.onclick=()=>this.nextScene(),this.prev.onclick=()=>this.prevScene(),this.addEventListener("keydown",i=>this.key(i))}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(n=>{this.visible=n.some(i=>i.isIntersecting),this.schedule()}),this.observer.observe(this)),this.load()}disconnectedCallback(){cancelAnimationFrame(this.raf),this.raf=0,this.observer?.disconnect()}attributeChangedCallback(n,i,r){i===r||!this.isConnected||(n==="src"?this.load():n==="label"?this.stage.setAttribute("aria-label",r??""):this.file&&this.mount())}async load(){let n=++this.loadToken;try{let i,r=this.getAttribute("src");if(r){let o=await fetch(r);if(!o.ok)throw new Error(`${r}: ${o.status} ${o.statusText}`);i=await o.text()}else{let o=this.querySelector('script[type="application/json"], script[type="application/vnd.dottie+json"]');if(!o)return;i=o.textContent??""}if(n!==this.loadToken)return;this.setFile(
|
|
83
|
+
</div>`;let n=i=>this.root.querySelector(i);this.stage=n(".stage"),this.bar=n(".bar"),this.playButton=n(".play"),this.scrub=n(".scrub"),this.time=n(".time"),this.sceneLabel=n(".scene"),this.prev=n(".prev"),this.next=n(".next"),this.playButton.onclick=()=>{let i=this.playback;i&&!this.playing&&i.scenes.length&&i.frame>=i.frameCount-1&&i.show(0),this.setPlaying(!this.playing)},this.scrub.oninput=()=>{this.setPlaying(!1),this.playback?.show(Number(this.scrub.value))},this.next.onclick=()=>this.nextScene(),this.prev.onclick=()=>this.prevScene(),this.stage.addEventListener("click",i=>{let r=pi(i.target);r&&this.activate(r.getAttribute("data-a")??"")}),this.addEventListener("keydown",i=>this.key(i))}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(n=>{this.visible=n.some(i=>i.isIntersecting),this.schedule()}),this.observer.observe(this)),this.load()}disconnectedCallback(){cancelAnimationFrame(this.raf),this.raf=0,this.observer?.disconnect()}attributeChangedCallback(n,i,r){i===r||!this.isConnected||(n==="src"?this.load():n==="label"?this.stage.setAttribute("aria-label",r??""):this.file&&this.mount())}async load(){let n=++this.loadToken;try{let i,r=this.getAttribute("src");if(r){let o=await fetch(r);if(!o.ok)throw new Error(`${r}: ${o.status} ${o.statusText}`);i=await o.text()}else{let o=this.querySelector('script[type="application/json"], script[type="application/vnd.dottie+json"]');if(!o)return;i=o.textContent??""}if(n!==this.loadToken)return;this.setFile(St(i))}catch(i){if(n!==this.loadToken)return;this.stage.innerHTML="";let r=document.createElement("div");r.className="error",r.textContent=`Couldn't show this drawing: ${i.message}`,this.stage.append(r),this.dispatchEvent(new CustomEvent("error",{detail:i}))}}setFile(n){this.file=n;for(let i of n.warnings)console.warn(`dottie-player: ${i}`);this.mount(),this.dispatchEvent(new CustomEvent("load",{detail:{file:n}}))}mount(){let n=this.file,i=n.pages[Bt(n,this.getAttribute("page"))],r=new Yt(i,this.stage,{clean:this.hasAttribute("clean"),file:n});this.playback=r,this.style.setProperty("--dottie-page",C(r.background)),this.style.setProperty("--dottie-ink",C(r.ink)),this.style.colorScheme=kt(r.background)<.5?"dark":"light",this.stage.setAttribute("aria-label",this.getAttribute("label")??i.name);let o=this.getAttribute("at"),s=i.timeline!==null&&r.frameCount>1&&o===null;this.bar.hidden=!s||this.hasAttribute("no-controls");let l=r.scenes.length>0;if(this.prev.hidden=this.next.hidden=this.sceneLabel.hidden=!l,this.scrub.max=String(r.frameCount-1),r.onFrame=u=>{if(this.scrub.value=String(u),this.time.textContent=`${r.plan.times[u].toFixed(1)}s`,l){let c=r.sceneAt(u);this.sceneLabel.textContent=c<0?"":r.sceneNames[c]}this.dispatchEvent(new CustomEvent("frame",{detail:{frame:u,time:r.plan.times[u]}}))},!s){r.drawAt(o!==null?Number(o)||0:at(i),o!==null?yi(r,Number(o)||0):r.posterFrame),this.setPlaying(!1);return}if(r.show(0),typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches){r.show(r.posterFrame),this.setPlaying(!1);return}this.setPlaying(!this.hasAttribute("no-autoplay")&&!r.scenes.includes(0))}get paused(){return!this.playing}get currentTime(){let n=this.playback;return n&&n.frame>=0?n.plan.times[n.frame]:0}set currentTime(n){let i=this.playback;i&&(this.setPlaying(!1),i.show(yi(i,n)))}get duration(){return this.playback?.page.timeline?.duration??0}play(){this.setPlaying(!0)}pause(){this.setPlaying(!1)}nextScene(){let n=this.playback;n&&(n.frame>=n.frameCount-1&&n.show(0),this.setPlaying(!0))}prevScene(){let n=this.playback;if(!n)return;let i=n.sceneAt(n.frame);i>=0&&n.scenes[i]===n.frame&&(i-=1),this.setPlaying(!1),n.show(i>=0?n.scenes[i]:0)}activate(n){let i=this.playback,r=i?.clicks.get(n),o=i?.replays.has(n)??!1;if(!i||!r&&!o)return;let s={element:n,...r??{},...o?{replay:!0}:{}};if(!this.dispatchEvent(new CustomEvent("action",{detail:s,cancelable:!0})))return;let l=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;if(o){let a=performance.now();i.replay(n,l?a-i.replays.get(n)*1e3:a),i.redraw(),this.scheduleReplay()}r&&("url"in r?/^(https?:|mailto:)/i.test(r.url)&&window.open(r.url,"_blank","noopener"):"page"in r?this.setAttribute("page",String(r.page+1)):r.scene>=0&&r.scene<i.scenes.length&&(l||this.hasAttribute("at")||i.frameCount<2?(this.setPlaying(!1),i.show(r.scene+1<i.scenes.length?i.scenes[r.scene+1]:i.frameCount-1)):(i.show(i.scenes[r.scene]),this.setPlaying(!0))))}scheduleReplay(){if(this.replayRaf)return;let n=()=>{this.replayRaf=0;let i=this.playback;!i||!this.isConnected||(this.playing||i.redraw(),i.replaying()?this.replayRaf=requestAnimationFrame(n):this.playing||i.redraw())};this.replayRaf=requestAnimationFrame(n)}setPlaying(n){let i=this.playback;this.playing=n&&!!i&&i.frameCount>1&&i.page.timeline!==null,this.playButton.textContent=this.playing?"\u275A\u275A":"\u25B6",this.playButton.setAttribute("aria-label",this.playing?"Pause":"Play"),this.last=0,this.acc=0,this.schedule()}schedule(){this.playing&&this.visible&&!this.raf&&this.isConnected&&(this.raf=requestAnimationFrame(n=>this.tick(n)))}tick(n){this.raf=0;let i=this.playback;if(!this.playing||!i)return;let r=1e3/(i.page.timeline?.fps??12);this.last&&(this.acc+=Math.min(n-this.last,1e3)),this.last=n;let o=!1;for(;this.playing&&this.acc>=r;){this.acc-=r;let s=i.frame+1;if(s>=i.frameCount&&(i.scenes.length||this.hasAttribute("no-loop"))){this.setPlaying(!1);break}if(i.frame=s%i.frameCount,o=!0,i.scenes.includes(i.frame)){this.setPlaying(!1);break}}o&&i.show(i.frame),this.playing&&!this.visible&&(this.last=0),this.schedule()}key(n){let i=this.playback,r=n.composedPath()[0],o=pi(r);if(i&&o&&(n.key==="Enter"||n.key===" ")){n.preventDefault(),this.activate(o.getAttribute("data-a")??"");return}if(!i||i.page.timeline===null||i.frameCount<=1||this.hasAttribute("at")||r===this.scrub&&n.key!==" ")return;let s=i.scenes.length>0,l=!0;n.key===" "?s?this.playing?this.setPlaying(!1):this.nextScene():this.setPlaying(!this.playing):n.key==="ArrowRight"?s?this.nextScene():(this.setPlaying(!1),i.show(i.frame+1)):n.key==="ArrowLeft"?s?this.prevScene():(this.setPlaying(!1),i.show(i.frame-1)):n.key==="."?(this.setPlaying(!1),i.show(i.frame+1)):n.key===","?(this.setPlaying(!1),i.show(i.frame-1)):l=!1,l&&n.preventDefault()}};P(Tt,"observedAttributes",["src","page","at","clean","no-controls","label"]);function pi(t){let e=t;return e&&typeof e.closest=="function"?e.closest(".dottie-a"):null}function yi(t,e){let n=0;return t.plan.times.forEach((i,r)=>{Math.abs(i-e)<Math.abs(t.plan.times[n]-e)&&(n=r)}),n}function fe(t="dottie-player"){typeof customElements<"u"&&!customElements.get(t)&&customElements.define(t,class extends Tt{})}var I=t=>{let e=It(t*1e4)/1e4;return e===0?0:e},Xe=t=>[I(t.x),I(t.y)],Ft=t=>[I(t.x),I(t.y),I(t.width),I(t.height)],gi=t=>[I(t.r),I(t.g),I(t.b),I(t.a)];function Qe(t){let e=t.timeline;if(!e)return[0];let n=e.duration,i=[0,n];for(let r=1;r<16;r++)i.push(n*(r+.37)/16);for(let r of e.markers??[])i.push(r.t);return e.poster!==null&&i.push(e.poster),[...new Set(i.map(I))].filter(r=>r>=0&&r<=n).sort((r,o)=>r-o)}function Ze(t,e){let n=U(t,e),i=q(n),r=new Set(n.layers.filter(l=>l.visible).map(l=>l.id)),o={t:I(e)},s=t.timeline;if(s){let l=Mt(s,e);o.view=l?Ft(l):null;let a=-1;(s.markers??[]).forEach((u,c)=>{u.t<=e&&(a=c)}),o.scene=a}return s?.camera?.length||(o.bounds=Ft(tt(n))),o.elements=ht(n).map((l,a)=>{let u={id:l.id,kind:l.kind,z:a,seed:l.seed,frame:Ft({x:l.x,y:l.y,width:l.width,height:l.height})};if(r.has(l.layerID)||(u.hiddenLayer=!0),l.rotation!==null&&(u.rotation=I(l.rotation)),l.style.opacity!==null&&(u.opacity=I(l.style.opacity)),l.reveal!==null&&(u.reveal=I(l.reveal)),l.style.dashOffset!==null&&(u.dashOffset=I(l.style.dashOffset)),u.strokeWidth=I(l.style.strokeWidth),u.stroke=gi(l.style.stroke),u.fill=gi(l.style.fill),l.kind==="connector"){let[c,h]=Z(l,i);u.start=Xe(c),u.end=Xe(h),u.route=rt(ot(l,i)).map(Xe)}return u}),o}function Je(t,e,n){let i={page:e+1,name:t.name,id:t.id},r=t.timeline;if(r){let o=At(t);i.duration=I(r.duration),i.fps=I(r.fps),i.frameCount=o.times.length,i.poster=I(r.poster??r.duration),i.size=[I(o.size.width),I(o.size.height)],r.camera?.length||(i.bounds=Ft(o.rects[0])),i.markers=(r.markers??[]).map(s=>({t:I(s.t),name:s.name}))}else i.bounds=Ft(tt(t));return i.frames=n.map(o=>Ze(t,o)),i}function bi(t,e){return{version:t.version,pages:t.pages.map((n,i)=>Je(n,i,e??Qe(n)))}}function Rr(t,e={}){let n=Sr(t)?t:St(t),i=n.pages[Bt(n,e.page===void 0?null:String(e.page))];return i=U(i,e.at??at(i)),e.clean&&(i=Gt(i,0)),me(i,e.background===void 0?{r:1,g:1,b:1,a:1}:e.background)}function Sr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.pages)&&Array.isArray(t.warnings)}var Ir="0.5.1";fe();globalThis.Dottie??(globalThis.Dottie=tn);})();
|