anniedrawing 0.3.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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/NOTICE +292 -0
- package/README.md +162 -0
- package/dist/agent/describe.d.ts +12 -0
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.js +2 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/place.d.ts +4 -0
- package/dist/agent/query.d.ts +3 -0
- package/dist/agent/toolDefs.d.ts +343 -0
- package/dist/board.d.ts +193 -0
- package/dist/core/catalog.d.ts +22 -0
- package/dist/core/clipboard.d.ts +2 -0
- package/dist/core/defaults.d.ts +19 -0
- package/dist/core/doc.d.ts +2 -0
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +1 -0
- package/dist/core/item.d.ts +25 -0
- package/dist/core/links.d.ts +21 -0
- package/dist/core/locks.d.ts +3 -0
- package/dist/core/migrate.d.ts +5 -0
- package/dist/core/paste.d.ts +27 -0
- package/dist/core/schema.d.ts +644 -0
- package/dist/core/types.d.ts +313 -0
- package/dist/docs/agents-repository.md +56 -0
- package/dist/docs/agents.md +157 -0
- package/dist/docs/api.md +258 -0
- package/dist/docs/board-js.md +345 -0
- package/dist/docs/code-of-conduct.md +11 -0
- package/dist/docs/contributing.md +35 -0
- package/dist/docs/decisions.md +107 -0
- package/dist/docs/extensions.md +122 -0
- package/dist/docs/format.md +79 -0
- package/dist/docs/index.html +993 -0
- package/dist/docs/license.txt +21 -0
- package/dist/docs/llms-full.txt +345 -0
- package/dist/docs/llms.txt +90 -0
- package/dist/docs/mcp.md +97 -0
- package/dist/docs/notice.txt +292 -0
- package/dist/docs/nunito-OFL.txt +93 -0
- package/dist/docs/releasing.md +38 -0
- package/dist/docs/security.md +33 -0
- package/dist/favicon.svg +1 -0
- package/dist/fellow.d.ts +7 -0
- package/dist/fellow.js +2 -0
- package/dist/fellow.js.map +1 -0
- package/dist/geo/box.d.ts +13 -0
- package/dist/geo/index.d.ts +5 -0
- package/dist/geo/picker.d.ts +25 -0
- package/dist/geo/router.d.ts +11 -0
- package/dist/geo/vec.d.ts +8 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/input/autosave.d.ts +2 -0
- package/dist/input/cursors.d.ts +8 -0
- package/dist/input/measure.d.ts +6 -0
- package/dist/input/urlPaste.d.ts +18 -0
- package/dist/kinds/index.d.ts +2 -0
- package/dist/kinds/registry.d.ts +45 -0
- package/dist/porter/index.d.ts +5 -0
- package/dist/porter/indexedPng.d.ts +13 -0
- package/dist/porter/json.d.ts +3 -0
- package/dist/porter/png.d.ts +10 -0
- package/dist/porter/svg.d.ts +9 -0
- package/dist/shared/board-Bya0O1I7.js +2 -0
- package/dist/shared/board-Bya0O1I7.js.map +1 -0
- package/dist/shared/cards-DWgSVE54.js +2 -0
- package/dist/shared/cards-DWgSVE54.js.map +1 -0
- package/dist/shared/defaults-C-aC_B4z.js +2 -0
- package/dist/shared/defaults-C-aC_B4z.js.map +1 -0
- package/dist/shared/describe-DaWyf3qV.js +3 -0
- package/dist/shared/describe-DaWyf3qV.js.map +1 -0
- package/dist/shared/paste-C22i8o-g.js +2 -0
- package/dist/shared/paste-C22i8o-g.js.map +1 -0
- package/dist/shared/picker-Dv_i4iNP.js +2 -0
- package/dist/shared/picker-Dv_i4iNP.js.map +1 -0
- package/dist/shared/ui-Cay6AVqT.js +2 -0
- package/dist/shared/ui-Cay6AVqT.js.map +1 -0
- package/dist/shared/urlPaste-DN4JtgeB.js +2 -0
- package/dist/shared/urlPaste-DN4JtgeB.js.map +1 -0
- package/dist/stage/cards.d.ts +2 -0
- package/dist/stage/index.d.ts +3 -0
- package/dist/stage/itemView.d.ts +22 -0
- package/dist/stage/lens.d.ts +26 -0
- package/dist/stage/paint.d.ts +23 -0
- package/dist/stage/presence.d.ts +50 -0
- package/dist/stage/stage.d.ts +60 -0
- package/dist/style.css +2 -0
- package/dist/ui/icons.d.ts +2 -0
- package/dist/ui/index.d.ts +16 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/version.d.ts +3 -0
- package/llms-full.txt +345 -0
- package/llms.txt +90 -0
- package/package.json +120 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=1,t=[{kind:"rect",since:1,w:180,h:110,note:"Rounded rectangle. Nodes, cards, boxes."},{kind:"ellipse",since:1,w:180,h:110,note:"Ellipse or circle."},{kind:"diamond",since:1,w:160,h:140,note:"Diamond. Decisions or highlights."},{kind:"line",since:1,w:180,h:0,note:"Straight segment. Optional points are relative to x/y."},{kind:"connector",since:1,w:0,h:0,note:"Bound or free link. Requires from and to. Compact JSON omits x/y/w/h."},{kind:"path",since:1,w:0,h:0,note:"Freehand or polyline. points relative to x/y; closed optional."},{kind:"text",since:1,w:200,h:48,note:"Plain text. Browser autoWidth measures and stores width and height."},{kind:"note",since:1,w:200,h:180,note:"Sticky note. Default moss fill and 12px corner."},{kind:"image",since:1,w:240,h:180,note:"References a media table key. Raster or SVG; remote URLs need allowed origins."},{kind:"video",since:1,w:480,h:270,note:"YouTube or Vimeo href. Stores the watch URL, not iframe markup."},{kind:"link",since:1,w:220,h:200,note:"Website card. href plus optional title, description, and preview media."},{kind:"group",since:1,w:0,h:0,note:"Only kind that contains children. Child positions stay in page coordinates."},{kind:"html",since:1,w:240,h:160,note:"Markup. Renders only when the host passed a sanitizer."}];function n(e=0){const n=e||0;return{version:1,since:n,kinds:t.filter(e=>e.since>n).map(e=>({...e}))}}var i=e=>crypto.getRandomValues(new Uint8Array(e)),r=((e,t=21)=>((e,t,n)=>{let i=256-256%e.length;if(256===i){let i=e.length-1;return(r=t)=>{if(!r)return"";let o="";for(;;){let t=n(r),s=r;for(;s--;)if(o+=e[t[s]&i],o.length>=r)return o}}}let r=Math.ceil(409.6*t/i);return(o=t)=>{if(!o)return"";let s="";for(;;){let t=n(r),l=r;for(;l--;)if(t[l]<i&&(s+=e[t[l]%e.length],s.length>=o))return s}}})(e,0|t,i))("346789abcdefghjkmnpqrtwxyz",6),o=()=>`i_${r()}`,s=()=>`p_${r()}`,l=()=>`m_${r()}`;function a(e,t){if(e&&!t.has(e)&&e.length<=160)return e;const n=(e.replace(/_\d+$/,"")||e||"i").slice(0,158);for(let i=1;i<1e7;i++){const e=`_${i}`,r=`${n.slice(0,160-e.length)}${e}`;if(!t.has(r))return r}return o()}var d={rectangle:"rect",arrow:"connector"},c={black:"ink",grey:"slate",gray:"slate",blue:"sky","light-blue":"sky",green:"teal","light-green":"moss",red:"rose","light-red":"rose",orange:"coral",yellow:"amber",violet:"violet","light-violet":"violet"};function h(e){return d[e]??e}function f(e){if(void 0!==e)return c[e]??e}function u(e){if(void 0!==e)return"string"==typeof e?{item:e,side:"auto"}:e}function k(e){if(!e)return e;const t=f(e.stroke),n=f(e.fill);return t===e.stroke&&n===e.fill?e:{...e,...void 0!==t?{stroke:t}:{},...void 0!==n?{fill:n}:{}}}var m=12,y={stroke:"ink",strokeWidth:2,dash:"solid",fill:"none",fillMode:"solid",corner:12,opacity:1},g=Object.fromEntries(t.map(e=>[e.kind,[e.w,e.h]]));function p(e){return structuredClone(e)}function w(e){return g[e]??[180,110]}function v(e){return Object.fromEntries((e??[]).filter(e=>e.defaults).map(e=>[e.kind,e.defaults]))}function b(){return{format:"anniedrawing",version:2,meta:{title:"Untitled board"},pages:[{id:"p_main",name:"Page 1",background:"paper",items:[]}],media:{}}}function x(e,t={}){const n=e.kind,i=h(n),r=t[i]??t[n];e={...e,kind:i},r&&(e={...p(r),...e,...r.style?{style:{...p(r.style),...e.style}}:{}});const s=w(i),l={...p(e),id:e.id??o(),kind:i,x:e.x??0,y:e.y??0,w:e.w??s[0],h:e.h??s[1]},a=u(e.from),d=u(e.to),c=k(e.style);return a?l.from=a:delete l.from,d?l.to=d:delete l.to,c?l.style=c:delete l.style,"arrow"===n&&(void 0===l.heads?.end&&(l.heads={...l.heads,end:"arrow"}),void 0===l.route&&(l.route="elbow")),e.children&&(l.children=e.children.map(e=>x(e,t))),l}function R(e,t={}){const n={...y,..."note"===e.kind?{fill:"moss",strokeWidth:0,corner:12}:{},...t[e.kind]?.style},i=p(e);if(0===i.rotation&&delete i.rotation,!1===i.locked&&delete i.locked,!1===i.hidden&&delete i.hidden,i.style){for(const e of Object.keys(i.style))i.style[e]===n[e]&&delete i.style[e];Object.keys(i.style).length||delete i.style}return i.children&&(i.children=i.children.map(e=>R(e,t)),i.children.length||delete i.children),"connector"===i.kind&&(delete i.x,delete i.y,delete i.w,delete i.h),i}export{a as _,p as a,n as b,R as c,f as d,u as f,s as g,l as h,k as i,x as l,o as m,g as n,b as o,h as p,y as r,v as s,m as t,w as u,e as v,t as y};
|
|
2
|
+
//# sourceMappingURL=defaults-C-aC_B4z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults-C-aC_B4z.js","names":["random"],"sources":["../../src/core/catalog.ts","../../node_modules/nanoid/index.browser.js","../../src/core/ids.ts","../../src/core/defaults.ts"],"sourcesContent":["/** Bump when a built-in kind is added or its create/read contract changes. */\nexport const CATALOG_VERSION = 1;\n\nexport interface KindCatalogEntry {\n kind: string;\n /** Catalog version that added this kind or last changed its create/read fields. */\n since: number;\n w: number;\n h: number;\n note: string;\n}\n\nexport interface KindCatalogSnapshot {\n version: number;\n since: number;\n kinds: KindCatalogEntry[];\n}\n\n/** Built-in kinds. `since` is the catalog version that introduced or last changed the kind. */\nexport const KIND_CATALOG: readonly KindCatalogEntry[] = [\n { kind: 'rect', since: 1, w: 180, h: 110, note: 'Rounded rectangle. Nodes, cards, boxes.' },\n { kind: 'ellipse', since: 1, w: 180, h: 110, note: 'Ellipse or circle.' },\n { kind: 'diamond', since: 1, w: 160, h: 140, note: 'Diamond. Decisions or highlights.' },\n {\n kind: 'line',\n since: 1,\n w: 180,\n h: 0,\n note: 'Straight segment. Optional points are relative to x/y.',\n },\n {\n kind: 'connector',\n since: 1,\n w: 0,\n h: 0,\n note: 'Bound or free link. Requires from and to. Compact JSON omits x/y/w/h.',\n },\n {\n kind: 'path',\n since: 1,\n w: 0,\n h: 0,\n note: 'Freehand or polyline. points relative to x/y; closed optional.',\n },\n {\n kind: 'text',\n since: 1,\n w: 200,\n h: 48,\n note: 'Plain text. Browser autoWidth measures and stores width and height.',\n },\n {\n kind: 'note',\n since: 1,\n w: 200,\n h: 180,\n note: 'Sticky note. Default moss fill and 12px corner.',\n },\n {\n kind: 'image',\n since: 1,\n w: 240,\n h: 180,\n note: 'References a media table key. Raster or SVG; remote URLs need allowed origins.',\n },\n {\n kind: 'video',\n since: 1,\n w: 480,\n h: 270,\n note: 'YouTube or Vimeo href. Stores the watch URL, not iframe markup.',\n },\n {\n kind: 'link',\n since: 1,\n w: 220,\n h: 200,\n note: 'Website card. href plus optional title, description, and preview media.',\n },\n {\n kind: 'group',\n since: 1,\n w: 0,\n h: 0,\n note: 'Only kind that contains children. Child positions stay in page coordinates.',\n },\n {\n kind: 'html',\n since: 1,\n w: 240,\n h: 160,\n note: 'Markup. Renders only when the host passed a sanitizer.',\n },\n];\n\n/**\n * Built-in kinds added or last changed after `since`.\n * Omit `since` or pass 0 to list every built-in kind.\n */\nexport function kindsSince(since = 0): KindCatalogSnapshot {\n const from = since || 0;\n return {\n version: CATALOG_VERSION,\n since: from,\n kinds: KIND_CATALOG.filter((entry) => entry.since > from).map((entry) => ({ ...entry })),\n };\n}\n","\n\nimport { urlAlphabet } from './url-alphabet/index.js'\n\nexport { urlAlphabet }\n\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\n\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let safeByteCutoff = 256 - (256 % alphabet.length)\n\n if (safeByteCutoff === 256) {\n let mask = alphabet.length - 1\n\n return (size = defaultSize) => {\n if (!size) return ''\n let id = ''\n while (true) {\n let bytes = getRandom(size)\n let j = size\n while (j--) {\n id += alphabet[bytes[j] & mask]\n if (id.length >= size) return id\n }\n }\n }\n }\n\n let step = Math.ceil((1.6 * 256 * defaultSize) / safeByteCutoff)\n\n return (size = defaultSize) => {\n if (!size) return ''\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n if (bytes[j] < safeByteCutoff) {\n id += alphabet[bytes[j] % alphabet.length]\n if (id.length >= size) return id\n }\n }\n }\n }\n}\n\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\n\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += urlAlphabet[bytes[size] & 63]\n }\n return id\n}\n","import { customAlphabet } from 'nanoid';\nconst random = customAlphabet('346789abcdefghjkmnpqrtwxyz', 6);\n/** Matches the item-id schema maximum. */\nconst ID_MAX = 160;\nexport const itemId = () => `i_${random()}`;\nexport const pageId = () => `p_${random()}`;\nexport const mediaId = () => `m_${random()}`;\n\n/** Next free id: keep `requested` when unused, otherwise `stem_1`, `stem_2`, … */\nexport function uniqueItemId(requested: string, taken: Set<string>): string {\n if (requested && !taken.has(requested) && requested.length <= ID_MAX) return requested;\n const stem = (requested.replace(/_\\d+$/, '') || requested || 'i').slice(0, ID_MAX - 2);\n for (let n = 1; n < 1e7; n++) {\n const suffix = `_${n}`;\n const id = `${stem.slice(0, ID_MAX - suffix.length)}${suffix}`;\n if (!taken.has(id)) return id;\n }\n return itemId();\n}\n","import type { AnnieDoc, Endpoint, EndpointInput, Item, NewItem, Style } from './types';\nimport { KIND_CATALOG } from './catalog';\nimport { itemId } from './ids';\nexport const KIND_ALIASES: Record<string, string> = {\n rectangle: 'rect',\n arrow: 'connector',\n};\nexport const COLOR_ALIASES: Record<string, string> = {\n black: 'ink',\n grey: 'slate',\n gray: 'slate',\n blue: 'sky',\n 'light-blue': 'sky',\n green: 'teal',\n 'light-green': 'moss',\n red: 'rose',\n 'light-red': 'rose',\n orange: 'coral',\n yellow: 'amber',\n violet: 'violet',\n 'light-violet': 'violet',\n};\nexport function storedKind(kind: string): string {\n return KIND_ALIASES[kind] ?? kind;\n}\nexport function storedColor(value?: string): string | undefined {\n if (value === undefined) return undefined;\n return COLOR_ALIASES[value] ?? value;\n}\nexport function storedEndpoint(value?: EndpointInput): Endpoint | undefined {\n if (value === undefined) return undefined;\n if (typeof value === 'string') return { item: value, side: 'auto' };\n return value;\n}\nexport function aliasStyle(style?: Style): Style | undefined {\n if (!style) return style;\n const stroke = storedColor(style.stroke),\n fill = storedColor(style.fill);\n if (stroke === style.stroke && fill === style.fill) return style;\n return {\n ...style,\n ...(stroke !== undefined ? { stroke } : {}),\n ...(fill !== undefined ? { fill } : {}),\n };\n}\nexport const CARD_CORNER = 12;\nexport const DEFAULT_STYLE: Required<Style> = {\n stroke: 'ink',\n strokeWidth: 2,\n dash: 'solid',\n fill: 'none',\n fillMode: 'solid',\n corner: CARD_CORNER,\n opacity: 1,\n};\nexport const DEFAULT_SIZES: Record<string, [number, number]> = Object.fromEntries(\n KIND_CATALOG.map((entry) => [entry.kind, [entry.w, entry.h]]),\n);\nexport function clone<T>(value: T): T {\n return structuredClone(value);\n}\nexport function sizeOf(kind: string): [number, number] {\n return DEFAULT_SIZES[kind] ?? [180, 110];\n}\nexport function kindDefaultsFrom(\n kinds?: { kind: string; defaults?: Partial<Item> }[],\n): Record<string, Partial<Item>> {\n return Object.fromEntries(\n (kinds ?? []).filter((kind) => kind.defaults).map((kind) => [kind.kind, kind.defaults!]),\n );\n}\nexport function defaultDoc(): AnnieDoc {\n return {\n format: 'anniedrawing',\n version: 2,\n meta: { title: 'Untitled board' },\n pages: [{ id: 'p_main', name: 'Page 1', background: 'paper', items: [] }],\n media: {},\n };\n}\nexport function normalizeItem(\n input: NewItem,\n kindDefaults: Record<string, Partial<Item>> = {},\n): Item {\n const originalKind = input.kind,\n kind = storedKind(originalKind);\n const custom = kindDefaults[kind] ?? kindDefaults[originalKind];\n input = { ...input, kind };\n if (custom)\n input = {\n ...clone(custom),\n ...input,\n ...(custom.style ? { style: { ...clone(custom.style), ...input.style } } : {}),\n };\n const size = sizeOf(kind);\n const result = {\n ...clone(input),\n id: input.id ?? itemId(),\n kind,\n x: input.x ?? 0,\n y: input.y ?? 0,\n w: input.w ?? size[0],\n h: input.h ?? size[1],\n } as Item;\n const from = storedEndpoint(input.from),\n to = storedEndpoint(input.to),\n style = aliasStyle(input.style);\n if (from) result.from = from;\n else delete result.from;\n if (to) result.to = to;\n else delete result.to;\n if (style) result.style = style;\n else delete result.style;\n if (originalKind === 'arrow') {\n if (result.heads?.end === undefined) result.heads = { ...result.heads, end: 'arrow' };\n if (result.route === undefined) result.route = 'elbow';\n }\n if (input.children)\n result.children = input.children.map((child) => normalizeItem(child, kindDefaults));\n return result;\n}\nexport function minimalItem(item: Item, kindDefaults: Record<string, Partial<Item>> = {}): Item {\n const defaults = {\n ...DEFAULT_STYLE,\n ...(item.kind === 'note' ? { fill: 'moss', strokeWidth: 0, corner: CARD_CORNER } : {}),\n ...kindDefaults[item.kind]?.style,\n };\n const next = clone(item);\n if (next.rotation === 0) delete next.rotation;\n if (next.locked === false) delete next.locked;\n if (next.hidden === false) delete next.hidden;\n if (next.style) {\n for (const key of Object.keys(next.style) as (keyof Style)[])\n if (next.style[key] === defaults[key]) delete next.style[key];\n if (!Object.keys(next.style).length) delete next.style;\n }\n if (next.children) {\n next.children = next.children.map((child) => minimalItem(child, kindDefaults));\n if (!next.children.length) delete next.children;\n }\n if (next.kind === 'connector') {\n delete (next as Partial<Item>).x;\n delete (next as Partial<Item>).y;\n delete (next as Partial<Item>).w;\n delete (next as Partial<Item>).h;\n }\n return next;\n}\n"],"x_google_ignoreList":[1],"mappings":"AACA,IAAa,EAAkB,EAkBlB,EAA4C,CACvD,CAAE,KAAM,OAAQ,MAAO,EAAG,EAAG,IAAK,EAAG,IAAK,KAAM,2CAChD,CAAE,KAAM,UAAW,MAAO,EAAG,EAAG,IAAK,EAAG,IAAK,KAAM,sBACnD,CAAE,KAAM,UAAW,MAAO,EAAG,EAAG,IAAK,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O,SACZ,EAAO,KACf,EAAI,EAAO,GAAK,SACR,EAAO,GACf,EAAO,EAAO,MAAQ,SACd,EAAO,MACE,UAAjB,SACwB,IAAtB,EAAO,OAAO,MAAmB,EAAO,MAAQ,IAAK,EAAO,MAAO,IAAK,eACvD,IAAjB,EAAO,QAAqB,EAAO,MAAQ,UAE7C,EAAM,WACR,EAAO,SAAW,EAAM,SAAS,IAAK,GAAU,EAAc,EAAO,KAChE,CACT,CACA,SAAgB,EAAY,EAAY,EAA8C,CAAC,GACrF,MAAM,EAAW,IACZ,KACe,SAAd,EAAK,KAAkB,CAAE,KAAM,OAAQ,YAAa,EAAG,OAAA,IAAwB,CAAC,KACjF,EAAa,EAAK,OAAO,OAExB,EAAO,EAAM,GAInB,GAHsB,IAAlB,EAAK,iBAAuB,EAAK,UACjB,IAAhB,EAAK,eAAyB,EAAK,QACnB,IAAhB,EAAK,eAAyB,EAAK,OACnC,EAAK,MAAO,CACd,IAAK,MAAM,KAAO,OAAO,KAAK,EAAK,OAC7B,EAAK,MAAM,KAAS,EAAS,WAAa,EAAK,MAAM,GACtD,OAAO,KAAK,EAAK,OAAO,eAAe,EAAK,KACnD,CAWA,OAVI,EAAK,WACP,EAAK,SAAW,EAAK,SAAS,IAAK,GAAU,EAAY,EAAO,IAC3D,EAAK,SAAS,eAAe,EAAK,UAEvB,cAAd,EAAK,cACC,EAAuB,SACvB,EAAuB,SACvB,EAAuB,SACvB,EAAuB,GAE1B,CACT"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{_ as e,a as t,m as n,p as i}from"./defaults-C-aC_B4z.js";var s={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function r(e){return e?{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}:s}function a(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function o(e,t,n,i,s){const r=s&&"input"in s?s.input:n.value,o=s?.expected??e.expects??null,u=s?.received??/* @__PURE__ */a(r),c={kind:e.kind,type:e.type,input:r,expected:o,received:u,message:`Invalid ${t}: ${o?`Expected ${o} but r`:"R"}eceived ${u}`,requirement:e.requirement,path:s?.path,issues:s?.issues,lang:i.lang,abortEarly:i.abortEarly,abortPipeEarly:i.abortPipeEarly},l="schema"===e.kind,p=s?.message??e.message??(/* @__PURE__ */e.reference,void c.lang)??(l?/* @__PURE__ */void c.lang:null)??i.message??/* @__PURE__ */void c.lang;void 0!==p&&(c.message="function"==typeof p?p(c):p),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function u(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&"__proto__"!==t&&"prototype"!==t&&"constructor"!==t}function l(e,t){const n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}function p(e){return e["~standard"]={version:1,vendor:"valibot",validate:t=>e["~run"]({value:t},/* @__PURE__ */r())},e}function y(e){return{kind:"validation",type:"finite",reference:y,async:!1,expects:null,requirement:Number.isFinite,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&o(this,"finite",e,t),e}}}function d(e){return{kind:"validation",type:"integer",reference:d,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&o(this,"integer",e,t),e}}}function f(e,t){return{kind:"validation",type:"max_length",reference:f,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length>this.requirement&&o(this,"length",e,t,{received:`${e.value.length}`}),e}}}function h(e,t){return{kind:"validation",type:"max_value",reference:h,async:!1,expects:`<=${e instanceof Date?e.toJSON():/* @__PURE__ */a(e)}`,requirement:e,message:t,"~run"(e,t){return!e.typed||e.value<=this.requirement||o(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():/* @__PURE__ */a(e.value)}),e}}}function m(e,t){return{kind:"validation",type:"min_length",reference:m,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&o(this,"length",e,t,{received:`${e.value.length}`}),e}}}function x(e,t){return{kind:"validation",type:"min_value",reference:x,async:!1,expects:`>=${e instanceof Date?e.toJSON():/* @__PURE__ */a(e)}`,requirement:e,message:t,"~run"(e,t){return!e.typed||e.value>=this.requirement||o(this,"value",e,t,{received:e.value instanceof Date?e.value.toJSON():/* @__PURE__ */a(e.value)}),e}}}var g={abortEarly:!0};function v(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function b(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}function k(e,t){return p({kind:"schema",type:"array",reference:k,expects:"Array",async:!1,item:e,message:t,"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<n.length;i++){const s=n[i],r=this.item["~run"]({value:s},t);if(r.issues){const a={type:"array",origin:"value",input:n,key:i,value:s};for(const t of r.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=r.issues),t.abortEarly){e.typed=!1;break}}r.typed||(e.typed=!1),e.value.push(r.value)}}else o(this,"type",e,t);return e}})}function w(e){return p({kind:"schema",type:"boolean",reference:w,expects:"boolean",async:!1,message:e,"~run"(e,t){return"boolean"==typeof e.value?e.typed=!0:o(this,"type",e,t),e}})}function $(e,t){return p({kind:"schema",type:"literal",reference:$,expects:/* @__PURE__ */a(e),async:!1,literal:e,message:t,"~run"(e,t){/* @__PURE__ */
|
|
2
|
+
return u(e.value,this.literal)?e.typed=!0:o(this,"type",e,t),e}})}function M(e,t){return p({kind:"schema",type:"loose_object",reference:M,expects:"Object",async:!1,entries:e,message:t,"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in this.entries){const s=this.entries[i];if(i in n||("exact_optional"===s.type||"optional"===s.type||"nullish"===s.type)&&void 0!==s.default){const r=i in n?n[i]:/* @__PURE__ */b(s),a=s["~run"]({value:r},t);if(a.issues){const s={type:"object",origin:"value",input:n,key:i,value:r};for(const t of a.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value[i]=a.value}else if(void 0!==s.fallback)e.value[i]=/* @__PURE__ */v(s);else if("exact_optional"!==s.type&&"optional"!==s.type&&"nullish"!==s.type&&(o(this,"key",e,t,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:n,key:i,value:n[i]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(const t in n)/* @__PURE__ */c(n,t)&&!Object.prototype.hasOwnProperty.call(this.entries,t)&&(e.value[t]=n[t])}else o(this,"type",e,t);return e}})}function j(e){return p({kind:"schema",type:"number",reference:j,expects:"number",async:!1,message:e,"~run"(e,t){return"number"!=typeof e.value||isNaN(e.value)?o(this,"type",e,t):e.typed=!0,e}})}function E(e,t){return p({kind:"schema",type:"object",reference:E,expects:"Object",async:!1,entries:e,message:t,"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in this.entries){const s=this.entries[i];if(i in n||("exact_optional"===s.type||"optional"===s.type||"nullish"===s.type)&&void 0!==s.default){const r=i in n?n[i]:/* @__PURE__ */b(s),a=s["~run"]({value:r},t);if(a.issues){const s={type:"object",origin:"value",input:n,key:i,value:r};for(const t of a.issues)t.path?t.path.unshift(s):t.path=[s],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value[i]=a.value}else if(void 0!==s.fallback)e.value[i]=/* @__PURE__ */v(s);else if("exact_optional"!==s.type&&"optional"!==s.type&&"nullish"!==s.type&&(o(this,"key",e,t,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:n,key:i,value:n[i]}]}),t.abortEarly))break}}else o(this,"type",e,t);return e}})}function O(e,t){return p({kind:"schema",type:"optional",reference:O,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return void 0===e.value&&(void 0!==this.default&&(e.value=/* @__PURE__ */b(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}})}function A(e,t){return p({kind:"schema",type:"picklist",reference:A,expects:/* @__PURE__ */l(e.map(a),"|"),async:!1,options:e,message:t,"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:o(this,"type",e,t),e}})}function N(e,t,n){return p({kind:"schema",type:"record",reference:N,expects:"Object",async:!1,key:e,value:t,message:n,"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){e.typed=!0,e.value={};for(const i in n)if(/* @__PURE__ */c(n,i)){const s=n[i],r=this.key["~run"]({value:i},t);if(r.issues){const a={type:"object",origin:"key",input:n,key:i,value:s};for(const t of r.issues)t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=r.issues),t.abortEarly){e.typed=!1;break}}const a=this.value["~run"]({value:s},t);if(a.issues){const r={type:"object",origin:"value",input:n,key:i,value:s};for(const t of a.issues)t.path?t.path.unshift(r):t.path=[r],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}r.typed&&a.typed||(e.typed=!1),r.typed&&(e.value[r.value]=a.value)}}else o(this,"type",e,t);return e}})}function S(e){return p({kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:e,"~run"(e,t){return"string"==typeof e.value?e.typed=!0:o(this,"type",e,t),e}})}function q(e,t){return p({kind:"schema",type:"tuple",reference:q,expects:"Array",async:!1,items:e,message:t,"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<this.items.length;i++){const s=n[i],r=this.items[i]["~run"]({value:s},t);if(r.issues){const a={type:"array",origin:"value",input:n,key:i,value:s};for(const t of r.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=r.issues),t.abortEarly){e.typed=!1;break}}r.typed||(e.typed=!1),e.value.push(r.value)}}else o(this,"type",e,t);return e}})}function _(e,t,n){return p({kind:"schema",type:"tuple_with_rest",reference:_,expects:"Array",async:!1,items:e,rest:t,message:n,"~run"(e,t){const n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let i=0;i<this.items.length;i++){const s=n[i],r=this.items[i]["~run"]({value:s},t);if(r.issues){const a={type:"array",origin:"value",input:n,key:i,value:s};for(const t of r.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=r.issues),t.abortEarly){e.typed=!1;break}}r.typed||(e.typed=!1),e.value.push(r.value)}if(!e.issues||!t.abortEarly)for(let i=this.items.length;i<n.length;i++){const s=n[i],r=this.rest["~run"]({value:s},t);if(r.issues){const a={type:"array",origin:"value",input:n,key:i,value:s};for(const t of r.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=r.issues),t.abortEarly){e.typed=!1;break}}r.typed||(e.typed=!1),e.value.push(r.value)}}else o(this,"type",e,t);return e}})}function P(e){let t;if(e)for(const n of e)if(t)for(const e of n.issues)t.push(e);else t=n.issues;return t}function I(e,t){return p({kind:"schema",type:"union",reference:I,expects:/* @__PURE__ */l(e.map(e=>e.expects),"|"),async:!1,options:e,message:t,"~run"(e,t){let n,i,s;for(const r of this.options){const a=r["~run"]({value:e.value},t);if(a.typed){if(!a.issues){n=a;break}i?i.push(a):i=[a]}else s?s.push(a):s=[a]}if(n)return n;if(i){if(1===i.length)return i[0];o(this,"type",e,t,{issues:/* @__PURE__ */P(i)}),e.typed=!0}else{if(1===s?.length)return s[0];o(this,"type",e,t,{issues:/* @__PURE__ */P(s)})}return e}})}function J(...e){return p({...e[0],pipe:e,"~run"(t,n){for(const i of e)if("metadata"!==i.kind){if(t.issues&&("schema"===i.kind||"transformation"===i.kind)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=i["~run"](t,n))}return t}})}function L(e,t,n){const i=e["~run"]({value:t},/* @__PURE__ */r(n));return{typed:i.typed,success:!i.issues,output:i.value,issues:i.issues}}var D={maxBatch:1e3,maxItems:5e4,maxCoordinate:1e6,maxTextLength:1e5,maxDepth:32,maxPoints:1e5,maxMediaLength:2e7,maxHistory:100,maxSessionLog:500,maxJsonDepth:104},C={colors:32,maxBytes:245760},T=J(j(),y()),z=J(T,x(-D.maxCoordinate),h(D.maxCoordinate)),B=J(T,x(0),h(D.maxCoordinate)),W=J(S(),m(1),f(160)),F=J(S(),f(D.maxTextLength)),R=E({x:z,y:z}),H=E({x:z,y:z,w:B,h:B}),U=E({stroke:O(S()),strokeWidth:O(J(B,h(1e3))),dash:O(A(["solid","dashed","dotted"])),fill:O(S()),fillMode:O(A(["solid","tint","hatch"])),corner:O(B),opacity:O(J(T,x(0),h(1)))}),G=E({value:F,align:O(A(["start","center","end"])),valign:O(A(["top","middle","bottom"])),size:O(I([A(["s","m","l","xl"]),J(T,x(1),h(1e3))])),font:O(A(["sans","serif","mono","hand"]))}),K=N(S(),function e(){return p({kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,"~run":e=>(e.typed=!0,e)})}()),Q=I([W,E({item:W,side:O(A(["auto","top","right","bottom","left"])),anchor:O(q([J(T,x(0),h(1)),J(T,x(0),h(1))]))}),R]),V=function e(t){return p({kind:"schema",type:"lazy",reference:e,expects:"unknown",async:!1,getter:t,"~run"(e,t){return this.getter(e.value)["~run"](e,t)}})}(()=>M({id:O(W),kind:J(S(),m(1),f(100)),x:O(z),y:O(z),w:O(B),h:O(B),rotation:O(z),style:O(U),text:O(G),locked:O(w()),hidden:O(w()),name:O(F),data:O(K),children:O(k(V)),points:O(J(k(_([z,z],J(T,x(0),h(1)))),f(D.maxPoints))),from:O(Q),to:O(Q),route:O(A(["straight","elbow","curve"])),heads:O(E({start:O(A(["none","arrow","dot"])),end:O(A(["none","arrow","dot"]))})),waypoints:O(k(q([z,z]))),closed:O(w()),autoWidth:O(w()),media:O(W),crop:O(H),href:O(F),description:O(F),html:O(F),mount:O(W)})),X=M({x:O(z),y:O(z),w:O(B),h:O(B),rotation:O(z),style:O(U),text:O(function(e,t){const n={};for(const i in e.entries)n[i]=!t||t.includes(i)?/* @__PURE__ */O(e.entries[i]):e.entries[i];return p({...e,entries:n})}(G)),href:O(F),description:O(F),data:O(K),from:O(Q),to:O(Q)}),Y=E({rightOf:O(W),leftOf:O(W),above:O(W),below:O(W),inside:O(W),near:O(W),gap:O(B),align:O(A(["start","middle","end"]))}),Z=E({mime:J(S(),function e(t,n){return{kind:"validation",type:"regex",reference:e,async:!1,expects:`${t}`,requirement:t,message:n,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&o(this,"format",e,t),e}}}(/^image\/(png|jpeg|gif|webp|avif|svg\+xml)$/)),w:B,h:B,src:J(S(),f(D.maxMediaLength))}),ee=E({id:W,name:F,background:O(S()),items:k(V)}),te=E({format:$("anniedrawing"),version:$(2),meta:M({title:F,modified:O(S())}),pages:J(k(ee),m(1)),media:N(S(),Z)}),ne=function e(t,n,i){return p({kind:"schema",type:"variant",reference:e,expects:"Object",async:!1,key:t,options:n,message:i,"~run"(e,t){const n=e.value;if(n&&"object"==typeof n){let i,s=0,r=this.key,a=[];const u=(e,o)=>{for(const c of e.options){if("variant"===c.type)u(c,new Set(o).add(c.key));else{let e=!0,u=0;for(const t of o){const i=c.entries[t];if(t in n?i["~run"]({typed:!1,value:n[t]},g).issues:"exact_optional"!==i.type&&"optional"!==i.type&&"nullish"!==i.type){e=!1,r!==t&&(s<u||s===u&&t in n&&!(r in n))&&(s=u,r=t,a=[]),r===t&&a.push(c.entries[t].expects);break}u++}if(e){const e=c["~run"]({value:n},t);(!i||!i.typed&&e.typed)&&(i=e)}}if(i&&!i.issues)break}};if(u(this,/* @__PURE__ */new Set([this.key])),i)return i;o(this,"type",e,t,{input:n[r],expected:/* @__PURE__ */l(a,"|"),path:[{type:"object",origin:"value",input:n,key:r,value:n[r]}]})}else o(this,"type",e,t);return e}})}("op",[E({op:$("add"),item:V,page:O(W),parent:O(W),index:O(J(j(),d(),x(0))),place:O(Y)}),E({op:$("set"),id:W,patch:X}),E({op:$("remove"),id:W}),E({op:$("order"),id:W,to:I([A(["front","back","forward","backward"]),J(j(),d(),x(0))])}),E({op:$("reparent"),id:W,parent:function e(t,n){return p({kind:"schema",type:"nullable",reference:e,expects:`(${t.expects} | null)`,async:!1,wrapped:t,default:n,"~run"(e,t){return null===e.value&&(void 0!==this.default&&(e.value=/* @__PURE__ */b(this,e,t)),null===e.value)?(e.typed=!0,e):this.wrapped["~run"](e,t)}})}(W),index:O(J(j(),d(),x(0)))}),E({op:$("page.add"),index:O(J(j(),d(),x(0))),page:E({id:O(W),name:F,background:O(S()),items:O(k(V))})}),E({op:$("page.set"),id:W,patch:E({name:O(F),background:O(S())})}),E({op:$("page.remove"),id:W}),E({op:$("meta.set"),patch:M({title:O(F),modified:O(S())})}),E({op:$("media.set"),id:W,media:Z}),E({op:$("media.remove"),id:W})]),ie=J(k(ne),f(D.maxBatch)),se=E({kind:O(I([S(),k(S())])),text:O(S()),within:O(H),connectedTo:O(W),direction:O(A(["in","out","both"])),inside:O(W),data:O(K),hidden:O(w()),locked:O(w()),page:O(W)}),re=E({scope:O(A(["doc","page","selection","viewport"])),detail:O(A(["brief","normal","full"])),relations:O(w()),freeSpace:O(w()),maxItems:O(J(j(),d(),x(1),h(1e4))),selection:O(k(W)),page:O(W),since:O(J(j(),y()))});function ae(e,t){const n=L(e,t);return n.success?void 0:n.issues.map(e=>`${e.path?.map(e=>e.key).join(".")??"value"}: ${e.message}`).join("; ")}var oe=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function ue(e,t,n){const i=n*Math.PI/180,s=Math.cos(i),r=Math.sin(i),a=e.x-t.x,o=e.y-t.y;return{x:t.x+a*s-o*r,y:t.y+a*r+o*s}}function ce(e,t,n){const i=n.x-t.x,s=n.y-t.y,r=i*i+s*s,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*s)/r)):0;return Math.hypot(e.x-t.x-a*i,e.y-t.y-a*s)}function le(e,t){let n=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const r=t[i],a=t[s];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function pe(e,t=.5){if(e.length<3)return e.slice();const n=/* @__PURE__ */new Set([0,e.length-1]),i=[[0,e.length-1]];for(;i.length;){const[s,r]=i.pop();let a=t,o=-1;for(let t=s+1;t<r;t++){const n=ce({x:e[t][0],y:e[t][1]},{x:e[s][0],y:e[s][1]},{x:e[r][0],y:e[r][1]});n>a&&(a=n,o=t)}o>=0&&(n.add(o),i.push([s,o],[o,r]))}return[...n].sort((e,t)=>e-t).map(t=>e[t])}function ye(e,t){if(e.length<3)return e;let n=0,i=0;for(let s=1;s<e.length-1;s++){const r=ce({x:e[s][0],y:e[s][1]},{x:e[0][0],y:e[0][1]},{x:e.at(-1)[0],y:e.at(-1)[1]}),a=s/(e.length-1),o=(e[0][2]??.5)*(1-a)+(e.at(-1)[2]??.5)*a,u=Math.max(r,Math.abs((e[s][2]??.5)-o)>.08?2*t:0);u>n&&(n=u,i=s)}return n>t?[...ye(e.slice(0,i+1),t).slice(0,-1),...ye(e.slice(i),t)]:[e[0],e.at(-1)]}function de(e,t,n){const i=xe(t,e);if("group"!==i?.kind)return i;const s=ge(i.children??[]).filter(e=>"connector"!==e.kind&&"group"!==e.kind).map(e=>xe(t,e.id)??e);return s.length?{...i,...$e(s,t,n),rotation:0}:i}function fe(e,t,n){const i=n?.(e);if(!i)return;const s=Array.isArray(i)?i:[i],r=e.w/2,a=e.h/2,o=t.x**2+t.y**2;if(!o)return;const u=(e,t)=>e.x*t.y-e.y*t.x;let c=-1/0;for(const l of s){const e=l.points.length;for(let n=0;n<e-(l.closed?0:1);n++){const i=l.points[n],s=l.points[(n+1)%e],p={x:s.x-i.x,y:s.y-i.y},y={x:i.x-r,y:i.y-a},d=u(t,p);if(Math.abs(d)<1e-10){if(Math.abs(u(y,t))<1e-10)for(const e of[i,s]){const n=((e.x-r)*t.x+(e.y-a)*t.y)/o;n>=0&&(c=Math.max(c,n))}continue}const f=u(y,p)/d,h=u(y,t)/d;f>=-1e-10&&h>=-1e-10&&h<=1+1e-10&&(c=Math.max(c,Math.max(0,f)))}}return Number.isFinite(c)?{x:e.x+r+t.x*c,y:e.y+a+t.y*c}:void 0}function he(e,t,n,i){if(!e)return{x:0,y:0};if(!("item"in e))return{x:e.x,y:e.y};const s=de(e.item,n,i);if(!s)return{x:0,y:0};const r=ve(s);let a;if(e.anchor)a={x:s.x+s.w*e.anchor[0],y:s.y+s.h*e.anchor[1]};else if(e.side&&"auto"!==e.side)a="top"===e.side?{x:r.x,y:s.y}:"bottom"===e.side?{x:r.x,y:s.y+s.h}:"left"===e.side?{x:s.x,y:r.y}:{x:s.x+s.w,y:r.y},a=fe(s,{x:a.x-r.x,y:a.y-r.y},i)??a;else{const e=ue(function(e,t,n){if(!e)return{x:0,y:0};if("item"in e){const i=de(e.item,t,n);return i?ve(i):{x:0,y:0}}return e}(t,n,i),r,-(s.rotation??0));let o=e.x-r.x,u=e.y-r.y;o||u||(o=1);const c=Math.max(s.w/2,.001),l=Math.max(s.h/2,.001),p="ellipse"===s.kind?1/Math.sqrt(o*o/(c*c)+u*u/(l*l)):"diamond"===s.kind?1/(Math.abs(o)/c+Math.abs(u)/l):Math.min(c/Math.max(Math.abs(o),1e-4),l/Math.max(Math.abs(u),1e-4));a=fe(s,{x:o,y:u},i)??{x:r.x+o*p,y:r.y+u*p}}return ue(a,r,s.rotation??0)}function me(e,t,n){const i=he(e.from,e.to,t,n),s=he(e.to,e.from,t,n);let r=[i,...(e.waypoints??[]).map(([e,t])=>({x:e,y:t})),s],a="";if("elbow"===e.route&&!e.waypoints?.length){const t=e.from,n=t&&"item"in t?t.side:void 0;r="top"===n||"bottom"===n||(!n||"auto"===n)&&Math.abs(s.y-i.y)>Math.abs(s.x-i.x)?[i,{x:i.x,y:(i.y+s.y)/2},{x:s.x,y:(i.y+s.y)/2},s]:[i,{x:(i.x+s.x)/2,y:i.y},{x:(i.x+s.x)/2,y:s.y},s]}if("curve"!==e.route||e.waypoints?.length)a=r.map((e,t)=>`${t?"L":"M"} ${e.x} ${e.y}`).join(" ");else{const e=s.x-i.x,t=s.y-i.y,n={x:(i.x+s.x)/2-.22*t,y:(i.y+s.y)/2+.22*e};a=`M ${i.x} ${i.y} Q ${n.x} ${n.y} ${s.x} ${s.y}`,r=Array.from({length:25},(e,t)=>{const r=t/24,a=1-r;return{x:a*a*i.x+2*a*r*n.x+r*r*s.x,y:a*a*i.y+2*a*r*n.y+r*r*s.y}})}const o=r.slice(1).map((e,t)=>oe(r[t],e));let u=o.reduce((e,t)=>e+t,0)/2,c=i;for(let l=0;l<o.length;l++){if(u<=o[l]){const e=o[l]?u/o[l]:0;c={x:r[l].x+(r[l+1].x-r[l].x)*e,y:r[l].y+(r[l+1].y-r[l].y)*e};break}u-=o[l]}return{points:r,d:a,midpoint:c,bounds:ke(r)}}function xe(e,t){return"function"==typeof e?e(t):e instanceof Map?e.get(t):Array.isArray(e)?ge(e).find(e=>e.id===t):e?.[t]}function ge(e){const t=[];return function e(n){for(const i of n)t.push(i),i.children&&e(i.children)}(e),t}var ve=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function be(e,t=0,n=ve(e)){const i=[{x:e.x,y:e.y},{x:e.x+e.w,y:e.y},{x:e.x+e.w,y:e.y+e.h},{x:e.x,y:e.y+e.h}];return t?i.map(e=>ue(e,n,t)):i}function ke(e){if(!e.length)return{x:0,y:0,w:0,h:0};let t=1/0,n=1/0,i=-1/0,s=-1/0;for(const r of e)t=Math.min(t,r.x),n=Math.min(n,r.y),i=Math.max(i,r.x),s=Math.max(s,r.y);return{x:t,y:n,w:i-t,h:s-n}}function we(e,t,n){if("connector"===e.kind)return me(e,t,n).bounds;if("group"===e.kind&&e.children?.length)return $e(e.children.map(e=>xe(t,e.id)??e),t,n);let i={x:e.x,y:e.y,w:e.w,h:e.h};return"path"!==e.kind&&"line"!==e.kind||!e.points?.length||(i=ke(e.points.map(t=>({x:e.x+t[0],y:e.y+t[1]})))),e.rotation?ke(be(i,e.rotation,ve(e))):i}function $e(e,t,n){const i=t??new Map(ge(e).map(e=>[e.id,e]));return ke(e.flatMap(e=>{const t=we(e,i,n);return[{x:t.x,y:t.y},{x:t.x+t.w,y:t.y+t.h}]}))}var Me=(e,t)=>e.x<=t.x+t.w&&e.x+e.w>=t.x&&e.y<=t.y+t.h&&e.y+e.h>=t.y,je=(e,t)=>t.x>=e.x&&t.y>=e.y&&t.x+t.w<=e.x+e.w&&t.y+t.h<=e.y+e.h,Ee=(e,t)=>t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h;function Oe(e){return e.pages.flatMap(e=>e.items)}function Ae(e){return ge(Oe(e))}function Ne(e,t){return t?{...e,...t,style:t.style?{...e.style,...t.style}:e.style,text:t.text?{...e.text,...t.text}:e.text,data:t.data?{...e.data,...t.data}:e.data}:e}function Se(e,t,n){const i={x:(e.x??0)+t,y:(e.y??0)+n};if("connector"===e.kind){for(const s of["from","to"]){const r=e[s];r&&!("item"in r)&&(i[s]={x:r.x+t,y:r.y+n})}e.waypoints&&(i.waypoints=e.waypoints.map(([e,i])=>[e+t,i+n]))}return i}var qe=["rightOf","leftOf","above","below","inside","near"];function _e(n,i){const s=t(i),r=new Set(Ae(n).map(e=>e.id)),a=/* @__PURE__ */new Map,o=[],u=(t,n)=>{t&&"object"==typeof t&&("string"==typeof t.id&&t.id&&(t.id=((t,n)=>{const i=e(t,r);return r.add(i),a.has(t)||a.set(t,i),i!==t&&o.push({index:n,code:"ID_REMAPPED",message:`Item id ${t} was already in use; stored as ${i}.`}),i})(t.id,n)),t.children?.forEach(e=>u(e,n)))};for(let e=0;e<s.length;e++){const t=s[e];t&&"object"==typeof t&&("add"===t.op?u(t.item,e):"page.add"===t.op?t.page.items?.forEach(t=>u(t,e)):"set"===t.op&&Array.isArray(t.patch?.children)&&t.patch.children.forEach(t=>u(t,e)))}const c=e=>e&&a.has(e)?a.get(e):e,l=e=>"string"==typeof e?c(e)??e:e&&"item"in e?{...e,item:c(e.item)??e.item}:e,p=e=>{e&&"object"==typeof e&&("from"in e&&void 0!==e.from&&(e.from=l(e.from)),"to"in e&&void 0!==e.to&&(e.to=l(e.to)),e.children?.forEach(p))};for(const e of s)if(e&&"object"==typeof e)if("add"===e.op){if(p(e.item),e.parent&&(e.parent=c(e.parent)),e.place)for(const t of qe){const n=e.place[t];n&&(e.place[t]=c(n))}}else"page.add"===e.op?e.page.items?.forEach(p):"set"===e.op?(e.id=c(e.id),void 0!==e.patch.from&&(e.patch.from=l(e.patch.from)),void 0!==e.patch.to&&(e.patch.to=l(e.patch.to)),Array.isArray(e.patch.children)&&e.patch.children.forEach(p)):"remove"===e.op||"order"===e.op?e.id=c(e.id):"reparent"===e.op&&(e.id=c(e.id),e.parent&&(e.parent=c(e.parent)));return{ops:s,warnings:o}}function Pe(e,i,s=n){const r=new Map(ge(e).map(e=>[e.id,s()])),a=e=>{const n={...t(e),id:r.get(e.id),x:(e.x??0)+i,y:(e.y??0)+i};e.children&&(n.children=e.children.map(a)),e.waypoints&&(n.waypoints=e.waypoints.map(([e,t])=>[e+i,t+i]));for(const t of["from","to"]){const s=e[t];s&&(n[t]="item"in s?{...s,item:r.get(s.item)??s.item}:{x:s.x+i,y:s.y+i})}return n};return e.map(a)}function Ie(e,n,i){const s=ge([...e]),r=new Set(s.map(e=>e.id)),a=[];for(const o of s){const e={};for(const s of["from","to"]){const a=o[s];a&&"item"in a&&!r.has(a.item)&&(e[s]=t(a),o[s]=he(a,o["from"===s?"to":"from"],n,i))}Object.keys(e).length&&a.push({op:"set",id:o.id,patch:e})}return a}function Je(e,t,n,i=n){const s=["rightOf","leftOf","above","below","inside","near"].filter(e=>t[e]);if(1!==s.length)throw new Error("Placement requires exactly one of rightOf, leftOf, above, below, inside, or near.");const r=s[0],a=xe(i,t[r]);if(!a)throw new Error(`Placement reference ${t[r]} does not exist.`);const o="inside"===r?{x:a.x,y:a.y,w:a.w,h:a.h}:we(a,i),u=t.gap??32,c=t.align??"middle",l=(e,t)=>"start"===c?0:"end"===c?e-t:(e-t)/2;let p=o.x,y=o.y;if("rightOf"===r&&(p=o.x+o.w+u,y=o.y+l(o.h,e.h)),"leftOf"===r&&(p=o.x-e.w-u,y=o.y+l(o.h,e.h)),"above"===r&&(p=o.x+l(o.w,e.w),y=o.y-e.h-u),"below"===r&&(p=o.x+l(o.w,e.w),y=o.y+o.h+u),"inside"===r){if("group"!==a.kind)throw new Error("Inside placement requires a group.");const t=a.children??[];let n=!1;for(let s=0;s<100&&!n;s++)for(let r=0;r<100&&!n;r++){const a={x:o.x+u+r*(e.w+u),y:o.y+u+s*(e.h+u),w:e.w,h:e.h};je(o,a)&&!t.some(e=>Me(a,we(e,i)))&&(p=a.x,y=a.y,n=!0)}if(!n)throw new Error(`No free slot inside ${a.id}; enlarge the group or use a smaller item.`)}if("near"===r){let t=!1;for(let s=1;s<=100&&!t;s++){const r=[{x:o.x+o.w+u*s,y:o.y},{x:o.x,y:o.y+o.h+u*s},{x:o.x-e.w-u*s,y:o.y},{x:o.x,y:o.y-e.h-u*s}];for(const s of r)if(!n.some(t=>Me({...s,w:e.w,h:e.h},we(t,i)))){p=s.x,y=s.y,t=!0;break}}if(!t)throw new Error("No free space found near the requested item.")}return{...e,x:p,y:y}}function Le(e,n={}){const s=Ae(e),r=new Map(s.map(e=>[e.id,e])),a=n.page?ge(e.pages.find(e=>e.id===n.page)?.items??[]):s,o=n.inside?new Set(ge(r.get(n.inside)?.children??[]).map(e=>e.id)):void 0;return a.filter(e=>{if(n.kind&&!(Array.isArray(n.kind)?n.kind:[n.kind]).map(i).includes(e.kind))return!1;if(n.text){const t=[e.text?.value,e.name].filter(Boolean).join(" ");if("string"==typeof n.text?!t.toLowerCase().includes(n.text.toLowerCase()):!new RegExp(n.text.source,n.text.flags.replace(/[gy]/g,"")).test(t))return!1}if(void 0!==n.hidden&&!!e.hidden!==n.hidden||void 0!==n.locked&&!!e.locked!==n.locked)return!1;if(n.within&&!je(n.within,we(e,r)))return!1;if(o&&!o.has(e.id))return!1;if(n.data&&Object.entries(n.data).some(([t,n])=>JSON.stringify(e.data?.[t])!==JSON.stringify(n)))return!1;if(n.connectedTo){const t=e.from&&"item"in e.from&&e.from.item===n.connectedTo,i=e.to&&"item"in e.to&&e.to.item===n.connectedTo,s=n.direction??"both";if(!("out"===s?t:"in"===s?i:t||i))return!1}return!0}).map(t)}var De=e=>Math.round(10*e)/10,Ce=e=>e.name??e.text?.value,Te=e=>JSON.stringify(e.length>160?`${e.slice(0,157)}…`:e);function ze(e,t={},n){const i=e.pages.filter((e,n)=>t.page?e.id===t.page:"page"!==t.scope||0===n),s=t.detail??"normal",r=t.maxItems??100,a=t.since,o=new Set(t.selection??[]),u=t.ids?new Set(t.ids):void 0,c=[];let l=0;const p=/* @__PURE__ */new Set,y=Ae(e),d=new Map(y.map(e=>[e.id,e])),f=void 0!==a&&n?e=>{const t=n.written.get(e);return!!t&&t.revision>a}:()=>!0,h=e=>!("selection"===t.scope&&!o.has(e.id))&&(!(u&&!u.has(e.id))&&f(e.id)),m=e=>"selection"!==t.scope&&!u&&((!t.page||e.page===t.page)&&(void 0!==a&&e.revision>a));let x=!1;for(const g of i){const e=ge(g.items).filter(h),i=n?[...n.removed.entries()].filter(([,e])=>e.page===g.id&&m(e)).sort(([e],[t])=>e<t?-1:e>t?1:0):[];if(void 0!==a&&!e.length&&!i.length)continue;x=!0;const y=ge(g.items).filter(e=>!("selection"===t.scope&&!o.has(e.id))&&!(u&&!u.has(e.id)));if(c.push(`Page ${Te(g.name)} (${g.id}): ${void 0===a?y.length:e.length+i.length} item${1===(void 0===a?y.length:e.length+i.length)?"":"s"}.${o.size&&void 0===a?` Selection: ${[...o].join(", ")}.`:""}`),!e.length&&!i.length){c.push("An empty board, ready for your first idea.");continue}const f=e.filter(e=>"connector"!==e.kind).sort((e,t)=>e.y-t.y||e.x-t.x||(e.id<t.id?-1:e.id>t.id?1:0));for(const t of f){if(l>=r)continue;l++,p.add(t.id);const e=we(t,d),i=Ce(t);let a=`${t.id} ${t.kind}${i?` ${Te(i)}`:""}`;"brief"!==s&&(a+=` at (${De(e.x)},${De(e.y)}) ${De(e.w)}×${De(e.h)}${t.style?.fill?`, fill ${t.style.fill}`:""}${t.hidden?", hidden":""}${t.locked?", locked":""}`),t.children?.length&&(a+=` contains ${t.children.map(e=>e.id).join(", ")}`),"full"===s&&t.data&&(a+=` [${Object.entries(t.data).sort(([e],[t])=>e<t?-1:e>t?1:0).map(([e,t])=>`data.${e}=${JSON.stringify(t)}`).join(", ")}]`),"brief"!==s&&n?.written.get(t.id)?.origin.startsWith("agent:")&&(a+=", by agent"),c.push(a)}const v=e.filter(e=>"connector"===e.kind);if(v.length){c.push("Connections:");for(const e of v){if(l>=r)continue;l++,p.add(e.id);const t=e=>e?"item"in e?e.item:`(${De(e.x)},${De(e.y)})`:"unset";let i=` ${e.id}: ${t(e.from)} → ${t(e.to)}${Ce(e)?` ${Te(Ce(e))}`:""} (${e.route??"straight"})`;"brief"!==s&&n?.written.get(e.id)?.origin.startsWith("agent:")&&(i+=", by agent"),c.push(i)}}for(const[t,n]of i)l>=r||(l++,p.add(t),c.push("brief"===s?`removed ${t}`:`removed ${t} ${n.kind}`));if(t.relations&&"brief"!==s){const e=[];for(let t=0;t<Math.min(f.length,20);t++){const n=f[t],i=f[t+1];if(!i)continue;const s=i.x-n.x-n.w;s>=0&&Math.abs(n.y-i.y)<5&&e.push(`${n.id} is left of ${i.id}, tops aligned, gap ${De(s)}`)}e.length&&c.push(`Layout: ${e.join("; ")}.`)}if(t.freeSpace){const t=void 0===a?ge(g.items).filter(h):e,n=t.length?t:e;if(n.length){const e=$e(n,d);c.push(`Free space: right of content from x=${De(e.x+e.w+40)}; below content from y=${De(e.y+e.h+40)}.`)}}const b=e.filter(e=>!p.has(e.id));if(b.length){const e=/* @__PURE__ */new Map;for(const t of b){const n=`near (${600*Math.floor(t.x/600)},${600*Math.floor(t.y/600)})`;e.set(n,(e.get(n)??0)+1)}c.push(`${b.length} more items: ${[...e].slice(0,8).map(([e,t])=>`${t} ${e}`).join("; ")}${e.size>8?`; ${e.size-8} more clusters`:""}. Use query() or increase maxItems for detail.`)}}return void 0===a||x?c.join("\n"):`No changes since revision ${a}.`}export{te as A,w as B,oe as C,pe as D,ce as E,Y as F,E as G,h as H,se as I,J,O as K,C as L,D as M,ne as N,ye as O,ie as P,ae as R,me as S,ue as T,x as U,d as V,j as W,S as X,L as Y,ge as _,Ne as a,xe as b,Oe as c,$e as d,be as f,Ee as g,je as h,Ae as i,V as j,re as k,_e as l,ve as m,Le as n,Pe as o,ke as p,A as q,Je as r,Ie as s,ze as t,Se as u,Me as v,le as w,he as x,we as y,k as z};
|
|
3
|
+
//# sourceMappingURL=describe-DaWyf3qV.js.map
|