buckyos 0.7.177 → 0.7.183
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/LICENSE +202 -21
- package/NOTICE +35 -0
- package/README.md +4 -0
- package/cli/deno.json +3 -2
- package/cli/dist/cli.mjs +1725 -301
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/aiws.ts +761 -58
- package/cli/modules/aiws_place.ts +383 -0
- package/cli/modules/aiws_schedule.ts +256 -0
- package/cli/modules/pikg.ts +193 -51
- package/cli/runtime/fs_retry.ts +26 -0
- package/cli/runtime/host.ts +18 -0
- package/cli/runtime/host_deno.ts +51 -2
- package/cli/runtime/host_node.ts +48 -3
- package/cli/runtime/node_entry.ts +1 -0
- package/cli/system_bootstrap.ts +1 -0
- package/cli/system_launcher.ts +1 -0
- package/cli/version.ts +1 -1
- package/dist/aicc_client.d.ts +1 -1
- package/dist/aicc_client.d.ts.map +1 -1
- package/dist/aiworkspace_client.d.ts +253 -2
- package/dist/aiworkspace_client.d.ts.map +1 -1
- package/dist/aiws_bind-3b874f77.mjs +2235 -0
- package/dist/aiws_bind-3b874f77.mjs.map +1 -0
- package/dist/aiws_bind-82bace11.js +2 -0
- package/dist/aiws_bind-82bace11.js.map +1 -0
- package/dist/aiws_bind.d.ts +233 -0
- package/dist/aiws_bind.d.ts.map +1 -0
- package/dist/aiws_ext.cjs +1 -1
- package/dist/aiws_ext.cjs.map +1 -1
- package/dist/aiws_ext.d.ts +9 -5
- package/dist/aiws_ext.d.ts.map +1 -1
- package/dist/aiws_ext.mjs +146 -11
- package/dist/aiws_ext.mjs.map +1 -1
- package/dist/aiws_rrule.d.ts +121 -0
- package/dist/aiws_rrule.d.ts.map +1 -0
- package/dist/aiws_schedule.d.ts +324 -0
- package/dist/aiws_schedule.d.ts.map +1 -0
- package/dist/aiws_write-89b5cc2a.js +13 -0
- package/dist/aiws_write-89b5cc2a.js.map +1 -0
- package/dist/{executor_client-bfc8a1e1.mjs → aiws_write-c2de498e.mjs} +724 -285
- package/dist/aiws_write-c2de498e.mjs.map +1 -0
- package/dist/aiws_write.d.ts +178 -0
- package/dist/aiws_write.d.ts.map +1 -0
- package/dist/app-frame.cjs +1 -1
- package/dist/app-frame.cjs.map +1 -1
- package/dist/app-frame.d.ts +1 -0
- package/dist/app-frame.d.ts.map +1 -1
- package/dist/app-frame.mjs +6 -2
- package/dist/app-frame.mjs.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +4 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +112 -21
- package/dist/browser.mjs.map +1 -1
- package/dist/{content_objid-9232bcaf.mjs → content_objid-a2cafba9.mjs} +2 -2
- package/dist/{content_objid-9232bcaf.mjs.map → content_objid-a2cafba9.mjs.map} +1 -1
- package/dist/content_objid-dff803ff.js +2 -0
- package/dist/{content_objid-1aff74b6.js.map → content_objid-dff803ff.js.map} +1 -1
- package/dist/{did_object_client-7fa36f90.mjs → did_object_client-cb2f9aba.mjs} +2 -2
- package/dist/{did_object_client-7fa36f90.mjs.map → did_object_client-cb2f9aba.mjs.map} +1 -1
- package/dist/executor_client.d.ts +1 -1
- package/dist/executor_client.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +113 -22
- package/dist/index.mjs.map +1 -1
- package/dist/nfsp.cjs.map +1 -1
- package/dist/nfsp.d.ts +2 -1
- package/dist/nfsp.d.ts.map +1 -1
- package/dist/nfsp.mjs.map +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +5 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.mjs +99 -6
- package/dist/node.mjs.map +1 -1
- package/dist/{object_url-f72c1704.mjs → object_url-376c5222.mjs} +4 -4
- package/dist/{object_url-f72c1704.mjs.map → object_url-376c5222.mjs.map} +1 -1
- package/dist/provision.cjs +1 -1
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +48 -16
- package/dist/provision.mjs.map +1 -1
- package/dist/provision_activate.d.ts.map +1 -1
- package/dist/xllm.mjs +2 -2
- package/package.json +5 -4
- package/dist/content_objid-1aff74b6.js +0 -2
- package/dist/executor_client-7ce0ddc7.js +0 -13
- package/dist/executor_client-7ce0ddc7.js.map +0 -1
- package/dist/executor_client-bfc8a1e1.mjs.map +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { type Json, type Op, type RowLike } from './aiws_schedule';
|
|
2
|
+
/** A field of a table as `doc.read` answers it (`content.fields[]`). */
|
|
3
|
+
export interface AiwsFieldRead {
|
|
4
|
+
field_id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
options?: {
|
|
8
|
+
option_id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
currency?: string;
|
|
12
|
+
order_key?: string;
|
|
13
|
+
def_rev?: number;
|
|
14
|
+
}
|
|
15
|
+
/** A table as `doc.read` answers it (`entity_id`, `content.fields`), or `{ entity_id, fields }`. */
|
|
16
|
+
export interface AiwsTableRead {
|
|
17
|
+
entity_id: string;
|
|
18
|
+
content?: {
|
|
19
|
+
fields?: AiwsFieldRead[];
|
|
20
|
+
} | null;
|
|
21
|
+
fields?: AiwsFieldRead[];
|
|
22
|
+
}
|
|
23
|
+
/** A record as `doc.read` with a `table_record` selector answers it (the record is its `content`), the record
|
|
24
|
+
* itself, or the SQL `_record` column (JSON text). */
|
|
25
|
+
export type AiwsRecordRead = RowLike | {
|
|
26
|
+
content: RowLike;
|
|
27
|
+
} | string;
|
|
28
|
+
/** An entity as `doc.read` answers it (the envelope: `meta_rev`, `struct_rev`, `content.key_revs`), or as
|
|
29
|
+
* `doc.read { as: "meta" }` does (`version`). */
|
|
30
|
+
export interface AiwsEntityRead {
|
|
31
|
+
entity_id: string;
|
|
32
|
+
meta_rev?: number;
|
|
33
|
+
struct_rev?: number | null;
|
|
34
|
+
version?: {
|
|
35
|
+
meta_rev?: number;
|
|
36
|
+
struct_rev?: number | null;
|
|
37
|
+
};
|
|
38
|
+
content?: {
|
|
39
|
+
key_revs?: Record<string, number>;
|
|
40
|
+
} | null;
|
|
41
|
+
}
|
|
42
|
+
export interface AiwsBlockState {
|
|
43
|
+
block_id: string;
|
|
44
|
+
hash: string;
|
|
45
|
+
struct_rev: number;
|
|
46
|
+
}
|
|
47
|
+
/** A rich text as `doc.read` answers it: `content.blocks` holds each block's `hash` and `struct_rev`. */
|
|
48
|
+
export interface AiwsRichTextRead {
|
|
49
|
+
entity_id: string;
|
|
50
|
+
content?: {
|
|
51
|
+
blocks?: Record<string, {
|
|
52
|
+
hash: string;
|
|
53
|
+
struct_rev: number;
|
|
54
|
+
}>;
|
|
55
|
+
} | null;
|
|
56
|
+
}
|
|
57
|
+
/** A block as `doc.read` with a `richtext_block` selector answers it (in `content`), or its state itself. */
|
|
58
|
+
export type AiwsBlockRead = AiwsBlockState | {
|
|
59
|
+
content: AiwsBlockState;
|
|
60
|
+
};
|
|
61
|
+
/** The field a key names: its name first, else its field id. */
|
|
62
|
+
export declare function fieldNamed(table: AiwsTableRead, key: string): AiwsFieldRead;
|
|
63
|
+
/** A cell value from its display form (what the body and the SQL display columns show) or its stored form: a select
|
|
64
|
+
* takes its label (or option id), a multi-select an array of them (or `a; b`, or the JSON array text), a number a
|
|
65
|
+
* numeric string, a boolean `true` / `false` / 1 / 0, a decimal a number, a currency `{ amount, currency }`, an amount,
|
|
66
|
+
* or `USD 12.50`, an object reference `{ entity_id }` or an entity id (a path must be resolved first), a json field an
|
|
67
|
+
* object or its JSON text. A `{ "$formula" }` object passes as it is; `null` stays `null` (unset). */
|
|
68
|
+
export declare function cellValue(field: AiwsFieldRead, value: unknown): Json;
|
|
69
|
+
/** `table.insert_records` of rows keyed by field name (or field id), values in display form (`cellValue`). A row's
|
|
70
|
+
* `_id` (when no field is named so) is its record id; one is generated otherwise. */
|
|
71
|
+
export declare function tableInsert(table: AiwsTableRead, rows: Record<string, unknown>[], opts?: {
|
|
72
|
+
newRecordId?: () => string;
|
|
73
|
+
}): Op[];
|
|
74
|
+
/** `table.set_values` / `table.unset_values` (null unsets) of one record, keyed by field name, each cell expected at
|
|
75
|
+
* the rev of `read` — the record as read (`doc.read` with `{ kind: "table_record", record_id }`, or SQL `_record`). */
|
|
76
|
+
export declare function tableSet(table: AiwsTableRead, recordId: string, values: Record<string, unknown>, read: AiwsRecordRead): Op[];
|
|
77
|
+
/** `table.delete_records`, each record expected at the rev it was read with (`reads`: the records as read). */
|
|
78
|
+
export declare function tableDelete(table: AiwsTableRead | string, recordIds: string[], reads: AiwsRecordRead[]): Op[];
|
|
79
|
+
/** A field to add: `options` are labels (or `{ label, option_id? }`) of a select / multi-select. */
|
|
80
|
+
export interface AiwsFieldInput {
|
|
81
|
+
name: string;
|
|
82
|
+
type: string;
|
|
83
|
+
field_id?: string;
|
|
84
|
+
options?: (string | {
|
|
85
|
+
label: string;
|
|
86
|
+
option_id?: string;
|
|
87
|
+
})[];
|
|
88
|
+
required?: boolean;
|
|
89
|
+
nullable?: boolean;
|
|
90
|
+
unique?: boolean;
|
|
91
|
+
description?: string;
|
|
92
|
+
scale?: number;
|
|
93
|
+
currency?: string;
|
|
94
|
+
max_items?: number;
|
|
95
|
+
target_types?: string[];
|
|
96
|
+
}
|
|
97
|
+
/** `table.add_field`: a generated field id (and option ids), placed after the last field; a required field of a table
|
|
98
|
+
* with records needs `backfill` (display form). */
|
|
99
|
+
export declare function fieldAdd(table: AiwsTableRead, def: AiwsFieldInput, opts?: {
|
|
100
|
+
backfill?: unknown;
|
|
101
|
+
}): Op;
|
|
102
|
+
/** `table.add_option`: a new option `label` of a select / multi-select field (by name), expected at the field's
|
|
103
|
+
* `def_rev` as read. */
|
|
104
|
+
export declare function optionAdd(table: AiwsTableRead, field: string, label: string, opts?: {
|
|
105
|
+
option_id?: string;
|
|
106
|
+
index?: number;
|
|
107
|
+
}): Op;
|
|
108
|
+
/** `richtext.insert_blocks` of `markdown` (`markdownToBlocks`) at the end of the document. */
|
|
109
|
+
export declare function textAppend(doc: AiwsRichTextRead | string, markdown: string, opts?: {
|
|
110
|
+
prefix?: string;
|
|
111
|
+
}): Op[];
|
|
112
|
+
/** `richtext.replace_block` of one block by the first block of `markdown` (it keeps the block id), expected at the
|
|
113
|
+
* hash it was read with (`read`, else the document's `content.blocks`); further blocks of `markdown` are inserted
|
|
114
|
+
* after it. */
|
|
115
|
+
export declare function textReplaceBlock(doc: AiwsRichTextRead, blockId: string, markdown: string, read?: AiwsBlockRead, opts?: {
|
|
116
|
+
prefix?: string;
|
|
117
|
+
}): Op[];
|
|
118
|
+
/** `richtext.delete_blocks`, each block expected at the hash and position it was read with. */
|
|
119
|
+
export declare function textDeleteBlocks(doc: AiwsRichTextRead, blockIds: string[], reads?: AiwsBlockRead[]): Op[];
|
|
120
|
+
/** `entity.rename` (null gives the name back to the title rule), expected at the `meta_rev` the entity was read with. */
|
|
121
|
+
export declare function rename(entity: AiwsEntityRead, name: string | null): Op;
|
|
122
|
+
/** `tree.move` under `parentId`, between the order keys `after` and `before` of its new siblings (`after`: the last
|
|
123
|
+
* child's key appends; neither: the parent has no children); expected at the `struct_rev` it was read with, if read. */
|
|
124
|
+
export declare function move(entity: AiwsEntityRead | string, parentId: string, after?: string | null, before?: string | null): Op;
|
|
125
|
+
/** `entity.set_props` of a Block or a container: properties of `config`, `bindings` or `on` (null removes one), each
|
|
126
|
+
* expected at the rev of its cell in `read` (or in `entity`, when it is a read): `content.key_revs["p:<key>.<name>"]`.
|
|
127
|
+
* Without a read the properties merge (no `expect`). */
|
|
128
|
+
export declare function setProps(entity: AiwsEntityRead | string, key: 'config' | 'bindings' | 'on', props: Record<string, unknown>, read?: AiwsEntityRead): Op;
|
|
129
|
+
/** One kRPC call whose business failure (`ok: false`) throws an `AiwsFailure`: an `AiWorkspaceClient`, or a CLI's call. */
|
|
130
|
+
export interface AiwsWriteTransport {
|
|
131
|
+
call<T = Record<string, unknown>>(method: string, params: Record<string, unknown>): Promise<T>;
|
|
132
|
+
}
|
|
133
|
+
export interface AiwsCommitOpsOptions {
|
|
134
|
+
message?: string;
|
|
135
|
+
/** The Workspace epoch (default: `ws.get_info`). */
|
|
136
|
+
epoch?: string;
|
|
137
|
+
idempotencyKey?: string;
|
|
138
|
+
/** Sends of the same request while its result stays unknown (default 3). */
|
|
139
|
+
attempts?: number;
|
|
140
|
+
retryDelayMs?: number;
|
|
141
|
+
partBytes?: number;
|
|
142
|
+
/** Whether a failed send left the result unknown (default: any error but an `AiwsFailure`, the service's answer). */
|
|
143
|
+
isUnknown?: (error: unknown) => boolean;
|
|
144
|
+
}
|
|
145
|
+
export interface AiwsCommitAccepted {
|
|
146
|
+
status: 'accepted';
|
|
147
|
+
commit_id: string;
|
|
148
|
+
seq: number;
|
|
149
|
+
[key: string]: unknown;
|
|
150
|
+
}
|
|
151
|
+
/** Commit `ops` as one Commit: the accepted result, or an `AiwsFailure` — a conflict carries the conflicting cells
|
|
152
|
+
* (`data.conflicts`, as the service answers them), a refusal its errors. A send whose result is unknown (a transport
|
|
153
|
+
* failure or timeout) is looked up with `doc.get_submission` and, if not accepted, sent again with the same
|
|
154
|
+
* idempotency key; a Commit too large for one request goes in parts (`commitWithParts`). */
|
|
155
|
+
export declare function commitOps(client: AiwsWriteTransport, workspace_id: string, ops: Op[], opts?: AiwsCommitOpsOptions): Promise<AiwsCommitAccepted>;
|
|
156
|
+
export interface RichTextMark {
|
|
157
|
+
type: string;
|
|
158
|
+
attrs?: Record<string, Json>;
|
|
159
|
+
}
|
|
160
|
+
export interface RichTextNode {
|
|
161
|
+
type: string;
|
|
162
|
+
attrs?: Record<string, Json>;
|
|
163
|
+
content?: RichTextNode[];
|
|
164
|
+
text?: string;
|
|
165
|
+
marks?: RichTextMark[];
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Markdown → top-level blocks of `buckyos.richtext.basic.v1` (block ids `<prefix>-<n>`; the default prefix is random,
|
|
169
|
+
* so the ids are new in any document). A subset of the core's converter (aiworkspace core/src/markdown.rs, CommonMark +
|
|
170
|
+
* GFM): ATX and setext headings (levels past 3 are 3), paragraphs with soft and hard breaks, bullet and ordered lists
|
|
171
|
+
* (nested by indentation, task markers as ☐ / ☑), fenced code blocks with their language, block quotes, horizontal
|
|
172
|
+
* rules, GFM pipe tables, and inline code, strong, emphasis, strike, links (http, https, mailto, `#`; `[label](entity:
|
|
173
|
+
* <id>)` an object link; other destinations keep their text) and autolinks. Not covered: indented code blocks (their
|
|
174
|
+
* text becomes a paragraph), reference-style links, HTML (kept as text), footnotes, embeds, and CommonMark's finer
|
|
175
|
+
* delimiter and laziness rules. The service validates the result as for any other block.
|
|
176
|
+
*/
|
|
177
|
+
export declare function markdownToBlocks(markdown: string, prefix?: string): RichTextNode[];
|
|
178
|
+
//# sourceMappingURL=aiws_write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiws_write.d.ts","sourceRoot":"","sources":["../src/aiws_write.ts"],"names":[],"mappings":"AASA,OAAO,EAEc,KAAK,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EACpD,MAAM,iBAAiB,CAAA;AAIxB,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,O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CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;CAAE;AAC5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;CACvB;AAwTD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAKlF"}
|
package/dist/app-frame.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./content.cjs");require("./content_mime-dc80d960.js");const t=t=>e.SYSTEM_DIALOG_ERROR_CODES.includes(t)?t:"protocol",i=(e,t,i={})=>({protocol:"buckyos.app-frame",version:1,type:e,payload:t,...i}),o=e=>{if(!e||"object"!=typeof e)return!1;const t=e;return"buckyos.app-frame"===t.protocol&&1===t.version&&"string"==typeof t.type&&!!t.payload&&"object"==typeof t.payload};const n="buckyos.preview-embed",s=(e,t,i=n)=>({protocol:i,version:1,type:e,payload:t}),r=(e,t=n)=>{const i=e;return!!i&&i.protocol===t&&1===i.version&&"string"==typeof i.type&&!!i.payload&&"object"==typeof i.payload},a="/embed/preview";const l="buckyos.sysdlg-embed",d="/embed/sysdlg/select";let c=!1;function p(i,o,n={}){var a,p;if(null==(a=n.signal)?void 0:a.aborted)return Promise.reject(new e.SystemDialogError("closed"));if(c)return Promise.reject(new e.SystemDialogError("busy"));c=!0;const h=new URL(i).origin,u=n.locale??navigator.language??"en",m=n.theme??((null==(p=window.matchMedia)?void 0:p.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"),g=u.toLowerCase().startsWith("zh");return new Promise(((i,a)=>{var p;const y=document.body,f=document.documentElement,w=document.activeElement instanceof HTMLElement?document.activeElement:null,b={x:window.scrollX,y:window.scrollY},v={body:y.getAttribute("style"),html:f.getAttribute("style")},E=Array.from(y.children).filter((e=>e instanceof HTMLElement)).map((e=>({el:e,inert:e.inert,hidden:e.getAttribute("aria-hidden")}))),T=document.createElement("div");let L;T.setAttribute("data-buckyos-sysdlg","select"),T.setAttribute("role","dialog"),T.setAttribute("aria-modal","true"),T.setAttribute("aria-label",g?"文件选择器":"File picker"),T.style.cssText="position:fixed;inset:0;height:100vh;height:100dvh;z-index:2147483647;background:rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center";let k,x="",C=!1;const O=e=>{T.contains(e.target)||(e.stopPropagation(),e.preventDefault())},A=["keydown","pointerdown","mousedown","touchstart","wheel"],S=()=>{var e;return!C&&(C=!0,c=!1,clearTimeout(k),window.removeEventListener("message",M),null==(e=n.signal)||e.removeEventListener("abort",R),"inert"in HTMLElement.prototype||A.forEach((e=>document.removeEventListener(e,O,!0))),T.remove(),E.forEach((({el:e,inert:t,hidden:i})=>{e.inert=t,null===i?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",i)})),null===v.body?y.removeAttribute("style"):y.setAttribute("style",v.body),null===v.html?f.removeAttribute("style"):f.setAttribute("style",v.html),window.scrollTo(b.x,b.y),null==w||w.focus({preventScroll:!0}),!0)},D=t=>{S()&&a(new e.SystemDialogError(t))},R=()=>D("closed"),I=()=>{null==L||L.remove(),L=void 0;const e=document.createElement("div");e.setAttribute("role","alert"),e.style.cssText=`max-width:22rem;margin:1rem;padding:1.25rem;border-radius:16px;font:14px/1.6 system-ui,sans-serif;background:${"dark"===m?"#1f2329":"#fff"};color:${"dark"===m?"#f2f3f5":"#1f2329"};box-shadow:0 24px 64px rgba(0,0,0,.24)`;const t=document.createElement("p");t.style.margin="0 0 1rem",t.textContent=g?"无法加载文件选择器":"Unable to load the file picker";const i=document.createElement("div");i.style.cssText="display:flex;gap:.5rem;justify-content:flex-end";const o=(e,t)=>{const o=document.createElement("button");return o.type="button",o.textContent=e,o.style.cssText="min-height:2.25rem;padding:0 1rem;font:inherit;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer",o.addEventListener("click",t),i.append(o),o};o(g?"取消":"Cancel",(()=>D("load_failed")));const n=o(g?"重试":"Retry",(()=>{e.remove(),U()}));e.append(t,i),T.append(e),n.focus()},U=()=>{x=crypto.randomUUID(),L=document.createElement("iframe"),L.title=g?"文件选择器":"File picker",L.style.cssText="position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;color-scheme:normal",L.setAttribute("allowtransparency","true"),L.addEventListener("error",I),L.src=`${h}${d}#bse=${x}&po=${encodeURIComponent(window.location.origin)}`,T.append(L),k=setTimeout(I,1e4)},M=n=>{var a;if(!L||n.origin!==h||n.source!==L.contentWindow||!r(n.data,l))return;const{type:d,payload:c}=n.data;if("embed.hello"===d){if(c.nonce!==x)return;clearTimeout(k),null==(a=L.contentWindow)||a.postMessage(s("embed.init",{nonce:x,params:o,theme:m,locale:u},l),h),L.focus()}if("embed.error"===d&&D(t(c.code)),"embed.result"===d){const t=e.readSelectDialogResult(c.result,{allowLocal:!0===o.allowLocal});t?(e=>{S()&&i(e)})(t):D("protocol")}};window.addEventListener("message",M),null==(p=n.signal)||p.addEventListener("abort",R,{once:!0}),"inert"in HTMLElement.prototype?E.forEach((({el:e})=>{e.inert=!0})):(E.forEach((({el:e})=>e.setAttribute("aria-hidden","true"))),A.forEach((e=>document.addEventListener(e,O,!0)))),f.style.overflow="hidden",y.style.position="fixed",y.style.top=-b.y+"px",y.style.left=-b.x+"px",y.style.right="0",y.style.overflow="hidden",y.append(T),U()}))}exports.AppFrameClient=class{constructor(e){if(this.options=e,this.listener=e=>{this.receive(e)},this.dialogs=new Map,this.origin=new URL(e.shellOrigin).origin,this.nonce=new URLSearchParams(window.location.hash.slice(1)).get("bfp"),window.addEventListener("message",this.listener),window.parent!==window&&this.nonce){const t=()=>window.parent.postMessage(i("frame.hello",{nonce:this.nonce,appCapabilities:[...e.onOpen?["open"]:[],...e.onBeforeClose?["beforeClose"]:[],...e.onBack?["back"]:[]]}),this.origin);t(),this.helloTimer=setInterval(t,250),this.helloDeadline=setTimeout((()=>clearInterval(this.helloTimer)),1500)}}async receive(n){var s,r,a,l,d,c,p,h,u,m,g,y,f,w;if(n.source!==window.parent||n.origin!==this.origin||!o(n.data))return;const b=n.data,v=b.payload;if("frame.init"===b.type){if(!this.nonce||v.nonce!==this.nonce||"string"!=typeof v.locale||!v.theme||"string"!=typeof v.windowId||v.launch&&!e.isOpenRequest(v.launch))return;return clearInterval(this.helloTimer),clearTimeout(this.helloDeadline),this.init=v,this.title=void 0,this.focused=void 0,void(null==(r=(s=this.options).onInit)||r.call(s,this.init))}if(!this.init)return;if("sysdlg.openResult"===b.type){const i=b.replyTo?this.dialogs.get(b.replyTo):void 0;if(!i)return;if(this.dialogs.delete(b.replyTo),!0!==v.ok)return i.reject(new e.SystemDialogError(t(v.code)));const o=e.readSelectDialogResult(v.result,{allowLocal:i.allowLocal});return void(o?i.resolve(o):i.reject(new e.SystemDialogError("protocol")))}const E=e=>window.parent.postMessage(i(b.type+"Result",e,{replyTo:b.id}),this.origin);try{"frame.open"===b.type&&e.isOpenRequest(v.request)&&E(await(null==(l=(a=this.options).onOpen)?void 0:l.call(a,v.request))??{accepted:!1}),"frame.beforeClose"===b.type&&E({decision:await(null==(c=(d=this.options).onBeforeClose)?void 0:c.call(d,v.reason))??"allow"}),"frame.back"===b.type&&E({handled:await(null==(h=(p=this.options).onBack)?void 0:h.call(p))??!1}),"frame.themeChanged"!==b.type||"dark"!==v.mode&&"light"!==v.mode||null==(m=(u=this.options).onTheme)||m.call(u,v),"frame.localeChanged"===b.type&&"string"==typeof v.locale&&(null==(y=(g=this.options).onLocale)||y.call(g,v.locale)),"frame.focusChanged"===b.type&&this.focused!==(!0===v.focused)&&(this.focused=!0===v.focused,null==(w=(f=this.options).onFocus)||w.call(f,this.focused))}catch{"frame.open"===b.type&&E({accepted:!1,fallback:"preview"}),"frame.beforeClose"===b.type&&E({decision:"deny"})}}send(e,t){this.init&&window.parent.postMessage(i(e,t),this.origin)}setTitle(e,t=!1){const i=JSON.stringify([e,t]);this.init&&i!==this.title&&(this.title=i,this.send("window.setTitle",{title:e,dirty:t}))}requestClose(){this.send("window.requestClose",{})}openContent(t,i="default",o={}){const n=o.hints??{};return this.init?(this.send("content.open",{request:t,target:i,newWindow:!0===o.newWindow,hints:n}),!0):!!this.options.systemOrigin&&(window.open(e.systemOpenUrl(this.options.systemOrigin,{request:t,target:i,hints:n,from:this.options.appId}),"_blank","noopener"),!0)}selectContent(t={},o={}){var n,s;if(this.init){if(!this.init.shellCapabilities.includes(e.SELECT_DIALOG_PATH))return Promise.reject(new e.SystemDialogError("unsupported"));if(this.dialogs.size)return Promise.reject(new e.SystemDialogError("busy"));const o=crypto.randomUUID();return new Promise(((n,s)=>{this.dialogs.set(o,{resolve:n,reject:s,allowLocal:!0===t.allowLocal}),window.parent.postMessage(i("sysdlg.open",{path:e.SELECT_DIALOG_PATH,params:t},{id:o}),this.origin)}))}if(!this.options.systemOrigin)return Promise.reject(new e.SystemDialogError("unsupported"));const r=this.embedAbort=new AbortController;return null==(n=o.signal)||n.addEventListener("abort",(()=>r.abort()),{once:!0}),(null==(s=o.signal)?void 0:s.aborted)&&r.abort(),p(this.options.systemOrigin,t,{...o,signal:r.signal})}dispose(){var t;clearInterval(this.helloTimer),clearTimeout(this.helloDeadline),window.removeEventListener("message",this.listener),this.dialogs.forEach((t=>t.reject(new e.SystemDialogError("closed")))),this.dialogs.clear(),null==(t=this.embedAbort)||t.abort()}},exports.AppFrameHost=class{constructor(e){this.options=e,this.ready=!1,this.capabilities=[],this.pending=new Map,this.listener=e=>this.receive(e),this.opens=[],this.dialogOpen=!1,window.addEventListener("message",this.listener)}async systemDialog(t,o,n){const s=e=>{var o;this.ready&&(null==(o=this.options.target())||o.postMessage(i("sysdlg.openResult",e,{replyTo:t}),this.options.origin))};if(!this.options.onSystemDialog||"string"!=typeof o)return s({ok:!1,code:"unsupported"});if(this.dialogOpen)return s({ok:!1,code:"busy"});this.dialogOpen=!0;try{s(await this.options.onSystemDialog(o,n))}catch(r){s({ok:!1,code:r instanceof e.SystemDialogError?r.code:"closed"})}finally{this.dialogOpen=!1}}receive(t){var i,n,s,r,a,l,d,c;if(t.source!==this.options.target()||t.origin!==this.options.origin||!o(t.data))return;const p=t.data,h=p.payload;if("frame.hello"===p.type){if(h.nonce!==this.options.init.nonce||!Array.isArray(h.appCapabilities))return;return this.ready=!0,this.capabilities=h.appCapabilities.filter((e=>"string"==typeof e)),this.send("frame.init",this.options.init),void 0!==this.focused&&this.send("frame.focusChanged",{focused:this.focused}),void(null==(n=(i=this.options).onReady)||n.call(i))}if(this.ready)if(p.replyTo){const e=this.pending.get(p.replyTo);e&&p.type===e.type+"Result"&&(clearTimeout(e.timer),this.pending.delete(p.replyTo),e.resolve(p.payload))}else if("window.setTitle"===p.type&&"string"==typeof h.title&&(null==(r=(s=this.options).onTitle)||r.call(s,h.title.slice(0,256),!0===h.dirty)),"window.requestClose"===p.type&&(null==(l=(a=this.options).onRequestClose)||l.call(a)),"sysdlg.open"===p.type&&"string"==typeof p.id&&this.systemDialog(p.id,h.path,h.params),"content.open"===p.type&&("default"===h.target||"preview"===h.target||"chooser"===h.target)){const t={...h.request,requestId:crypto.randomUUID()};if(!e.isOpenRequest(t))return;if(this.opens=this.opens.filter((e=>e>Date.now()-1e4)),this.opens.length>=5)return;this.opens.push(Date.now()),null==(c=(d=this.options).onContentOpen)||c.call(d,t,h.target,{newWindow:!0===h.newWindow,hints:e.readContentHints(h.hints)})}}update(e){this.options.init={...this.options.init,...e}}setFocused(e){this.focused!==e&&(this.focused=e,this.send("frame.focusChanged",{focused:e}))}send(e,t){var o;this.ready&&(null==(o=this.options.target())||o.postMessage(i(e,t),this.options.origin))}request(e,t,o=3e3){if(!this.ready)return Promise.reject(new Error("App frame is not ready"));const n=crypto.randomUUID();return new Promise(((s,r)=>{var a;const l=setTimeout((()=>{this.pending.delete(n),r(new Error("App frame timed out"))}),o);this.pending.set(n,{resolve:s,reject:r,timer:l,type:e}),null==(a=this.options.target())||a.postMessage(i(e,t,{id:n}),this.options.origin)}))}async open(e){return this.capabilities.includes("open")?await this.request("frame.open",{request:e}):{accepted:!1}}async beforeClose(e="user"){if(!this.ready||!this.capabilities.includes("beforeClose"))return"allow";const t=await this.request("frame.beforeClose",{reason:e});return"allow"===t.decision||"pending"===t.decision?t.decision:"deny"}async back(){return!!this.capabilities.includes("back")&&!0===(await this.request("frame.back",{})).handled}dispose(){window.removeEventListener("message",this.listener),this.pending.forEach((e=>{clearTimeout(e.timer),e.reject(new Error("App frame disposed"))})),this.pending.clear(),this.ready=!1}},exports.PREVIEW_EMBED_PATH=a,exports.PreviewEmbed=class{constructor(e){this.options=e,this.nonce=crypto.randomUUID(),this.listener=e=>this.receive(e),this.origin=new URL(e.systemOrigin).origin,this.init=e.init,this.url=`${this.origin}${a}#bpe=${this.nonce}&po=${encodeURIComponent(window.location.origin)}`,window.addEventListener("message",this.listener)}post(e,t){var i,o;null==(o=null==(i=this.options.frame())?void 0:i.contentWindow)||o.postMessage(s(e,t),this.origin)}receive(t){var i,o,n,s,a,l,d;if(t.origin!==this.origin||t.source!==(null==(i=this.options.frame())?void 0:i.contentWindow)||!r(t.data))return;const{type:c,payload:p}=t.data;if("embed.hello"!==c){if("embed.state"===c&&("loading"===p.status||"ready"===p.status||"error"===p.status)){const e=p.error;null==(n=(o=this.options).onState)||n.call(o,{status:p.status,error:e&&"string"==typeof e.kind&&"string"==typeof e.code?{kind:e.kind,code:e.code}:void 0,title:"string"==typeof p.title?p.title.slice(0,256):void 0,mediaType:"string"==typeof p.mediaType?p.mediaType.slice(0,128):void 0})}if("embed.openWith"===c){const t=p.request;t&&e.isTransferableRef(t.source)&&(void 0===t.session||e.isTransferableSession(t.session))&&(null==(a=(s=this.options).onOpenWith)||a.call(s,{request:{source:t.source,session:t.session},hints:e.readContentHints(p.hints)}))}"embed.exit"===c&&(null==(d=(l=this.options).onExit)||d.call(l))}else p.nonce===this.nonce&&this.post("embed.init",{...this.init,nonce:this.nonce})}update(e){this.init={...this.init,...e},this.post("embed.update",e)}dispose(){window.removeEventListener("message",this.listener)}},exports.PreviewEmbedHost=class{constructor(e){this.options=e,this.ready=!1,this.listener=e=>this.receive(e);const t=new URLSearchParams(window.location.hash.slice(1));this.nonce=t.get("bpe");let i=null;try{i=new URL(t.get("po")??"").origin}catch{}if(this.parentOrigin=window.parent!==window&&this.nonce&&i&&e.accept(i)?i:null,!this.parentOrigin)return;window.addEventListener("message",this.listener);const o=()=>window.parent.postMessage(s("embed.hello",{nonce:this.nonce}),this.parentOrigin);o(),this.hello=setInterval((()=>{this.ready||o()}),250)}receive(t){var i,o;if(t.source!==window.parent||t.origin!==this.parentOrigin||!r(t.data))return;const{type:n,payload:s}=t.data;if("embed.init"===n){if(s.nonce!==this.nonce||(a=s.source,!(e.isTransferableRef(a)||a&&"object"==typeof a&&"blob"===a.kind&&"undefined"!=typeof Blob&&a.blob instanceof Blob&&"string"==typeof a.name))||void 0!==s.session&&!e.isTransferableSession(s.session)||"string"!=typeof s.locale)return;return this.ready=!0,clearInterval(this.hello),void this.options.onInit({nonce:String(s.nonce),source:s.source,session:s.session,theme:"dark"===s.theme?"dark":"light",locale:s.locale})}var a;if("embed.update"===n&&this.ready){const e={};"dark"!==s.theme&&"light"!==s.theme||(e.theme=s.theme),"string"==typeof s.locale&&(e.locale=s.locale),null==(o=(i=this.options).onUpdate)||o.call(i,e)}}post(e,t){this.ready&&this.parentOrigin&&window.parent.postMessage(s(e,t),this.parentOrigin)}state(e){this.post("embed.state",e)}openWith(e){this.post("embed.openWith",e)}exit(){this.post("embed.exit",{})}dispose(){clearInterval(this.hello),window.removeEventListener("message",this.listener)}},exports.SELECT_EMBED_PATH=d,exports.SelectEmbedHost=class{constructor(e){this.options=e,this.ready=!1,this.listener=e=>this.receive(e);const t=new URLSearchParams(window.location.hash.slice(1));this.nonce=t.get("bse");let i=null;try{i=new URL(t.get("po")??"").origin}catch{}if(this.parentOrigin=window.parent!==window&&this.nonce&&i&&e.accept(i)?i:null,!this.parentOrigin)return;window.addEventListener("message",this.listener);const o=()=>window.parent.postMessage(s("embed.hello",{nonce:this.nonce},l),this.parentOrigin);o(),this.hello=setInterval((()=>{this.ready||o()}),250)}receive(e){if(e.source!==window.parent||e.origin!==this.parentOrigin||!r(e.data,l))return;const{type:t,payload:i}=e.data;"embed.init"!==t||this.ready||i.nonce!==this.nonce||"string"!=typeof i.locale||(this.ready=!0,clearInterval(this.hello),this.options.onInit({nonce:String(i.nonce),params:i.params,theme:"dark"===i.theme?"dark":"light",locale:i.locale}))}post(e,t){this.ready&&this.parentOrigin&&window.parent.postMessage(s(e,t,l),this.parentOrigin)}result(e){this.post("embed.result",{result:e})}error(e){this.post("embed.error",{code:e})}dispose(){clearInterval(this.hello),window.removeEventListener("message",this.listener)}},exports.embedderOrigin=function(e){var t;if(window.parent===window)return null;const i=[null==(t=window.location.ancestorOrigins)?void 0:t[0],document.referrer];for(const o of i)if(o)try{const t=new URL(o).origin;if(e(t))return t}catch{}return null},exports.openSelectEmbed=p,exports.originInZone=(e,t)=>{try{const i=new URL(e);return i.protocol===window.location.protocol&&(i.hostname===t||i.hostname.endsWith(`.${t}`))}catch{return!1}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./content.cjs");require("./content_mime-dc80d960.js");const t=t=>e.SYSTEM_DIALOG_ERROR_CODES.includes(t)?t:"protocol",i=(e,t,i={})=>({protocol:"buckyos.app-frame",version:1,type:e,payload:t,...i}),o=e=>{if(!e||"object"!=typeof e)return!1;const t=e;return"buckyos.app-frame"===t.protocol&&1===t.version&&"string"==typeof t.type&&!!t.payload&&"object"==typeof t.payload};const n="buckyos.preview-embed",s=(e,t,i=n)=>({protocol:i,version:1,type:e,payload:t}),r=(e,t=n)=>{const i=e;return!!i&&i.protocol===t&&1===i.version&&"string"==typeof i.type&&!!i.payload&&"object"==typeof i.payload},a="/embed/preview";const l="buckyos.sysdlg-embed",d="/embed/sysdlg/select";let c=!1;function p(i,o,n={}){var a,p;if(null==(a=n.signal)?void 0:a.aborted)return Promise.reject(new e.SystemDialogError("closed"));if(c)return Promise.reject(new e.SystemDialogError("busy"));c=!0;const h=new URL(i).origin,u=n.locale??navigator.language??"en",m=n.theme??((null==(p=window.matchMedia)?void 0:p.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"),g=u.toLowerCase().startsWith("zh");return new Promise(((i,a)=>{var p;const y=document.body,f=document.documentElement,w=document.activeElement instanceof HTMLElement?document.activeElement:null,b={x:window.scrollX,y:window.scrollY},v={body:y.getAttribute("style"),html:f.getAttribute("style")},E=Array.from(y.children).filter((e=>e instanceof HTMLElement)).map((e=>({el:e,inert:e.inert,hidden:e.getAttribute("aria-hidden")}))),T=document.createElement("div");let L;T.setAttribute("data-buckyos-sysdlg","select"),T.setAttribute("role","dialog"),T.setAttribute("aria-modal","true"),T.setAttribute("aria-label",g?"文件选择器":"File picker"),T.style.cssText="position:fixed;inset:0;height:100vh;height:100dvh;z-index:2147483647;background:rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center";let k,x="",C=!1;const O=e=>{T.contains(e.target)||(e.stopPropagation(),e.preventDefault())},A=["keydown","pointerdown","mousedown","touchstart","wheel"],S=()=>{var e;return!C&&(C=!0,c=!1,clearTimeout(k),window.removeEventListener("message",M),null==(e=n.signal)||e.removeEventListener("abort",R),"inert"in HTMLElement.prototype||A.forEach((e=>document.removeEventListener(e,O,!0))),T.remove(),E.forEach((({el:e,inert:t,hidden:i})=>{e.inert=t,null===i?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",i)})),null===v.body?y.removeAttribute("style"):y.setAttribute("style",v.body),null===v.html?f.removeAttribute("style"):f.setAttribute("style",v.html),window.scrollTo(b.x,b.y),null==w||w.focus({preventScroll:!0}),!0)},D=t=>{S()&&a(new e.SystemDialogError(t))},R=()=>D("closed"),I=()=>{null==L||L.remove(),L=void 0;const e=document.createElement("div");e.setAttribute("role","alert"),e.style.cssText=`max-width:22rem;margin:1rem;padding:1.25rem;border-radius:16px;font:14px/1.6 system-ui,sans-serif;background:${"dark"===m?"#1f2329":"#fff"};color:${"dark"===m?"#f2f3f5":"#1f2329"};box-shadow:0 24px 64px rgba(0,0,0,.24)`;const t=document.createElement("p");t.style.margin="0 0 1rem",t.textContent=g?"无法加载文件选择器":"Unable to load the file picker";const i=document.createElement("div");i.style.cssText="display:flex;gap:.5rem;justify-content:flex-end";const o=(e,t)=>{const o=document.createElement("button");return o.type="button",o.textContent=e,o.style.cssText="min-height:2.25rem;padding:0 1rem;font:inherit;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer",o.addEventListener("click",t),i.append(o),o};o(g?"取消":"Cancel",(()=>D("load_failed")));const n=o(g?"重试":"Retry",(()=>{e.remove(),U()}));e.append(t,i),T.append(e),n.focus()},U=()=>{x=crypto.randomUUID(),L=document.createElement("iframe"),L.title=g?"文件选择器":"File picker",L.style.cssText="position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;color-scheme:normal",L.setAttribute("allowtransparency","true"),L.addEventListener("error",I),L.src=`${h}${d}#bse=${x}&po=${encodeURIComponent(window.location.origin)}`,T.append(L),k=setTimeout(I,1e4)},M=n=>{var a;if(!L||n.origin!==h||n.source!==L.contentWindow||!r(n.data,l))return;const{type:d,payload:c}=n.data;if("embed.hello"===d){if(c.nonce!==x)return;clearTimeout(k),null==(a=L.contentWindow)||a.postMessage(s("embed.init",{nonce:x,params:o,theme:m,locale:u},l),h),L.focus()}if("embed.error"===d&&D(t(c.code)),"embed.result"===d){const t=e.readSelectDialogResult(c.result,{allowLocal:!0===o.allowLocal});t?(e=>{S()&&i(e)})(t):D("protocol")}};window.addEventListener("message",M),null==(p=n.signal)||p.addEventListener("abort",R,{once:!0}),"inert"in HTMLElement.prototype?E.forEach((({el:e})=>{e.inert=!0})):(E.forEach((({el:e})=>e.setAttribute("aria-hidden","true"))),A.forEach((e=>document.addEventListener(e,O,!0)))),f.style.overflow="hidden",y.style.position="fixed",y.style.top=-b.y+"px",y.style.left=-b.x+"px",y.style.right="0",y.style.overflow="hidden",y.append(T),U()}))}exports.AppFrameClient=class{constructor(e){if(this.options=e,this.listener=e=>{this.receive(e)},this.dialogs=new Map,this.origin=new URL(e.shellOrigin).origin,this.nonce=new URLSearchParams(window.location.hash.slice(1)).get("bfp"),window.addEventListener("message",this.listener),window.parent!==window&&this.nonce){const t=()=>window.parent.postMessage(i("frame.hello",{nonce:this.nonce,appCapabilities:[...e.onOpen?["open"]:[],...e.onBeforeClose?["beforeClose"]:[],...e.onBack?["back"]:[]]}),this.origin);t(),this.helloTimer=setInterval(t,250),this.helloDeadline=setTimeout((()=>clearInterval(this.helloTimer)),1500)}}async receive(n){var s,r,a,l,d,c,p,h,u,m,g,y,f,w;if(n.source!==window.parent||n.origin!==this.origin||!o(n.data))return;const b=n.data,v=b.payload;if("frame.init"===b.type){if(!this.nonce||v.nonce!==this.nonce||"string"!=typeof v.locale||!v.theme||"string"!=typeof v.windowId||v.launch&&!e.isOpenRequest(v.launch))return;return clearInterval(this.helloTimer),clearTimeout(this.helloDeadline),this.init=v,this.title=void 0,this.focused=void 0,void(null==(r=(s=this.options).onInit)||r.call(s,this.init))}if(!this.init)return;if("sysdlg.openResult"===b.type){const i=b.replyTo?this.dialogs.get(b.replyTo):void 0;if(!i)return;if(this.dialogs.delete(b.replyTo),!0!==v.ok)return i.reject(new e.SystemDialogError(t(v.code)));const o=e.readSelectDialogResult(v.result,{allowLocal:i.allowLocal});return void(o?i.resolve(o):i.reject(new e.SystemDialogError("protocol")))}const E=e=>window.parent.postMessage(i(b.type+"Result",e,{replyTo:b.id}),this.origin);try{"frame.open"===b.type&&e.isOpenRequest(v.request)&&E(await(null==(l=(a=this.options).onOpen)?void 0:l.call(a,v.request))??{accepted:!1}),"frame.beforeClose"===b.type&&E({decision:await(null==(c=(d=this.options).onBeforeClose)?void 0:c.call(d,v.reason))??"allow"}),"frame.back"===b.type&&E({handled:await(null==(h=(p=this.options).onBack)?void 0:h.call(p))??!1}),"frame.themeChanged"!==b.type||"dark"!==v.mode&&"light"!==v.mode||null==(m=(u=this.options).onTheme)||m.call(u,v),"frame.localeChanged"===b.type&&"string"==typeof v.locale&&(null==(y=(g=this.options).onLocale)||y.call(g,v.locale)),"frame.focusChanged"===b.type&&this.focused!==(!0===v.focused)&&(this.focused=!0===v.focused,null==(w=(f=this.options).onFocus)||w.call(f,this.focused))}catch{"frame.open"===b.type&&E({accepted:!1,fallback:"preview"}),"frame.beforeClose"===b.type&&E({decision:"deny"})}}send(e,t){this.init&&window.parent.postMessage(i(e,t),this.origin)}setTitle(e,t=!1){const i=JSON.stringify([e,t]);this.init&&i!==this.title&&(this.title=i,this.send("window.setTitle",{title:e,dirty:t}))}requestClose(){this.send("window.requestClose",{})}openContent(t,i="default",o={}){const n=o.hints??{};return this.init?(this.send("content.open",{request:t,target:i,newWindow:!0===o.newWindow,hints:n}),!0):!!this.options.systemOrigin&&(window.open(e.systemOpenUrl(this.options.systemOrigin,{request:t,target:i,hints:n,from:this.options.appId}),"_blank","noopener"),!0)}selectContent(t={},o={}){var n,s;if(this.init){if(!this.init.shellCapabilities.includes(e.SELECT_DIALOG_PATH))return Promise.reject(new e.SystemDialogError("unsupported"));if(this.dialogs.size)return Promise.reject(new e.SystemDialogError("busy"));const o=crypto.randomUUID();return new Promise(((n,s)=>{this.dialogs.set(o,{resolve:n,reject:s,allowLocal:!0===t.allowLocal}),window.parent.postMessage(i("sysdlg.open",{path:e.SELECT_DIALOG_PATH,params:t},{id:o}),this.origin)}))}if(!this.options.systemOrigin)return Promise.reject(new e.SystemDialogError("unsupported"));const r=this.embedAbort=new AbortController;return null==(n=o.signal)||n.addEventListener("abort",(()=>r.abort()),{once:!0}),(null==(s=o.signal)?void 0:s.aborted)&&r.abort(),p(this.options.systemOrigin,t,{...o,signal:r.signal})}dispose(){var t;clearInterval(this.helloTimer),clearTimeout(this.helloDeadline),window.removeEventListener("message",this.listener),this.dialogs.forEach((t=>t.reject(new e.SystemDialogError("closed")))),this.dialogs.clear(),null==(t=this.embedAbort)||t.abort()}},exports.AppFrameHost=class{constructor(e){this.options=e,this.ready=!1,this.capabilities=[],this.pending=new Map,this.listener=e=>this.receive(e),this.opens=[],this.dialogOpen=!1,window.addEventListener("message",this.listener)}async systemDialog(t,o,n){const s=e=>{var o;this.ready&&(null==(o=this.options.target())||o.postMessage(i("sysdlg.openResult",e,{replyTo:t}),this.options.origin))};if(!this.options.onSystemDialog||"string"!=typeof o)return s({ok:!1,code:"unsupported"});if(this.dialogOpen)return s({ok:!1,code:"busy"});this.dialogOpen=!0;try{s(await this.options.onSystemDialog(o,n))}catch(r){s({ok:!1,code:r instanceof e.SystemDialogError?r.code:"closed"})}finally{this.dialogOpen=!1}}receive(t){var i,n,s,r,a,l,d,c;if(t.source!==this.options.target()||t.origin!==this.options.origin||!o(t.data))return;const p=t.data,h=p.payload;if("frame.hello"===p.type){if(h.nonce!==this.options.init.nonce||!Array.isArray(h.appCapabilities))return;return this.ready=!0,this.capabilities=h.appCapabilities.filter((e=>"string"==typeof e)),this.send("frame.init",this.options.init),void 0!==this.focused&&this.send("frame.focusChanged",{focused:this.focused}),void(null==(n=(i=this.options).onReady)||n.call(i))}if(this.ready)if(p.replyTo){const e=this.pending.get(p.replyTo);e&&p.type===e.type+"Result"&&(clearTimeout(e.timer),this.pending.delete(p.replyTo),e.resolve(p.payload))}else if("window.setTitle"===p.type&&"string"==typeof h.title&&(null==(r=(s=this.options).onTitle)||r.call(s,h.title.slice(0,256),!0===h.dirty)),"window.requestClose"===p.type&&(null==(l=(a=this.options).onRequestClose)||l.call(a)),"sysdlg.open"===p.type&&"string"==typeof p.id&&this.systemDialog(p.id,h.path,h.params),"content.open"===p.type&&("default"===h.target||"preview"===h.target||"chooser"===h.target)){const t={...h.request,requestId:crypto.randomUUID()};if(!e.isOpenRequest(t))return;if(this.opens=this.opens.filter((e=>e>Date.now()-1e4)),this.opens.length>=5)return;this.opens.push(Date.now()),null==(c=(d=this.options).onContentOpen)||c.call(d,t,h.target,{newWindow:!0===h.newWindow,hints:e.readContentHints(h.hints)})}}update(e){this.options.init={...this.options.init,...e}}setFocused(e){this.focused!==e&&(this.focused=e,this.send("frame.focusChanged",{focused:e}))}send(e,t){var o;this.ready&&(null==(o=this.options.target())||o.postMessage(i(e,t),this.options.origin))}request(e,t,o=3e3){if(!this.ready)return Promise.reject(new Error("App frame is not ready"));const n=crypto.randomUUID();return new Promise(((s,r)=>{var a;const l=setTimeout((()=>{this.pending.delete(n),r(new Error("App frame timed out"))}),o);this.pending.set(n,{resolve:s,reject:r,timer:l,type:e}),null==(a=this.options.target())||a.postMessage(i(e,t,{id:n}),this.options.origin)}))}async open(e){return this.capabilities.includes("open")?await this.request("frame.open",{request:e}):{accepted:!1}}async beforeClose(e="user"){if(!this.ready||!this.capabilities.includes("beforeClose"))return"allow";const t=await this.request("frame.beforeClose",{reason:e});return"allow"===t.decision||"pending"===t.decision?t.decision:"deny"}async back(){return!!this.capabilities.includes("back")&&!0===(await this.request("frame.back",{})).handled}dispose(){window.removeEventListener("message",this.listener),this.pending.forEach((e=>{clearTimeout(e.timer),e.reject(new Error("App frame disposed"))})),this.pending.clear(),this.ready=!1}},exports.PREVIEW_EMBED_PATH=a,exports.PreviewEmbed=class{constructor(e){this.options=e,this.nonce=crypto.randomUUID(),this.listener=e=>this.receive(e),this.ready=!1,this.origin=new URL(e.systemOrigin).origin,this.init=e.init,this.url=`${this.origin}${a}#bpe=${this.nonce}&po=${encodeURIComponent(window.location.origin)}`,window.addEventListener("message",this.listener)}post(e,t){var i,o;null==(o=null==(i=this.options.frame())?void 0:i.contentWindow)||o.postMessage(s(e,t),this.origin)}receive(t){var i,o,n,s,a,l,d;if(t.origin!==this.origin||t.source!==(null==(i=this.options.frame())?void 0:i.contentWindow)||!r(t.data))return;const{type:c,payload:p}=t.data;if("embed.hello"!==c){if("embed.state"===c&&("loading"===p.status||"ready"===p.status||"error"===p.status)){const e=p.error;null==(n=(o=this.options).onState)||n.call(o,{status:p.status,error:e&&"string"==typeof e.kind&&"string"==typeof e.code?{kind:e.kind,code:e.code}:void 0,title:"string"==typeof p.title?p.title.slice(0,256):void 0,mediaType:"string"==typeof p.mediaType?p.mediaType.slice(0,128):void 0})}if("embed.openWith"===c){const t=p.request;t&&e.isTransferableRef(t.source)&&(void 0===t.session||e.isTransferableSession(t.session))&&(null==(a=(s=this.options).onOpenWith)||a.call(s,{request:{source:t.source,session:t.session},hints:e.readContentHints(p.hints)}))}"embed.exit"===c&&(null==(d=(l=this.options).onExit)||d.call(l))}else p.nonce===this.nonce&&(this.ready=!0,this.post("embed.init",{...this.init,nonce:this.nonce}))}update(e){this.init={...this.init,...e},this.ready&&this.post("embed.update",e)}dispose(){window.removeEventListener("message",this.listener)}},exports.PreviewEmbedHost=class{constructor(e){this.options=e,this.ready=!1,this.listener=e=>this.receive(e);const t=new URLSearchParams(window.location.hash.slice(1));this.nonce=t.get("bpe");let i=null;try{i=new URL(t.get("po")??"").origin}catch{}if(this.parentOrigin=window.parent!==window&&this.nonce&&i&&e.accept(i)?i:null,!this.parentOrigin)return;window.addEventListener("message",this.listener);const o=()=>window.parent.postMessage(s("embed.hello",{nonce:this.nonce}),this.parentOrigin);o(),this.hello=setInterval((()=>{this.ready||o()}),250)}receive(t){var i,o;if(t.source!==window.parent||t.origin!==this.parentOrigin||!r(t.data))return;const{type:n,payload:s}=t.data;if("embed.init"===n){if(s.nonce!==this.nonce||(a=s.source,!(e.isTransferableRef(a)||a&&"object"==typeof a&&"blob"===a.kind&&"undefined"!=typeof Blob&&a.blob instanceof Blob&&"string"==typeof a.name))||void 0!==s.session&&!e.isTransferableSession(s.session)||"string"!=typeof s.locale)return;return this.ready=!0,clearInterval(this.hello),void this.options.onInit({nonce:String(s.nonce),source:s.source,session:s.session,theme:"dark"===s.theme?"dark":"light",locale:s.locale})}var a;if("embed.update"===n&&this.ready){const e={};"dark"!==s.theme&&"light"!==s.theme||(e.theme=s.theme),"string"==typeof s.locale&&(e.locale=s.locale),null==(o=(i=this.options).onUpdate)||o.call(i,e)}}post(e,t){this.ready&&this.parentOrigin&&window.parent.postMessage(s(e,t),this.parentOrigin)}state(e){this.post("embed.state",e)}openWith(e){this.post("embed.openWith",e)}exit(){this.post("embed.exit",{})}dispose(){clearInterval(this.hello),window.removeEventListener("message",this.listener)}},exports.SELECT_EMBED_PATH=d,exports.SelectEmbedHost=class{constructor(e){this.options=e,this.ready=!1,this.listener=e=>this.receive(e);const t=new URLSearchParams(window.location.hash.slice(1));this.nonce=t.get("bse");let i=null;try{i=new URL(t.get("po")??"").origin}catch{}if(this.parentOrigin=window.parent!==window&&this.nonce&&i&&e.accept(i)?i:null,!this.parentOrigin)return;window.addEventListener("message",this.listener);const o=()=>window.parent.postMessage(s("embed.hello",{nonce:this.nonce},l),this.parentOrigin);o(),this.hello=setInterval((()=>{this.ready||o()}),250)}receive(e){if(e.source!==window.parent||e.origin!==this.parentOrigin||!r(e.data,l))return;const{type:t,payload:i}=e.data;"embed.init"!==t||this.ready||i.nonce!==this.nonce||"string"!=typeof i.locale||(this.ready=!0,clearInterval(this.hello),this.options.onInit({nonce:String(i.nonce),params:i.params,theme:"dark"===i.theme?"dark":"light",locale:i.locale}))}post(e,t){this.ready&&this.parentOrigin&&window.parent.postMessage(s(e,t,l),this.parentOrigin)}result(e){this.post("embed.result",{result:e})}error(e){this.post("embed.error",{code:e})}dispose(){clearInterval(this.hello),window.removeEventListener("message",this.listener)}},exports.embedderOrigin=function(e){var t;if(window.parent===window)return null;const i=[null==(t=window.location.ancestorOrigins)?void 0:t[0],document.referrer];for(const o of i)if(o)try{const t=new URL(o).origin;if(e(t))return t}catch{}return null},exports.openSelectEmbed=p,exports.originInZone=(e,t)=>{try{const i=new URL(e);return i.protocol===window.location.protocol&&(i.hostname===t||i.hostname.endsWith(`.${t}`))}catch{return!1}};
|
|
2
2
|
//# sourceMappingURL=app-frame.cjs.map
|
package/dist/app-frame.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-frame.cjs","sources":["../src/app-frame.ts"],"sourcesContent":["import { isOpenRequest, isTransferableRef, isTransferableSession, readContentHints, readSelectDialogResult, systemOpenUrl, SELECT_DIALOG_PATH, SystemDialogError, SYSTEM_DIALOG_ERROR_CODES, type ContentHints, type ContentOpenTarget, type OpenRequest, type SelectDialogParams, type SelectDialogResult, type SystemDialogErrorCode, type TransferableContentRef, type TransferableSessionContext } from './content'\nexport type SystemDialogReply = { ok: true; result: unknown } | { ok: false; code: SystemDialogErrorCode }\nconst dialogErrorCode = (value: unknown): SystemDialogErrorCode =>\n SYSTEM_DIALOG_ERROR_CODES.includes(value as SystemDialogErrorCode) ? value as SystemDialogErrorCode : 'protocol'\nexport interface AppFrameMessage<T extends string = string, P = unknown> {\n protocol: 'buckyos.app-frame'; version: 1; type: T; id?: string; replyTo?: string; payload: P\n}\nexport interface FrameInit {\n nonce: string\n windowId: string\n formFactor: 'desktop' | 'mobile'\n theme: { mode: 'light' | 'dark'; accent?: string }\n locale: string\n launch?: OpenRequest\n shellCapabilities: string[]\n}\nexport type CloseDecision = 'allow' | 'deny' | 'pending'\nconst envelope = (type: string, payload: unknown, extra: { id?: string; replyTo?: string } = {}): AppFrameMessage =>\n ({ protocol: 'buckyos.app-frame', version: 1, type, payload, ...extra })\nconst isMessage = (value: unknown): value is AppFrameMessage => {\n if (!value || typeof value !== 'object') return false\n const v = value as AppFrameMessage\n return v.protocol === 'buckyos.app-frame' && v.version === 1 && typeof v.type === 'string' && !!v.payload && typeof v.payload === 'object'\n}\nexport class AppFrameHost {\n ready = false\n capabilities: string[] = []\n private pending = new Map<string, { resolve: (v: unknown) => void; reject: (e: Error) => void; timer: ReturnType<typeof setTimeout>; type: string }>()\n private listener = (event: MessageEvent) => this.receive(event)\n private opens: number[] = []\n constructor(private options: {\n target: () => Window | null; origin: string; init: FrameInit\n onReady?: () => void\n onTitle?: (title: string, dirty: boolean) => void\n onRequestClose?: () => void\n onContentOpen?: (request: OpenRequest, target: ContentOpenTarget, options: { newWindow: boolean; hints: ContentHints }) => void\n /** Shows a system dialog the App asked for (`sysdlg.open`). `params` is untrusted input: validate it. */\n onSystemDialog?: (path: string, params: unknown) => Promise<SystemDialogReply>\n }) { window.addEventListener('message', this.listener) }\n private focused?: boolean\n private dialogOpen = false\n private async systemDialog(id: string, path: unknown, params: unknown): Promise<void> {\n const reply = (payload: SystemDialogReply) => { if (this.ready) this.options.target()?.postMessage(envelope('sysdlg.openResult', payload, { replyTo: id }), this.options.origin) }\n if (!this.options.onSystemDialog || typeof path !== 'string') return reply({ ok: false, code: 'unsupported' })\n if (this.dialogOpen) return reply({ ok: false, code: 'busy' })\n this.dialogOpen = true\n try { reply(await this.options.onSystemDialog(path, params)) }\n catch (error) { reply({ ok: false, code: error instanceof SystemDialogError ? error.code : 'closed' }) }\n finally { this.dialogOpen = false }\n }\n private receive(event: MessageEvent): void {\n if (event.source !== this.options.target() || event.origin !== this.options.origin || !isMessage(event.data)) return\n const m = event.data\n const p = m.payload as Record<string, unknown>\n if (m.type === 'frame.hello') {\n if (p.nonce !== this.options.init.nonce || !Array.isArray(p.appCapabilities)) return\n this.ready = true\n this.capabilities = p.appCapabilities.filter((c): c is string => typeof c === 'string')\n this.send('frame.init', this.options.init)\n if (this.focused !== undefined) this.send('frame.focusChanged', { focused: this.focused })\n this.options.onReady?.()\n return\n }\n if (!this.ready) return\n if (m.replyTo) {\n const pending = this.pending.get(m.replyTo)\n if (pending && m.type === pending.type + 'Result') {\n clearTimeout(pending.timer); this.pending.delete(m.replyTo); pending.resolve(m.payload)\n }\n return\n }\n if (m.type === 'window.setTitle' && typeof p.title === 'string') this.options.onTitle?.(p.title.slice(0, 256), p.dirty === true)\n if (m.type === 'window.requestClose') this.options.onRequestClose?.()\n if (m.type === 'sysdlg.open' && typeof m.id === 'string') void this.systemDialog(m.id, p.path, p.params)\n if (m.type === 'content.open' && (p.target === 'default' || p.target === 'preview' || p.target === 'chooser')) {\n const request = { ...(p.request as object), requestId: crypto.randomUUID() }\n if (!isOpenRequest(request)) return\n this.opens = this.opens.filter(t => t > Date.now() - 10000)\n if (this.opens.length >= 5) return\n this.opens.push(Date.now())\n this.options.onContentOpen?.(request, p.target, { newWindow: p.newWindow === true, hints: readContentHints(p.hints) })\n }\n }\n update(init: Partial<FrameInit>): void { this.options.init = { ...this.options.init, ...init } }\n /** Reports whether the App's window is the focused one; only a change is sent. */\n setFocused(focused: boolean): void {\n if (this.focused === focused) return\n this.focused = focused\n this.send('frame.focusChanged', { focused })\n }\n send(type: string, payload: unknown): void {\n if (this.ready) this.options.target()?.postMessage(envelope(type, payload), this.options.origin)\n }\n request(type: string, payload: unknown, timeout = 3000): Promise<unknown> {\n if (!this.ready) return Promise.reject(new Error('App frame is not ready'))\n const id = crypto.randomUUID()\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => { this.pending.delete(id); reject(new Error('App frame timed out')) }, timeout)\n this.pending.set(id, { resolve, reject, timer, type })\n this.options.target()?.postMessage(envelope(type, payload, { id }), this.options.origin)\n })\n }\n async open(request: OpenRequest): Promise<{ accepted: boolean; fallback?: 'preview' }> {\n if (!this.capabilities.includes('open')) return { accepted: false }\n return await this.request('frame.open', { request }) as { accepted: boolean; fallback?: 'preview' }\n }\n async beforeClose(reason: 'user' | 'logout' | 'shell' = 'user'): Promise<CloseDecision> {\n if (!this.ready || !this.capabilities.includes('beforeClose')) return 'allow'\n const r = await this.request('frame.beforeClose', { reason }) as { decision?: CloseDecision }\n return r.decision === 'allow' || r.decision === 'pending' ? r.decision : 'deny'\n }\n async back(): Promise<boolean> {\n if (!this.capabilities.includes('back')) return false\n return (await this.request('frame.back', {}) as { handled?: boolean }).handled === true\n }\n dispose(): void {\n window.removeEventListener('message', this.listener)\n this.pending.forEach(p => { clearTimeout(p.timer); p.reject(new Error('App frame disposed')) })\n this.pending.clear(); this.ready = false\n }\n}\n/**\n * Origin of the window embedding this page, when `accept` admits it. `location.ancestorOrigins` names the real\n * parent even after the frame navigated through other pages (a sign-in round trip); the referrer is the fallback.\n */\nexport function embedderOrigin(accept: (origin: string) => boolean): string | null {\n if (window.parent === window) return null\n const candidates = [window.location.ancestorOrigins?.[0], document.referrer]\n for (const candidate of candidates) {\n if (!candidate) continue\n try {\n const origin = new URL(candidate).origin\n if (accept(origin)) return origin\n } catch {}\n }\n return null\n}\nexport const originInZone = (origin: string, zoneHost: string): boolean => {\n try {\n const url = new URL(origin)\n return url.protocol === window.location.protocol && (url.hostname === zoneHost || url.hostname.endsWith(`.${zoneHost}`))\n } catch { return false }\n}\nexport class AppFrameClient {\n init?: FrameInit\n private title?: string\n private focused?: boolean\n private helloTimer?: ReturnType<typeof setInterval>\n private helloDeadline?: ReturnType<typeof setTimeout>\n private readonly nonce: string | null\n private readonly origin: string\n private readonly listener = (event: MessageEvent) => { void this.receive(event) }\n private dialogs = new Map<string, { resolve: (result: SelectDialogResult) => void; reject: (error: Error) => void; allowLocal: boolean }>()\n private embedAbort?: AbortController\n constructor(private options: {\n shellOrigin: string\n /** The Zone's system entry (its root origin): where content is opened when this page is not embedded in the shell. */\n systemOrigin?: string\n /** This App's id, so the system does not offer the content back to it. */\n appId?: string\n onInit?: (init: FrameInit) => void\n onOpen?: (request: OpenRequest) => Promise<{ accepted: boolean; fallback?: 'preview' }> | { accepted: boolean; fallback?: 'preview' }\n onBeforeClose?: (reason: 'user' | 'logout' | 'shell') => Promise<CloseDecision> | CloseDecision\n onBack?: () => Promise<boolean> | boolean\n onTheme?: (theme: FrameInit['theme']) => void\n onLocale?: (locale: string) => void\n onFocus?: (focused: boolean) => void\n }) {\n this.origin = new URL(options.shellOrigin).origin\n this.nonce = new URLSearchParams(window.location.hash.slice(1)).get('bfp')\n window.addEventListener('message', this.listener)\n if (window.parent !== window && this.nonce) {\n const hello = () => window.parent.postMessage(envelope('frame.hello', { nonce: this.nonce, appCapabilities: [\n ...options.onOpen ? ['open'] : [], ...options.onBeforeClose ? ['beforeClose'] : [], ...options.onBack ? ['back'] : [],\n ] }), this.origin)\n hello()\n this.helloTimer = setInterval(hello, 250)\n this.helloDeadline = setTimeout(() => clearInterval(this.helloTimer), 1500)\n }\n }\n private async receive(event: MessageEvent): Promise<void> {\n if (event.source !== window.parent || event.origin !== this.origin || !isMessage(event.data)) return\n const m = event.data\n const p = m.payload as Record<string, unknown>\n if (m.type === 'frame.init') {\n if (!this.nonce || p.nonce !== this.nonce || typeof p.locale !== 'string' || !p.theme || typeof p.windowId !== 'string' || p.launch && !isOpenRequest(p.launch)) return\n clearInterval(this.helloTimer); clearTimeout(this.helloDeadline)\n this.init = p as unknown as FrameInit\n this.title = undefined; this.focused = undefined\n this.options.onInit?.(this.init)\n return\n }\n if (!this.init) return\n if (m.type === 'sysdlg.openResult') {\n const pending = m.replyTo ? this.dialogs.get(m.replyTo) : undefined\n if (!pending) return\n this.dialogs.delete(m.replyTo!)\n if (p.ok !== true) return pending.reject(new SystemDialogError(dialogErrorCode(p.code)))\n const result = readSelectDialogResult(p.result, { allowLocal: pending.allowLocal })\n if (result) pending.resolve(result)\n else pending.reject(new SystemDialogError('protocol'))\n return\n }\n const reply = (payload: unknown) => window.parent.postMessage(envelope(m.type + 'Result', payload, { replyTo: m.id }), this.origin)\n try {\n if (m.type === 'frame.open' && isOpenRequest(p.request)) reply(await this.options.onOpen?.(p.request) ?? { accepted: false })\n if (m.type === 'frame.beforeClose') reply({ decision: await this.options.onBeforeClose?.(p.reason as 'user') ?? 'allow' })\n if (m.type === 'frame.back') reply({ handled: await this.options.onBack?.() ?? false })\n if (m.type === 'frame.themeChanged' && (p.mode === 'dark' || p.mode === 'light')) this.options.onTheme?.(p as FrameInit['theme'])\n if (m.type === 'frame.localeChanged' && typeof p.locale === 'string') this.options.onLocale?.(p.locale)\n if (m.type === 'frame.focusChanged' && this.focused !== (p.focused === true)) { this.focused = p.focused === true; this.options.onFocus?.(this.focused) }\n } catch {\n if (m.type === 'frame.open') reply({ accepted: false, fallback: 'preview' })\n if (m.type === 'frame.beforeClose') reply({ decision: 'deny' })\n }\n }\n send(type: string, payload: unknown): void {\n if (this.init) window.parent.postMessage(envelope(type, payload), this.origin)\n }\n setTitle(title: string, dirty = false): void {\n const key = JSON.stringify([title, dirty])\n if (!this.init || key === this.title) return\n this.title = key\n this.send('window.setTitle', { title, dirty })\n }\n requestClose(): void { this.send('window.requestClose', {}) }\n /**\n * Asks the system to open content: with its default app, in Preview, or by letting the user choose (`chooser`).\n * Embedded in the shell the request goes over the frame; in a standalone tab it opens the Zone's system entry\n * (`systemOrigin`) in a new tab. Returns false when neither is available.\n */\n openContent(request: Omit<OpenRequest, 'requestId'>, target: ContentOpenTarget = 'default', options: { newWindow?: boolean; hints?: ContentHints } = {}): boolean {\n const hints = options.hints ?? {}\n if (this.init) { this.send('content.open', { request, target, newWindow: options.newWindow === true, hints }); return true }\n if (!this.options.systemOrigin) return false\n window.open(systemOpenUrl(this.options.systemOrigin, { request, target, hints, from: this.options.appId }), '_blank', 'noopener')\n return true\n }\n /**\n * Shows the system file picker (`sysdlg/select`) and resolves with what the user chose; cancelling resolves with\n * `{ action: 'cancelled' }`. Embedded in the shell the shell draws the dialog over this App's window; in a\n * standalone tab the picker page of the Zone's system entry (`systemOrigin`) is framed over this page. Rejects\n * with a `SystemDialogError` when no picker is available or the request did not complete.\n */\n selectContent(params: SelectDialogParams = {}, options: { signal?: AbortSignal; theme?: 'light' | 'dark'; locale?: string } = {}): Promise<SelectDialogResult> {\n if (this.init) {\n if (!this.init.shellCapabilities.includes(SELECT_DIALOG_PATH)) return Promise.reject(new SystemDialogError('unsupported'))\n if (this.dialogs.size) return Promise.reject(new SystemDialogError('busy'))\n const id = crypto.randomUUID()\n return new Promise((resolve, reject) => {\n this.dialogs.set(id, { resolve, reject, allowLocal: params.allowLocal === true })\n window.parent.postMessage(envelope('sysdlg.open', { path: SELECT_DIALOG_PATH, params }, { id }), this.origin)\n })\n }\n if (!this.options.systemOrigin) return Promise.reject(new SystemDialogError('unsupported'))\n const abort = this.embedAbort = new AbortController()\n options.signal?.addEventListener('abort', () => abort.abort(), { once: true })\n if (options.signal?.aborted) abort.abort()\n return openSelectEmbed(this.options.systemOrigin, params, { ...options, signal: abort.signal })\n }\n dispose(): void {\n clearInterval(this.helloTimer); clearTimeout(this.helloDeadline); window.removeEventListener('message', this.listener)\n this.dialogs.forEach(pending => pending.reject(new SystemDialogError('closed')))\n this.dialogs.clear(); this.embedAbort?.abort()\n }\n}\n\n/**\n * Preview embed protocol (`buckyos.preview-embed` v1): an App shows the system Preview component inside its own UI.\n * The App frames `<systemOrigin>/embed/preview` (component only, no shell) and hands it a content reference; the\n * system page reads the content with its own Zone-root session, so no token crosses origins. Open With goes back\n * through the App to the shell (`AppFrameClient.openContent(…, 'chooser')`).\n */\nexport type PreviewEmbedSource = TransferableContentRef | { kind: 'blob'; blob: Blob; name: string }\nexport interface PreviewEmbedInit {\n nonce: string\n source: PreviewEmbedSource\n session?: TransferableSessionContext\n theme: 'light' | 'dark'\n locale: string\n}\nexport interface PreviewEmbedState {\n status: 'loading' | 'ready' | 'error'\n /** Preview error kind (`unsupported`, `not-found`, `permission-denied`, `timeout`, `error`, …) and code. */\n error?: { kind: string; code: string }\n title?: string\n mediaType?: string\n}\nexport interface PreviewEmbedOpenWith { request: Omit<OpenRequest, 'requestId'>; hints: ContentHints }\nconst PREVIEW_EMBED = 'buckyos.preview-embed'\nconst embedEnvelope = (type: string, payload: unknown, protocol = PREVIEW_EMBED) => ({ protocol, version: 1, type, payload })\nconst isEmbedMessage = (value: unknown, protocol = PREVIEW_EMBED): value is { type: string; payload: Record<string, unknown> } => {\n const v = value as { protocol?: unknown; version?: unknown; type?: unknown; payload?: unknown } | null\n return !!v && v.protocol === protocol && v.version === 1 && typeof v.type === 'string' && !!v.payload && typeof v.payload === 'object'\n}\nconst isEmbedSource = (value: unknown): value is PreviewEmbedSource =>\n isTransferableRef(value) || (!!value && typeof value === 'object' && (value as { kind?: unknown }).kind === 'blob' &&\n typeof Blob !== 'undefined' && (value as { blob?: unknown }).blob instanceof Blob && typeof (value as { name?: unknown }).name === 'string')\nexport const PREVIEW_EMBED_PATH = '/embed/preview'\n\n/** App side: owns the iframe that shows the system Preview. */\nexport class PreviewEmbed {\n readonly url: string\n private readonly nonce = crypto.randomUUID()\n private readonly origin: string\n private readonly listener = (event: MessageEvent) => this.receive(event)\n private init: Omit<PreviewEmbedInit, 'nonce'>\n constructor(private options: {\n systemOrigin: string\n frame: () => HTMLIFrameElement | null\n init: Omit<PreviewEmbedInit, 'nonce'>\n onState?: (state: PreviewEmbedState) => void\n onOpenWith?: (open: PreviewEmbedOpenWith) => void\n onExit?: () => void\n }) {\n this.origin = new URL(options.systemOrigin).origin\n this.init = options.init\n this.url = `${this.origin}${PREVIEW_EMBED_PATH}#bpe=${this.nonce}&po=${encodeURIComponent(window.location.origin)}`\n window.addEventListener('message', this.listener)\n }\n private post(type: string, payload: unknown): void {\n this.options.frame()?.contentWindow?.postMessage(embedEnvelope(type, payload), this.origin)\n }\n private receive(event: MessageEvent): void {\n if (event.origin !== this.origin || event.source !== this.options.frame()?.contentWindow || !isEmbedMessage(event.data)) return\n const { type, payload: p } = event.data\n if (type === 'embed.hello') { if (p.nonce === this.nonce) this.post('embed.init', { ...this.init, nonce: this.nonce }); return }\n if (type === 'embed.state' && (p.status === 'loading' || p.status === 'ready' || p.status === 'error')) {\n const error = p.error as { kind?: unknown; code?: unknown } | undefined\n this.options.onState?.({ status: p.status,\n error: error && typeof error.kind === 'string' && typeof error.code === 'string' ? { kind: error.kind, code: error.code } : undefined,\n title: typeof p.title === 'string' ? p.title.slice(0, 256) : undefined, mediaType: typeof p.mediaType === 'string' ? p.mediaType.slice(0, 128) : undefined })\n }\n if (type === 'embed.openWith') {\n const request = p.request as Omit<OpenRequest, 'requestId'> | undefined\n if (request && isTransferableRef(request.source) && (request.session === undefined || isTransferableSession(request.session))) {\n this.options.onOpenWith?.({ request: { source: request.source, session: request.session }, hints: readContentHints(p.hints) })\n }\n }\n if (type === 'embed.exit') this.options.onExit?.()\n }\n update(patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>>): void {\n this.init = { ...this.init, ...patch }\n this.post('embed.update', patch)\n }\n dispose(): void { window.removeEventListener('message', this.listener) }\n}\n\n/** System side: the component-only page at `PREVIEW_EMBED_PATH`. Accepts one embedding App whose origin `accept` admits. */\nexport class PreviewEmbedHost {\n readonly parentOrigin: string | null\n private readonly nonce: string | null\n private ready = false\n private readonly hello?: ReturnType<typeof setInterval>\n private readonly listener = (event: MessageEvent) => this.receive(event)\n constructor(private options: {\n accept: (origin: string) => boolean\n onInit: (init: PreviewEmbedInit) => void\n onUpdate?: (patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>>) => void\n }) {\n const params = new URLSearchParams(window.location.hash.slice(1))\n this.nonce = params.get('bpe')\n let parentOrigin: string | null = null\n try { parentOrigin = new URL(params.get('po') ?? '').origin } catch {}\n this.parentOrigin = window.parent !== window && this.nonce && parentOrigin && options.accept(parentOrigin) ? parentOrigin : null\n if (!this.parentOrigin) return\n window.addEventListener('message', this.listener)\n const hello = () => window.parent.postMessage(embedEnvelope('embed.hello', { nonce: this.nonce }), this.parentOrigin!)\n hello()\n this.hello = setInterval(() => { if (!this.ready) hello() }, 250)\n }\n private receive(event: MessageEvent): void {\n if (event.source !== window.parent || event.origin !== this.parentOrigin || !isEmbedMessage(event.data)) return\n const { type, payload: p } = event.data\n if (type === 'embed.init') {\n if (p.nonce !== this.nonce || !isEmbedSource(p.source) || (p.session !== undefined && !isTransferableSession(p.session)) || typeof p.locale !== 'string') return\n this.ready = true; clearInterval(this.hello)\n this.options.onInit({ nonce: String(p.nonce), source: p.source, session: p.session as TransferableSessionContext | undefined, theme: p.theme === 'dark' ? 'dark' : 'light', locale: p.locale })\n return\n }\n if (type === 'embed.update' && this.ready) {\n const patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>> = {}\n if (p.theme === 'dark' || p.theme === 'light') patch.theme = p.theme\n if (typeof p.locale === 'string') patch.locale = p.locale\n this.options.onUpdate?.(patch)\n }\n }\n private post(type: string, payload: unknown): void {\n if (this.ready && this.parentOrigin) window.parent.postMessage(embedEnvelope(type, payload), this.parentOrigin)\n }\n state(state: PreviewEmbedState): void { this.post('embed.state', state) }\n openWith(open: PreviewEmbedOpenWith): void { this.post('embed.openWith', open) }\n exit(): void { this.post('embed.exit', {}) }\n dispose(): void { clearInterval(this.hello); window.removeEventListener('message', this.listener) }\n}\n\n/**\n * System dialog embed protocol (`buckyos.sysdlg-embed` v1): a standalone App page (no shell) shows the system file\n * picker by framing `<systemOrigin>/embed/sysdlg/select` over itself. The handshake is the Preview embed's\n * (`embed.hello` → `embed.init`); the system page browses with its own Zone-root session and answers with\n * `embed.result`. No token crosses origins, and every message names its exact target origin.\n */\nconst SYSDLG_EMBED = 'buckyos.sysdlg-embed'\nexport const SELECT_EMBED_PATH = '/embed/sysdlg/select'\nexport interface SelectEmbedInit { nonce: string; params: unknown; theme: 'light' | 'dark'; locale: string }\nlet selectEmbedOpen = false\n\n/** App side of `buckyos.sysdlg-embed`: the full-page layer that frames the picker. One at a time per page. */\nexport function openSelectEmbed(systemOrigin: string, params: SelectDialogParams, options: { signal?: AbortSignal; theme?: 'light' | 'dark'; locale?: string } = {}): Promise<SelectDialogResult> {\n if (options.signal?.aborted) return Promise.reject(new SystemDialogError('closed'))\n if (selectEmbedOpen) return Promise.reject(new SystemDialogError('busy'))\n selectEmbedOpen = true\n const origin = new URL(systemOrigin).origin\n const locale = options.locale ?? navigator.language ?? 'en'\n const theme = options.theme ?? (window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n const zh = locale.toLowerCase().startsWith('zh')\n return new Promise((resolve, reject) => {\n const body = document.body\n const html = document.documentElement\n const focused = document.activeElement instanceof HTMLElement ? document.activeElement : null\n const scroll = { x: window.scrollX, y: window.scrollY }\n const saved = { body: body.getAttribute('style'), html: html.getAttribute('style') }\n const siblings = Array.from(body.children).filter((el): el is HTMLElement => el instanceof HTMLElement)\n .map(el => ({ el, inert: el.inert, hidden: el.getAttribute('aria-hidden') }))\n const root = document.createElement('div')\n root.setAttribute('data-buckyos-sysdlg', 'select')\n root.setAttribute('role', 'dialog'); root.setAttribute('aria-modal', 'true')\n root.setAttribute('aria-label', zh ? '文件选择器' : 'File picker')\n root.style.cssText = 'position:fixed;inset:0;height:100vh;height:100dvh;z-index:2147483647;background:rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center'\n let frame: HTMLIFrameElement | undefined\n let nonce = ''\n let timer: ReturnType<typeof setTimeout> | undefined\n let done = false\n const block = (event: Event) => { if (!root.contains(event.target as Node)) { event.stopPropagation(); event.preventDefault() } }\n const blocked = ['keydown', 'pointerdown', 'mousedown', 'touchstart', 'wheel'] as const\n const cleanup = () => {\n if (done) return false\n done = true; selectEmbedOpen = false\n clearTimeout(timer)\n window.removeEventListener('message', receive)\n options.signal?.removeEventListener('abort', abort)\n if (!('inert' in HTMLElement.prototype)) blocked.forEach(type => document.removeEventListener(type, block, true))\n root.remove()\n siblings.forEach(({ el, inert, hidden }) => { el.inert = inert; if (hidden === null) el.removeAttribute('aria-hidden'); else el.setAttribute('aria-hidden', hidden) })\n if (saved.body === null) body.removeAttribute('style'); else body.setAttribute('style', saved.body)\n if (saved.html === null) html.removeAttribute('style'); else html.setAttribute('style', saved.html)\n window.scrollTo(scroll.x, scroll.y)\n focused?.focus({ preventScroll: true })\n return true\n }\n const finish = (result: SelectDialogResult) => { if (cleanup()) resolve(result) }\n const fail = (code: SystemDialogErrorCode) => { if (cleanup()) reject(new SystemDialogError(code)) }\n const abort = () => fail('closed')\n const showFailure = () => {\n frame?.remove(); frame = undefined\n const panel = document.createElement('div')\n panel.setAttribute('role', 'alert')\n panel.style.cssText = `max-width:22rem;margin:1rem;padding:1.25rem;border-radius:16px;font:14px/1.6 system-ui,sans-serif;background:${theme === 'dark' ? '#1f2329' : '#fff'};color:${theme === 'dark' ? '#f2f3f5' : '#1f2329'};box-shadow:0 24px 64px rgba(0,0,0,.24)`\n const text = document.createElement('p')\n text.style.margin = '0 0 1rem'\n text.textContent = zh ? '无法加载文件选择器' : 'Unable to load the file picker'\n const actions = document.createElement('div')\n actions.style.cssText = 'display:flex;gap:.5rem;justify-content:flex-end'\n const button = (label: string, action: () => void) => {\n const el = document.createElement('button')\n el.type = 'button'; el.textContent = label\n el.style.cssText = 'min-height:2.25rem;padding:0 1rem;font:inherit;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer'\n el.addEventListener('click', action); actions.append(el); return el\n }\n button(zh ? '取消' : 'Cancel', () => fail('load_failed'))\n const retry = button(zh ? '重试' : 'Retry', () => { panel.remove(); load() })\n panel.append(text, actions); root.append(panel); retry.focus()\n }\n const load = () => {\n nonce = crypto.randomUUID()\n frame = document.createElement('iframe')\n frame.title = zh ? '文件选择器' : 'File picker'\n frame.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;color-scheme:normal'\n frame.setAttribute('allowtransparency', 'true')\n frame.addEventListener('error', showFailure)\n frame.src = `${origin}${SELECT_EMBED_PATH}#bse=${nonce}&po=${encodeURIComponent(window.location.origin)}`\n root.append(frame)\n timer = setTimeout(showFailure, 10000)\n }\n const receive = (event: MessageEvent) => {\n if (!frame || event.origin !== origin || event.source !== frame.contentWindow || !isEmbedMessage(event.data, SYSDLG_EMBED)) return\n const { type, payload: p } = event.data\n if (type === 'embed.hello') {\n if (p.nonce !== nonce) return\n clearTimeout(timer)\n frame.contentWindow?.postMessage(embedEnvelope('embed.init', { nonce, params, theme, locale } satisfies SelectEmbedInit, SYSDLG_EMBED), origin)\n frame.focus()\n }\n if (type === 'embed.error') fail(dialogErrorCode(p.code))\n if (type === 'embed.result') {\n const result = readSelectDialogResult(p.result, { allowLocal: params.allowLocal === true })\n if (result) finish(result)\n else fail('protocol')\n }\n }\n window.addEventListener('message', receive)\n options.signal?.addEventListener('abort', abort, { once: true })\n if ('inert' in HTMLElement.prototype) siblings.forEach(({ el }) => { el.inert = true })\n else { siblings.forEach(({ el }) => el.setAttribute('aria-hidden', 'true')); blocked.forEach(type => document.addEventListener(type, block, true)) }\n // `overflow: hidden` alone does not stop the page behind from scrolling on iOS; pinning the body does.\n html.style.overflow = 'hidden'\n body.style.position = 'fixed'; body.style.top = `${-scroll.y}px`; body.style.left = `${-scroll.x}px`; body.style.right = '0'; body.style.overflow = 'hidden'\n body.append(root)\n load()\n })\n}\n\n/** System side: the picker page at `SELECT_EMBED_PATH`. Works only for an embedding page whose origin `accept` admits. */\nexport class SelectEmbedHost {\n readonly parentOrigin: string | null\n private readonly nonce: string | null\n private ready = false\n private readonly hello?: ReturnType<typeof setInterval>\n private readonly listener = (event: MessageEvent) => this.receive(event)\n constructor(private options: { accept: (origin: string) => boolean; onInit: (init: SelectEmbedInit) => void }) {\n const params = new URLSearchParams(window.location.hash.slice(1))\n this.nonce = params.get('bse')\n let parentOrigin: string | null = null\n try { parentOrigin = new URL(params.get('po') ?? '').origin } catch {}\n this.parentOrigin = window.parent !== window && this.nonce && parentOrigin && options.accept(parentOrigin) ? parentOrigin : null\n if (!this.parentOrigin) return\n window.addEventListener('message', this.listener)\n const hello = () => window.parent.postMessage(embedEnvelope('embed.hello', { nonce: this.nonce }, SYSDLG_EMBED), this.parentOrigin!)\n hello()\n this.hello = setInterval(() => { if (!this.ready) hello() }, 250)\n }\n private receive(event: MessageEvent): void {\n if (event.source !== window.parent || event.origin !== this.parentOrigin || !isEmbedMessage(event.data, SYSDLG_EMBED)) return\n const { type, payload: p } = event.data\n if (type !== 'embed.init' || this.ready || p.nonce !== this.nonce || typeof p.locale !== 'string') return\n this.ready = true; clearInterval(this.hello)\n this.options.onInit({ nonce: String(p.nonce), params: p.params, theme: p.theme === 'dark' ? 'dark' : 'light', locale: p.locale })\n }\n private post(type: string, payload: unknown): void {\n if (this.ready && this.parentOrigin) window.parent.postMessage(embedEnvelope(type, payload, SYSDLG_EMBED), this.parentOrigin)\n }\n result(result: SelectDialogResult): void { this.post('embed.result', { result }) }\n error(code: SystemDialogErrorCode): void { this.post('embed.error', { code }) }\n dispose(): void { clearInterval(this.hello); window.removeEventListener('message', this.listener) }\n}\n"],"names":["dialogErrorCode","value","SYSTEM_DIALOG_ERROR_CODES","includes","envelope","type","payload","extra","protocol","version","isMessage","v","PREVIEW_EMBED","embedEnvelope","isEmbedMessage","PREVIEW_EMBED_PATH","SYSDLG_EMBED","SELECT_EMBED_PATH","selectEmbedOpen","openSelectEmbed","systemOrigin","params","options","_a","signal","aborted","Promise","reject","SystemDialogError","origin","URL","locale","navigator","language","theme","_b","window","matchMedia","call","matches","zh","toLowerCase","startsWith","resolve","body","document","html","documentElement","focused","activeElement","HTMLElement","scroll","x","scrollX","y","scrollY","saved","getAttribute","siblings","Array","from","children","filter","el","map","inert","hidden","root","createElement","frame","setAttribute","style","cssText","timer","nonce","done","block","event","contains","target","stopPropagation","preventDefault","blocked","cleanup","clearTimeout","removeEventListener","receive","abort","prototype","forEach","remove","removeAttribute","scrollTo","focus","preventScroll","fail","code","showFailure","panel","text","margin","textContent","actions","button","label","action","addEventListener","append","retry","load","crypto","randomUUID","title","src","encodeURIComponent","location","setTimeout","source","contentWindow","data","p","postMessage","result","readSelectDialogResult","allowLocal","finish","once","overflow","position","top","left","right","constructor","this","listener","dialogs","Map","shellOrigin","URLSearchParams","hash","slice","get","parent","hello","appCapabilities","onOpen","onBeforeClose","onBack","helloTimer","setInterval","helloDeadline","clearInterval","m","windowId","launch","isOpenRequest","init","onInit","pending","replyTo","delete","ok","reply","id","request","_d","_c","accepted","decision","_f","_e","reason","handled","_h","_g","mode","_j","_i","onTheme","_l","_k","onLocale","_n","_m","onFocus","fallback","send","setTitle","dirty","key","JSON","stringify","requestClose","openContent","hints","newWindow","open","systemOpenUrl","appId","selectContent","shellCapabilities","SELECT_DIALOG_PATH","size","set","path","embedAbort","AbortController","dispose","clear","ready","capabilities","opens","dialogOpen","systemDialog","onSystemDialog","error","isArray","c","onReady","onTitle","onRequestClose","requestId","t","Date","now","length","push","onContentOpen","readContentHints","update","setFocused","timeout","Error","beforeClose","r","back","url","post","status","onState","kind","mediaType","isTransferableRef","session","isTransferableSession","onOpenWith","onExit","patch","parentOrigin","accept","Blob","blob","name","String","onUpdate","state","openWith","exit","candidates","ancestorOrigins","referrer","candidate","zoneHost","hostname","endsWith"],"mappings":"uJAEA,MAAMA,EAAmBC,GACvBC,4BAA0BC,SAASF,GAAkCA,EAAiC,WAclGG,EAAW,CAACC,EAAcC,EAAkBC,EAA2C,CAAA,KAAA,CACxFC,SAAU,oBAAqBC,QAAS,EAAGJ,OAAMC,aAAYC,IAC5DG,EAAaT,IACb,IAACA,GAA0B,iBAAVA,EAA2B,OAAA,EAChD,MAAMU,EAAIV,EACV,MAAsB,sBAAfU,EAAEH,UAAkD,IAAdG,EAAEF,SAAmC,iBAAXE,EAAEN,QAAuBM,EAAEL,SAAgC,iBAAdK,EAAEL,OAAY,EA2QpI,MAAMM,EAAgB,wBAChBC,EAAgB,CAACR,EAAcC,EAAkBE,EAAWI,KAAmB,CAAEJ,WAAUC,QAAS,EAAGJ,OAAMC,YAC7GQ,EAAiB,CAACb,EAAgBO,EAAWI,KACjD,MAAMD,EAAIV,EACV,QAASU,GAAKA,EAAEH,WAAaA,GAA0B,IAAdG,EAAEF,SAAmC,iBAAXE,EAAEN,QAAuBM,EAAEL,SAAgC,iBAAdK,EAAEL,OAAY,EAKnHS,EAAqB,iBAwGlC,MAAMC,EAAe,uBACRC,EAAoB,uBAEjC,IAAIC,GAAkB,EAGf,SAASC,EAAgBC,EAAsBC,EAA4BC,EAA+E,CAAA,WAC3J,GAAA,OAAAC,EAAAD,EAAQE,aAAQ,EAAAD,EAAAE,QAAS,OAAOC,QAAQC,OAAO,IAAIC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,CAChH,MAAS,OAAA,CAAM"}
|
|
1
|
+
{"version":3,"file":"app-frame.cjs","sources":["../src/app-frame.ts"],"sourcesContent":["import { isOpenRequest, isTransferableRef, isTransferableSession, readContentHints, readSelectDialogResult, systemOpenUrl, SELECT_DIALOG_PATH, SystemDialogError, SYSTEM_DIALOG_ERROR_CODES, type ContentHints, type ContentOpenTarget, type OpenRequest, type SelectDialogParams, type SelectDialogResult, type SystemDialogErrorCode, type TransferableContentRef, type TransferableSessionContext } from './content'\nexport type SystemDialogReply = { ok: true; result: unknown } | { ok: false; code: SystemDialogErrorCode }\nconst dialogErrorCode = (value: unknown): SystemDialogErrorCode =>\n SYSTEM_DIALOG_ERROR_CODES.includes(value as SystemDialogErrorCode) ? value as SystemDialogErrorCode : 'protocol'\nexport interface AppFrameMessage<T extends string = string, P = unknown> {\n protocol: 'buckyos.app-frame'; version: 1; type: T; id?: string; replyTo?: string; payload: P\n}\nexport interface FrameInit {\n nonce: string\n windowId: string\n formFactor: 'desktop' | 'mobile'\n theme: { mode: 'light' | 'dark'; accent?: string }\n locale: string\n launch?: OpenRequest\n shellCapabilities: string[]\n}\nexport type CloseDecision = 'allow' | 'deny' | 'pending'\nconst envelope = (type: string, payload: unknown, extra: { id?: string; replyTo?: string } = {}): AppFrameMessage =>\n ({ protocol: 'buckyos.app-frame', version: 1, type, payload, ...extra })\nconst isMessage = (value: unknown): value is AppFrameMessage => {\n if (!value || typeof value !== 'object') return false\n const v = value as AppFrameMessage\n return v.protocol === 'buckyos.app-frame' && v.version === 1 && typeof v.type === 'string' && !!v.payload && typeof v.payload === 'object'\n}\nexport class AppFrameHost {\n ready = false\n capabilities: string[] = []\n private pending = new Map<string, { resolve: (v: unknown) => void; reject: (e: Error) => void; timer: ReturnType<typeof setTimeout>; type: string }>()\n private listener = (event: MessageEvent) => this.receive(event)\n private opens: number[] = []\n constructor(private options: {\n target: () => Window | null; origin: string; init: FrameInit\n onReady?: () => void\n onTitle?: (title: string, dirty: boolean) => void\n onRequestClose?: () => void\n onContentOpen?: (request: OpenRequest, target: ContentOpenTarget, options: { newWindow: boolean; hints: ContentHints }) => void\n /** Shows a system dialog the App asked for (`sysdlg.open`). `params` is untrusted input: validate it. */\n onSystemDialog?: (path: string, params: unknown) => Promise<SystemDialogReply>\n }) { window.addEventListener('message', this.listener) }\n private focused?: boolean\n private dialogOpen = false\n private async systemDialog(id: string, path: unknown, params: unknown): Promise<void> {\n const reply = (payload: SystemDialogReply) => { if (this.ready) this.options.target()?.postMessage(envelope('sysdlg.openResult', payload, { replyTo: id }), this.options.origin) }\n if (!this.options.onSystemDialog || typeof path !== 'string') return reply({ ok: false, code: 'unsupported' })\n if (this.dialogOpen) return reply({ ok: false, code: 'busy' })\n this.dialogOpen = true\n try { reply(await this.options.onSystemDialog(path, params)) }\n catch (error) { reply({ ok: false, code: error instanceof SystemDialogError ? error.code : 'closed' }) }\n finally { this.dialogOpen = false }\n }\n private receive(event: MessageEvent): void {\n if (event.source !== this.options.target() || event.origin !== this.options.origin || !isMessage(event.data)) return\n const m = event.data\n const p = m.payload as Record<string, unknown>\n if (m.type === 'frame.hello') {\n if (p.nonce !== this.options.init.nonce || !Array.isArray(p.appCapabilities)) return\n this.ready = true\n this.capabilities = p.appCapabilities.filter((c): c is string => typeof c === 'string')\n this.send('frame.init', this.options.init)\n if (this.focused !== undefined) this.send('frame.focusChanged', { focused: this.focused })\n this.options.onReady?.()\n return\n }\n if (!this.ready) return\n if (m.replyTo) {\n const pending = this.pending.get(m.replyTo)\n if (pending && m.type === pending.type + 'Result') {\n clearTimeout(pending.timer); this.pending.delete(m.replyTo); pending.resolve(m.payload)\n }\n return\n }\n if (m.type === 'window.setTitle' && typeof p.title === 'string') this.options.onTitle?.(p.title.slice(0, 256), p.dirty === true)\n if (m.type === 'window.requestClose') this.options.onRequestClose?.()\n if (m.type === 'sysdlg.open' && typeof m.id === 'string') void this.systemDialog(m.id, p.path, p.params)\n if (m.type === 'content.open' && (p.target === 'default' || p.target === 'preview' || p.target === 'chooser')) {\n const request = { ...(p.request as object), requestId: crypto.randomUUID() }\n if (!isOpenRequest(request)) return\n this.opens = this.opens.filter(t => t > Date.now() - 10000)\n if (this.opens.length >= 5) return\n this.opens.push(Date.now())\n this.options.onContentOpen?.(request, p.target, { newWindow: p.newWindow === true, hints: readContentHints(p.hints) })\n }\n }\n update(init: Partial<FrameInit>): void { this.options.init = { ...this.options.init, ...init } }\n /** Reports whether the App's window is the focused one; only a change is sent. */\n setFocused(focused: boolean): void {\n if (this.focused === focused) return\n this.focused = focused\n this.send('frame.focusChanged', { focused })\n }\n send(type: string, payload: unknown): void {\n if (this.ready) this.options.target()?.postMessage(envelope(type, payload), this.options.origin)\n }\n request(type: string, payload: unknown, timeout = 3000): Promise<unknown> {\n if (!this.ready) return Promise.reject(new Error('App frame is not ready'))\n const id = crypto.randomUUID()\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => { this.pending.delete(id); reject(new Error('App frame timed out')) }, timeout)\n this.pending.set(id, { resolve, reject, timer, type })\n this.options.target()?.postMessage(envelope(type, payload, { id }), this.options.origin)\n })\n }\n async open(request: OpenRequest): Promise<{ accepted: boolean; fallback?: 'preview' }> {\n if (!this.capabilities.includes('open')) return { accepted: false }\n return await this.request('frame.open', { request }) as { accepted: boolean; fallback?: 'preview' }\n }\n async beforeClose(reason: 'user' | 'logout' | 'shell' = 'user'): Promise<CloseDecision> {\n if (!this.ready || !this.capabilities.includes('beforeClose')) return 'allow'\n const r = await this.request('frame.beforeClose', { reason }) as { decision?: CloseDecision }\n return r.decision === 'allow' || r.decision === 'pending' ? r.decision : 'deny'\n }\n async back(): Promise<boolean> {\n if (!this.capabilities.includes('back')) return false\n return (await this.request('frame.back', {}) as { handled?: boolean }).handled === true\n }\n dispose(): void {\n window.removeEventListener('message', this.listener)\n this.pending.forEach(p => { clearTimeout(p.timer); p.reject(new Error('App frame disposed')) })\n this.pending.clear(); this.ready = false\n }\n}\n/**\n * Origin of the window embedding this page, when `accept` admits it. `location.ancestorOrigins` names the real\n * parent even after the frame navigated through other pages (a sign-in round trip); the referrer is the fallback.\n */\nexport function embedderOrigin(accept: (origin: string) => boolean): string | null {\n if (window.parent === window) return null\n const candidates = [window.location.ancestorOrigins?.[0], document.referrer]\n for (const candidate of candidates) {\n if (!candidate) continue\n try {\n const origin = new URL(candidate).origin\n if (accept(origin)) return origin\n } catch {}\n }\n return null\n}\nexport const originInZone = (origin: string, zoneHost: string): boolean => {\n try {\n const url = new URL(origin)\n return url.protocol === window.location.protocol && (url.hostname === zoneHost || url.hostname.endsWith(`.${zoneHost}`))\n } catch { return false }\n}\nexport class AppFrameClient {\n init?: FrameInit\n private title?: string\n private focused?: boolean\n private helloTimer?: ReturnType<typeof setInterval>\n private helloDeadline?: ReturnType<typeof setTimeout>\n private readonly nonce: string | null\n private readonly origin: string\n private readonly listener = (event: MessageEvent) => { void this.receive(event) }\n private dialogs = new Map<string, { resolve: (result: SelectDialogResult) => void; reject: (error: Error) => void; allowLocal: boolean }>()\n private embedAbort?: AbortController\n constructor(private options: {\n shellOrigin: string\n /** The Zone's system entry (its root origin): where content is opened when this page is not embedded in the shell. */\n systemOrigin?: string\n /** This App's id, so the system does not offer the content back to it. */\n appId?: string\n onInit?: (init: FrameInit) => void\n onOpen?: (request: OpenRequest) => Promise<{ accepted: boolean; fallback?: 'preview' }> | { accepted: boolean; fallback?: 'preview' }\n onBeforeClose?: (reason: 'user' | 'logout' | 'shell') => Promise<CloseDecision> | CloseDecision\n onBack?: () => Promise<boolean> | boolean\n onTheme?: (theme: FrameInit['theme']) => void\n onLocale?: (locale: string) => void\n onFocus?: (focused: boolean) => void\n }) {\n this.origin = new URL(options.shellOrigin).origin\n this.nonce = new URLSearchParams(window.location.hash.slice(1)).get('bfp')\n window.addEventListener('message', this.listener)\n if (window.parent !== window && this.nonce) {\n const hello = () => window.parent.postMessage(envelope('frame.hello', { nonce: this.nonce, appCapabilities: [\n ...options.onOpen ? ['open'] : [], ...options.onBeforeClose ? ['beforeClose'] : [], ...options.onBack ? ['back'] : [],\n ] }), this.origin)\n hello()\n this.helloTimer = setInterval(hello, 250)\n this.helloDeadline = setTimeout(() => clearInterval(this.helloTimer), 1500)\n }\n }\n private async receive(event: MessageEvent): Promise<void> {\n if (event.source !== window.parent || event.origin !== this.origin || !isMessage(event.data)) return\n const m = event.data\n const p = m.payload as Record<string, unknown>\n if (m.type === 'frame.init') {\n if (!this.nonce || p.nonce !== this.nonce || typeof p.locale !== 'string' || !p.theme || typeof p.windowId !== 'string' || p.launch && !isOpenRequest(p.launch)) return\n clearInterval(this.helloTimer); clearTimeout(this.helloDeadline)\n this.init = p as unknown as FrameInit\n this.title = undefined; this.focused = undefined\n this.options.onInit?.(this.init)\n return\n }\n if (!this.init) return\n if (m.type === 'sysdlg.openResult') {\n const pending = m.replyTo ? this.dialogs.get(m.replyTo) : undefined\n if (!pending) return\n this.dialogs.delete(m.replyTo!)\n if (p.ok !== true) return pending.reject(new SystemDialogError(dialogErrorCode(p.code)))\n const result = readSelectDialogResult(p.result, { allowLocal: pending.allowLocal })\n if (result) pending.resolve(result)\n else pending.reject(new SystemDialogError('protocol'))\n return\n }\n const reply = (payload: unknown) => window.parent.postMessage(envelope(m.type + 'Result', payload, { replyTo: m.id }), this.origin)\n try {\n if (m.type === 'frame.open' && isOpenRequest(p.request)) reply(await this.options.onOpen?.(p.request) ?? { accepted: false })\n if (m.type === 'frame.beforeClose') reply({ decision: await this.options.onBeforeClose?.(p.reason as 'user') ?? 'allow' })\n if (m.type === 'frame.back') reply({ handled: await this.options.onBack?.() ?? false })\n if (m.type === 'frame.themeChanged' && (p.mode === 'dark' || p.mode === 'light')) this.options.onTheme?.(p as FrameInit['theme'])\n if (m.type === 'frame.localeChanged' && typeof p.locale === 'string') this.options.onLocale?.(p.locale)\n if (m.type === 'frame.focusChanged' && this.focused !== (p.focused === true)) { this.focused = p.focused === true; this.options.onFocus?.(this.focused) }\n } catch {\n if (m.type === 'frame.open') reply({ accepted: false, fallback: 'preview' })\n if (m.type === 'frame.beforeClose') reply({ decision: 'deny' })\n }\n }\n send(type: string, payload: unknown): void {\n if (this.init) window.parent.postMessage(envelope(type, payload), this.origin)\n }\n setTitle(title: string, dirty = false): void {\n const key = JSON.stringify([title, dirty])\n if (!this.init || key === this.title) return\n this.title = key\n this.send('window.setTitle', { title, dirty })\n }\n requestClose(): void { this.send('window.requestClose', {}) }\n /**\n * Asks the system to open content: with its default app, in Preview, or by letting the user choose (`chooser`).\n * Embedded in the shell the request goes over the frame; in a standalone tab it opens the Zone's system entry\n * (`systemOrigin`) in a new tab. Returns false when neither is available.\n */\n openContent(request: Omit<OpenRequest, 'requestId'>, target: ContentOpenTarget = 'default', options: { newWindow?: boolean; hints?: ContentHints } = {}): boolean {\n const hints = options.hints ?? {}\n if (this.init) { this.send('content.open', { request, target, newWindow: options.newWindow === true, hints }); return true }\n if (!this.options.systemOrigin) return false\n window.open(systemOpenUrl(this.options.systemOrigin, { request, target, hints, from: this.options.appId }), '_blank', 'noopener')\n return true\n }\n /**\n * Shows the system file picker (`sysdlg/select`) and resolves with what the user chose; cancelling resolves with\n * `{ action: 'cancelled' }`. Embedded in the shell the shell draws the dialog over this App's window; in a\n * standalone tab the picker page of the Zone's system entry (`systemOrigin`) is framed over this page. Rejects\n * with a `SystemDialogError` when no picker is available or the request did not complete.\n */\n selectContent(params: SelectDialogParams = {}, options: { signal?: AbortSignal; theme?: 'light' | 'dark'; locale?: string } = {}): Promise<SelectDialogResult> {\n if (this.init) {\n if (!this.init.shellCapabilities.includes(SELECT_DIALOG_PATH)) return Promise.reject(new SystemDialogError('unsupported'))\n if (this.dialogs.size) return Promise.reject(new SystemDialogError('busy'))\n const id = crypto.randomUUID()\n return new Promise((resolve, reject) => {\n this.dialogs.set(id, { resolve, reject, allowLocal: params.allowLocal === true })\n window.parent.postMessage(envelope('sysdlg.open', { path: SELECT_DIALOG_PATH, params }, { id }), this.origin)\n })\n }\n if (!this.options.systemOrigin) return Promise.reject(new SystemDialogError('unsupported'))\n const abort = this.embedAbort = new AbortController()\n options.signal?.addEventListener('abort', () => abort.abort(), { once: true })\n if (options.signal?.aborted) abort.abort()\n return openSelectEmbed(this.options.systemOrigin, params, { ...options, signal: abort.signal })\n }\n dispose(): void {\n clearInterval(this.helloTimer); clearTimeout(this.helloDeadline); window.removeEventListener('message', this.listener)\n this.dialogs.forEach(pending => pending.reject(new SystemDialogError('closed')))\n this.dialogs.clear(); this.embedAbort?.abort()\n }\n}\n\n/**\n * Preview embed protocol (`buckyos.preview-embed` v1): an App shows the system Preview component inside its own UI.\n * The App frames `<systemOrigin>/embed/preview` (component only, no shell) and hands it a content reference; the\n * system page reads the content with its own Zone-root session, so no token crosses origins. Open With goes back\n * through the App to the shell (`AppFrameClient.openContent(…, 'chooser')`).\n */\nexport type PreviewEmbedSource = TransferableContentRef | { kind: 'blob'; blob: Blob; name: string }\nexport interface PreviewEmbedInit {\n nonce: string\n source: PreviewEmbedSource\n session?: TransferableSessionContext\n theme: 'light' | 'dark'\n locale: string\n}\nexport interface PreviewEmbedState {\n status: 'loading' | 'ready' | 'error'\n /** Preview error kind (`unsupported`, `not-found`, `permission-denied`, `timeout`, `error`, …) and code. */\n error?: { kind: string; code: string }\n title?: string\n mediaType?: string\n}\nexport interface PreviewEmbedOpenWith { request: Omit<OpenRequest, 'requestId'>; hints: ContentHints }\nconst PREVIEW_EMBED = 'buckyos.preview-embed'\nconst embedEnvelope = (type: string, payload: unknown, protocol = PREVIEW_EMBED) => ({ protocol, version: 1, type, payload })\nconst isEmbedMessage = (value: unknown, protocol = PREVIEW_EMBED): value is { type: string; payload: Record<string, unknown> } => {\n const v = value as { protocol?: unknown; version?: unknown; type?: unknown; payload?: unknown } | null\n return !!v && v.protocol === protocol && v.version === 1 && typeof v.type === 'string' && !!v.payload && typeof v.payload === 'object'\n}\nconst isEmbedSource = (value: unknown): value is PreviewEmbedSource =>\n isTransferableRef(value) || (!!value && typeof value === 'object' && (value as { kind?: unknown }).kind === 'blob' &&\n typeof Blob !== 'undefined' && (value as { blob?: unknown }).blob instanceof Blob && typeof (value as { name?: unknown }).name === 'string')\nexport const PREVIEW_EMBED_PATH = '/embed/preview'\n\n/** App side: owns the iframe that shows the system Preview. */\nexport class PreviewEmbed {\n readonly url: string\n private readonly nonce = crypto.randomUUID()\n private readonly origin: string\n private readonly listener = (event: MessageEvent) => this.receive(event)\n private init: Omit<PreviewEmbedInit, 'nonce'>\n private ready = false\n constructor(private options: {\n systemOrigin: string\n frame: () => HTMLIFrameElement | null\n init: Omit<PreviewEmbedInit, 'nonce'>\n onState?: (state: PreviewEmbedState) => void\n onOpenWith?: (open: PreviewEmbedOpenWith) => void\n onExit?: () => void\n }) {\n this.origin = new URL(options.systemOrigin).origin\n this.init = options.init\n this.url = `${this.origin}${PREVIEW_EMBED_PATH}#bpe=${this.nonce}&po=${encodeURIComponent(window.location.origin)}`\n window.addEventListener('message', this.listener)\n }\n private post(type: string, payload: unknown): void {\n this.options.frame()?.contentWindow?.postMessage(embedEnvelope(type, payload), this.origin)\n }\n private receive(event: MessageEvent): void {\n if (event.origin !== this.origin || event.source !== this.options.frame()?.contentWindow || !isEmbedMessage(event.data)) return\n const { type, payload: p } = event.data\n if (type === 'embed.hello') { if (p.nonce === this.nonce) { this.ready = true; this.post('embed.init', { ...this.init, nonce: this.nonce }) } return }\n if (type === 'embed.state' && (p.status === 'loading' || p.status === 'ready' || p.status === 'error')) {\n const error = p.error as { kind?: unknown; code?: unknown } | undefined\n this.options.onState?.({ status: p.status,\n error: error && typeof error.kind === 'string' && typeof error.code === 'string' ? { kind: error.kind, code: error.code } : undefined,\n title: typeof p.title === 'string' ? p.title.slice(0, 256) : undefined, mediaType: typeof p.mediaType === 'string' ? p.mediaType.slice(0, 128) : undefined })\n }\n if (type === 'embed.openWith') {\n const request = p.request as Omit<OpenRequest, 'requestId'> | undefined\n if (request && isTransferableRef(request.source) && (request.session === undefined || isTransferableSession(request.session))) {\n this.options.onOpenWith?.({ request: { source: request.source, session: request.session }, hints: readContentHints(p.hints) })\n }\n }\n if (type === 'embed.exit') this.options.onExit?.()\n }\n update(patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>>): void {\n this.init = { ...this.init, ...patch }\n // Before the handshake the frame still holds its initial about:blank (this App's origin, so the browser rejects\n // the target origin); `embed.init` carries the patch.\n if (this.ready) this.post('embed.update', patch)\n }\n dispose(): void { window.removeEventListener('message', this.listener) }\n}\n\n/** System side: the component-only page at `PREVIEW_EMBED_PATH`. Accepts one embedding App whose origin `accept` admits. */\nexport class PreviewEmbedHost {\n readonly parentOrigin: string | null\n private readonly nonce: string | null\n private ready = false\n private readonly hello?: ReturnType<typeof setInterval>\n private readonly listener = (event: MessageEvent) => this.receive(event)\n constructor(private options: {\n accept: (origin: string) => boolean\n onInit: (init: PreviewEmbedInit) => void\n onUpdate?: (patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>>) => void\n }) {\n const params = new URLSearchParams(window.location.hash.slice(1))\n this.nonce = params.get('bpe')\n let parentOrigin: string | null = null\n try { parentOrigin = new URL(params.get('po') ?? '').origin } catch {}\n this.parentOrigin = window.parent !== window && this.nonce && parentOrigin && options.accept(parentOrigin) ? parentOrigin : null\n if (!this.parentOrigin) return\n window.addEventListener('message', this.listener)\n const hello = () => window.parent.postMessage(embedEnvelope('embed.hello', { nonce: this.nonce }), this.parentOrigin!)\n hello()\n this.hello = setInterval(() => { if (!this.ready) hello() }, 250)\n }\n private receive(event: MessageEvent): void {\n if (event.source !== window.parent || event.origin !== this.parentOrigin || !isEmbedMessage(event.data)) return\n const { type, payload: p } = event.data\n if (type === 'embed.init') {\n if (p.nonce !== this.nonce || !isEmbedSource(p.source) || (p.session !== undefined && !isTransferableSession(p.session)) || typeof p.locale !== 'string') return\n this.ready = true; clearInterval(this.hello)\n this.options.onInit({ nonce: String(p.nonce), source: p.source, session: p.session as TransferableSessionContext | undefined, theme: p.theme === 'dark' ? 'dark' : 'light', locale: p.locale })\n return\n }\n if (type === 'embed.update' && this.ready) {\n const patch: Partial<Pick<PreviewEmbedInit, 'theme' | 'locale'>> = {}\n if (p.theme === 'dark' || p.theme === 'light') patch.theme = p.theme\n if (typeof p.locale === 'string') patch.locale = p.locale\n this.options.onUpdate?.(patch)\n }\n }\n private post(type: string, payload: unknown): void {\n if (this.ready && this.parentOrigin) window.parent.postMessage(embedEnvelope(type, payload), this.parentOrigin)\n }\n state(state: PreviewEmbedState): void { this.post('embed.state', state) }\n openWith(open: PreviewEmbedOpenWith): void { this.post('embed.openWith', open) }\n exit(): void { this.post('embed.exit', {}) }\n dispose(): void { clearInterval(this.hello); window.removeEventListener('message', this.listener) }\n}\n\n/**\n * System dialog embed protocol (`buckyos.sysdlg-embed` v1): a standalone App page (no shell) shows the system file\n * picker by framing `<systemOrigin>/embed/sysdlg/select` over itself. The handshake is the Preview embed's\n * (`embed.hello` → `embed.init`); the system page browses with its own Zone-root session and answers with\n * `embed.result`. No token crosses origins, and every message names its exact target origin.\n */\nconst SYSDLG_EMBED = 'buckyos.sysdlg-embed'\nexport const SELECT_EMBED_PATH = '/embed/sysdlg/select'\nexport interface SelectEmbedInit { nonce: string; params: unknown; theme: 'light' | 'dark'; locale: string }\nlet selectEmbedOpen = false\n\n/** App side of `buckyos.sysdlg-embed`: the full-page layer that frames the picker. One at a time per page. */\nexport function openSelectEmbed(systemOrigin: string, params: SelectDialogParams, options: { signal?: AbortSignal; theme?: 'light' | 'dark'; locale?: string } = {}): Promise<SelectDialogResult> {\n if (options.signal?.aborted) return Promise.reject(new SystemDialogError('closed'))\n if (selectEmbedOpen) return Promise.reject(new SystemDialogError('busy'))\n selectEmbedOpen = true\n const origin = new URL(systemOrigin).origin\n const locale = options.locale ?? navigator.language ?? 'en'\n const theme = options.theme ?? (window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n const zh = locale.toLowerCase().startsWith('zh')\n return new Promise((resolve, reject) => {\n const body = document.body\n const html = document.documentElement\n const focused = document.activeElement instanceof HTMLElement ? document.activeElement : null\n const scroll = { x: window.scrollX, y: window.scrollY }\n const saved = { body: body.getAttribute('style'), html: html.getAttribute('style') }\n const siblings = Array.from(body.children).filter((el): el is HTMLElement => el instanceof HTMLElement)\n .map(el => ({ el, inert: el.inert, hidden: el.getAttribute('aria-hidden') }))\n const root = document.createElement('div')\n root.setAttribute('data-buckyos-sysdlg', 'select')\n root.setAttribute('role', 'dialog'); root.setAttribute('aria-modal', 'true')\n root.setAttribute('aria-label', zh ? '文件选择器' : 'File picker')\n root.style.cssText = 'position:fixed;inset:0;height:100vh;height:100dvh;z-index:2147483647;background:rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center'\n let frame: HTMLIFrameElement | undefined\n let nonce = ''\n let timer: ReturnType<typeof setTimeout> | undefined\n let done = false\n const block = (event: Event) => { if (!root.contains(event.target as Node)) { event.stopPropagation(); event.preventDefault() } }\n const blocked = ['keydown', 'pointerdown', 'mousedown', 'touchstart', 'wheel'] as const\n const cleanup = () => {\n if (done) return false\n done = true; selectEmbedOpen = false\n clearTimeout(timer)\n window.removeEventListener('message', receive)\n options.signal?.removeEventListener('abort', abort)\n if (!('inert' in HTMLElement.prototype)) blocked.forEach(type => document.removeEventListener(type, block, true))\n root.remove()\n siblings.forEach(({ el, inert, hidden }) => { el.inert = inert; if (hidden === null) el.removeAttribute('aria-hidden'); else el.setAttribute('aria-hidden', hidden) })\n if (saved.body === null) body.removeAttribute('style'); else body.setAttribute('style', saved.body)\n if (saved.html === null) html.removeAttribute('style'); else html.setAttribute('style', saved.html)\n window.scrollTo(scroll.x, scroll.y)\n focused?.focus({ preventScroll: true })\n return true\n }\n const finish = (result: SelectDialogResult) => { if (cleanup()) resolve(result) }\n const fail = (code: SystemDialogErrorCode) => { if (cleanup()) reject(new SystemDialogError(code)) }\n const abort = () => fail('closed')\n const showFailure = () => {\n frame?.remove(); frame = undefined\n const panel = document.createElement('div')\n panel.setAttribute('role', 'alert')\n panel.style.cssText = `max-width:22rem;margin:1rem;padding:1.25rem;border-radius:16px;font:14px/1.6 system-ui,sans-serif;background:${theme === 'dark' ? '#1f2329' : '#fff'};color:${theme === 'dark' ? '#f2f3f5' : '#1f2329'};box-shadow:0 24px 64px rgba(0,0,0,.24)`\n const text = document.createElement('p')\n text.style.margin = '0 0 1rem'\n text.textContent = zh ? '无法加载文件选择器' : 'Unable to load the file picker'\n const actions = document.createElement('div')\n actions.style.cssText = 'display:flex;gap:.5rem;justify-content:flex-end'\n const button = (label: string, action: () => void) => {\n const el = document.createElement('button')\n el.type = 'button'; el.textContent = label\n el.style.cssText = 'min-height:2.25rem;padding:0 1rem;font:inherit;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer'\n el.addEventListener('click', action); actions.append(el); return el\n }\n button(zh ? '取消' : 'Cancel', () => fail('load_failed'))\n const retry = button(zh ? '重试' : 'Retry', () => { panel.remove(); load() })\n panel.append(text, actions); root.append(panel); retry.focus()\n }\n const load = () => {\n nonce = crypto.randomUUID()\n frame = document.createElement('iframe')\n frame.title = zh ? '文件选择器' : 'File picker'\n frame.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;color-scheme:normal'\n frame.setAttribute('allowtransparency', 'true')\n frame.addEventListener('error', showFailure)\n frame.src = `${origin}${SELECT_EMBED_PATH}#bse=${nonce}&po=${encodeURIComponent(window.location.origin)}`\n root.append(frame)\n timer = setTimeout(showFailure, 10000)\n }\n const receive = (event: MessageEvent) => {\n if (!frame || event.origin !== origin || event.source !== frame.contentWindow || !isEmbedMessage(event.data, SYSDLG_EMBED)) return\n const { type, payload: p } = event.data\n if (type === 'embed.hello') {\n if (p.nonce !== nonce) return\n clearTimeout(timer)\n frame.contentWindow?.postMessage(embedEnvelope('embed.init', { nonce, params, theme, locale } satisfies SelectEmbedInit, SYSDLG_EMBED), origin)\n frame.focus()\n }\n if (type === 'embed.error') fail(dialogErrorCode(p.code))\n if (type === 'embed.result') {\n const result = readSelectDialogResult(p.result, { allowLocal: params.allowLocal === true })\n if (result) finish(result)\n else fail('protocol')\n }\n }\n window.addEventListener('message', receive)\n options.signal?.addEventListener('abort', abort, { once: true })\n if ('inert' in HTMLElement.prototype) siblings.forEach(({ el }) => { el.inert = true })\n else { siblings.forEach(({ el }) => el.setAttribute('aria-hidden', 'true')); blocked.forEach(type => document.addEventListener(type, block, true)) }\n // `overflow: hidden` alone does not stop the page behind from scrolling on iOS; pinning the body does.\n html.style.overflow = 'hidden'\n body.style.position = 'fixed'; body.style.top = `${-scroll.y}px`; body.style.left = `${-scroll.x}px`; body.style.right = '0'; body.style.overflow = 'hidden'\n body.append(root)\n load()\n })\n}\n\n/** System side: the picker page at `SELECT_EMBED_PATH`. Works only for an embedding page whose origin `accept` admits. */\nexport class SelectEmbedHost {\n readonly parentOrigin: string | null\n private readonly nonce: string | null\n private ready = false\n private readonly hello?: ReturnType<typeof setInterval>\n private readonly listener = (event: MessageEvent) => this.receive(event)\n constructor(private options: { accept: (origin: string) => boolean; onInit: (init: SelectEmbedInit) => void }) {\n const params = new URLSearchParams(window.location.hash.slice(1))\n this.nonce = params.get('bse')\n let parentOrigin: string | null = null\n try { parentOrigin = new URL(params.get('po') ?? '').origin } catch {}\n this.parentOrigin = window.parent !== window && this.nonce && parentOrigin && options.accept(parentOrigin) ? parentOrigin : null\n if (!this.parentOrigin) return\n window.addEventListener('message', this.listener)\n const hello = () => window.parent.postMessage(embedEnvelope('embed.hello', { nonce: this.nonce }, SYSDLG_EMBED), this.parentOrigin!)\n hello()\n this.hello = setInterval(() => { if (!this.ready) hello() }, 250)\n }\n private receive(event: MessageEvent): void {\n if (event.source !== window.parent || event.origin !== this.parentOrigin || !isEmbedMessage(event.data, SYSDLG_EMBED)) return\n const { type, payload: p } = event.data\n if (type !== 'embed.init' || this.ready || p.nonce !== this.nonce || typeof p.locale !== 'string') return\n this.ready = true; clearInterval(this.hello)\n this.options.onInit({ nonce: String(p.nonce), params: p.params, theme: p.theme === 'dark' ? 'dark' : 'light', locale: p.locale })\n }\n private post(type: string, payload: unknown): void {\n if (this.ready && this.parentOrigin) window.parent.postMessage(embedEnvelope(type, payload, SYSDLG_EMBED), this.parentOrigin)\n }\n result(result: SelectDialogResult): void { this.post('embed.result', { result }) }\n error(code: SystemDialogErrorCode): void { this.post('embed.error', { code }) }\n dispose(): void { clearInterval(this.hello); window.removeEventListener('message', this.listener) }\n}\n"],"names":["dialogErrorCode","value","SYSTEM_DIALOG_ERROR_CODES","includes","envelope","type","payload","extra","protocol","version","isMessage","v","PREVIEW_EMBED","embedEnvelope","isEmbedMessage","PREVIEW_EMBED_PATH","SYSDLG_EMBED","SELECT_EMBED_PATH","selectEmbedOpen","openSelectEmbed","systemOrigin","params","options","_a","signal","aborted","Promise","reject","SystemDialogError","origin","URL","locale","navigator","language","theme","_b","window","matchMedia","call","matches","zh","toLowerCase","startsWith","resolve","body","document","html","documentElement","focused","activeElement","HTMLElement","scroll","x","scrollX","y","scrollY","saved","getAttribute","siblings","Array","from","children","filter","el","map","inert","hidden","root","createElement","frame","setAttribute","style","cssText","timer","nonce","done","block","event","contains","target","stopPropagation","preventDefault","blocked","cleanup","clearTimeout","removeEventListener","receive","abort","prototype","forEach","remove","removeAttribute","scrollTo","focus","preventScroll","fail","code","showFailure","panel","text","margin","textContent","actions","button","label","action","addEventListener","append","retry","load","crypto","randomUUID","title","src","encodeURIComponent","location","setTimeout","source","contentWindow","data","p","postMessage","result","readSelectDialogResult","allowLocal","finish","once","overflow","position","top","left","right","constructor","this","listener","dialogs","Map","shellOrigin","URLSearchParams","hash","slice","get","parent","hello","appCapabilities","onOpen","onBeforeClose","onBack","helloTimer","setInterval","helloDeadline","clearInterval","m","windowId","launch","isOpenRequest","init","onInit","pending","replyTo","delete","ok","reply","id","request","_d","_c","accepted","decision","_f","_e","reason","handled","_h","_g","mode","_j","_i","onTheme","_l","_k","onLocale","_n","_m","onFocus","fallback","send","setTitle","dirty","key","JSON","stringify","requestClose","openContent","hints","newWindow","open","systemOpenUrl","appId","selectContent","shellCapabilities","SELECT_DIALOG_PATH","size","set","path","embedAbort","AbortController","dispose","clear","ready","capabilities","opens","dialogOpen","systemDialog","onSystemDialog","error","isArray","c","onReady","onTitle","onRequestClose","requestId","t","Date","now","length","push","onContentOpen","readContentHints","update","setFocused","timeout","Error","beforeClose","r","back","url","post","status","onState","kind","mediaType","isTransferableRef","session","isTransferableSession","onOpenWith","onExit","patch","parentOrigin","accept","Blob","blob","name","String","onUpdate","state","openWith","exit","candidates","ancestorOrigins","referrer","candidate","zoneHost","hostname","endsWith"],"mappings":"uJAEA,MAAMA,EAAmBC,GACvBC,4BAA0BC,SAASF,GAAkCA,EAAiC,WAclGG,EAAW,CAACC,EAAcC,EAAkBC,EAA2C,CAAA,KAAA,CACxFC,SAAU,oBAAqBC,QAAS,EAAGJ,OAAMC,aAAYC,IAC5DG,EAAaT,IACb,IAACA,GAA0B,iBAAVA,EAA2B,OAAA,EAChD,MAAMU,EAAIV,EACV,MAAsB,sBAAfU,EAAEH,UAAkD,IAAdG,EAAEF,SAAmC,iBAAXE,EAAEN,QAAuBM,EAAEL,SAAgC,iBAAdK,EAAEL,OAAY,EA2QpI,MAAMM,EAAgB,wBAChBC,EAAgB,CAACR,EAAcC,EAAkBE,EAAWI,KAAmB,CAAEJ,WAAUC,QAAS,EAAGJ,OAAMC,YAC7GQ,EAAiB,CAACb,EAAgBO,EAAWI,KACjD,MAAMD,EAAIV,EACV,QAASU,GAAKA,EAAEH,WAAaA,GAA0B,IAAdG,EAAEF,SAAmC,iBAAXE,EAAEN,QAAuBM,EAAEL,SAAgC,iBAAdK,EAAEL,OAAY,EAKnHS,EAAqB,iBA2GlC,MAAMC,EAAe,uBACRC,EAAoB,uBAEjC,IAAIC,GAAkB,EAGf,SAASC,EAAgBC,EAAsBC,EAA4BC,EAA+E,CAAA,WAC3J,GAAA,OAAAC,EAAAD,EAAQE,aAAQ,EAAAD,EAAAE,QAAS,OAAOC,QAAQC,OAAO,IAAIC,EAAAA,kBAAkB,WACrE,GAAAV,EAAiB,OA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