@xtrable-ltd/nanoesis 0.1.26 → 0.1.27

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.
Files changed (31) hide show
  1. package/dist/adapter-azure-blob.js +1 -1
  2. package/dist/{chunk-TEIQFPNO.js → chunk-CH4DCPNN.js} +50 -3
  3. package/dist/{chunk-H6ZHZWDJ.js → chunk-EGQLAHLP.js} +210 -97
  4. package/dist/editor-api.d.ts +17 -3
  5. package/dist/editor-api.js +2 -2
  6. package/dist/index.d.ts +107 -2
  7. package/dist/index.js +3 -1
  8. package/dist/mcp.js +3 -3
  9. package/editor/assets/MigrationsPane-eijyEoIw.js +4 -0
  10. package/editor/assets/{TemplatesPane-Dt8Z7trK.js → TemplatesPane-DjFFkccd.js} +116 -116
  11. package/editor/assets/{cssMode-D9n2swjt.js → cssMode-BNSyZV7c.js} +1 -1
  12. package/editor/assets/{freemarker2-DPD1J29I.js → freemarker2-B8rz05rs.js} +1 -1
  13. package/editor/assets/{handlebars-D3A5tmfF.js → handlebars-B3M9DD2d.js} +1 -1
  14. package/editor/assets/{html-ChVj5GP3.js → html-BajOMTpc.js} +1 -1
  15. package/editor/assets/{htmlMode-BLNw3RHS.js → htmlMode-Cqrnk3KF.js} +1 -1
  16. package/editor/assets/index-BtwjABtU.js +145 -0
  17. package/editor/assets/{index-D4IOSCAV.css → index-CUG-24-D.css} +1 -1
  18. package/editor/assets/{javascript-DNcoKqyy.js → javascript-CgKgaKRj.js} +1 -1
  19. package/editor/assets/{jsonMode-DMU6Vb_m.js → jsonMode-B4i8iNyO.js} +1 -1
  20. package/editor/assets/{liquid-BXHGTS2v.js → liquid-DJaUoyuM.js} +1 -1
  21. package/editor/assets/{mdx-BV8b_dZV.js → mdx-DBfFAeUj.js} +1 -1
  22. package/editor/assets/{python-C4cGrrAN.js → python-ClvSkGDd.js} +1 -1
  23. package/editor/assets/{razor-DW1FX8pl.js → razor-BJcU60fL.js} +1 -1
  24. package/editor/assets/{tsMode-C141_BK1.js → tsMode-8Lhfeq5V.js} +1 -1
  25. package/editor/assets/{typescript-CakAGQIi.js → typescript-D3i2tBiq.js} +1 -1
  26. package/editor/assets/{xml-BbYDGoTr.js → xml-CXwucYqL.js} +1 -1
  27. package/editor/assets/{yaml-CSwnT3wl.js → yaml-D48SS_IL.js} +1 -1
  28. package/editor/index.html +2 -2
  29. package/package.json +1 -1
  30. package/editor/assets/MigrationsPane-BEY3O03s.js +0 -4
  31. package/editor/assets/index-DbxwBEBR.js +0 -145
package/dist/index.d.ts CHANGED
@@ -287,6 +287,89 @@ declare function joinAuthors(names: readonly string[]): string;
287
287
  */
288
288
  declare function renderAuthors(value: FieldValue | undefined, directory?: AuthorDirectory): string;
289
289
 
290
+ /**
291
+ * Publish progress (DESIGN §11). The pipeline reports what it is doing through a narrow
292
+ * {@link ProgressReporter} callback so a host can stream a deterministic, per-resource
293
+ * timeline to the editor. This is a *port*, not I/O: the engine stays pure (CLAUDE §2);
294
+ * the callback is synchronous and side-effect-only, like {@link Logger}. Same inputs ->
295
+ * same event sequence, so progress is reproducible.
296
+ *
297
+ * This module imports nothing from the rest of the publish pipeline on purpose: both
298
+ * `compile/site.ts` (which reports plan + per-resource events) and `publish.ts` (which
299
+ * reports the surrounding validate/upload/purge/done events) depend on it, so keeping it
300
+ * dependency-free avoids an import cycle.
301
+ */
302
+ /** One unit shown in the publish timeline: a page, an image, or a copied file. */
303
+ interface PublishResource {
304
+ readonly kind: 'page' | 'image' | 'file';
305
+ /** Stable identity, the published path; the UI keys its checklist on this. */
306
+ readonly id: string;
307
+ /** Human label: a page's title, or an asset's filename. */
308
+ readonly label: string;
309
+ }
310
+ /**
311
+ * What a publish *will* do, computed up front without encoding or writing anything
312
+ * ({@link planPublish}). It gives the editor an exact denominator and an ordered resource
313
+ * list before the work starts, so the timeline is deterministic even when the per-resource
314
+ * events arrive in one buffered burst rather than streamed live.
315
+ */
316
+ interface PublishPlan {
317
+ /** Every resource the publish will produce, ordered images, then files, then pages. */
318
+ readonly resources: readonly PublishResource[];
319
+ readonly images: number;
320
+ readonly files: number;
321
+ readonly pages: number;
322
+ }
323
+ /** Counts of what went live, mirrored from the engine's publish summary (page-level). */
324
+ interface ProgressSummary {
325
+ readonly published: number;
326
+ readonly drafts: number;
327
+ readonly firstPublishWarning?: string;
328
+ }
329
+ /**
330
+ * A single progress event. A publish emits, in order: `validate`, then `plan` (the full
331
+ * resource list), then a `resource` event as each image/file/page completes, then `upload`
332
+ * as artifacts are written, an optional `purge`, and finally `done`. A blocked validation
333
+ * gate emits `validate` then `blocked` (no plan, nothing was built).
334
+ */
335
+ type PublishProgress = {
336
+ readonly phase: 'validate';
337
+ } | {
338
+ readonly phase: 'blocked';
339
+ readonly errors: readonly string[];
340
+ } | {
341
+ readonly phase: 'plan';
342
+ readonly plan: PublishPlan;
343
+ } | {
344
+ readonly phase: 'resource';
345
+ readonly resource: PublishResource;
346
+ /** How many resources have completed (this one included) and the total. */
347
+ readonly done: number;
348
+ readonly total: number;
349
+ } | {
350
+ readonly phase: 'upload';
351
+ readonly written: number;
352
+ readonly total: number;
353
+ } | {
354
+ readonly phase: 'purge';
355
+ } | {
356
+ readonly phase: 'done';
357
+ readonly written: number;
358
+ readonly summary?: ProgressSummary;
359
+ }
360
+ /**
361
+ * An unexpected throw during publish (a programmer error, not a gate failure, which is
362
+ * `blocked`). The engine never emits this, it throws; a streaming *host* emits it as the
363
+ * terminal event so a client reading the stream sees a clean end instead of a truncated
364
+ * one. Part of the wire vocabulary, kept in the union so one decoder handles every line.
365
+ */
366
+ | {
367
+ readonly phase: 'error';
368
+ readonly message: string;
369
+ };
370
+ /** The callback a host passes to receive {@link PublishProgress} events as they happen. */
371
+ type ProgressReporter = (event: PublishProgress) => void;
372
+
290
373
  interface CompileSiteOptions {
291
374
  /** Absolute base URL; enables sitemap.xml (and RSS when `rss` is set). */
292
375
  readonly baseUrl?: string;
@@ -300,7 +383,7 @@ interface CompileSiteOptions {
300
383
  readonly contentIndex?: boolean;
301
384
  /** Image encoder for the media pipeline; without it, images keep their raw path. */
302
385
  readonly imageEncoder?: ImageEncoder;
303
- /** Max images encoded in parallel per page (default {@link DEFAULT_IMAGE_CONCURRENCY}). */
386
+ /** Max images encoded in parallel *site-wide* (default {@link DEFAULT_IMAGE_CONCURRENCY}). */
304
387
  readonly imageConcurrency?: number;
305
388
  /**
306
389
  * Resolve an author's stored `user` handle to its current display name (DESIGN
@@ -308,6 +391,13 @@ interface CompileSiteOptions {
308
391
  * `authors` bylines use the stored name snapshot.
309
392
  */
310
393
  readonly authorDirectory?: AuthorDirectory;
394
+ /**
395
+ * Optional progress callback (DESIGN §11). When supplied, compile emits a `plan` event
396
+ * (the full resource list) once the plan phase resolves, then a `resource` event as each
397
+ * image, file, and page completes, so a host can stream a deterministic timeline. Pure:
398
+ * the callback is side-effect-only and never changes the output (CLAUDE §2).
399
+ */
400
+ readonly onProgress?: ProgressReporter;
311
401
  }
312
402
  /** One compiled output file, text (HTML/XML/JSON) or binary (image variants, files). */
313
403
  interface Artifact {
@@ -321,6 +411,13 @@ interface Artifact {
321
411
  */
322
412
  readonly cacheControl?: string;
323
413
  }
414
+ /**
415
+ * Compute what a publish *will* produce (DESIGN §11) without encoding or writing anything:
416
+ * the exact resource list + per-kind counts a host shows the operator before the work
417
+ * starts. Cheap (loads the tree + templates, runs no media pipeline), so a UI can call it
418
+ * up front for a deterministic progress denominator, then stream the live events over it.
419
+ */
420
+ declare function planPublish(source: ContentSource): Promise<PublishPlan>;
324
421
  /**
325
422
  * Compile a whole site to artifacts (DESIGN §15 step 9, compile phase). Walks the
326
423
  * content tree and renders every **published** item through its template, the
@@ -1337,6 +1434,14 @@ interface PublishOptions extends CompileSiteOptions {
1337
1434
  readonly prebuild?: PreBuildHook;
1338
1435
  /** Max sink writes in flight at once (default {@link DEFAULT_WRITE_CONCURRENCY}). */
1339
1436
  readonly writeConcurrency?: number;
1437
+ /**
1438
+ * Optional progress callback (DESIGN §11). When supplied, the publish reports its phases
1439
+ * as they happen, `validate`, then `plan` + a `resource` event per image/file/page (from
1440
+ * compile), then `upload` as artifacts are written, an optional `purge`, and `done` (or
1441
+ * `blocked` when the gate fails). A host streams these to the editor's publish timeline.
1442
+ * Pure: reporting never changes what is written (CLAUDE §2).
1443
+ */
1444
+ readonly onProgress?: ProgressReporter;
1340
1445
  }
1341
1446
  /**
1342
1447
  * What the publish actually did to *content*, as opposed to artifacts. Counts come from a
@@ -1765,4 +1870,4 @@ declare function createDiagnosticRegistry(): DiagnosticRegistry;
1765
1870
 
1766
1871
  declare const workingStoreRoundTripDiagnostic: Diagnostic;
1767
1872
 
1768
- export { type Artifact, type ArtifactSink, type AuthEndpoints, type AuthResult, type AuthorDirectory, type AuthorEntry, type AuthorOption, type AuthorRef, type AuthoringReference, type BlobStore, type BoundItem, CACHE_IMMUTABLE, CACHE_REVALIDATE, type ChangePasswordRequest, type ChangePasswordSuccess, type CollectionConfig, type CollectionQuery, type CompileInput, type CompilePageOptions, type CompileSiteOptions, type CompiledPage, type ComponentMap, type ContentIndex, type ContentItem, ContentParseError, type ContentSource, type CreateTokenSuccess, type CreateUserRequest, DEFAULT_DIRS, DOCUMENT_SHELL, type DerivedField, type DiagnoseDeps, type Severity as DiagnoseSeverity, type Source as DiagnoseSource, type Diagnostic$1 as Diagnostic, type Diagnostic as DiagnosticCheck, type DiagnosticRegistry, type DirEntry, type DirNode, type EncodeRequest, type EncodedImage, type EncodedVariant, type EntryKind, FIELD_TYPES, type FieldPrimitive, type FieldRecord, type FieldType, type FieldTypeDef, type FieldValue, type Finding, type IdentityProvider, type ImageEncoder, type ImageFormat, type ImageInfo, InMemoryArtifactSink, InMemoryBlobStore, InMemoryContentSource, IndexedStore, type ItemNode, type LengthConstraints, type LoginRequest, type LoginSuccess, type MediaResolver, type MigrationResolution, type PageEntry, type PendingMigrationItem, type PendingMigrations, type PreBuildHook, type Principal, type PublishOptions, type PublishResult, type PublishSummary, type PurgeService, RESERVED_PREFIX, type ReconcileResult, type RedirectRule, type ReferenceContext, type ReferenceEntry, type ReferenceSection, type RefreshSuccess, type RenameResult, type Repair, type RepairArgs, type ResetPasswordRequest, type ResolveContext, type Role, type RssOptions, type SchemaDelta, type SchemaFieldRef, type Scope, type Severity$1 as Severity, type SiteConfig, type SortFile, type StampDecision, type StampRecord, type Storage, type TemplateAnalysis, type TemplateKind, type TokenContext, type TokenRef, type TreeNode, type TypeChange, type UpdateUserRequest, type UserAdminEndpoints, type UserSummary, type ValidationResult, type ValueKind, type WorkingStore, analyzeTemplate, applyMigration, baseTemplateName, bestFitSnapshot, buildAuthoringReference, buildContentIndex, buildPictureMarkup, buildRedirects, buildResolveContext, buildRss, buildSitemap, cacheControlFor, canEdit, compilePage, compileSite, compileTemplate, computeSchemaDelta, contentHash, contentTypeFor, createDiagnosticRegistry, deriveFields, detectStamp, emptyIndex, escapeHtmlAttribute, escapeHtmlText, escapeJsonStringContent, findTokens, hasRole, humanize, inferControl, isDestructiveTypeChange, isFieldType, isReservedVersionedPath, isVersionedTemplateName, joinAuthors, loadComponentScripts, loadComponentStyles, loadComponents, loadContentTree, loadDocumentShell, loadIndex, loadRedirects, loadSiteConfig, loadTemplate, nextVersionNumber, noopPurgeService, outputPathForItem, parseContentItem, parseRedirects, parseSortFile, pendingMigrations, processImage, publishSite, reconcileIndex, renderAuthors, renderReferenceMarkdown, sanitizeUrl, saveIndex, slugify, snapshotName, textContent, toAuthorRefs, urlForItem, validateSite, valueKindOf, versionNumber, wholeValueToken, workingStoreRoundTripDiagnostic };
1873
+ export { type Artifact, type ArtifactSink, type AuthEndpoints, type AuthResult, type AuthorDirectory, type AuthorEntry, type AuthorOption, type AuthorRef, type AuthoringReference, type BlobStore, type BoundItem, CACHE_IMMUTABLE, CACHE_REVALIDATE, type ChangePasswordRequest, type ChangePasswordSuccess, type CollectionConfig, type CollectionQuery, type CompileInput, type CompilePageOptions, type CompileSiteOptions, type CompiledPage, type ComponentMap, type ContentIndex, type ContentItem, ContentParseError, type ContentSource, type CreateTokenSuccess, type CreateUserRequest, DEFAULT_DIRS, DOCUMENT_SHELL, type DerivedField, type DiagnoseDeps, type Severity as DiagnoseSeverity, type Source as DiagnoseSource, type Diagnostic$1 as Diagnostic, type Diagnostic as DiagnosticCheck, type DiagnosticRegistry, type DirEntry, type DirNode, type EncodeRequest, type EncodedImage, type EncodedVariant, type EntryKind, FIELD_TYPES, type FieldPrimitive, type FieldRecord, type FieldType, type FieldTypeDef, type FieldValue, type Finding, type IdentityProvider, type ImageEncoder, type ImageFormat, type ImageInfo, InMemoryArtifactSink, InMemoryBlobStore, InMemoryContentSource, IndexedStore, type ItemNode, type LengthConstraints, type LoginRequest, type LoginSuccess, type MediaResolver, type MigrationResolution, type PageEntry, type PendingMigrationItem, type PendingMigrations, type PreBuildHook, type Principal, type ProgressReporter, type ProgressSummary, type PublishOptions, type PublishPlan, type PublishProgress, type PublishResource, type PublishResult, type PublishSummary, type PurgeService, RESERVED_PREFIX, type ReconcileResult, type RedirectRule, type ReferenceContext, type ReferenceEntry, type ReferenceSection, type RefreshSuccess, type RenameResult, type Repair, type RepairArgs, type ResetPasswordRequest, type ResolveContext, type Role, type RssOptions, type SchemaDelta, type SchemaFieldRef, type Scope, type Severity$1 as Severity, type SiteConfig, type SortFile, type StampDecision, type StampRecord, type Storage, type TemplateAnalysis, type TemplateKind, type TokenContext, type TokenRef, type TreeNode, type TypeChange, type UpdateUserRequest, type UserAdminEndpoints, type UserSummary, type ValidationResult, type ValueKind, type WorkingStore, analyzeTemplate, applyMigration, baseTemplateName, bestFitSnapshot, buildAuthoringReference, buildContentIndex, buildPictureMarkup, buildRedirects, buildResolveContext, buildRss, buildSitemap, cacheControlFor, canEdit, compilePage, compileSite, compileTemplate, computeSchemaDelta, contentHash, contentTypeFor, createDiagnosticRegistry, deriveFields, detectStamp, emptyIndex, escapeHtmlAttribute, escapeHtmlText, escapeJsonStringContent, findTokens, hasRole, humanize, inferControl, isDestructiveTypeChange, isFieldType, isReservedVersionedPath, isVersionedTemplateName, joinAuthors, loadComponentScripts, loadComponentStyles, loadComponents, loadContentTree, loadDocumentShell, loadIndex, loadRedirects, loadSiteConfig, loadTemplate, nextVersionNumber, noopPurgeService, outputPathForItem, parseContentItem, parseRedirects, parseSortFile, pendingMigrations, planPublish, processImage, publishSite, reconcileIndex, renderAuthors, renderReferenceMarkdown, sanitizeUrl, saveIndex, slugify, snapshotName, textContent, toAuthorRefs, urlForItem, validateSite, valueKindOf, versionNumber, wholeValueToken, workingStoreRoundTripDiagnostic };
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ import {
61
61
  parseRedirects,
62
62
  parseSortFile,
63
63
  pendingMigrations,
64
+ planPublish,
64
65
  processImage,
65
66
  publishSite,
66
67
  reconcileIndex,
@@ -78,7 +79,7 @@ import {
78
79
  versionNumber,
79
80
  wholeValueToken,
80
81
  workingStoreRoundTripDiagnostic
81
- } from "./chunk-H6ZHZWDJ.js";
82
+ } from "./chunk-EGQLAHLP.js";
82
83
  export {
83
84
  CACHE_IMMUTABLE,
84
85
  CACHE_REVALIDATE,
@@ -142,6 +143,7 @@ export {
142
143
  parseRedirects,
143
144
  parseSortFile,
144
145
  pendingMigrations,
146
+ planPublish,
145
147
  processImage,
146
148
  publishSite,
147
149
  reconcileIndex,
package/dist/mcp.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  MCP_TOOLS,
4
4
  callMcpTool,
5
5
  readMcpResource
6
- } from "./chunk-TEIQFPNO.js";
7
- import "./chunk-H6ZHZWDJ.js";
6
+ } from "./chunk-CH4DCPNN.js";
7
+ import "./chunk-EGQLAHLP.js";
8
8
 
9
9
  // ../../hosts/host-mcp/src/http.ts
10
10
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
@@ -56,7 +56,7 @@ function createMcpServer(deps, identity) {
56
56
  }
57
57
 
58
58
  // ../../hosts/host-mcp/src/http.ts
59
- var DEFAULT_VERSION = true ? "0.1.26" : "0.0.0-workspace";
59
+ var DEFAULT_VERSION = true ? "0.1.27" : "0.0.0-workspace";
60
60
  async function handleMcpRequest(deps, request, opts) {
61
61
  const server = createMcpServer(deps, {
62
62
  name: opts?.name ?? "nanoesis",
@@ -0,0 +1,4 @@
1
+ import{ai as Ke,aG as F,ag as Te,aa as g,W as w,T as e,h as n,ab as Qe,q as a,Q as z,aH as h,y as j,aC as o,R as _,au as v,r as Ve,J as U,x as Ye,i as ze,aN as Ue,aA as c,aI as J,aw as X,ax as _e,Y as Xe,at as Ze,ac as ea}from"./index-BtwjABtU.js";var aa=_('<p class="placeholder svelte-1lpfi31">Loading preview…</p>'),ta=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),la=_("<option> </option>"),sa=_('<select class="svelte-1lpfi31"></select>'),ra=_('<li class="orphan svelte-1lpfi31"><div class="orphan-head svelte-1lpfi31"><code class="orphan-name svelte-1lpfi31"> </code> <span class="orphan-value svelte-1lpfi31"> </span></div> <div class="orphan-actions svelte-1lpfi31" role="radiogroup"><label class="svelte-1lpfi31"><input type="radio" value="drop"/> Drop</label> <label class="svelte-1lpfi31"><input type="radio" value="keep"/> Keep (unrendered)</label> <label class="svelte-1lpfi31"><input type="radio" value="rename"/> Rename to</label> <!></div></li>'),ia=_(`<section class="resolutions svelte-1lpfi31" aria-label="Orphan field resolutions"><h3 class="svelte-1lpfi31">Orphan fields</h3> <p class="hint svelte-1lpfi31">These fields exist in this item's JSON but the current template doesn't render them.
2
+ Pick what to do with each.</p> <ul class="orphans svelte-1lpfi31"></ul></section>`),na=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),oa=_('<div class="diff svelte-1lpfi31"><section class="pane svelte-1lpfi31" aria-label="Previous version (left)"><header class="pane-head svelte-1lpfi31"><!></header> <pre class="source svelte-1lpfi31"> </pre></section> <section class="pane svelte-1lpfi31" aria-label="Current template (right)"><header class="pane-head svelte-1lpfi31"> </header> <pre class="source svelte-1lpfi31"> </pre></section></div> <!> <!> <div class="commit-bar svelte-1lpfi31"><button type="button" class="primary svelte-1lpfi31"> </button></div>',1),va=_('<header class="detail-head svelte-1lpfi31"><button type="button" class="back svelte-1lpfi31">← Back</button> <h2 class="svelte-1lpfi31"> </h2></header> <!>',1),pa=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),ca=_('<p class="placeholder svelte-1lpfi31">Loading…</p>'),fa=_(`<div class="empty svelte-1lpfi31"><h3 class="svelte-1lpfi31">All caught up</h3> <p>Every content item's fields match its bound template. Migrations show up here when a
3
+ destructive template edit (or a manual hand-edit) leaves an item with orphan fields.</p></div>`),ua=_('<li class="item"><button class="item-row svelte-1lpfi31" type="button"><span class="item-path svelte-1lpfi31"><code> </code></span> <span class="item-summary svelte-1lpfi31"><!> <!> <!></span> <span class="open-icon svelte-1lpfi31">→</span></button></li>'),da=_('<section class="group svelte-1lpfi31"><h3 class="group-title svelte-1lpfi31"><code class="svelte-1lpfi31"> </code> <span class="count svelte-1lpfi31"> </span></h3> <ul class="items svelte-1lpfi31"></ul></section>'),ma=_('<header class="list-head svelte-1lpfi31"><h2>Migrations</h2> <button type="button" class="svelte-1lpfi31"> </button></header> <!>',1),_a=_('<div class="migrations svelte-1lpfi31"><!> <!></div>');function ga(Re,Le){Ke(Le,!0);let M=F(null),u=F(null),Z=F(!1),C=F(null),r=F(Te({})),he=F(Te({})),N=F(!1),W=F(null);g.ensureLoaded();async function Ce(s){v(M,s,!0),v(r,{},!0),v(he,{},!0),v(u,null),v(C,null),v(Z,!0);try{v(u,await ea(s),!0);const f={};for(const l of e(u).orphans){const d=Ee(l.name,e(u).currentTemplateFields);f[l.name]=d?{rename:d}:"keep"}v(r,f,!0)}catch(f){v(C,f instanceof Error?f.message:String(f),!0)}finally{v(Z,!1)}}function ge(){v(M,null),v(u,null),v(C,null)}function Ee(s,f){const l=s.toLowerCase();for(const d of f)if(d.toLowerCase().startsWith(l)||d.toLowerCase().endsWith(l))return d;return null}async function Se(){if(!(e(M)===null||e(u)===null)){v(N,!0),v(W,null);try{const s={drop:Object.entries(e(r)).filter(([,l])=>l==="drop").map(([l])=>l),keep:Object.entries(e(r)).filter(([,l])=>l==="keep").map(([l])=>l),rename:Object.fromEntries(Object.entries(e(r)).filter(([,l])=>typeof l=="object"&&l!==null&&"rename"in l).map(([l,d])=>[l,d.rename])),fill:{...e(he)}},f=await ze(e(M),s);g.refresh().catch(()=>{}),ge()}catch(s){v(W,s instanceof Error?s.message:String(s),!0)}finally{v(N,!1)}}}function Pe(s){return typeof s=="string"?s:JSON.stringify(s)}const qe=Ue(()=>g.list===null?[]:Object.entries(g.list.byTemplate).map(([s,f])=>({template:s,items:[...f].sort((l,d)=>l.path.localeCompare(d.path))})));var be=_a(),xe=a(be);{var Ae=s=>{var f=va(),l=z(f),d=a(l),ee=o(d,2),ae=a(ee),te=o(l,2);{var le=i=>{var m=aa();n(i,m)},se=i=>{var m=ta(),k=a(m);h(()=>c(k,e(C))),n(i,m)},re=i=>{var m=oa(),k=z(m),R=a(k),O=a(R),I=a(O);{var $=p=>{var x=J();h(()=>c(x,`Before — ${e(u).left.template??""}`)),n(p,x)},D=p=>{var x=J("Before — no snapshot available");n(p,x)};w(I,p=>{e(u).left?p($):p(D,-1)})}var ie=o(O,2),ne=a(ie),oe=o(R,2),G=a(oe),E=a(G),b=o(G,2),H=a(b),S=o(k,2);{var K=p=>{var x=ia(),P=o(a(x),4);U(P,21,()=>e(u).orphans,q=>q.name,(q,t)=>{var y=ra(),V=a(y),ye=a(V),We=a(ye),Ie=o(ye,2),$e=a(Ie),we=o(V,2),ke=a(we),fe=a(ke),Fe=o(ke,2),ue=a(Fe),je=o(Fe,2),de=a(je),De=o(je,2);{var Ge=A=>{var T=sa();U(T,20,()=>e(u).currentTemplateFields,B=>B,(B,me)=>{var Y=la(),He=a(Y),Oe={};h(()=>{c(He,me),Oe!==(Oe=me)&&(Y.value=(Y.__value=me)??"")}),n(B,Y)});var Me;Xe(T),h(()=>{Me!==(Me=e(r)[e(t).name].rename)&&(T.value=(T.__value=e(r)[e(t).name].rename)??"",Ze(T,e(r)[e(t).name].rename))}),j("change",T,B=>v(r,{...e(r),[e(t).name]:{rename:B.currentTarget.value}},!0)),n(A,T)};w(De,A=>{typeof e(r)[e(t).name]=="object"&&e(r)[e(t).name]!==null&&"rename"in e(r)[e(t).name]&&A(Ge)})}h(A=>{c(We,e(t).name),c($e,A),X(we,"aria-label",`Resolution for ${e(t).name}`),X(fe,"name",`d-${e(t).name}`),_e(fe,e(r)[e(t).name]==="drop"),X(ue,"name",`d-${e(t).name}`),_e(ue,e(r)[e(t).name]==="keep"),X(de,"name",`d-${e(t).name}`),_e(de,typeof e(r)[e(t).name]=="object"&&e(r)[e(t).name]!==null&&"rename"in e(r)[e(t).name])},[()=>Pe(e(t).value)]),j("change",fe,()=>v(r,{...e(r),[e(t).name]:"drop"},!0)),j("change",ue,()=>v(r,{...e(r),[e(t).name]:"keep"},!0)),j("change",de,()=>v(r,{...e(r),[e(t).name]:{rename:e(u).currentTemplateFields[0]??""}},!0)),n(q,y)}),n(p,x)};w(S,p=>{e(u).orphans.length>0&&p(K)})}var Q=o(S,2);{var ve=p=>{var x=na(),P=a(x);h(()=>c(P,e(W))),n(p,x)};w(Q,p=>{e(W)&&p(ve)})}var pe=o(Q,2),L=a(pe),ce=a(L);h(()=>{var p;c(ne,((p=e(u).left)==null?void 0:p.html)??"(no snapshot covers this item)"),c(E,`After — ${e(u).right.template??""}`),c(H,e(u).right.html),L.disabled=e(N)||e(u).orphans.length===0,c(ce,e(N)?"Migrating…":"Migrate item")}),j("click",L,Se),n(i,m)};w(te,i=>{e(Z)?i(le):e(C)?i(se,1):e(u)&&i(re,2)})}h(()=>c(ae,e(M))),j("click",d,ge),n(s,f)},Be=s=>{var f=ma(),l=z(f),d=o(a(l),2),ee=a(d),ae=o(l,2);{var te=i=>{var m=pa(),k=a(m);h(()=>c(k,g.error)),n(i,m)},le=i=>{var m=ca();n(i,m)},se=i=>{var m=fa();n(i,m)},re=i=>{var m=Ve(),k=z(m);U(k,17,()=>e(qe),R=>R.template,(R,O)=>{var I=da(),$=a(I),D=a($),ie=a(D),ne=o(D,2),oe=a(ne),G=o($,2);U(G,21,()=>e(O).items,E=>E.path,(E,b)=>{var H=ua(),S=a(H),K=a(S),Q=a(K),ve=a(Q),pe=o(K,2),L=a(pe);{var ce=t=>{var y=J();h(V=>c(y,`${e(b).orphanFields.length??""} orphan field${e(b).orphanFields.length===1?"":"s"}:
4
+ ${V??""}`),[()=>e(b).orphanFields.join(", ")]),n(t,y)};w(L,t=>{e(b).orphanFields.length>0&&t(ce)})}var p=o(L,2);{var x=t=>{var y=J();h(()=>c(y,`· ${e(b).missingRequiredFields.length??""} missing required`)),n(t,y)};w(p,t=>{e(b).missingRequiredFields.length>0&&t(x)})}var P=o(p,2);{var q=t=>{var y=J();h(()=>c(y,`· best-fit: ${e(b).bestFitSnapshot??""}`)),n(t,y)};w(P,t=>{e(b).bestFitSnapshot&&t(q)})}h(()=>c(ve,e(b).path)),j("click",S,()=>Ce(e(b).path)),n(E,H)}),h(()=>{c(ie,e(O).template),c(oe,`${e(O).items.length??""} item${e(O).items.length===1?"":"s"}`)}),n(R,I)}),n(i,m)};w(ae,i=>{g.error?i(te):g.loading&&g.list===null?i(le,1):g.count===0?i(se,2):i(re,-1)})}h(()=>{d.disabled=g.loading,c(ee,g.loading?"Refreshing…":"Refresh")}),j("click",d,()=>g.refresh()),n(s,f)};w(xe,s=>{e(M)!==null?s(Ae):s(Be,-1)})}var Je=o(xe,2);{var Ne=s=>{};w(Je,s=>{!e(M)&&g.list===null&&s(Ne)})}n(Re,be),Qe()}Ye(["click","change"]);export{ga as default};