wicked-crew 0.18.17 → 0.18.19
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/dist/api/capture.d.ts.map +1 -1
- package/dist/api/capture.js +5 -0
- package/dist/api/capture.js.map +1 -1
- package/dist/api/chat-jobs.d.ts +30 -0
- package/dist/api/chat-jobs.d.ts.map +1 -1
- package/dist/api/chat-jobs.js +74 -7
- package/dist/api/chat-jobs.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +38 -3
- package/dist/api/chat-proposals.d.ts.map +1 -1
- package/dist/api/chat-proposals.js +162 -21
- package/dist/api/chat-proposals.js.map +1 -1
- package/dist/api/chat-scope.d.ts +9 -0
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +35 -4
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +13 -0
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/mcp.js +1 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/api/needs.js +1 -1
- package/dist/api/needs.js.map +1 -1
- package/dist/api/post-hoc-deliver.d.ts +9 -0
- package/dist/api/post-hoc-deliver.d.ts.map +1 -1
- package/dist/api/post-hoc-deliver.js +32 -3
- package/dist/api/post-hoc-deliver.js.map +1 -1
- package/dist/api/redeliver.d.ts +48 -0
- package/dist/api/redeliver.d.ts.map +1 -0
- package/dist/api/redeliver.js +178 -0
- package/dist/api/redeliver.js.map +1 -0
- package/dist/api/roster-standing.d.ts +10 -1
- package/dist/api/roster-standing.d.ts.map +1 -1
- package/dist/api/roster-standing.js +34 -4
- package/dist/api/roster-standing.js.map +1 -1
- package/dist/api/routes.d.ts +14 -6
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +468 -210
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-base-notice.d.ts +5 -0
- package/dist/api/run-base-notice.d.ts.map +1 -0
- package/dist/api/run-base-notice.js +15 -0
- package/dist/api/run-base-notice.js.map +1 -0
- package/dist/api/run-files.d.ts.map +1 -1
- package/dist/api/run-files.js +41 -2
- package/dist/api/run-files.js.map +1 -1
- package/dist/api/seat-agents.d.ts +3 -1
- package/dist/api/seat-agents.d.ts.map +1 -1
- package/dist/api/seat-agents.js +8 -2
- package/dist/api/seat-agents.js.map +1 -1
- package/dist/api/seat-images.d.ts +54 -0
- package/dist/api/seat-images.d.ts.map +1 -1
- package/dist/api/seat-images.js +132 -8
- package/dist/api/seat-images.js.map +1 -1
- package/dist/api/seat-probe.d.ts +6 -5
- package/dist/api/seat-probe.d.ts.map +1 -1
- package/dist/api/seat-probe.js +11 -7
- package/dist/api/seat-probe.js.map +1 -1
- package/dist/api/seat-standing.d.ts +3 -0
- package/dist/api/seat-standing.d.ts.map +1 -1
- package/dist/api/seat-standing.js +9 -4
- package/dist/api/seat-standing.js.map +1 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +16 -6
- package/dist/api/server.js.map +1 -1
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +4 -2
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/ui-text.d.ts +2 -0
- package/dist/api/ui-text.d.ts.map +1 -1
- package/dist/api/ui-text.js +2 -0
- package/dist/api/ui-text.js.map +1 -1
- package/dist/apps-server/server/lib/bundle/server.mjs +227 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/service.d.ts +2 -0
- package/dist/cli/service.d.ts.map +1 -1
- package/dist/cli/service.js +14 -0
- package/dist/cli/service.js.map +1 -1
- package/dist/core/adapter.d.ts +27 -3
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +89 -10
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/bridge-reaper.d.ts +4 -3
- package/dist/core/bridge-reaper.d.ts.map +1 -1
- package/dist/core/bridge-reaper.js +24 -8
- package/dist/core/bridge-reaper.js.map +1 -1
- package/dist/core/deliver-exclusions.d.ts +32 -0
- package/dist/core/deliver-exclusions.d.ts.map +1 -1
- package/dist/core/deliver-exclusions.js +47 -0
- package/dist/core/deliver-exclusions.js.map +1 -1
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +11 -2
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/deliver.d.ts +34 -1
- package/dist/core/deliver.d.ts.map +1 -1
- package/dist/core/deliver.js +277 -49
- package/dist/core/deliver.js.map +1 -1
- package/dist/core/job-seats.d.ts +23 -0
- package/dist/core/job-seats.d.ts.map +1 -0
- package/dist/core/job-seats.js +38 -0
- package/dist/core/job-seats.js.map +1 -0
- package/dist/core/launch-posture.d.ts +75 -0
- package/dist/core/launch-posture.d.ts.map +1 -0
- package/dist/core/launch-posture.js +88 -0
- package/dist/core/launch-posture.js.map +1 -0
- package/dist/core/pr-checks-helper.d.ts +51 -0
- package/dist/core/pr-checks-helper.d.ts.map +1 -0
- package/dist/core/pr-checks-helper.js +172 -0
- package/dist/core/pr-checks-helper.js.map +1 -0
- package/dist/core/redeliver.d.ts +16 -0
- package/dist/core/redeliver.d.ts.map +1 -0
- package/dist/core/redeliver.js +64 -0
- package/dist/core/redeliver.js.map +1 -0
- package/dist/core/threadpool.d.ts +3 -0
- package/dist/core/threadpool.d.ts.map +1 -0
- package/dist/core/threadpool.js +14 -0
- package/dist/core/threadpool.js.map +1 -0
- package/dist/insights/review-service.d.ts +10 -0
- package/dist/insights/review-service.d.ts.map +1 -1
- package/dist/insights/review-service.js +27 -3
- package/dist/insights/review-service.js.map +1 -1
- package/dist/interactive/council-outcome.js +1 -1
- package/dist/interactive/council-outcome.js.map +1 -1
- package/dist/learnings/extract.d.ts +7 -12
- package/dist/learnings/extract.d.ts.map +1 -1
- package/dist/learnings/extract.js +9 -40
- package/dist/learnings/extract.js.map +1 -1
- package/dist/learnings/recall.d.ts +11 -1
- package/dist/learnings/recall.d.ts.map +1 -1
- package/dist/learnings/recall.js +20 -4
- package/dist/learnings/recall.js.map +1 -1
- package/dist/learnings/replacement-lineage.d.ts +22 -0
- package/dist/learnings/replacement-lineage.d.ts.map +1 -0
- package/dist/learnings/replacement-lineage.js +41 -0
- package/dist/learnings/replacement-lineage.js.map +1 -0
- package/dist/learnings/service.d.ts +12 -15
- package/dist/learnings/service.d.ts.map +1 -1
- package/dist/learnings/service.js +23 -43
- package/dist/learnings/service.js.map +1 -1
- package/dist/mcp/env.js +3 -3
- package/dist/mcp/env.js.map +1 -1
- package/dist/mcp/registry.js +3 -3
- package/dist/mcp/registry.js.map +1 -1
- package/dist/projects/auto-refresh.d.ts +21 -0
- package/dist/projects/auto-refresh.d.ts.map +1 -1
- package/dist/projects/auto-refresh.js +55 -1
- package/dist/projects/auto-refresh.js.map +1 -1
- package/dist/projects/graph.d.ts +39 -0
- package/dist/projects/graph.d.ts.map +1 -1
- package/dist/projects/graph.js +144 -13
- package/dist/projects/graph.js.map +1 -1
- package/dist/schedules/routes.d.ts.map +1 -1
- package/dist/schedules/routes.js +5 -0
- package/dist/schedules/routes.js.map +1 -1
- package/dist/schedules/scheduler.d.ts +40 -1
- package/dist/schedules/scheduler.d.ts.map +1 -1
- package/dist/schedules/scheduler.js +175 -13
- package/dist/schedules/scheduler.js.map +1 -1
- package/dist/schedules/store.d.ts +20 -0
- package/dist/schedules/store.d.ts.map +1 -1
- package/dist/schedules/store.js +17 -0
- package/dist/schedules/store.js.map +1 -1
- package/dist/setup/delivery-readiness.d.ts +117 -0
- package/dist/setup/delivery-readiness.d.ts.map +1 -0
- package/dist/setup/delivery-readiness.js +262 -0
- package/dist/setup/delivery-readiness.js.map +1 -0
- package/dist/setup/known.d.ts +27 -0
- package/dist/setup/known.d.ts.map +1 -1
- package/dist/setup/known.js +47 -0
- package/dist/setup/known.js.map +1 -1
- package/dist/setup/routes.d.ts +5 -3
- package/dist/setup/routes.d.ts.map +1 -1
- package/dist/setup/routes.js +9 -3
- package/dist/setup/routes.js.map +1 -1
- package/dist/sources/routes.js +1 -1
- package/dist/sources/routes.js.map +1 -1
- package/dist/standing-orders/parse.js +1 -1
- package/dist/standing-orders/parse.js.map +1 -1
- package/dist/studio/apps-standalone/fixture.js +3 -3
- package/dist/studio/apps-standalone/runtime.js +1 -1
- package/dist/studio/assets/{KnowledgeGraph-BekDGaZW.js → KnowledgeGraph-DWw0I8RJ.js} +1 -1
- package/dist/studio/assets/index-C4Xj-zxa.css +32 -0
- package/dist/studio/assets/{index-D5r5wtIa.js → index-CrNY3d06.js} +305 -305
- package/dist/studio/editors/wicked-apps/editor.json +1 -1
- package/dist/studio/editors/wicked-apps/index.html +2 -2
- package/dist/studio/editors/wicked-deck/editor.json +1 -1
- package/dist/studio/editors/wicked-deck/index.html +13 -13
- package/dist/studio/editors/wicked-doc/editor.json +1 -1
- package/dist/studio/editors/wicked-doc/index.html +12 -12
- package/dist/studio/editors/wicked-insights/editor.json +1 -1
- package/dist/studio/editors/wicked-insights/index.html +2 -2
- package/dist/studio/editors/wicked-page/editor.json +1 -1
- package/dist/studio/editors/wicked-page/index.html +12 -12
- package/dist/studio/editors/wicked-video/editor.json +1 -1
- package/dist/studio/editors/wicked-video/index.html +10 -10
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +69 -3
- package/dist/working-doc/event-lines.d.ts +4 -0
- package/dist/working-doc/event-lines.d.ts.map +1 -1
- package/dist/working-doc/event-lines.js +8 -2
- package/dist/working-doc/event-lines.js.map +1 -1
- package/dist/working-doc/notes-index.d.ts.map +1 -1
- package/dist/working-doc/notes-index.js +2 -2
- package/dist/working-doc/notes-index.js.map +1 -1
- package/endpoint-manifest.json +36 -1
- package/package.json +4 -4
- package/workflows/distill-learnings.json +2 -2
- package/dist/studio/assets/index-CkosDNYp.css +0 -32
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="wicked-editor" content="wicked-page">
|
|
6
|
-
<meta name="wicked-editor-version" content="0.16.
|
|
6
|
+
<meta name="wicked-editor-version" content="0.16.15">
|
|
7
7
|
<title>Document</title>
|
|
8
8
|
<style>
|
|
9
9
|
/* The plugin's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</style>
|
|
46
46
|
</head>
|
|
47
47
|
<body data-size="pane">
|
|
48
|
-
<script>var wickedEditor=(function(
|
|
48
|
+
<script>var wickedEditor=(function(K){"use strict";var $n=Object.defineProperty;var Tn=(K,U,J)=>U in K?$n(K,U,{enumerable:!0,configurable:!0,writable:!0,value:J}):K[U]=J;var wt=(K,U,J)=>Tn(K,typeof U!="symbol"?U+"":U,J);const U=/^slide-(\d+)-([a-z-]+)-(\d+)$/,J=/^section-(\d+)$/,kt={heading:"heading",paragraph:"paragraph","list-item":"list item",quote:"quote",caption:"caption",cell:"table cell",link:"link",button:"button",image:"image",block:"block",text:"line"},xt=/^[A-Za-z]{2,}(?:[-_ ][A-Za-z]{2,})*$/;function ne(e,n){const r=U.exec(e);if(r!==null){const i=Number(r[1]),l=kt[r[2]??""]??(r[2]??"").replace(/-+/g," "),a=Number(r[3]);return n==="deck"?`slide ${i+1}’s ${l==="heading"&&a===1?"title":`${l} ${a}`}`:i===0?`${l} ${a}`:`${l} ${a} in section ${i+1}`}const s=J.exec(e);return s!==null?n==="deck"?`slide ${Number(s[1])+1}`:`section ${Number(s[1])+1}`:xt.test(e)?`the ${e.replace(/[-_]+/g," ").toLowerCase()}`:"this part"}function At(e,n){const r=Object.entries(n).filter(([,s])=>!s.composite&&s.text!=="");return e.map(s=>{const i=s.reqId.trim();if(i==="")return{...s,wid:null};const l=r.find(([,a])=>Et(a.text,i));return{...s,wid:l===void 0?null:l[0]}})}const Xe=/[A-Za-z0-9_-]/,Ye=/[A-Za-z0-9]/;function Et(e,n){const r=e.toLowerCase(),s=n.toLowerCase();if(s==="")return!1;for(let i=r.indexOf(s);i!==-1;i=r.indexOf(s,i+1)){const l=r.charAt(i-1),a=r.charAt(i+s.length),u=Xe.test(l)||l==="."&&Ye.test(r.charAt(i-2)),w=Xe.test(a)||a==="."&&Ye.test(r.charAt(i+s.length+1));if(!u&&!w)return!0}return!1}function Ct(e,n){const r=e.filter(i=>i.wid!==null).length,s=n>e.length?` (the first ${e.length} of ${n})`:"";return`${r} of ${e.length} named in this document${s}`}const St={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},$t=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function He(e){if($t.has(e))return!0;const n=St[Tt(e)];return n!==void 0&&n.verb==="navigate"}function Tt(e){const n=/^alt\+(.)$/i.exec(e);return n===null?e:`Alt+${n[1].toUpperCase()}`}function Ot(e){if(e===""||/[\u0000-\u001f\u007f]/.test(e))return!1;const n=Intl.Segmenter;return n!==void 0?Array.from(new n(void 0,{granularity:"grapheme"}).segment(e)).length===1:Array.from(e).length===1}function Lt(e,n,r){return{left:e.left-(r.scrollX-n.scrollX),top:e.top-(r.scrollY-n.scrollY),width:e.width,height:e.height}}const Rt=/^[A-Za-z0-9_.:-]{1,100}$/;function _(e){return typeof e=="number"&&isFinite(e)}function Mt(e){if(typeof e!="object"||e===null)return!1;const n=e;return n.section!==void 0&&(typeof n.section!="string"||!Rt.test(n.section))?!1:typeof n.text=="string"&&typeof n.composite=="boolean"}function Ft(e){if(typeof e!="object"||e===null)return!1;const n=e;return _(n.x)&&_(n.y)&&_(n.width)&&_(n.height)&&_(n.top)&&_(n.left)&&_(n.right)&&_(n.bottom)}function _t(e){if(typeof e!="object"||e===null)return null;const n=e;if(n.v!==1)return null;const r=n.type;if(r==="wid-inventory"){const s=n.widMap,i=n.scrollX,l=n.scrollY;if(typeof s!="object"||s===null||!_(i)||!_(l))return null;const a={};for(const[C,b]of Object.entries(s)){if(!Ft(b))return null;a[C]=b}const u=n.blocks;if(u===void 0)return{v:1,type:"wid-inventory",widMap:a,scrollX:i,scrollY:l};if(typeof u!="object"||u===null)return null;const w={};for(const[C,b]of Object.entries(u)){if(!Mt(b))return null;w[C]={text:b.text,composite:b.composite,...b.cut===!0?{cut:!0}:{},...b.section!==void 0?{section:b.section}:{}}}return{v:1,type:"wid-inventory",widMap:a,scrollX:i,scrollY:l,blocks:w}}if(r==="scroll-state"){const s=n.scrollX,i=n.scrollY;return!_(s)||!_(i)?null:{v:1,type:"scroll-state",scrollX:s,scrollY:i}}if(r==="scroll-ack"){const s=n.wid;if(typeof s!="string"||s==="")return null;const i=n.scrollX,l=n.scrollY,a=n.seq;return{v:1,type:"scroll-ack",wid:s,..._(i)&&_(l)?{scrollX:i,scrollY:l}:{},...typeof a=="number"&&Number.isInteger(a)&&a>0?{seq:a}:{}}}if(r==="wid-click"){const s=n.wid;return typeof s!="string"||s===""?null:{v:1,type:"wid-click",wid:s}}if(r==="wid-hover"){const s=n.wid;return s!==null&&(typeof s!="string"||s==="")?null:{v:1,type:"wid-hover",wid:s}}return null}const jt=Object.freeze({v:1,type:"request-inventory"});function Dt(e,n){return n===void 0?{v:1,type:"scroll-to-wid",wid:e}:{v:1,type:"scroll-to-wid",wid:e,seq:n}}const Bt="request-inventory";function Nt(e){return e.includes(Bt)}const qt=`
|
|
49
49
|
(function () {
|
|
50
50
|
if (window.__wickedInstrumentBridge) return;
|
|
51
51
|
window.__wickedInstrumentBridge = 1;
|
|
@@ -123,22 +123,22 @@
|
|
|
123
123
|
post(inventory());
|
|
124
124
|
}
|
|
125
125
|
})();
|
|
126
|
-
`;function
|
|
126
|
+
`;function It(e){const n=`<script>${qt}<\/script>`;return/<\/body>/i.test(e)?e.replace(/<\/body>/i,()=>`${n}</body>`):`${e}${n}`}const V=String.raw`\s*-?(?:\d+(?:\.\d+)?|\.\d+)%?\s*`,Pt=new RegExp(`^(?:#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\\((?:${V},){2}${V}(?:,${V})?\\)|hsla?\\(\\s*-?\\d+(?:\\.\\d+)?(?:deg)?\\s*,${V},${V}(?:,${V})?\\)|var\\(--wi-[a-z0-9-]{1,40}\\)|revert-layer)$`,"i");function zt(e,n=new Set){if(!Pt.test(e))return!1;const r=/^var\((--wi-[a-z0-9-]+)\)$/i.exec(e);return r===null||n.has(r[1].toLowerCase())}const Kt=[["--wi-bg","Background"],["--wi-surface","Surface"],["--wi-card-bg","Card"],["--wi-primary","Primary"],["--wi-secondary","Secondary"],["--wi-accent","Accent"],["--wi-text","Text"],["--wi-text-secondary","Secondary text"],["--wi-muted","Muted"],["--wi-border","Border"]],Ce="revert-layer";function Ut(e){const n=new Map;for(const i of e.matchAll(/(--wi-[a-z-]{1,40})\s*:\s*([^;}{]{1,80})/gi))n.set(i[1].toLowerCase(),i[2].trim());const r=new Set,s=[];for(const[i,l]of Kt){const a=n.get(i);if(a===void 0)continue;const u=a.startsWith("#")?a.toLowerCase():a;!zt(u)||r.has(u.toLowerCase())||(r.add(u.toLowerCase()),s.push({token:i,value:u,label:l}))}return s}const oe="wicked.editor",re=1,Je=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Wt=["card","options","full"];function Xt(e){return e==="inline"?"card":e==="pane"?"options":"full"}function Yt(e){return e==="card"?"inline":e==="options"?"pane":"full"}function Ht(e){const n=Je(e)?e:{},r=n.size==="inline"||n.size==="full"?n.size:"pane",s=n.protocol===2?2:1,i=s===2&&typeof n.tab=="string"?n.tab:null,l=s===2&&Wt.includes(n.surface)?n.surface:Xt(r),a=l==="options"&&i===null?"full":l,u=s===2&&(n.mode==="simple"||n.mode==="advanced")?n.mode:null;return{protocol:s,surface:a,tab:i,mode:u,size:r}}function Jt(e,n,r){return{editor:e,version:n,protocol:[1,2],surfaces:r}}function Vt(e,n){const r=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:oe,v:re,type:"plugin.ready",payload:Jt(e,r,n)},"*")}function Ve(e){return Array.from(e.querySelectorAll("button, a[href], input, select, textarea, summary, [tabindex]")).filter(n=>n.tabIndex>=0&&!n.matches(":disabled")&&n.closest("[hidden]")===null)}function Zt(e,n,r){const s=e.metaKey||e.ctrlKey;let i=null;if(e.key==="Escape")i="Escape";else if(s&&!e.altKey&&e.key.toLowerCase()==="k")i="Mod+K";else if(e.altKey&&!s&&/^Key[A-Z]$/.test(e.code)&&He(`Alt+${e.code.slice(3)}`))i=`Alt+${e.code.slice(3)}`;else if(e.key==="Tab"){const l=Ve(n),a=l.indexOf(e.target);(e.shiftKey?a<=0:a===-1||a===l.length-1)&&(i=e.shiftKey?"Shift+Tab":"Tab")}return i===null?!1:(e.preventDefault(),e.stopPropagation(),r(i),!0)}function Gt(e,n,r){if(e.defaultPrevented)return!1;const s=e.target;if(e.key==="Tab"&&!(s instanceof HTMLElement&&Ve(n).includes(s)))return!1;if(Zt(e,n,l=>r("ui.key",{key:l})))return!0;if(e.metaKey||e.ctrlKey||e.altKey||!Ot(e.key))return!1;const i=s?.closest("[contenteditable]");return s?.closest("input,textarea,select")||i&&i.getAttribute("contenteditable")!=="false"||e.key===" "&&s?.closest('button,summary,a[href],[role="button"],[tabindex]:not([tabindex="-1"])')?!1:(e.preventDefault(),e.stopPropagation(),r("ui.typed",{grapheme:e.key}),!0)}class Qt{constructor(n,r){wt(this,"revs",new Map);this.port=n,this.h=r}reply(n,r){this.port.postMessage({p:oe,v:re,re:n,ok:!0,payload:r})}refuse(n,r,s){this.port.postMessage({p:oe,v:re,re:n,ok:!1,error:{code:r,message:s}})}bump(n){const r=(this.revs.get(n)??0)+1;return this.revs.set(n,r),r}values(n,r){this.port.postMessage({p:oe,v:re,type:"options.values",payload:{tab:n,rev:this.bump(n),values:r}})}height(n){this.port.postMessage({p:oe,v:re,type:"ui.height",payload:{px:Math.round(n)}})}dispatch(n){const r=Je(n.payload)?n.payload:{},s=typeof n.id=="string"?n.id:null;switch(n.type){case"host.surface":{const i=r.surface;return(i==="card"||i==="options"||i==="full")&&this.h.surface?.(i,r.mode==="simple"||r.mode==="advanced"?r.mode:null),!0}case"host.mode":{if(s===null)return!0;const i=r.mode;return i!=="simple"&&i!=="advanced"?(this.refuse(s,"bad_request","mode is simple or advanced"),!0):(this.reply(s,{mode:this.h.mode?.(i)??i}),!0)}case"host.action":{if(s===null)return!0;const i=r.id;return typeof i!="string"||this.h.action===void 0?(this.reply(s,{handled:!1}),!0):(Promise.resolve(this.h.action(i)).then(l=>this.reply(s,{handled:l.handled===!0,...typeof l.status=="string"?{status:l.status.slice(0,120)}:{}}),()=>this.reply(s,{handled:!1})),!0)}case"host.tab":return typeof r.tab=="string"&&this.h.tab?.(r.tab),!0;case"host.selection":return Array.isArray(r.anchors)&&this.h.selection?.(r.anchors),!0;case"options.changed":{if(s===null)return!0;const i=r.tab,l=r.id;return typeof i!="string"||typeof l!="string"||this.h.optionsChanged===void 0?(this.refuse(s,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(i,l,r.value)).then(a=>this.reply(s,{applied:a.applied,rev:this.bump(i),values:a.values,...a.reason!==void 0?{reason:a.reason.slice(0,120)}:{}}),a=>this.refuse(s,"unavailable",a instanceof Error?a.message.slice(0,120):"failed")),!0)}default:return!1}}}const ue=[{name:"corporate-light",display_name:"Corporate Light",colors:{background:"#FFFFFF",surface:"#F8FAFC",primary:"#1E3A5F",secondary:"#2563EB",accent:"#0891B2",text_primary:"#1E293B",text_secondary:"#64748B",text_muted:"#94A3B8",border:"#E2E8F0"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"midnight-purple",display_name:"Midnight Purple",colors:{background:"#0A0A0F",surface:"#13091D",primary:"#A100FF",secondary:"#6B2FA0",accent:"#F59E0B",text_primary:"#FFFFFF",text_secondary:"#A0A0B0",text_muted:"#6B6B80",border:"#2A2A3D"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"warm-dark",display_name:"Warm Dark",colors:{background:"#1A1A2E",surface:"#16213E",primary:"#FF6B6B",secondary:"#C44569",accent:"#FFD93D",text_primary:"#F8F8F2",text_secondary:"#B0B0C0",text_muted:"#6B6B80",border:"#2D2D44"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}}],Ze=["Inter","Roboto","Source Sans 3","IBM Plex Sans","Calibri","Georgia","system-ui"],en=[["background","Background"],["surface","Surface"],["primary","Primary"],["accent","Accent"],["text_primary","Text"]],Se=e=>({name:e.name,colors:{...e.colors},fonts:{...e.fonts}});function tn(e,n){e.replaceChildren(),e.classList.add("plugin-style"),e.tabIndex=-1,e.onkeydown=g=>{Gt(g,e,(m,k)=>{"key"in k?n.key?.(k.key):n.typed?.(k.grapheme)})};const r=document.createElement("style");r.textContent=`.plugin-style{padding:16px;box-sizing:border-box;color:var(--ink-high);background:var(--surface-base);font:13px var(--font-sans,system-ui)}
|
|
127
127
|
.plugin-style h2{font-size:16px;margin:0 0 12px}.plugin-style .theme-cards{display:grid;gap:8px;margin-bottom:18px}
|
|
128
128
|
.plugin-style button,.plugin-style input,.plugin-style select{font:inherit;color:var(--ink-high);background:var(--surface-card);border:1px solid var(--border);border-radius:4px}
|
|
129
129
|
.plugin-style button{padding:8px;text-align:left;cursor:pointer}.plugin-style button:focus-visible,.plugin-style input:focus-visible,.plugin-style select:focus-visible{outline:2px solid var(--accent)}
|
|
130
130
|
.plugin-style .ps-swatches{display:flex;width:100%;height:16px;margin-bottom:6px;border:1px solid var(--border)}.plugin-style .ps-swatches span{flex:1}
|
|
131
131
|
.plugin-style label{display:flex;align-items:center;gap:8px;margin:10px 0}.plugin-style label>span:first-child{flex:1}.plugin-style input[type=color]{width:36px;height:30px;padding:2px}.plugin-style input[type=text]{width:80px;padding:5px}.plugin-style select{max-width:170px;padding:5px}
|
|
132
|
-
.plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,e.append(r);const s=document.createElement("h2");s.textContent="Style",e.append(s);const i=document.createElement("div");i.className="theme-cards",e.append(i);const l=document.createElement("p");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let a=!1;const u=[],w=()=>Se(n.tokens()??ue[0]),C=[],
|
|
133
|
-
`),s=new Map;for(const u of r.matchAll(/(--wi-[a-z-]+)\s*:\s*([^;}{]+)/gi))s.set(u[1].toLowerCase(),u[2].trim());if(s.size===0)return null;const i=Se(ue[0]),l={background:"--wi-bg",surface:"--wi-surface",primary:"--wi-primary",secondary:"--wi-secondary",accent:"--wi-accent",text_primary:"--wi-text",text_secondary:"--wi-text-secondary",text_muted:"--wi-muted",border:"--wi-border"};for(const u of Object.keys(l)){const w=s.get(l[u]);w!==void 0&&/^(#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\([0-9.,%\s]+\))$/i.test(w)&&(i.colors[u]=w)}for(const u of["heading","body","mono"]){const w=s.get(`--wi-font-${u}`);w!==void 0&&(i.fonts[u]=w.split(",")[0].trim().replace(/^['"]|['"]$/g,""))}const a=ue.find(u=>JSON.stringify(u.colors)===JSON.stringify(i.colors)&&JSON.stringify(u.fonts)===JSON.stringify(i.fonts));return i.name=a?.name??"custom",i}const
|
|
134
|
-
`,se=/[\n\r\u2028\u2029]/,
|
|
135
|
-
`||g==="\r")break;A+=1}if(!F)break;u=!1;const
|
|
136
|
-
`:"")+$e+e.slice(n)}const
|
|
137
|
-
`));a.textContent=u,r.add(
|
|
132
|
+
.plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,e.append(r);const s=document.createElement("h2");s.textContent="Style",e.append(s);const i=document.createElement("div");i.className="theme-cards",e.append(i);const l=document.createElement("p");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let a=!1;const u=[],w=()=>Se(n.tokens()??ue[0]),C=[],b=[],A=()=>{const g=w();for(const{key:m,picker:k,hex:S}of C)S.value=g.colors[m],k.value=/^#[0-9a-f]{6}$/i.test(g.colors[m])?g.colors[m]:"";for(const{key:m,select:k}of b)k.value=Ze.includes(g.fonts[m])?g.fonts[m]:"system-ui";for(const m of Array.from(i.querySelectorAll("button")))m.setAttribute("aria-pressed",String(m.dataset.theme===g.name))},F=async g=>{if(!a){a=!0,u.forEach(m=>{m.disabled=!0}),l.textContent="Applying theme…";try{const m=await n.apply(g);l.textContent=m.ok?"Theme applied.":`Theme was not applied: ${m.reason}`}catch(m){l.textContent=`Theme was not applied: ${m instanceof Error?m.message:"unavailable"}`}finally{a=!1,u.forEach(m=>{m.disabled=!1}),A()}}};for(const g of ue){const m=document.createElement("button");m.type="button",m.dataset.theme=g.name;const k=document.createElement("span");k.className="ps-swatches",k.setAttribute("aria-hidden","true");for(const y of["background","surface","primary","secondary","accent"]){const x=document.createElement("span");x.style.backgroundColor=g.colors[y],k.append(x)}const S=document.createElement("span");S.textContent=g.display_name,m.append(k,S),m.addEventListener("click",()=>{F(Se(g))}),i.append(m),u.push(m)}for(const[g,m]of en){const k=document.createElement("label"),S=document.createElement("span");S.textContent=m;const y=document.createElement("input");y.type="color",y.setAttribute("aria-label",m);const x=document.createElement("input");x.type="text",x.maxLength=7,x.setAttribute("aria-label",`${m} hex`);const L=Z=>{if(!/^#[0-9a-f]{6}$/i.test(Z)){l.textContent="Enter a six-digit hex colour: a # and six digits or letters a to f.",A();return}const B=w();B.name="custom",B.colors[g]=Z,F(B)};y.addEventListener("change",()=>L(y.value)),x.addEventListener("change",()=>L(x.value)),k.append(S,y,x),e.append(k),u.push(y,x),C.push({key:g,picker:y,hex:x})}for(const g of["heading","body"]){const m=document.createElement("label"),k=document.createElement("span");k.textContent=g==="heading"?"Heading font":"Body font";const S=document.createElement("select");S.setAttribute("aria-label",k.textContent);for(const y of Ze){const x=document.createElement("option");x.value=y,x.textContent=y,S.append(x)}S.addEventListener("change",()=>{const y=w();y.name="custom",y.fonts[g]=S.value,F(y)}),m.append(k,S),e.append(m),u.push(S),b.push({key:g,select:S})}const D=document.createElement("p");return D.textContent="Match a website or a PDF: the host's Match button under this tab",e.append(D,l),A(),{refresh:A}}function nn(e){const n=new DOMParser().parseFromString(e,"text/html"),r=Array.from(n.querySelectorAll("style")).map(u=>u.textContent??"").join(`
|
|
133
|
+
`),s=new Map;for(const u of r.matchAll(/(--wi-[a-z-]+)\s*:\s*([^;}{]+)/gi))s.set(u[1].toLowerCase(),u[2].trim());if(s.size===0)return null;const i=Se(ue[0]),l={background:"--wi-bg",surface:"--wi-surface",primary:"--wi-primary",secondary:"--wi-secondary",accent:"--wi-accent",text_primary:"--wi-text",text_secondary:"--wi-text-secondary",text_muted:"--wi-muted",border:"--wi-border"};for(const u of Object.keys(l)){const w=s.get(l[u]);w!==void 0&&/^(#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\([0-9.,%\s]+\))$/i.test(w)&&(i.colors[u]=w)}for(const u of["heading","body","mono"]){const w=s.get(`--wi-font-${u}`);w!==void 0&&(i.fonts[u]=w.split(",")[0].trim().replace(/^['"]|['"]$/g,""))}const a=ue.find(u=>JSON.stringify(u.colors)===JSON.stringify(i.colors)&&JSON.stringify(u.fonts)===JSON.stringify(i.fonts));return i.name=a?.name??"custom",i}const on=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=(e,n)=>e>>>n|e<<32-n;function Ge(e){const n=new TextEncoder().encode(e),r=n.length*8,s=new Uint8Array(Math.ceil((n.length+9)/64)*64);s.set(n),s[n.length]=128;const i=new DataView(s.buffer);i.setUint32(s.length-8,Math.floor(r/4294967296)),i.setUint32(s.length-4,r>>>0);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);for(let C=0;C<s.length;C+=64){for(let y=0;y<16;y++)a[y]=i.getUint32(C+y*4);for(let y=16;y<64;y++){const x=I(a[y-15],7)^I(a[y-15],18)^a[y-15]>>>3,L=I(a[y-2],17)^I(a[y-2],19)^a[y-2]>>>10;a[y]=a[y-16]+x+a[y-7]+L>>>0}let[b,A,F,D,g,m,k,S]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let y=0;y<64;y++){const x=S+(I(g,6)^I(g,11)^I(g,25))+(g&m^~g&k)+on[y]+a[y]>>>0,L=(I(b,2)^I(b,13)^I(b,22))+(b&A^b&F^A&F)>>>0;S=k,k=m,m=g,g=D+x>>>0,D=F,F=A,A=b,b=x+L>>>0}l[0]=l[0]+b>>>0,l[1]=l[1]+A>>>0,l[2]=l[2]+F>>>0,l[3]=l[3]+D>>>0,l[4]=l[4]+g>>>0,l[5]=l[5]+m>>>0,l[6]=l[6]+k>>>0,l[7]=l[7]+S>>>0}const u=new DataView(new ArrayBuffer(32));l.forEach((C,b)=>u.setUint32(b*4,C));let w="";for(let C=0;C<32;C++)w+=String.fromCharCode(u.getUint8(C));return btoa(w)}const Qe="WebRTC is not available in an editor frame",rn=["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCDataChannel","RTCIceTransport","RTCDtlsTransport","RTCSctpTransport","RTCRtpSender","RTCRtpReceiver","RTCRtpTransceiver","RTCIceCandidate","RTCSessionDescription","RTCCertificate"],$e='(function(w,o){if(typeof w!=="object"||w===null||w.window!==w)throw '+JSON.stringify(Qe)+";var n="+JSON.stringify(rn)+",k=o.getOwnPropertyNames(w),i,d;for(i=0;i!==k.length;i++)if(/^(webkit|moz)?RTC/.test(k[i])&&(d=o.getOwnPropertyDescriptor(w,k[i]))&&d.configurable)n.push(k[i]);for(i=0;i!==n.length;i++){o.defineProperty(w,n[i],{value:void 0,writable:false,configurable:false});if(w[n[i]]!==void 0)throw "+JSON.stringify(Qe)+`}})(window,({}).constructor);
|
|
134
|
+
`,se=/[\n\r\u2028\u2029]/,et=/\s/,tt=/[\w$\\\u0080-\uFFFF]/;function sn(e,n){if(n>=e.length)return!0;const r=e[n];if(r==='"'||r==="'"||r==="{"||r==="~"||/[0-9]/.test(r))return!0;if(r==="!")return e[n+1]!=="=";if(r===".")return/[0-9]/.test(e[n+1]??"");if(r==="\\")return!0;if(r==="+"||r==="-")return e[n+1]===r;if(!tt.test(r))return!1;let s=n;for(;s<e.length&&tt.test(e[s])&&!et.test(e[s]);)s++;const i=e.slice(n,s);return i!=="in"&&i!=="instanceof"}function an(e){const n=e.length;let r=0,s=0,i=!1,l=!1;if(e.startsWith("#!")){for(;r<n&&!se.test(e[r]);)r++;s=r,i=!0}let a=!1,u=!0,w=!0;const C=()=>{for(;;){for(;r<n&&et.test(e[r]);)se.test(e[r])&&(a=!0,u=!0),r++;if(w&&u&&e.startsWith("-->",r)){for(;r<n&&!se.test(e[r]);)r++;continue}if(e.startsWith("/*",r)){const b=e.indexOf("*/",r+2);if(b<0)return!1;se.test(e.slice(r,b))&&(a=!0,u=!0),r=b+2}else if(e.startsWith("//",r)||w&&e.startsWith("<!--",r))for(;r<n&&!se.test(e[r]);)r++;else return!0}};for(;C();){const b=e[r];if(b!=='"'&&b!=="'")break;w=!1;let A=r+1,F=!1;for(;A<n;){const g=e[A];if(g==="\\"){A+=2;continue}if(g===b){F=!0,A+=1;break}if(g===`
|
|
135
|
+
`||g==="\r")break;A+=1}if(!F)break;u=!1;const D=A;if(r=A,a=!1,!C())break;if(e[r]===";")r+=1,u=!1,s=r,l=!1;else if(e.startsWith("<!--",r)){s=D,l=!0,i=!1;break}else if((a||r>=n)&&sn(e,r))s=D,l=!0;else break;i=!1}return{at:s,afterHashbang:i,semicolon:l}}function ln(e){const{at:n,afterHashbang:r,semicolon:s}=an(e);return e.slice(0,n)+(s?";":"")+(r?`
|
|
136
|
+
`:"")+$e+e.slice(n)}const cn=new Set(["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]),nt="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml";function dn(e){if(e.namespaceURI===nt?e.hasAttribute("href")||e.hasAttribute("xlink:href"):e.hasAttribute("src"))return!1;const n=e.namespaceURI===nt?null:e.getAttribute("language"),r=e.hasAttribute("type")?e.getAttribute("type"):n!==null&&n!==""?`text/${n}`:"";return r===""||r.toLowerCase()==="module"?!0:cn.has(r.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"").toLowerCase())}function rt(e){const n=Array.from(e.querySelectorAll("script"));for(const r of Array.from(e.querySelectorAll("template")))r.namespaceURI===ot&&n.push(...rt(r.content));return n}function st(e){const n=Array.from(e.querySelectorAll("meta[http-equiv]")).filter(r=>r.getAttribute("http-equiv").trim().toLowerCase()==="content-security-policy");for(const r of Array.from(e.querySelectorAll("template")))r.namespaceURI===ot&&n.push(...st(r.content));return n}function un(e){return e.doctype===null?"":new XMLSerializer().serializeToString(e.doctype)}function pn(e){const n=new DOMParser().parseFromString(e,"text/html"),r=new Set([Ge($e)]);for(const a of rt(n)){if(!dn(a))continue;const u=ln((a.textContent??"").replace(/\r\n?/g,`
|
|
137
|
+
`));a.textContent=u,r.add(Ge(u))}for(const a of st(n)){const u=(a.getAttribute("content")??"").split(";").map(w=>w.trim()).filter(w=>w!==""&&!/^script-src(-elem|-attr)?(\s|$)/i.test(w));a.setAttribute("content",[...u,"script-src 'unsafe-inline'"].join("; "))}const s=n.createElement("meta");s.setAttribute("http-equiv","Content-Security-Policy"),s.setAttribute("content",`script-src ${[...r].map(a=>`'sha256-${a}'`).join(" ")}; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'`);const i=n.createElement("meta");i.setAttribute("http-equiv","Content-Security-Policy"),i.setAttribute("content","script-src 'unsafe-inline'");const l=n.createElement("script");return l.textContent=$e,n.head.prepend(s,i,l),`${un(n)}${n.documentElement.outerHTML}`}const ie="wicked.editor",pe=1,fn=[[390,"Phone"],[820,"Tablet"],[1280,"Desktop"]],Te=34,hn=[0,250,750,1500],yn=`
|
|
138
138
|
<div data-testid="page-style" id="style" class="style-pane" hidden></div>
|
|
139
139
|
<div data-testid="page-editor" id="editor" class="editor" data-kind="page" data-head="" data-pickable="false" data-selected="" data-size="pane" data-width="" tabindex="0" role="application" aria-label="The page">
|
|
140
140
|
<div data-testid="page-tools" id="tools" class="tools" role="toolbar" aria-label="Page width">
|
|
141
|
-
${
|
|
141
|
+
${fn.map(([e,n])=>`<button type="button" data-testid="page-width" data-width="${e}" aria-pressed="false" title="${n} · ${e} px wide">${n} ${e}</button>`).join("")}
|
|
142
142
|
</div>
|
|
143
143
|
<div id="stage" class="stage"></div>
|
|
144
144
|
<div data-testid="page-hover-box" id="hover" class="box box--hover" hidden></div>
|
|
@@ -153,13 +153,13 @@
|
|
|
153
153
|
<span class="swatches" data-testid="page-swatches" data-prop="background" id="fills"><span class="word">Fill</span></span>
|
|
154
154
|
<span class="swatches" data-testid="page-swatches" data-prop="color" id="inks"><span class="word">Text</span></span>
|
|
155
155
|
</div>
|
|
156
|
-
</div>`;function M(e){const n=document.getElementById(e);if(n===null)throw new Error(`wicked-page: no #${e}`);return n}function
|
|
156
|
+
</div>`;function M(e){const n=document.getElementById(e);if(n===null)throw new Error(`wicked-page: no #${e}`);return n}function it(e,n){const r=e?.blocks[n];return e===null||e.widMap[n]===void 0||r===void 0?"unmeasured":r.composite?"container":r.cut===!0?"cut":"yes"}function Oe(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function mn(e){document.body.insertAdjacentHTML("afterbegin",yn);const n=M("editor");n.dataset.kind=e.kind,n.setAttribute("aria-label",e.kind==="document"?"The document":"The page");const r=M("stage");let s=null;const i=M("hover"),l=M("selected"),a=M("input"),u=M("handle"),w=M("hint"),C=M("note"),b=M("tools"),A=M("peek"),F=M("to-section"),D=M("remove"),g=M("fills"),m=M("inks");let k=null,S=[],y="pane",x=1,L="options",Z="style",B="simple",Le=null;const ae=()=>x===1?y!=="inline":L==="full",G=()=>ae()&&(x===1||B==="advanced");let fe=null,bn=0;const Re=new Map,P=(t,o)=>{k?.postMessage({p:ie,v:pe,type:t,payload:o})},le=(t,o)=>new Promise(c=>{if(k===null){c({ok:!1,error:{code:"unavailable",message:"no host yet"}});return}const d=`wp-${++bn}`;Re.set(d,c),k.postMessage({p:ie,v:pe,type:t,id:d,payload:o})}),he=t=>P("ui.status",{line:t.slice(0,120)});let O=null,Me=Object.create(null),Q=null,Fe=0,ce=!1,_e=!1,Y=null;const E=e.coverage?document.createElement("aside"):null;if(E!==null){E.id="coverage",E.dataset.testid="doc-coverage",E.setAttribute("aria-label","Requirements"),E.hidden=!0,document.body.append(E);const t=document.createElement("style");t.textContent=`#coverage{box-sizing:border-box;height:100%;overflow:auto;padding:16px;color:var(--ink-high);background:var(--surface-base);font:13px var(--font-sans,system-ui)}
|
|
157
157
|
#coverage h2{font-size:16px;margin:0 0 12px}#coverage p{color:var(--ink-muted);line-height:1.5}
|
|
158
158
|
#coverage button{display:block;width:100%;padding:10px 8px;text-align:left;font:inherit;color:var(--ink-high);background:var(--surface-card);border:1px solid var(--border);border-radius:4px;margin:6px 0;cursor:pointer}
|
|
159
159
|
#coverage button:disabled{cursor:default}#coverage button:focus-visible{outline:2px solid var(--accent)}
|
|
160
160
|
#coverage p button{display:inline;width:auto;padding:0;margin:0;border:0;background:transparent;color:var(--accent);text-decoration:underline}
|
|
161
161
|
body[data-coverage="side"] .editor{width:calc(100% - min(300px,38%))}
|
|
162
|
-
body[data-coverage="side"] #coverage{position:absolute;right:0;top:0;width:min(300px,38%);border-left:1px solid var(--border)}`,document.body.append(t)}const ye=()=>{if(E===null)return;if(E.replaceChildren(),delete E.dataset.total,delete E.dataset.rows,delete E.dataset.named,ce){const h=document.createElement("p");h.textContent="Couldn't read the requirements · ";const T=document.createElement("button");T.type="button",T.textContent="Try again",T.addEventListener("click",()=>{_e()}),h.append(T),E.append(h);return}if(Q===null){const h=document.createElement("p");h.textContent="Reading requirements…",E.append(h);return}if(Q.length===0){const h=document.createElement("p");h.textContent="No requirements for this document's repository",E.append(h);return}const t=xt(Q.map(h=>({key:h.id,reqId:h.id,title:h.text,risk:!1})),Me),o=t.filter(h=>h.wid!==null),c=t.filter(h=>h.wid===null);E.dataset.total=String(Fe),E.dataset.rows=String(t.length),E.dataset.named=String(o.length);const d=document.createElement("h2");d.textContent="Requirements",E.append(d);const p=document.createElement("p");p.dataset.testid="doc-coverage-line",p.textContent=Et(t,Fe),E.append(p);const f=(h,T)=>{if(T.length===0)return;const de=document.createElement("p");de.textContent=`${h} (${T.length})`,E.append(de);for(const q of T){const X=document.createElement("button");X.type="button",X.dataset.testid="doc-coverage-row",X.dataset.req=q.reqId,X.dataset.named=String(q.wid!==null),X.disabled=q.wid===null,X.textContent=`${q.reqId} · ${q.title}${q.wid===null?"":` · ${ne(q.wid,e.kind)}`}`,X.addEventListener("click",()=>{if(q.wid!==null){if(L==="options"){S.includes("selection.chip")&&U("selection.set",{anchors:[{kind:"element",id:q.wid}]});return}te(q.wid,!0),Ae(q.wid)}}),E.append(X)}};f("Not named",c),f("Named",o)},_e=async()=>{if(!(!e.coverage||Q!==null||je)){je=!0,ce=!1,ye();try{const t=await le("checks.read",{}),o=t.ok?t.payload.checks:null;if(!t.ok||!Array.isArray(o)){ce=!0;return}Q=o.filter(c=>typeof c=="object"&&c!==null&&typeof c.id=="string"&&typeof c.text=="string"),Fe=typeof t.payload.total=="number"?t.payload.total:Q.length}catch{ce=!0}finally{je=!1,ye()}}},mn=t=>{const o=new DOMParser().parseFromString(t,"text/html");Me=Object.create(null);const c=Array.from(o.querySelectorAll("[data-wid]")),d=new Map;for(const p of c){const f=p.getAttribute("data-wid")??"";d.set(f,(d.get(f)??0)+1)}for(const p of c){const f=p.getAttribute("data-wid")??"";!/^[A-Za-z0-9_.:-]{1,100}$/.test(f)||d.get(f)!==1||(Me[f]={text:(p.textContent??"").replace(/\s+/g," ").trim(),composite:p.querySelector("[data-wid]")!==null})}ye()};let $=null,me={scrollX:0,scrollY:0},ge=null,b=null,_=null,ve=null,N=!1,at=[],P=null,Be=0,lt=-1,ee=null,De=null,ct=0,be=[],Ne=!1,qe=null,we=null;const dt=t=>{s?.contentWindow?.postMessage(t,"*")},gn=t=>{if(t===s){lt=Be;for(const o of be)clearTimeout(o);be=un.map(o=>setTimeout(()=>dt(Ft),o))}},vn=t=>{const o=document.createElement("iframe");for(const[d,p]of Object.entries({"data-testid":"page-frame",sandbox:"allow-scripts",title:e.kind==="document"?"The document":"The page",class:"frame"}))o.setAttribute(d,p);o.addEventListener("load",()=>gn(o));const c=s;s=o;for(const d of be)clearTimeout(d);o.srcdoc=cn(t),r.appendChild(o),c?.remove(),ke()},ut=()=>{const t=y==="inline"?0:Te;if(P===null)return{x:0,y:t,s:1};const o=r.clientWidth,c=o>0?Math.min(1,o/P):1;return{x:Math.max(0,(o-P*c)/2),y:t,s:c}},ke=()=>{r.style.top=`${y==="inline"?0:Te}px`,n.dataset.width=P===null?"":String(P);for(const c of Array.from(v.querySelectorAll("[data-width]")))c.setAttribute("aria-pressed",String(Number(c.dataset.width)===P));if(s===null)return;if(P===null){s.style.cssText="";return}const t=ut(),o=r.clientHeight>0?r.clientHeight/t.s:0;s.style.cssText=`position:absolute;left:${t.x}px;top:0;width:${P}px;${o>0?`height:${o}px;`:""}transform:scale(${t.s});transform-origin:0 0`},xe=t=>{if(t===null||$===null)return null;const o=$.widMap[t];if(o===void 0)return null;const c=Tt(o,$.measured,me),d=ut();return{left:d.x+c.left*d.s,top:d.y+c.top*d.s,width:c.width*d.s,height:c.height*d.s}},Ie=(t,o,c=0,d=0)=>{if(o===null){t.hidden=!0;return}t.hidden=!1,t.style.left=`${o.left}px`,t.style.top=`${o.top}px`,t.style.width=`${Math.max(o.width,c)}px`,t.style.height=`${Math.max(o.height,d)}px`},Pe=()=>(y!=="inline"||k>=2&&L==="card")&&$!==null,R=()=>{if(n.dataset.head=O===null?"":String(O),n.dataset.pickable=String(Pe()),n.dataset.selected=b??"",n.dataset.size=y,Ie(i,ge!==b&&_===null?xe(ge):null),l.dataset.wid=b??"",Ie(l,_===null?xe(b):null),_!==null?Ie(a,xe(_.wid),160,30):a.hidden=!0,v.hidden=y==="inline",n.dataset.mode=k>=2?D:"",B.hidden=!G(),g.hidden=!G(),m.hidden=!G(),bn(),!ae()||!Pe()||_!==null){w.hidden=!0;return}if(w.hidden=!1,b===null){w.removeAttribute("data-editable"),w.textContent="Click an element to make it the subject · type on it to change it";return}const t=ne(b,e.kind),o=st($,b);w.dataset.editable=String(o==="yes"),w.textContent=o==="yes"?`Type to change ${t} · Enter to edit its text · Esc to let go`:o==="container"?`${Oe(t)} holds other parts — click a line of text inside it to change the words · Esc to let go`:o==="cut"?`${Oe(t)} is too long to change by typing — say what to change in the message box · Esc to let go`:`${Oe(t)} can’t be changed by typing — say what to change in the message box · Esc to let go`},bn=()=>{const t=G()&&Pe()&&_===null&&!N?xe(b):null;if(t===null||b===null){A.hidden=!0;return}A.hidden=!1,F.hidden=$?.blocks[b]?.section===void 0;const o=A.offsetHeight||30,c=t.top+t.height+6,d=n.clientHeight===0||c+o<=n.clientHeight-4,p=A.offsetWidth,f=n.clientWidth>0?n.clientWidth-p-4:1/0;A.style.left=`${Math.max(4,Math.min(t.left,f))}px`,A.style.top=`${d?c:Math.max(Te+2,t.top-o-6)}px`},pt=(t,o)=>{for(const d of Array.from(t.querySelectorAll("button")))d.remove();const c=(d,p)=>{const f=document.createElement("button");f.type="button",f.className=d===Ce?"swatch swatch--default":"swatch";for(const[h,T]of Object.entries({"data-testid":"page-swatch"}))f.setAttribute(h,T);f.dataset.prop=o,f.dataset.value=d,f.title=`${o==="background"?"Fill":"Text"}: ${p}`,f.setAttribute("aria-label",f.title),d===Ce?f.textContent="Default":f.style.setProperty("--swatch",d),f.addEventListener("click",()=>{b!==null&&kn(b,o,d,p)}),t.appendChild(f)};for(const d of at)c(d.value,d.label);c(Ce,"Default")},W=()=>{if(_===null)return;_=null,a.hidden=!0,a.value="";const t=ve;ve=null,t!==null&&ze(t),R()},te=(t,o=!1)=>{Y=null,b=t,W(),R(),t!==null&&(S.includes("selection.chip")&&U("selection.set",{anchors:[{kind:"element",id:t}]}),o||u.focus())},Ae=t=>{ct+=1,dt(jt(t,ct))},ze=t=>{const o=t.version;if(typeof o=="number"&&O!==null&&o<O)return;if(_!==null){const p=ve?.version;typeof o=="number"&&o>_.base&&(typeof p!="number"||o>=p)&&(ve=t);return}C.hidden=!0;const c=t.content,d=typeof c?.html=="string"?c.html:"";e.coverage&&mn(d),O=typeof o=="number"?o:O,at=zt(d),fe=Qt(d)??fe,We?.refresh(),pt(g,"background"),pt(m,"color"),Be+=1,De=ee,ee=null,$=null,ge=null,b=null,W(),R(),vn(Bt(d)?d:Nt(d))},H=async t=>{if(Ne){if(t!==void 0&&t===qe)return;we=t===void 0?{}:{version:t};return}Ne=!0,qe=t??null;try{const o=await le("artifact.read",t===void 0?{}:{version:t});if(!o.ok){C.hidden=!1,C.textContent=o.error.code==="not_granted"?`This editor may not read the ${e.kind} here.`:`The ${e.kind} could not be read (${o.error.code}).`;return}ze(o.payload)}finally{if(Ne=!1,qe=null,we!==null){const o=we;we=null,(o.version===void 0||o.version!==O)&&H(o.version)}}};window.addEventListener("message",t=>{if(s===null||s.contentWindow===null||t.source!==s.contentWindow||lt!==Be)return;const o=Mt(t.data);if(o!==null){if(o.type==="wid-inventory"){for(const d of be)clearTimeout(d);$={widMap:o.widMap,blocks:o.blocks??{},measured:{scrollX:o.scrollX,scrollY:o.scrollY}},me={scrollX:o.scrollX,scrollY:o.scrollY};const c=De;De=null,c!==null&&o.widMap[c]!==void 0&&Ae(c),Y!==null&&o.widMap[Y]!==void 0&&(b=Y,e.coverage&&Ae(Y)),R()}else if(o.type==="scroll-state")me={scrollX:o.scrollX,scrollY:o.scrollY},R();else if(o.type==="scroll-ack")o.scrollX!==void 0&&o.scrollY!==void 0&&(me={scrollX:o.scrollX,scrollY:o.scrollY},R());else if(o.type==="wid-hover")ge=o.wid,R();else if(o.type==="wid-click"){if(k===1&&y==="inline")return;if(k===2&&L==="card"){te(o.wid);return}const c=o.wid===b?$?.blocks[o.wid]?.section:void 0;te(c!==void 0&&$?.widMap[c]!==void 0?c:o.wid)}}});const ft=(t,o)=>{if(!ae()||N||O===null||$===null||st($,t)!=="yes")return;const c=$.blocks[t]?.text??"";_={wid:t,before:c,base:O},a.value=o??c,R(),a.focus(),o===null?a.select():a.setSelectionRange(a.value.length,a.value.length)},Ke=async(t,o,c,d,p=O)=>{if(O===null||N)return;N=!0,R(),he(c);const f=d;try{const h=await le("version.write",{base:p,ops:t,summary:o});if(h.ok)ee=f,await H(typeof h.payload.version=="number"?h.payload.version:void 0);else if(h.error.code==="stale"||h.error.code==="head_moved"){he(h.error.code==="stale"&&h.error.message?h.error.message:"Not changed: it moved while you typed"),ee=f;const T=h.payload?.head;h.error.code==="head_moved"?await H(typeof T=="number"?T:void 0):typeof T=="number"&&T!==O&&await H(T)}else h.error.code==="timeout"||(h.error.code==="refused"?he(h.error.message||"Nothing changed"):he(`Not changed: ${h.error.message||h.error.code}`))}finally{N=!1,R()}},wn=async()=>{if(_===null||O===null||N)return;const{wid:t,before:o,base:c}=_,d=a.value.replace(/\s*\n\s*/g," ");if(W(),u.focus(),d===o)return;const p=ne(t,e.kind);await Ke([{op:"text",anchor:t,value:d,before:o}],p,`Changing ${p}…`,t,c)},ht=async t=>{if(!G()||N||$?.widMap[t]===void 0)return;const o=ne(t,e.kind),c=$.blocks[t]?.section??null;u.focus(),await Ke([{op:"remove",anchor:t}],o,`Removing ${o}…`,c)},kn=async(t,o,c,d)=>{if(!G()||N||$?.widMap[t]===void 0)return;const p=ne(t,e.kind);u.focus(),await Ke([{op:"style",anchor:t,style:{[o]:c}}],p,`${o==="background"?"Filling":"Colouring the text of"} ${p}: ${d.toLowerCase()}…`,t)},yt=t=>{const o=$?.blocks[t]?.section;return o===void 0||$?.widMap[o]===void 0?!1:(te(o),!0)};F.addEventListener("click",()=>{b!==null&&yt(b)}),B.addEventListener("click",()=>{b!==null&&ht(b)});for(const t of Array.from(v.querySelectorAll("[data-width]")))t.addEventListener("click",()=>{const o=Number(t.dataset.width);P=P===o?null:o,ke(),R()});window.addEventListener("resize",()=>{ke(),R()}),a.addEventListener("keydown",t=>{t.stopPropagation(),t.key==="Enter"?(t.preventDefault(),wn()):t.key==="Escape"&&(t.preventDefault(),W(),u.focus())}),a.addEventListener("blur",()=>{W()});const xn=()=>[...Array.from(v.querySelectorAll("button")),u,...Array.from(A.querySelectorAll("button")),...Array.from(E?.querySelectorAll("button")??[])].filter(t=>t.closest("[hidden]")===null&&!(t instanceof HTMLButtonElement&&t.disabled)),mt=(t,o)=>{if(t.target===a)return;const c=t.target?.tagName==="BUTTON";if(!(c&&(t.key==="Enter"||t.key===" "))){if(t.key==="Escape"){if(!o&&b!==null){t.preventDefault(),te(null);return}t.preventDefault(),U("ui.key",{key:"Escape"});return}if((t.metaKey||t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()==="k"){t.preventDefault(),U("ui.key",{key:"Mod+K"});return}if(!o&&(t.metaKey||t.ctrlKey)&&!t.altKey&&(t.key==="Backspace"||t.key==="Delete")){t.preventDefault(),b!==null&&!N&&ht(b);return}if(!o&&t.altKey&&!t.metaKey&&!t.ctrlKey&&t.key==="ArrowUp"){t.preventDefault(),b!==null&&yt(b);return}if(t.altKey&&!t.metaKey&&!t.ctrlKey&&/^Key[A-Z]$/.test(t.code)&&He(`Alt+${t.code.slice(3)}`)){t.preventDefault(),U("ui.key",{key:`Alt+${t.code.slice(3)}`});return}if(t.key==="Tab"){t.preventDefault();const d=xn(),p=d.indexOf(document.activeElement),f=p===-1&&document.activeElement===n&&!t.shiftKey?0:p+(t.shiftKey?-1:1);if(p===-1&&f!==0||f<0||f>=d.length){U("ui.key",{key:t.shiftKey?"Shift+Tab":"Tab"});return}d[f].focus();return}if(!(t.metaKey||t.ctrlKey||t.altKey)&&!(c&&t.key.length!==1)){if(t.key==="Enter"){!o&&b!==null&&!N&&ae()&&(t.preventDefault(),ft(b,null));return}if(t.key.length===1){if(t.preventDefault(),!o&&b!==null&&!N&&ae()){ft(b,t.key);return}U("ui.typed",{grapheme:t.key})}}}};n.addEventListener("keydown",t=>mt(t,!1)),E?.addEventListener("keydown",t=>mt(t,!0));const Ue=t=>{y=t,document.body.dataset.size=t,t==="inline"&&(W(),k<2&&te(null),document.activeElement?.blur?.()),ke(),R()},gt=t=>{if(!(typeof t!="object"||t===null))for(const[o,c]of Object.entries(t))/^--[a-z0-9-]+$/.test(o)&&typeof c=="string"&&c.length<=200&&!/url\(/i.test(c)&&document.documentElement.style.setProperty(o,c)},An=t=>{const o=t.data;try{if(o===null||typeof o!="object"||o.p!==ie||o.v!==pe)return;if(typeof o.re=="string"){const d=Re.get(o.re);if(d===void 0)return;Re.delete(o.re);const p=typeof o.payload=="object"&&o.payload!==null?o.payload:{};o.ok===!0?d({ok:!0,payload:p}):d({ok:!1,error:o.error??{code:"unavailable",message:"no answer"},payload:p});return}if(Le!==null&&Le.dispatch(o))return;const c=typeof o.payload=="object"&&o.payload!==null?o.payload:{};switch(o.type){case"host.ping":typeof o.id=="string"&&x?.postMessage({p:ie,v:pe,re:o.id,ok:!0,payload:{}});return;case"host.size":(c.size==="inline"||c.size==="pane"||c.size==="full")&&Ue(c.size);return;case"host.theme":gt(c.theme);return;case"artifact.changed":{ce&&_e();const d=c.version;typeof d=="number"&&d!==O&&(ee=ee??b,H(d));return}case"selection.cleared":Y=null,b!==null&&(b=null,W(),R());return;default:return}}catch{}};window.addEventListener("message",t=>{const o=t.data;if(x!==null||o===null||typeof o!="object"||o.p!==ie||o.type!=="host.hello"||t.ports[0]===void 0)return;x=t.ports[0],x.onmessage=An;const c=typeof o.payload=="object"&&o.payload!==null?o.payload:{};S=Array.isArray(c.grants)?c.grants.filter(p=>typeof p=="string"):[],gt(c.theme);const d=Xt(c);k=d.protocol,k>=2?(L=c.surface==="options"?"options":d.surface,Z=d.tab??"style",D=d.mode??"simple",Le=new Vt(x,{surface:(p,f)=>{L=p,f!==null&&(D=f),Ee()},mode:p=>(D=p,e.coverage?Ee():R(),D),tab:p=>{e.coverage&&(Z=p,Ee())},selection:p=>{const f=p.find(h=>typeof h=="object"&&h!==null&&h.kind==="element"&&typeof h.id=="string");L==="options"&&f!==void 0||(Y=f?.id??null,b=f!==void 0&&$?.widMap[f.id]!==void 0?f.id:null,b!==null&&e.coverage&&Ae(b),W(),R())}}),Ee()):Ue(d.size),H()});const vt=M("style");let We=null;const Ee=()=>{const t=L==="options",o=e.coverage&&t&&Z==="coverage",c=e.coverage&&L==="full"&&D==="advanced";e.coverage&&(document.body.dataset.coverage=c?"side":"",E!==null&&(E.hidden=!o&&!c),(o||c)&&(ye(),_e())),vt.hidden=!t||o,n.hidden=t,t&&!o&&We===null&&(We=Gt(vt,{tokens:()=>fe,key:d=>U("ui.key",{key:d}),apply:async d=>{for(let p=0;p<2;p+=1){if(O===null)return{ok:!1,reason:`The ${e.kind} is not loaded yet`};const f=await le("theme.set",{base:O,tokens:d});if(f.ok){const de=f.payload.version;return fe={name:d.name,colors:{...d.colors},fonts:{...d.fonts}},typeof de=="number"&&await H(de),{ok:!0}}if(f.error.code!=="head_moved")return{ok:!1,reason:f.error.message};const h=await le("artifact.read",{});if(!h.ok)return{ok:!1,reason:h.error.message||h.error.code};const T=h.payload.version;if(typeof T!="number"||O!==null&&T<O)return{ok:!1,reason:`The current ${e.kind} version could not be read.`};if(ze(h.payload),p===1)return{ok:!1,reason:f.error.message||f.error.code}}return{ok:!1,reason:`The ${e.kind} changed again: try once more`}}})),Ue(Wt(L))};Ht(e.editor,e.surfaces)}const hn={card:{interactive:!0,aspect:"16:9",actions:[{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"style",label:"Style",render:"plugin"}]},full:{modes:["simple","advanced"],default:"simple"}};function it(){fn({editor:"wicked-page",surfaces:hn,kind:"page",coverage:!1})}return it(),z.start=it,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),z})({});
|
|
162
|
+
body[data-coverage="side"] #coverage{position:absolute;right:0;top:0;width:min(300px,38%);border-left:1px solid var(--border)}`,document.body.append(t)}const ye=()=>{if(E===null)return;if(E.replaceChildren(),delete E.dataset.total,delete E.dataset.rows,delete E.dataset.named,ce){const h=document.createElement("p");h.textContent="Couldn't read the requirements · ";const T=document.createElement("button");T.type="button",T.textContent="Try again",T.addEventListener("click",()=>{je()}),h.append(T),E.append(h);return}if(Q===null){const h=document.createElement("p");h.textContent="Reading requirements…",E.append(h);return}if(Q.length===0){const h=document.createElement("p");h.textContent="No requirements for this document's repository",E.append(h);return}const t=At(Q.map(h=>({key:h.id,reqId:h.id,title:h.text,risk:!1})),Me),o=t.filter(h=>h.wid!==null),c=t.filter(h=>h.wid===null);E.dataset.total=String(Fe),E.dataset.rows=String(t.length),E.dataset.named=String(o.length);const d=document.createElement("h2");d.textContent="Requirements",E.append(d);const p=document.createElement("p");p.dataset.testid="doc-coverage-line",p.textContent=Ct(t,Fe),E.append(p);const f=(h,T)=>{if(T.length===0)return;const de=document.createElement("p");de.textContent=`${h} (${T.length})`,E.append(de);for(const q of T){const X=document.createElement("button");X.type="button",X.dataset.testid="doc-coverage-row",X.dataset.req=q.reqId,X.dataset.named=String(q.wid!==null),X.disabled=q.wid===null,X.textContent=`${q.reqId} · ${q.title}${q.wid===null?"":` · ${ne(q.wid,e.kind)}`}`,X.addEventListener("click",()=>{if(q.wid!==null){if(L==="options"){S.includes("selection.chip")&&P("selection.set",{anchors:[{kind:"element",id:q.wid}]});return}te(q.wid,!0),Ae(q.wid)}}),E.append(X)}};f("Not named",c),f("Named",o)},je=async()=>{if(!(!e.coverage||Q!==null||_e)){_e=!0,ce=!1,ye();try{const t=await le("checks.read",{}),o=t.ok?t.payload.checks:null;if(!t.ok||!Array.isArray(o)){ce=!0;return}Q=o.filter(c=>typeof c=="object"&&c!==null&&typeof c.id=="string"&&typeof c.text=="string"),Fe=typeof t.payload.total=="number"?t.payload.total:Q.length}catch{ce=!0}finally{_e=!1,ye()}}},vn=t=>{const o=new DOMParser().parseFromString(t,"text/html");Me=Object.create(null);const c=Array.from(o.querySelectorAll("[data-wid]")),d=new Map;for(const p of c){const f=p.getAttribute("data-wid")??"";d.set(f,(d.get(f)??0)+1)}for(const p of c){const f=p.getAttribute("data-wid")??"";!/^[A-Za-z0-9_.:-]{1,100}$/.test(f)||d.get(f)!==1||(Me[f]={text:(p.textContent??"").replace(/\s+/g," ").trim(),composite:p.querySelector("[data-wid]")!==null})}ye()};let $=null,me={scrollX:0,scrollY:0},ge=null,v=null,j=null,be=null,N=!1,lt=[],z=null,De=0,ct=-1,ee=null,Be=null,dt=0,ve=[],Ne=!1,qe=null,we=null;const ut=t=>{s?.contentWindow?.postMessage(t,"*")},wn=t=>{if(t===s){ct=De;for(const o of ve)clearTimeout(o);ve=hn.map(o=>setTimeout(()=>ut(jt),o))}},kn=t=>{const o=document.createElement("iframe");for(const[d,p]of Object.entries({"data-testid":"page-frame",sandbox:"allow-scripts",title:e.kind==="document"?"The document":"The page",class:"frame"}))o.setAttribute(d,p);o.addEventListener("load",()=>wn(o));const c=s;s=o;for(const d of ve)clearTimeout(d);o.srcdoc=pn(t),r.appendChild(o),c?.remove(),ke()},pt=()=>{const t=y==="inline"?0:Te;if(z===null)return{x:0,y:t,s:1};const o=r.clientWidth,c=o>0?Math.min(1,o/z):1;return{x:Math.max(0,(o-z*c)/2),y:t,s:c}},ke=()=>{r.style.top=`${y==="inline"?0:Te}px`,n.dataset.width=z===null?"":String(z);for(const c of Array.from(b.querySelectorAll("[data-width]")))c.setAttribute("aria-pressed",String(Number(c.dataset.width)===z));if(s===null)return;if(z===null){s.style.cssText="";return}const t=pt(),o=r.clientHeight>0?r.clientHeight/t.s:0;s.style.cssText=`position:absolute;left:${t.x}px;top:0;width:${z}px;${o>0?`height:${o}px;`:""}transform:scale(${t.s});transform-origin:0 0`},xe=t=>{if(t===null||$===null)return null;const o=$.widMap[t];if(o===void 0)return null;const c=Lt(o,$.measured,me),d=pt();return{left:d.x+c.left*d.s,top:d.y+c.top*d.s,width:c.width*d.s,height:c.height*d.s}},Ie=(t,o,c=0,d=0)=>{if(o===null){t.hidden=!0;return}t.hidden=!1,t.style.left=`${o.left}px`,t.style.top=`${o.top}px`,t.style.width=`${Math.max(o.width,c)}px`,t.style.height=`${Math.max(o.height,d)}px`},Pe=()=>(y!=="inline"||x>=2&&L==="card")&&$!==null,R=()=>{if(n.dataset.head=O===null?"":String(O),n.dataset.pickable=String(Pe()),n.dataset.selected=v??"",n.dataset.size=y,Ie(i,ge!==v&&j===null?xe(ge):null),l.dataset.wid=v??"",Ie(l,j===null?xe(v):null),j!==null?Ie(a,xe(j.wid),160,30):a.hidden=!0,b.hidden=y==="inline",n.dataset.mode=x>=2?B:"",D.hidden=!G(),g.hidden=!G(),m.hidden=!G(),xn(),!ae()||!Pe()||j!==null){w.hidden=!0;return}if(w.hidden=!1,v===null){w.removeAttribute("data-editable"),w.textContent="Click an element to make it the subject · type on it to change it";return}const t=ne(v,e.kind),o=it($,v);w.dataset.editable=String(o==="yes"),w.textContent=o==="yes"?`Type to change ${t} · Enter to edit its text · Esc to let go`:o==="container"?`${Oe(t)} holds other parts — click a line of text inside it to change the words · Esc to let go`:o==="cut"?`${Oe(t)} is too long to change by typing — say what to change in the message box · Esc to let go`:`${Oe(t)} can’t be changed by typing — say what to change in the message box · Esc to let go`},xn=()=>{const t=G()&&Pe()&&j===null&&!N?xe(v):null;if(t===null||v===null){A.hidden=!0;return}A.hidden=!1,F.hidden=$?.blocks[v]?.section===void 0;const o=A.offsetHeight||30,c=t.top+t.height+6,d=n.clientHeight===0||c+o<=n.clientHeight-4,p=A.offsetWidth,f=n.clientWidth>0?n.clientWidth-p-4:1/0;A.style.left=`${Math.max(4,Math.min(t.left,f))}px`,A.style.top=`${d?c:Math.max(Te+2,t.top-o-6)}px`},ft=(t,o)=>{for(const d of Array.from(t.querySelectorAll("button")))d.remove();const c=(d,p)=>{const f=document.createElement("button");f.type="button",f.className=d===Ce?"swatch swatch--default":"swatch";for(const[h,T]of Object.entries({"data-testid":"page-swatch"}))f.setAttribute(h,T);f.dataset.prop=o,f.dataset.value=d,f.title=`${o==="background"?"Fill":"Text"}: ${p}`,f.setAttribute("aria-label",f.title),d===Ce?f.textContent="Default":f.style.setProperty("--swatch",d),f.addEventListener("click",()=>{v!==null&&En(v,o,d,p)}),t.appendChild(f)};for(const d of lt)c(d.value,d.label);c(Ce,"Default")},W=()=>{if(j===null)return;j=null,a.hidden=!0,a.value="";const t=be;be=null,t!==null&&ze(t),R()},te=(t,o=!1)=>{Y=null,v=t,W(),R(),t!==null&&(S.includes("selection.chip")&&P("selection.set",{anchors:[{kind:"element",id:t}]}),o||u.focus())},Ae=t=>{dt+=1,ut(Dt(t,dt))},ze=t=>{const o=t.version;if(typeof o=="number"&&O!==null&&o<O)return;if(j!==null){const p=be?.version;typeof o=="number"&&o>j.base&&(typeof p!="number"||o>=p)&&(be=t);return}C.hidden=!0;const c=t.content,d=typeof c?.html=="string"?c.html:"";e.coverage&&vn(d),O=typeof o=="number"?o:O,lt=Ut(d),fe=nn(d)??fe,We?.refresh(),ft(g,"background"),ft(m,"color"),De+=1,Be=ee,ee=null,$=null,ge=null,v=null,W(),R(),kn(Nt(d)?d:It(d))},H=async t=>{if(Ne){if(t!==void 0&&t===qe)return;we=t===void 0?{}:{version:t};return}Ne=!0,qe=t??null;try{const o=await le("artifact.read",t===void 0?{}:{version:t});if(!o.ok){C.hidden=!1,C.textContent=o.error.code==="not_granted"?`This editor may not read the ${e.kind} here.`:`The ${e.kind} could not be read (${o.error.code}).`;return}ze(o.payload)}finally{if(Ne=!1,qe=null,we!==null){const o=we;we=null,(o.version===void 0||o.version!==O)&&H(o.version)}}};window.addEventListener("message",t=>{if(s===null||s.contentWindow===null||t.source!==s.contentWindow||ct!==De)return;const o=_t(t.data);if(o!==null){if(o.type==="wid-inventory"){for(const d of ve)clearTimeout(d);$={widMap:o.widMap,blocks:o.blocks??{},measured:{scrollX:o.scrollX,scrollY:o.scrollY}},me={scrollX:o.scrollX,scrollY:o.scrollY};const c=Be;Be=null,c!==null&&o.widMap[c]!==void 0&&Ae(c),Y!==null&&o.widMap[Y]!==void 0&&(v=Y,e.coverage&&Ae(Y)),R()}else if(o.type==="scroll-state")me={scrollX:o.scrollX,scrollY:o.scrollY},R();else if(o.type==="scroll-ack")o.scrollX!==void 0&&o.scrollY!==void 0&&(me={scrollX:o.scrollX,scrollY:o.scrollY},R());else if(o.type==="wid-hover")ge=o.wid,R();else if(o.type==="wid-click"){if(x===1&&y==="inline")return;if(x===2&&L==="card"){te(o.wid);return}const c=o.wid===v?$?.blocks[o.wid]?.section:void 0;te(c!==void 0&&$?.widMap[c]!==void 0?c:o.wid)}}});const ht=(t,o)=>{if(!ae()||N||O===null||$===null||it($,t)!=="yes")return;const c=$.blocks[t]?.text??"";j={wid:t,before:c,base:O},a.value=o??c,R(),a.focus(),o===null?a.select():a.setSelectionRange(a.value.length,a.value.length)},Ke=async(t,o,c,d,p=O)=>{if(O===null||N)return;N=!0,R(),he(c);const f=d;try{const h=await le("version.write",{base:p,ops:t,summary:o});if(h.ok)ee=f,await H(typeof h.payload.version=="number"?h.payload.version:void 0);else if(h.error.code==="stale"||h.error.code==="head_moved"){he(h.error.code==="stale"&&h.error.message?h.error.message:"Not changed: it moved while you typed"),ee=f;const T=h.payload?.head;h.error.code==="head_moved"?await H(typeof T=="number"?T:void 0):typeof T=="number"&&T!==O&&await H(T)}else h.error.code==="timeout"||(h.error.code==="refused"?he(h.error.message||"Nothing changed"):he(`Not changed: ${h.error.message||h.error.code}`))}finally{N=!1,R()}},An=async()=>{if(j===null||O===null||N)return;const{wid:t,before:o,base:c}=j,d=a.value.replace(/\s*\n\s*/g," ");if(W(),u.focus(),d===o)return;const p=ne(t,e.kind);await Ke([{op:"text",anchor:t,value:d,before:o}],p,`Changing ${p}…`,t,c)},yt=async t=>{if(!G()||N||$?.widMap[t]===void 0)return;const o=ne(t,e.kind),c=$.blocks[t]?.section??null;u.focus(),await Ke([{op:"remove",anchor:t}],o,`Removing ${o}…`,c)},En=async(t,o,c,d)=>{if(!G()||N||$?.widMap[t]===void 0)return;const p=ne(t,e.kind);u.focus(),await Ke([{op:"style",anchor:t,style:{[o]:c}}],p,`${o==="background"?"Filling":"Colouring the text of"} ${p}: ${d.toLowerCase()}…`,t)},mt=t=>{const o=$?.blocks[t]?.section;return o===void 0||$?.widMap[o]===void 0?!1:(te(o),!0)};F.addEventListener("click",()=>{v!==null&&mt(v)}),D.addEventListener("click",()=>{v!==null&&yt(v)});for(const t of Array.from(b.querySelectorAll("[data-width]")))t.addEventListener("click",()=>{const o=Number(t.dataset.width);z=z===o?null:o,ke(),R()});window.addEventListener("resize",()=>{ke(),R()}),a.addEventListener("keydown",t=>{t.stopPropagation(),t.key==="Enter"?(t.preventDefault(),An()):t.key==="Escape"&&(t.preventDefault(),W(),u.focus())}),a.addEventListener("blur",()=>{W()});const Cn=()=>[...Array.from(b.querySelectorAll("button")),u,...Array.from(A.querySelectorAll("button")),...Array.from(E?.querySelectorAll("button")??[])].filter(t=>t.closest("[hidden]")===null&&!(t instanceof HTMLButtonElement&&t.disabled)),gt=(t,o)=>{if(t.target===a)return;const c=t.target?.tagName==="BUTTON";if(!(c&&(t.key==="Enter"||t.key===" "))){if(t.key==="Escape"){if(!o&&v!==null){t.preventDefault(),te(null);return}t.preventDefault(),P("ui.key",{key:"Escape"});return}if((t.metaKey||t.ctrlKey)&&!t.altKey&&t.key.toLowerCase()==="k"){t.preventDefault(),P("ui.key",{key:"Mod+K"});return}if(!o&&(t.metaKey||t.ctrlKey)&&!t.altKey&&(t.key==="Backspace"||t.key==="Delete")){t.preventDefault(),v!==null&&!N&&yt(v);return}if(!o&&t.altKey&&!t.metaKey&&!t.ctrlKey&&t.key==="ArrowUp"){t.preventDefault(),v!==null&&mt(v);return}if(t.altKey&&!t.metaKey&&!t.ctrlKey&&/^Key[A-Z]$/.test(t.code)&&He(`Alt+${t.code.slice(3)}`)){t.preventDefault(),P("ui.key",{key:`Alt+${t.code.slice(3)}`});return}if(t.key==="Tab"){t.preventDefault();const d=Cn(),p=d.indexOf(document.activeElement),f=p===-1&&document.activeElement===n&&!t.shiftKey?0:p+(t.shiftKey?-1:1);if(p===-1&&f!==0||f<0||f>=d.length){P("ui.key",{key:t.shiftKey?"Shift+Tab":"Tab"});return}d[f].focus();return}if(!(t.metaKey||t.ctrlKey||t.altKey)&&!(c&&t.key.length!==1)){if(t.key==="Enter"){!o&&v!==null&&!N&&ae()&&(t.preventDefault(),ht(v,null));return}if(t.key.length===1){if(t.preventDefault(),!o&&v!==null&&!N&&ae()){ht(v,t.key);return}P("ui.typed",{grapheme:t.key})}}}};n.addEventListener("keydown",t=>gt(t,!1)),E?.addEventListener("keydown",t=>gt(t,!0));const Ue=t=>{y=t,document.body.dataset.size=t,t==="inline"&&(W(),x<2&&te(null),document.activeElement?.blur?.()),ke(),R()},bt=t=>{if(!(typeof t!="object"||t===null))for(const[o,c]of Object.entries(t))/^--[a-z0-9-]+$/.test(o)&&typeof c=="string"&&c.length<=200&&!/url\(/i.test(c)&&document.documentElement.style.setProperty(o,c)},Sn=t=>{const o=t.data;try{if(o===null||typeof o!="object"||o.p!==ie||o.v!==pe)return;if(typeof o.re=="string"){const d=Re.get(o.re);if(d===void 0)return;Re.delete(o.re);const p=typeof o.payload=="object"&&o.payload!==null?o.payload:{};o.ok===!0?d({ok:!0,payload:p}):d({ok:!1,error:o.error??{code:"unavailable",message:"no answer"},payload:p});return}if(Le!==null&&Le.dispatch(o))return;const c=typeof o.payload=="object"&&o.payload!==null?o.payload:{};switch(o.type){case"host.ping":typeof o.id=="string"&&k?.postMessage({p:ie,v:pe,re:o.id,ok:!0,payload:{}});return;case"host.size":(c.size==="inline"||c.size==="pane"||c.size==="full")&&Ue(c.size);return;case"host.theme":bt(c.theme);return;case"artifact.changed":{ce&&je();const d=c.version;typeof d=="number"&&d!==O&&(ee=ee??v,H(d));return}case"selection.cleared":Y=null,v!==null&&(v=null,W(),R());return;default:return}}catch{}};window.addEventListener("message",t=>{const o=t.data;if(k!==null||o===null||typeof o!="object"||o.p!==ie||o.type!=="host.hello"||t.ports[0]===void 0)return;k=t.ports[0],k.onmessage=Sn;const c=typeof o.payload=="object"&&o.payload!==null?o.payload:{};S=Array.isArray(c.grants)?c.grants.filter(p=>typeof p=="string"):[],bt(c.theme);const d=Ht(c);x=d.protocol,x>=2?(L=c.surface==="options"?"options":d.surface,Z=d.tab??"style",B=d.mode??"simple",Le=new Qt(k,{surface:(p,f)=>{L=p,f!==null&&(B=f),Ee()},mode:p=>(B=p,e.coverage?Ee():R(),B),tab:p=>{e.coverage&&(Z=p,Ee())},selection:p=>{const f=p.find(h=>typeof h=="object"&&h!==null&&h.kind==="element"&&typeof h.id=="string");L==="options"&&f!==void 0||(Y=f?.id??null,v=f!==void 0&&$?.widMap[f.id]!==void 0?f.id:null,v!==null&&e.coverage&&Ae(v),W(),R())}}),Ee()):Ue(d.size),H()});const vt=M("style");let We=null;const Ee=()=>{const t=L==="options",o=e.coverage&&t&&Z==="coverage",c=e.coverage&&L==="full"&&B==="advanced";e.coverage&&(document.body.dataset.coverage=c?"side":"",E!==null&&(E.hidden=!o&&!c),(o||c)&&(ye(),je())),vt.hidden=!t||o,n.hidden=t,t&&!o&&We===null&&(We=tn(vt,{tokens:()=>fe,key:d=>P("ui.key",{key:d}),typed:d=>P("ui.typed",{grapheme:d}),apply:async d=>{for(let p=0;p<2;p+=1){if(O===null)return{ok:!1,reason:`The ${e.kind} is not loaded yet`};const f=await le("theme.set",{base:O,tokens:d});if(f.ok){const de=f.payload.version;return fe={name:d.name,colors:{...d.colors},fonts:{...d.fonts}},typeof de=="number"&&await H(de),{ok:!0}}if(f.error.code!=="head_moved")return{ok:!1,reason:f.error.message};const h=await le("artifact.read",{});if(!h.ok)return{ok:!1,reason:h.error.message||h.error.code};const T=h.payload.version;if(typeof T!="number"||O!==null&&T<O)return{ok:!1,reason:`The current ${e.kind} version could not be read.`};if(ze(h.payload),p===1)return{ok:!1,reason:f.error.message||f.error.code}}return{ok:!1,reason:`The ${e.kind} changed again: try once more`}}})),Ue(Yt(L))};Vt(e.editor,e.surfaces)}const gn={card:{interactive:!0,aspect:"16:9",actions:[{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"style",label:"Style",render:"plugin"}]},full:{modes:["simple","advanced"],default:"simple"}};function at(){mn({editor:"wicked-page",surfaces:gn,kind:"page",coverage:!1})}return at(),K.start=at,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),K})({});
|
|
163
163
|
</script>
|
|
164
164
|
</body>
|
|
165
165
|
</html>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en"><head><meta charset="utf-8">
|
|
3
3
|
<meta name="wicked-editor" content="wicked-video">
|
|
4
|
-
<meta name="wicked-editor-version" content="0.16.
|
|
4
|
+
<meta name="wicked-editor-version" content="0.16.15">
|
|
5
5
|
<title>Video</title>
|
|
6
6
|
<style>
|
|
7
7
|
:root{--surface-base:#fff;--surface-card:#f6f7f9;--surface-raised:#fff;--ink-high:#0d1117;--ink-body:#2b333d;--ink-muted:#5b6673;--border:#d5dae1;--accent:#224a5e;--font-sans:system-ui,sans-serif}
|
|
@@ -15,17 +15,17 @@ button,input,select,textarea{font:inherit;color:inherit}button{border:1px solid
|
|
|
15
15
|
.review-tab{padding:16px;overflow:auto;min-width:0}.review-tab .findings{list-style:decimal;padding-left:18px;gap:6px;font-size:12px;line-height:1.5;overflow-wrap:anywhere;margin-bottom:12px}.review-tab .findings [data-state=FAIL]{color:var(--status-fail)}.sheets{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}.sheet{margin:0;display:grid;gap:6px}.sheet img{width:100%;display:block;border:1px solid var(--border);border-radius:6px;background:var(--surface-card)}.sheet figcaption{font-size:12px;color:var(--ink-muted)}
|
|
16
16
|
@media(max-width:850px){.video-editor[data-mode=advanced][data-surface=full]{grid-template-columns:200px minmax(0,1fr)}.inspectors{grid-column:2;border-left:0}.video-editor[data-surface=full]{grid-template-columns:200px minmax(0,1fr)}}
|
|
17
17
|
@media(max-width:600px){.video-editor[data-surface=full],.video-editor[data-mode=advanced][data-surface=full]{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;align-content:start;height:auto;min-height:100%}.video-editor[data-surface=full] .segment-box{flex:1 1 100%!important}.video-editor[data-surface=full] .segment{height:40px}.video-editor[data-surface=full] .work{order:-1;padding:8px;overflow:visible}.video-editor[data-surface=full] .chapters{border-right:0;border-top:1px solid var(--border)}.video-editor[data-surface=full] .inspectors{grid-column:auto;border-left:0;border-top:1px solid var(--border)}.video-editor[data-surface=full] .player{max-height:none}.timeline{flex-wrap:wrap}.chips{flex-wrap:wrap;overflow-x:visible}.sheets{grid-template-columns:1fr}}
|
|
18
|
-
</style></head><body><script>var wickedEditor=(function(G){"use strict";var Vt=Object.defineProperty;var _t=(G,Z,re)=>Z in G?Vt(G,Z,{enumerable:!0,configurable:!0,writable:!0,value:re}):G[Z]=re;var ht=(G,Z,re)=>_t(G,typeof Z!="symbol"?Z+"":Z,re);const Z={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},re=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function mt(t){if(re.has(t))return!0;const n=Z[bt(t)];return n!==void 0&&n.verb==="navigate"}function bt(t){const n=/^alt\+(.)$/i.exec(t);return n===null?t:`Alt+${n[1].toUpperCase()}`}const V="wicked.editor",_=1,Ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),vt=["card","options","full"];function Ze(t){return t==="inline"?"card":t==="pane"?"options":"full"}function yt(t){const n=Ge(t)?t:{},l=n.size==="inline"||n.size==="full"?n.size:"pane",u=n.protocol===2?2:1,s=u===2&&typeof n.tab=="string"?n.tab:null,v=u===2&&vt.includes(n.surface)?n.surface:Ze(l),b=v==="options"&&s===null?"full":v,y=u===2&&(n.mode==="simple"||n.mode==="advanced")?n.mode:null;return{protocol:u,surface:b,tab:s,mode:y,size:l}}function gt(t,n,l){return{editor:t,version:n,protocol:[1,2],surfaces:l}}function kt(t,n){const l=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:V,v:_,type:"plugin.ready",payload:gt(t,l,n)},"*")}function St(t,n,l){const u=t.metaKey||t.ctrlKey;let s=null;if(t.key==="Escape")s="Escape";else if(u&&!t.altKey&&t.key.toLowerCase()==="k")s="Mod+K";else if(t.altKey&&!u&&/^Key[A-Z]$/.test(t.code)&&mt(`Alt+${t.code.slice(3)}`))s=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const v=Array.from(n.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(y=>y.tabIndex>=0&&!y.matches(":disabled")&&y.closest("[hidden]")===null),b=v.indexOf(t.target);(t.shiftKey?b<=0:b===-1||b===v.length-1)&&(s=t.shiftKey?"Shift+Tab":"Tab")}return s===null?!1:(t.preventDefault(),t.stopPropagation(),l(s),!0)}class xt{constructor(n,l){ht(this,"revs",new Map);this.port=n,this.h=l}reply(n,l){this.port.postMessage({p:V,v:_,re:n,ok:!0,payload:l})}refuse(n,l,u){this.port.postMessage({p:V,v:_,re:n,ok:!1,error:{code:l,message:u}})}bump(n){const l=(this.revs.get(n)??0)+1;return this.revs.set(n,l),l}values(n,l){this.port.postMessage({p:V,v:_,type:"options.values",payload:{tab:n,rev:this.bump(n),values:l}})}height(n){this.port.postMessage({p:V,v:_,type:"ui.height",payload:{px:Math.round(n)}})}dispatch(n){const l=Ge(n.payload)?n.payload:{},u=typeof n.id=="string"?n.id:null;switch(n.type){case"host.surface":{const s=l.surface;return(s==="card"||s==="options"||s==="full")&&this.h.surface?.(s,l.mode==="simple"||l.mode==="advanced"?l.mode:null),!0}case"host.mode":{if(u===null)return!0;const s=l.mode;return s!=="simple"&&s!=="advanced"?(this.refuse(u,"bad_request","mode is simple or advanced"),!0):(this.reply(u,{mode:this.h.mode?.(s)??s}),!0)}case"host.action":{if(u===null)return!0;const s=l.id;return typeof s!="string"||this.h.action===void 0?(this.reply(u,{handled:!1}),!0):(Promise.resolve(this.h.action(s)).then(v=>this.reply(u,{handled:v.handled===!0,...typeof v.status=="string"?{status:v.status.slice(0,120)}:{}}),()=>this.reply(u,{handled:!1})),!0)}case"host.tab":return typeof l.tab=="string"&&this.h.tab?.(l.tab),!0;case"host.selection":return Array.isArray(l.anchors)&&this.h.selection?.(l.anchors),!0;case"options.changed":{if(u===null)return!0;const s=l.tab,v=l.id;return typeof s!="string"||typeof v!="string"||this.h.optionsChanged===void 0?(this.refuse(u,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(s,v,l.value)).then(b=>this.reply(u,{applied:b.applied,rev:this.bump(s),values:b.values,...b.reason!==void 0?{reason:b.reason.slice(0,120)}:{}}),b=>this.refuse(u,"unavailable",b instanceof Error?b.message.slice(0,120):"failed")),!0)}default:return!1}}}const Je={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous chapter",verb:"plugin"},{id:"next",label:"Next chapter",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"chapters",label:"Chapters",render:"plugin"},{id:"sheets",label:"Review",render:"plugin"},{id:"captions",label:"Captions",render:"controls",controls:[{id:"on",label:"Captions",type:"toggle"},{id:"burn",label:"Burn into video",type:"toggle"},{id:"position",label:"Position",type:"segmented",options:[{id:"bottom",label:"Bottom"},{id:"top",label:"Top"}]},{id:"size",label:"Text size",type:"range",min:18,max:72,step:2},{id:"lines",label:"Max lines",type:"range",min:1,max:3,step:1},{id:"wrap",label:"Line length",type:"range",min:20,max:80,step:1},{id:"look",label:"Look",type:"segmented",options:[{id:"bar",label:"Bar"},{id:"outline",label:"Outline"},{id:"plain",label:"Plain"}]}]},{id:"theme",label:"Theme",render:"controls",controls:[{id:"palette",label:"Colours",type:"select",options:[{id:"studio",label:"Studio skin · default"},{id:"corporate",label:"Corporate Light"},{id:"midnight",label:"Midnight Purple"},{id:"warm",label:"Warm Dark"},{id:"custom",label:"Custom"}]},{id:"title",label:"Title card",type:"toggle"},{id:"titletext",label:"Title",type:"text",maxChars:80},{id:"end",label:"End card",type:"toggle"},{id:"endtext",label:"End card text",type:"text",maxChars:80},{id:"background",label:"Background",type:"color"},{id:"foreground",label:"Text colour",type:"color"},{id:"accent",label:"Accent",type:"color"},{id:"font",label:"Font",type:"select",options:[{id:"inter",label:"Inter"},{id:"roboto",label:"Roboto"},{id:"source-sans",label:"Source Sans 3"},{id:"plex",label:"IBM Plex Sans"},{id:"system",label:"System"},{id:"archivo",label:"Archivo"}]}]}]},full:{modes:["simple","advanced"],default:"simple"}},Ye={corporate:{background:"#FFFFFF",foreground:"#1E293B",accent:"#0891B2"},midnight:{background:"#0A0A0F",foreground:"#FFFFFF",accent:"#A100FF"},warm:{background:"#1A1A2E",foreground:"#F8F8F2",accent:"#FFD93D"}},wt=(t,n)=>["background","foreground","accent"].every(l=>t[l].toLowerCase()===n[l].toLowerCase());function ve(t){if(t.palette===void 0||t.palette==="skin")return"studio";for(const[n,l]of Object.entries(Ye))if(wt(t,l))return n;return"custom"}function Ie(t,n,l){const u=ve(t)==="studio"?l??n??t:t;return{background:u.background,foreground:u.foreground,accent:u.accent}}const Pe={inter:"Inter",roboto:"Roboto","source-sans":"Source Sans 3",plex:"IBM Plex Sans",system:"system-ui",archivo:"Archivo"};function le(t,n,l=null,u){const s=t.captions,v=t.theme;if(n==="captions")return{on:s.on,burn:s.burnIn,position:s.position,size:s.size,lines:s.maxLines,wrap:s.wrapChars,look:s.style};if(n==="theme"){const b=Ie(v,l,u),y=ve(v)==="studio"?u?.font??v.font:v.font;return{palette:ve(v),title:v.titleCard.on,titletext:v.titleCard.title,end:v.endCard.on,endtext:v.endCard.title,background:b.background,foreground:b.foreground,accent:b.accent,font:Object.keys(Pe).find(x=>Pe[x]===y)??"system"}}return{}}function At(t,n,l,u){const s=JSON.parse(JSON.stringify(t));if(n==="captions"){const v={on:"on",burn:"burnIn",position:"position",size:"size",lines:"maxLines",wrap:"wrapChars",look:"style"};Object.assign(s.captions,{[v[l]]:u})}else if(n==="theme")switch(l){case"title":s.theme.titleCard.on=u;break;case"titletext":s.theme.titleCard.title=u;break;case"end":s.theme.endCard.on=u;break;case"endtext":s.theme.endCard.title=u;break;case"font":s.theme.font=Pe[u],s.theme.palette="custom";break;case"palette":s.theme.palette=u==="studio"?"skin":"custom",(u==="corporate"||u==="midnight"||u==="warm")&&Object.assign(s.theme,Ye[u]);break;default:Object.assign(s.theme,{[l]:u,palette:"custom"})}return s}const I={actions:4,tabs:5,controls:12,options:8,labelChars:24,maxChars:200},Te=/^[a-z][a-z0-9-]{0,31}$/u,$t=/^[A-Za-z0-9 ·'-]{1,24}$/u,Ct=["approve","accept","deliver","merge","send","launch","delete","remove","stop","deny","allow","grant","install"],Et={а:"a",е:"e",о:"o",р:"p",с:"c",у:"y",х:"x",і:"i",ј:"j",ѕ:"s","ԁ":"d","ӏ":"l",α:"a",ε:"e",ο:"o",ρ:"p",ν:"v",τ:"t",κ:"k",ι:"i",μ:"m",0:"o",1:"l",3:"e",4:"a",5:"s",7:"t"};function Lt(t){const n=t.normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase();let l="";for(const u of n)l+=Et[u]??u;return l.split(/[^a-z]+/u).filter(u=>u!=="")}function Tt(t){return Lt(t).some(n=>Ct.some(l=>n.startsWith(l)))}const ee=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Fe=t=>typeof t=="number"&&Number.isFinite(t),m=t=>({ok:!1,reason:t}),Ft=/(?:[A-Za-z][0-9]|[0-9][A-Za-z])/u;function Me(t,n){return typeof t!="string"||!$t.test(t)?`${n}: a label is 1 to ${I.labelChars} plain characters`:Ft.test(t)?`${n}: a word in a label is letters or digits, not both`:Tt(t)?`${n}: "${t}" uses a word only the host's own controls may use`:null}function Oe(t,n){const l=new Set;for(const u of t){if(l.has(u.id))return`${n}: the id "${u.id}" is used twice`;l.add(u.id)}return null}const te=(t,n,l)=>{for(const u of Object.keys(t))if(!n.includes(u))return`${l}: unknown field "${u}"`;return null};function Mt(t,n){if(!ee(t))return m(`${n}: not an object`);const l=te(t,["id","label","type","options","min","max","step","maxChars"],n);if(l!==null)return m(l);if(typeof t.id!="string"||!Te.test(t.id))return m(`${n}: a bad id`);const u=Me(t.label,n);if(u!==null)return m(u);const s=t.type;if(s!=="toggle"&&s!=="segmented"&&s!=="select"&&s!=="color"&&s!=="text"&&s!=="range")return m(`${n}: an unknown control type`);const v={id:t.id,label:t.label,type:s};if(s==="segmented"||s==="select"){const b=t.options;if(!Array.isArray(b)||b.length<2||b.length>I.options)return m(`${n}: ${s} needs 2 to ${I.options} options`);const y=[];for(const[W,k]of b.entries()){if(!ee(k)||typeof k.id!="string"||!Te.test(k.id))return m(`${n}.options[${W}]: a bad id`);const w=Me(k.label,`${n}.options[${W}]`);if(w!==null)return m(w);const $=te(k,["id","label"],`${n}.options[${W}]`);if($!==null)return m($);y.push({id:k.id,label:k.label})}const x=Oe(y,`${n}.options`);if(x!==null)return m(x);v.options=y}else if(t.options!==void 0)return m(`${n}: only select and segmented take options`);if(s==="range"){const{min:b,max:y,step:x}=t;if(!Fe(b)||!Fe(y)||!Fe(x))return m(`${n}: range needs finite min, max and step`);if(!(b<y)||!(x>0)||x>y-b)return m(`${n}: range needs min < max and 0 < step ≤ max - min`);if(Math.abs(b)>1e9||Math.abs(y)>1e9||x<1e-6||(y-b)/x>1e6)return m(`${n}: range bounds are within ±1e9, step ≥ 1e-6, at most 1e6 steps`);if(x<Math.max(Math.abs(b),Math.abs(y))*1e-12)return m(`${n}: range step is too fine for its bounds`);v.min=b,v.max=y,v.step=x}else if(t.min!==void 0||t.max!==void 0||t.step!==void 0)return m(`${n}: only range takes min, max and step`);if(s==="text"){const b=t.maxChars===void 0?I.maxChars:t.maxChars;if(!Number.isInteger(b)||b<1||b>I.maxChars)return m(`${n}: maxChars is 1 to ${I.maxChars}`);v.maxChars=b}else if(t.maxChars!==void 0)return m(`${n}: only text takes maxChars`);return{ok:!0,value:v}}function Ot(t){if(!ee(t))return m("surfaces: not an object");const n=te(t,["card","options","full"],"surfaces");if(n!==null)return m(n);const l=t.card;if(!ee(l))return m("surfaces.card is required");const u=te(l,["interactive","aspect","actions"],"surfaces.card");if(u!==null)return m(u);const s=l.interactive===void 0?!1:l.interactive;if(typeof s!="boolean")return m("surfaces.card.interactive: a boolean");const v=l.aspect===void 0?"16:9":l.aspect;if(v!=="16:9"&&v!=="4:3"&&v!=="auto")return m("surfaces.card.aspect: 16:9, 4:3 or auto");const b=l.actions===void 0?[]:l.actions;if(!Array.isArray(b)||b.length>I.actions)return m(`surfaces.card.actions: at most ${I.actions}`);const y=[];for(const[w,$]of b.entries()){const L=`surfaces.card.actions[${w}]`;if(!ee($))return m(`${L}: not an object`);const F=te($,["id","label","primary","verb"],L);if(F!==null)return m(F);if(typeof $.id!="string"||!Te.test($.id))return m(`${L}: a bad id`);const o=Me($.label,L);if(o!==null)return m(o);const A=$.verb;if(A!=="plugin"&&A!=="host:export"&&A!=="host:ask")return m(`${L}: verb is plugin, host:export or host:ask`);const N=$.primary===void 0?!1:$.primary;if(typeof N!="boolean")return m(`${L}: primary is a boolean`);y.push({id:$.id,label:$.label,primary:N,verb:A})}const x=Oe(y,"surfaces.card.actions");if(x!==null)return m(x);let W=null;if(t.options!==void 0){const w=t.options;if(!ee(w))return m("surfaces.options: not an object");const $=te(w,["tabs"],"surfaces.options");if($!==null)return m($);const L=w.tabs;if(!Array.isArray(L)||L.length<1||L.length>I.tabs)return m(`surfaces.options.tabs: 1 to ${I.tabs}`);const F=[];for(const[A,N]of L.entries()){const O=`surfaces.options.tabs[${A}]`;if(!ee(N))return m(`${O}: not an object`);const B=te(N,["id","label","render","controls"],O);if(B!==null)return m(B);if(typeof N.id!="string"||!Te.test(N.id))return m(`${O}: a bad id`);const H=Me(N.label,O);if(H!==null)return m(H);const U=N.render;if(U!=="plugin"&&U!=="controls")return m(`${O}: render is plugin or controls`);const oe={id:N.id,label:N.label,render:U};if(U==="controls"){const ae=N.controls;if(!Array.isArray(ae)||ae.length<1||ae.length>I.controls)return m(`${O}.controls: 1 to ${I.controls}`);const K=[];for(const[ye,R]of ae.entries()){const X=Mt(R,`${O}.controls[${ye}]`);if(!X.ok)return X;K.push(X.value)}const ne=Oe(K,`${O}.controls`);if(ne!==null)return m(ne);oe.controls=K}else if(N.controls!==void 0)return m(`${O}: a plugin-rendered tab has no controls`);F.push(oe)}const o=Oe(F,"surfaces.options.tabs");if(o!==null)return m(o);W={tabs:F}}let k=null;if(t.full!==void 0){const w=t.full;if(!ee(w))return m("surfaces.full: not an object");const $=te(w,["modes","default"],"surfaces.full");if($!==null)return m($);let L=null;if(w.modes!==void 0){const o=w.modes;if(!Array.isArray(o)||o.length!==2||o[0]!=="simple"||o[1]!=="advanced")return m('surfaces.full.modes: exactly ["simple","advanced"]');L=["simple","advanced"]}const F=w.default===void 0?"simple":w.default;if(F!=="simple"&&F!=="advanced")return m("surfaces.full.default: simple or advanced");if(L===null&&w.default!==void 0)return m("surfaces.full.default needs modes");k={modes:L,default:F}}return{ok:!0,value:{card:{interactive:s,aspect:v,actions:y},options:W,full:k}}}const Qe=String.raw`(?:\d{1,3}(?:\.\d+)?%?|\.\d+%?)`,Rt=new RegExp(String.raw`^(?:#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgba?|hsla?)\(\s*${Qe}(?:\s*,\s*${Qe}){2,3}\s*\))$`,"iu");function Nt(t,n){switch(t.type){case"toggle":return typeof n=="boolean";case"segmented":case"select":return typeof n=="string"&&(t.options??[]).some(l=>l.id===n);case"color":return typeof n=="string"&&n.length<=64&&Rt.test(n);case"text":return typeof n=="string"&&n.length<=(t.maxChars??I.maxChars)&&!/[\r\n]/u.test(n);case"range":{if(!Fe(n)||t.min===void 0||t.max===void 0||t.step===void 0||n<t.min||n>t.max)return!1;const l=Math.round((n-t.min)/t.step);return Math.abs(n-(t.min+l*t.step))<=t.step*.001}}}const Ue=Ot(Je);if(!Ue.ok)throw new Error(Ue.reason);const jt=Ue.value;function et(){document.body.insertAdjacentHTML("afterbegin",`<main id="video-editor" class="video-editor" data-testid="video-editor" tabindex="0">
|
|
18
|
+
</style></head><body><script>var wickedEditor=(function(Z){"use strict";var Zt=Object.defineProperty;var Jt=(Z,J,le)=>J in Z?Zt(Z,J,{enumerable:!0,configurable:!0,writable:!0,value:le}):Z[J]=le;var bt=(Z,J,le)=>Jt(Z,typeof J!="symbol"?J+"":J,le);const J={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},le=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function vt(t){if(le.has(t))return!0;const n=J[yt(t)];return n!==void 0&&n.verb==="navigate"}function yt(t){const n=/^alt\+(.)$/i.exec(t);return n===null?t:`Alt+${n[1].toUpperCase()}`}const _="wicked.editor",W=1,Ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),gt=["card","options","full"];function Ze(t){return t==="inline"?"card":t==="pane"?"options":"full"}function kt(t){const n=Ge(t)?t:{},l=n.size==="inline"||n.size==="full"?n.size:"pane",u=n.protocol===2?2:1,s=u===2&&typeof n.tab=="string"?n.tab:null,v=u===2&>.includes(n.surface)?n.surface:Ze(l),b=v==="options"&&s===null?"full":v,S=u===2&&(n.mode==="simple"||n.mode==="advanced")?n.mode:null;return{protocol:u,surface:b,tab:s,mode:S,size:l}}function St(t,n,l){return{editor:t,version:n,protocol:[1,2],surfaces:l}}function xt(t,n){const l=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:_,v:W,type:"plugin.ready",payload:St(t,l,n)},"*")}function wt(t){return Array.from(t.querySelectorAll("button, a[href], input, select, textarea, summary, [tabindex]")).filter(n=>n.tabIndex>=0&&!n.matches(":disabled")&&n.closest("[hidden]")===null)}function At(t,n,l){const u=t.metaKey||t.ctrlKey;let s=null;if(t.key==="Escape")s="Escape";else if(u&&!t.altKey&&t.key.toLowerCase()==="k")s="Mod+K";else if(t.altKey&&!u&&/^Key[A-Z]$/.test(t.code)&&vt(`Alt+${t.code.slice(3)}`))s=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const v=wt(n),b=v.indexOf(t.target);(t.shiftKey?b<=0:b===-1||b===v.length-1)&&(s=t.shiftKey?"Shift+Tab":"Tab")}return s===null?!1:(t.preventDefault(),t.stopPropagation(),l(s),!0)}class Ct{constructor(n,l){bt(this,"revs",new Map);this.port=n,this.h=l}reply(n,l){this.port.postMessage({p:_,v:W,re:n,ok:!0,payload:l})}refuse(n,l,u){this.port.postMessage({p:_,v:W,re:n,ok:!1,error:{code:l,message:u}})}bump(n){const l=(this.revs.get(n)??0)+1;return this.revs.set(n,l),l}values(n,l){this.port.postMessage({p:_,v:W,type:"options.values",payload:{tab:n,rev:this.bump(n),values:l}})}height(n){this.port.postMessage({p:_,v:W,type:"ui.height",payload:{px:Math.round(n)}})}dispatch(n){const l=Ge(n.payload)?n.payload:{},u=typeof n.id=="string"?n.id:null;switch(n.type){case"host.surface":{const s=l.surface;return(s==="card"||s==="options"||s==="full")&&this.h.surface?.(s,l.mode==="simple"||l.mode==="advanced"?l.mode:null),!0}case"host.mode":{if(u===null)return!0;const s=l.mode;return s!=="simple"&&s!=="advanced"?(this.refuse(u,"bad_request","mode is simple or advanced"),!0):(this.reply(u,{mode:this.h.mode?.(s)??s}),!0)}case"host.action":{if(u===null)return!0;const s=l.id;return typeof s!="string"||this.h.action===void 0?(this.reply(u,{handled:!1}),!0):(Promise.resolve(this.h.action(s)).then(v=>this.reply(u,{handled:v.handled===!0,...typeof v.status=="string"?{status:v.status.slice(0,120)}:{}}),()=>this.reply(u,{handled:!1})),!0)}case"host.tab":return typeof l.tab=="string"&&this.h.tab?.(l.tab),!0;case"host.selection":return Array.isArray(l.anchors)&&this.h.selection?.(l.anchors),!0;case"options.changed":{if(u===null)return!0;const s=l.tab,v=l.id;return typeof s!="string"||typeof v!="string"||this.h.optionsChanged===void 0?(this.refuse(u,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(s,v,l.value)).then(b=>this.reply(u,{applied:b.applied,rev:this.bump(s),values:b.values,...b.reason!==void 0?{reason:b.reason.slice(0,120)}:{}}),b=>this.refuse(u,"unavailable",b instanceof Error?b.message.slice(0,120):"failed")),!0)}default:return!1}}}const Je={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous chapter",verb:"plugin"},{id:"next",label:"Next chapter",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"chapters",label:"Chapters",render:"plugin"},{id:"sheets",label:"Review",render:"plugin"},{id:"captions",label:"Captions",render:"controls",controls:[{id:"on",label:"Captions",type:"toggle"},{id:"burn",label:"Burn into video",type:"toggle"},{id:"position",label:"Position",type:"segmented",options:[{id:"bottom",label:"Bottom"},{id:"top",label:"Top"}]},{id:"size",label:"Text size",type:"range",min:18,max:72,step:2},{id:"lines",label:"Max lines",type:"range",min:1,max:3,step:1},{id:"wrap",label:"Line length",type:"range",min:20,max:80,step:1},{id:"look",label:"Look",type:"segmented",options:[{id:"bar",label:"Bar"},{id:"outline",label:"Outline"},{id:"plain",label:"Plain"}]}]},{id:"theme",label:"Theme",render:"controls",controls:[{id:"palette",label:"Colours",type:"select",options:[{id:"studio",label:"Studio skin · default"},{id:"corporate",label:"Corporate Light"},{id:"midnight",label:"Midnight Purple"},{id:"warm",label:"Warm Dark"},{id:"custom",label:"Custom"}]},{id:"title",label:"Title card",type:"toggle"},{id:"titletext",label:"Title",type:"text",maxChars:80},{id:"end",label:"End card",type:"toggle"},{id:"endtext",label:"End card text",type:"text",maxChars:80},{id:"background",label:"Background",type:"color"},{id:"foreground",label:"Text colour",type:"color"},{id:"accent",label:"Accent",type:"color"},{id:"font",label:"Font",type:"select",options:[{id:"inter",label:"Inter"},{id:"roboto",label:"Roboto"},{id:"source-sans",label:"Source Sans 3"},{id:"plex",label:"IBM Plex Sans"},{id:"system",label:"System"},{id:"archivo",label:"Archivo"}]}]}]},full:{modes:["simple","advanced"],default:"simple"}},$t={background:"#16181d",foreground:"#f5f6f8",accent:"#b8bec9"},Et={corporate:{background:"#FFFFFF",foreground:"#1E293B",accent:"#0891B2"},midnight:{background:"#0A0A0F",foreground:"#FFFFFF",accent:"#A100FF"},warm:{background:"#1A1A2E",foreground:"#F8F8F2",accent:"#FFD93D"}};function Lt(t){return{theme:{titleCard:{on:!0,title:t,subtitle:"",seconds:2.5},endCard:{on:!0,title:"Thanks for watching",subtitle:"",seconds:2.5},palette:"skin",...$t,font:"system-ui"},captions:{on:!0,burnIn:!0,position:"bottom",size:36,maxLines:2,wrapChars:42,style:"bar"}}}const Ye=Et,Tt=(t,n)=>["background","foreground","accent"].every(l=>t[l].toLowerCase()===n[l].toLowerCase());function ve(t){if(t.palette===void 0||t.palette==="skin")return"studio";for(const[n,l]of Object.entries(Ye))if(Tt(t,l))return n;return"custom"}function Ie(t,n,l){const u=ve(t)==="studio"?l??n??t:t;return{background:u.background,foreground:u.foreground,accent:u.accent}}const Pe={inter:"Inter",roboto:"Roboto","source-sans":"Source Sans 3",plex:"IBM Plex Sans",system:"system-ui",archivo:"Archivo"};function ie(t,n,l=null,u){const s=t.captions,v=t.theme;if(n==="captions")return{on:s.on,burn:s.burnIn,position:s.position,size:s.size,lines:s.maxLines,wrap:s.wrapChars,look:s.style};if(n==="theme"){const b=Ie(v,l,u),S=ve(v)==="studio"?u?.font??v.font:v.font;return{palette:ve(v),title:v.titleCard.on,titletext:v.titleCard.title,end:v.endCard.on,endtext:v.endCard.title,background:b.background,foreground:b.foreground,accent:b.accent,font:Object.keys(Pe).find(x=>Pe[x]===S)??"system"}}return{}}function Ot(t,n,l,u){const s=JSON.parse(JSON.stringify(t));if(n==="captions"){const v={on:"on",burn:"burnIn",position:"position",size:"size",lines:"maxLines",wrap:"wrapChars",look:"style"};Object.assign(s.captions,{[v[l]]:u})}else if(n==="theme")switch(l){case"title":s.theme.titleCard.on=u;break;case"titletext":s.theme.titleCard.title=u;break;case"end":s.theme.endCard.on=u;break;case"endtext":s.theme.endCard.title=u;break;case"font":s.theme.font=Pe[u],s.theme.palette="custom";break;case"palette":s.theme.palette=u==="studio"?"skin":"custom",(u==="corporate"||u==="midnight"||u==="warm")&&Object.assign(s.theme,Ye[u]);break;default:Object.assign(s.theme,{[l]:u,palette:"custom"})}return s}const I={actions:4,tabs:5,controls:12,options:8,labelChars:24,maxChars:200},Te=/^[a-z][a-z0-9-]{0,31}$/u,Ft=/^[A-Za-z0-9 ·'-]{1,24}$/u,Mt=["approve","accept","deliver","merge","send","launch","delete","remove","stop","deny","allow","grant","install"],Rt={а:"a",е:"e",о:"o",р:"p",с:"c",у:"y",х:"x",і:"i",ј:"j",ѕ:"s","ԁ":"d","ӏ":"l",α:"a",ε:"e",ο:"o",ρ:"p",ν:"v",τ:"t",κ:"k",ι:"i",μ:"m",0:"o",1:"l",3:"e",4:"a",5:"s",7:"t"};function Nt(t){const n=t.normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase();let l="";for(const u of n)l+=Rt[u]??u;return l.split(/[^a-z]+/u).filter(u=>u!=="")}function jt(t){return Nt(t).some(n=>Mt.some(l=>n.startsWith(l)))}const ee=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Oe=t=>typeof t=="number"&&Number.isFinite(t),m=t=>({ok:!1,reason:t}),It=/(?:[A-Za-z][0-9]|[0-9][A-Za-z])/u;function Fe(t,n){return typeof t!="string"||!Ft.test(t)?`${n}: a label is 1 to ${I.labelChars} plain characters`:It.test(t)?`${n}: a word in a label is letters or digits, not both`:jt(t)?`${n}: "${t}" uses a word only the host's own controls may use`:null}function Me(t,n){const l=new Set;for(const u of t){if(l.has(u.id))return`${n}: the id "${u.id}" is used twice`;l.add(u.id)}return null}const te=(t,n,l)=>{for(const u of Object.keys(t))if(!n.includes(u))return`${l}: unknown field "${u}"`;return null};function Pt(t,n){if(!ee(t))return m(`${n}: not an object`);const l=te(t,["id","label","type","options","min","max","step","maxChars"],n);if(l!==null)return m(l);if(typeof t.id!="string"||!Te.test(t.id))return m(`${n}: a bad id`);const u=Fe(t.label,n);if(u!==null)return m(u);const s=t.type;if(s!=="toggle"&&s!=="segmented"&&s!=="select"&&s!=="color"&&s!=="text"&&s!=="range")return m(`${n}: an unknown control type`);const v={id:t.id,label:t.label,type:s};if(s==="segmented"||s==="select"){const b=t.options;if(!Array.isArray(b)||b.length<2||b.length>I.options)return m(`${n}: ${s} needs 2 to ${I.options} options`);const S=[];for(const[B,g]of b.entries()){if(!ee(g)||typeof g.id!="string"||!Te.test(g.id))return m(`${n}.options[${B}]: a bad id`);const w=Fe(g.label,`${n}.options[${B}]`);if(w!==null)return m(w);const C=te(g,["id","label"],`${n}.options[${B}]`);if(C!==null)return m(C);S.push({id:g.id,label:g.label})}const x=Me(S,`${n}.options`);if(x!==null)return m(x);v.options=S}else if(t.options!==void 0)return m(`${n}: only select and segmented take options`);if(s==="range"){const{min:b,max:S,step:x}=t;if(!Oe(b)||!Oe(S)||!Oe(x))return m(`${n}: range needs finite min, max and step`);if(!(b<S)||!(x>0)||x>S-b)return m(`${n}: range needs min < max and 0 < step ≤ max - min`);if(Math.abs(b)>1e9||Math.abs(S)>1e9||x<1e-6||(S-b)/x>1e6)return m(`${n}: range bounds are within ±1e9, step ≥ 1e-6, at most 1e6 steps`);if(x<Math.max(Math.abs(b),Math.abs(S))*1e-12)return m(`${n}: range step is too fine for its bounds`);v.min=b,v.max=S,v.step=x}else if(t.min!==void 0||t.max!==void 0||t.step!==void 0)return m(`${n}: only range takes min, max and step`);if(s==="text"){const b=t.maxChars===void 0?I.maxChars:t.maxChars;if(!Number.isInteger(b)||b<1||b>I.maxChars)return m(`${n}: maxChars is 1 to ${I.maxChars}`);v.maxChars=b}else if(t.maxChars!==void 0)return m(`${n}: only text takes maxChars`);return{ok:!0,value:v}}function Ut(t){if(!ee(t))return m("surfaces: not an object");const n=te(t,["card","options","full"],"surfaces");if(n!==null)return m(n);const l=t.card;if(!ee(l))return m("surfaces.card is required");const u=te(l,["interactive","aspect","actions"],"surfaces.card");if(u!==null)return m(u);const s=l.interactive===void 0?!1:l.interactive;if(typeof s!="boolean")return m("surfaces.card.interactive: a boolean");const v=l.aspect===void 0?"16:9":l.aspect;if(v!=="16:9"&&v!=="4:3"&&v!=="auto")return m("surfaces.card.aspect: 16:9, 4:3 or auto");const b=l.actions===void 0?[]:l.actions;if(!Array.isArray(b)||b.length>I.actions)return m(`surfaces.card.actions: at most ${I.actions}`);const S=[];for(const[w,C]of b.entries()){const L=`surfaces.card.actions[${w}]`;if(!ee(C))return m(`${L}: not an object`);const O=te(C,["id","label","primary","verb"],L);if(O!==null)return m(O);if(typeof C.id!="string"||!Te.test(C.id))return m(`${L}: a bad id`);const i=Fe(C.label,L);if(i!==null)return m(i);const A=C.verb;if(A!=="plugin"&&A!=="host:export"&&A!=="host:ask")return m(`${L}: verb is plugin, host:export or host:ask`);const N=C.primary===void 0?!1:C.primary;if(typeof N!="boolean")return m(`${L}: primary is a boolean`);S.push({id:C.id,label:C.label,primary:N,verb:A})}const x=Me(S,"surfaces.card.actions");if(x!==null)return m(x);let B=null;if(t.options!==void 0){const w=t.options;if(!ee(w))return m("surfaces.options: not an object");const C=te(w,["tabs"],"surfaces.options");if(C!==null)return m(C);const L=w.tabs;if(!Array.isArray(L)||L.length<1||L.length>I.tabs)return m(`surfaces.options.tabs: 1 to ${I.tabs}`);const O=[];for(const[A,N]of L.entries()){const M=`surfaces.options.tabs[${A}]`;if(!ee(N))return m(`${M}: not an object`);const K=te(N,["id","label","render","controls"],M);if(K!==null)return m(K);if(typeof N.id!="string"||!Te.test(N.id))return m(`${M}: a bad id`);const H=Fe(N.label,M);if(H!==null)return m(H);const U=N.render;if(U!=="plugin"&&U!=="controls")return m(`${M}: render is plugin or controls`);const ae={id:N.id,label:N.label,render:U};if(U==="controls"){const se=N.controls;if(!Array.isArray(se)||se.length<1||se.length>I.controls)return m(`${M}.controls: 1 to ${I.controls}`);const q=[];for(const[ye,R]of se.entries()){const X=Pt(R,`${M}.controls[${ye}]`);if(!X.ok)return X;q.push(X.value)}const ne=Me(q,`${M}.controls`);if(ne!==null)return m(ne);ae.controls=q}else if(N.controls!==void 0)return m(`${M}: a plugin-rendered tab has no controls`);O.push(ae)}const i=Me(O,"surfaces.options.tabs");if(i!==null)return m(i);B={tabs:O}}let g=null;if(t.full!==void 0){const w=t.full;if(!ee(w))return m("surfaces.full: not an object");const C=te(w,["modes","default"],"surfaces.full");if(C!==null)return m(C);let L=null;if(w.modes!==void 0){const i=w.modes;if(!Array.isArray(i)||i.length!==2||i[0]!=="simple"||i[1]!=="advanced")return m('surfaces.full.modes: exactly ["simple","advanced"]');L=["simple","advanced"]}const O=w.default===void 0?"simple":w.default;if(O!=="simple"&&O!=="advanced")return m("surfaces.full.default: simple or advanced");if(L===null&&w.default!==void 0)return m("surfaces.full.default needs modes");g={modes:L,default:O}}return{ok:!0,value:{card:{interactive:s,aspect:v,actions:S},options:B,full:g}}}const Qe=String.raw`(?:\d{1,3}(?:\.\d+)?%?|\.\d+%?)`,zt=new RegExp(String.raw`^(?:#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgba?|hsla?)\(\s*${Qe}(?:\s*,\s*${Qe}){2,3}\s*\))$`,"iu");function Dt(t,n){switch(t.type){case"toggle":return typeof n=="boolean";case"segmented":case"select":return typeof n=="string"&&(t.options??[]).some(l=>l.id===n);case"color":return typeof n=="string"&&n.length<=64&&zt.test(n);case"text":return typeof n=="string"&&n.length<=(t.maxChars??I.maxChars)&&!/[\r\n]/u.test(n);case"range":{if(!Oe(n)||t.min===void 0||t.max===void 0||t.step===void 0||n<t.min||n>t.max)return!1;const l=Math.round((n-t.min)/t.step);return Math.abs(n-(t.min+l*t.step))<=t.step*.001}}}const Ue=Ut(Je);if(!Ue.ok)throw new Error(Ue.reason);const Bt=Ue.value;function et(){document.body.insertAdjacentHTML("afterbegin",`<main id="video-editor" class="video-editor" data-testid="video-editor" tabindex="0">
|
|
19
19
|
<aside id="chapters" class="chapters"><h2>Chapters</h2><ol id="chapter-list"></ol><div id="editor-fields" class="editor-fields"></div></aside>
|
|
20
20
|
<section id="work" class="work"><div class="player"><video id="player" data-testid="video-player" playsinline preload="metadata" aria-label="Video"></video><div id="unavailable" class="unavailable">The video isn't available here</div><img id="poster" data-testid="video-poster" class="poster" alt="" hidden><div id="caption" class="caption"></div></div>
|
|
21
21
|
<div class="transport"><button id="play" data-testid="video-play" type="button">Play</button><span id="count"></span></div><div id="chips" class="chips" aria-label="Chapter chips"></div><div id="timeline" class="timeline" aria-label="Chapter timeline"></div><p id="status" class="status" role="status"></p></section>
|
|
22
22
|
<section id="review-tab" class="review-tab" data-testid="video-review" hidden><h2>Review</h2><p id="review-line" class="summary" data-testid="video-review-line"></p><ol id="review-findings" class="findings" aria-label="Findings"></ol><div id="review-sheets" class="sheets" aria-label="Contact sheets"></div></section>
|
|
23
|
-
<aside id="inspectors" class="inspectors"><section id="proof"><h2>Checks</h2><p id="proof-summary" class="summary"></p><ol id="check-list" aria-label="Checks"></ol></section><h2>Text</h2><textarea id="say" aria-label="Chapter caption text" readonly></textarea><h2>Theme</h2><p id="theme-summary" class="summary"></p></aside></main>`);const t=e=>document.getElementById(e),n=t("video-editor"),l=t("chapter-list"),u=t("editor-fields"),s=t("player"),v=t("chips"),b=t("timeline"),
|
|
24
|
-
`),
|
|
25
|
-
${j==="studio"?
|
|
26
|
-
Background ${
|
|
27
|
-
Text ${
|
|
28
|
-
Accent ${
|
|
29
|
-
Title card: ${
|
|
30
|
-
End card: ${
|
|
23
|
+
<aside id="inspectors" class="inspectors"><section id="proof"><h2>Checks</h2><p id="proof-summary" class="summary"></p><ol id="check-list" aria-label="Checks"></ol></section><h2>Text</h2><textarea id="say" aria-label="Chapter caption text" readonly></textarea><h2>Theme</h2><p id="theme-summary" class="summary"></p></aside></main>`);const t=e=>document.getElementById(e),n=t("video-editor"),l=t("chapter-list"),u=t("editor-fields"),s=t("player"),v=t("chips"),b=t("timeline"),S=t("caption");let x=null,B=null,g="card",w="simple",C="chapters",L=1,O=[],i=null,A=null,N=0,M=!1,K=!1,H=null,U=null,ae="",se=0,q=null,ne=0,ye=0,R=!1,X=null,ge=!1,tt=null,ke=[],ze=0;const ce=new Map,Re=(e,o)=>x?.postMessage({p:_,v:W,type:e,payload:o}),de=(e,o)=>new Promise(r=>{if(x===null||K){r({ok:!1,error:{code:"unavailable",message:"No host here."}});return}const c=`wv-${++N}`,d=setTimeout(()=>{ce.delete(c),r({ok:!1,error:{code:"timeout",message:"The host has not answered; check Versions."}})},1e4);ce.set(c,{resolve:r,timer:d}),x.postMessage({p:_,v:W,type:e,id:c,payload:o})}),Se=()=>i?.chapters.find(e=>e.id===A),De=e=>i?.chapters.find(o=>o.startSec>=0&&e>=o.startSec&&(o.durationSec<0||e<o.startSec+o.durationSec)),nt=e=>e!==void 0&&e.startSec>=0&&i!==null&&i.style.captions.on&&(R||!(i.style.captions.burnIn&&i.ffmpeg?.burnIn)),z=()=>O.includes("artifact.write")&&!M&&!K,ue=()=>g==="options"||w==="advanced",Ne=e=>{t("status").textContent=e,Re("ui.status",{line:e.replace(/[\r\n]/g," ").slice(0,120)})},Be=()=>{if(L===2&&i!==null)for(const e of["captions","theme"])B?.values(e,ie(i.style,e,G,i.resolvedTheme))},ot=e=>ie(Lt(""),e,G),it=()=>{if(L===2&&i===null)for(const e of["captions","theme"])B?.values(e,ot(e))};let G=null;const Ke=e=>{if(typeof e!="string"||e===""||e.length>200||/url\(/i.test(e))return null;const o=document.createElement("span");o.style.color=e,document.body.append(o);const r=getComputedStyle(o).color;return o.remove(),/^rgba?\(\s*\d/.test(r)?r.replace(/\s+/g," "):null},at=e=>{if(typeof e!="object"||e===null)return;const o=e,r=Ke(o["--surface-raised"]??o["--surface-base"]),c=Ke(o["--ink-high"]),d=Ke(o["--accent"]);r!==null&&c!==null&&d!==null&&(G={background:r,foreground:c,accent:d});for(const[a,p]of Object.entries(e))typeof p=="string"&&/^--[a-z0-9-]+$/.test(a)&&p.length<=200&&!/url\(/i.test(p)&&document.documentElement.style.setProperty(a,p)},qe=()=>{q!==null&&URL.revokeObjectURL(q),q=null,s.removeAttribute("src")};let V=null;async function Kt(e){const o=await de("artifact.media",{ref:"poster"});if(K||e!==ne)return;const r=o.payload?.blob,c=o.payload?.type,d=t("poster");if(V!==null&&(URL.revokeObjectURL(V),V=null),!o.ok||!(r instanceof Blob)||typeof c!="string"||!c.startsWith("image/")||typeof URL.createObjectURL!="function"){d.hidden=!0;return}V=URL.createObjectURL(r),d.src=V,d.alt=i?.proof?.verdict==="FAIL"?"The moment the walkthrough failed":"The recording's still",d.hidden=!1,t("unavailable").textContent=i?.proof?.verdict==="FAIL"?"No video: this is the moment it failed":"The video isn't available here"}async function oe(e="video",o){const r=++ne;if(ge=!0,!O.includes("media.read")){ge=!1,qe(),t("unavailable").hidden=!1;return}const c=await de("artifact.media",{ref:e});if(K||r!==ne)return;qe();const d=c.payload?.blob,a=c.payload?.type;if(!c.ok||!(d instanceof Blob)||typeof a!="string"||!a.startsWith("video/")||typeof URL.createObjectURL!="function"){ge=!1,t("unavailable").hidden=!1,Kt(r);return}t("poster").hidden=!0,V!==null&&(URL.revokeObjectURL(V),V=null,t("poster").removeAttribute("src")),q=URL.createObjectURL(d),s.src=q,t("unavailable").hidden=!0,_e(),s.onloadedmetadata=()=>{if(!(K||r!==ne)){if(ge=!1,!R&&i!==null&&Number.isFinite(s.duration)){for(const[p,f]of i.chapters.entries())if(f.startSec>=0&&f.durationSec<0){const y=i.chapters.slice(p+1).find(k=>k.startSec>=0)?.startSec??s.duration;f.durationSec=Math.max(0,y-f.startSec),f.outSec=f.inSec+f.durationSec}$()}if(s.currentTime=X??o??(R?Se()?.inSec??0:Math.max(0,Se()?.startSec??0)),X!==null){X=null;const p=De(s.currentTime);p!==void 0&&(A=p.id),$()}}}}const Y=(e,o,r)=>{const c=document.createElement("button");return c.type="button",c.textContent=e,c.onclick=o,r!==void 0&&(c.dataset.testid=r),c};function pe(e,o=!0){i?.chapters.some(r=>r.id===e&&r.startSec>=0)&&(X=null,A=e,R&&(R=!1,oe()),s.currentTime=Se()?.startSec??0,$(),o&&O.includes("selection.chip")&&Re("selection.set",{anchors:[{kind:"chapter",id:e}]}))}function qt(e){if(!Number.isFinite(e)||e<0||(X=e,i===null))return;const o=De(e);o!==void 0&&(A=o.id),R?(R=!1,oe()):!ge&&q!==null&&s.readyState>=1&&(s.currentTime=e,X=null),$()}function Ve(e,o){const r=i?.chapters??[],c=r.findIndex(p=>p.id===e),d=c+o;if(d<0||d>=r.length)return;const a=r.filter(p=>p.id!==e);re({op:"chapter-move",chapter:e,after:d===0?null:a[d-1].id})}async function fe(){const e=++ye,o=await de("artifact.read",{});if(K||e!==ye)return!1;const r=o.payload?.content;if(!o.ok||r?.type!=="demo-cut"||!Array.isArray(r.chapters))return Ne(o.error?.message??"No cut is available here."),it(),!1;if(i!==null&&r.version<i.version)return!1;const c=i?.version;return i=r,c!==i.version&&(R=!1),i.chapters.some(d=>d.id===A&&d.startSec>=0)||(A=i.chapters.find(d=>d.startSec>=0)?.id??null),$(),Be(),g!=="options"&&c!==i.version&&oe(),!0}async function re(e,o=i?.version){if(!(!z()||i===null||o===void 0)){M=!0,$();try{const r=await de("version.write",{base:o,ops:[e],summary:`chapter ${i.chapters.findIndex(c=>c.id===e.chapter)+1}`});r.ok?(await fe(),e.op==="chapter-take"&&g!=="options"&&(R=!0,oe({chapter:e.chapter}))):(Ne(r.error?.message??"The chapter could not be saved."),r.error?.code==="head_moved"&&await fe())}finally{M=!1,$()}}}function st(e){if(!z()||i===null||U!==null)return;U=e.id,ae=e.title,se=i.version,$();const o=u.querySelector('[data-testid="video-rename-input"]');o?.focus(),o?.select()}function Vt(){const e=i?.chapters.find(r=>r.id===U);if(e===void 0)return U=null,null;const o=document.createElement("input");return o.value=ae,o.maxLength=80,o.setAttribute("aria-label","Chapter title"),o.dataset.testid="video-rename-input",o.oninput=()=>{ae=o.value},o.onkeydown=r=>{r.key==="Escape"?(r.preventDefault(),r.stopPropagation(),U=null,$()):r.key==="Enter"&&(r.preventDefault(),r.stopPropagation(),U=null,o.value.trim()&&!/[\r\n]/.test(o.value)&&o.value!==e.title?re({op:"chapter-rename",chapter:e.id,title:o.value},se):$())},o}function _e(){if(i===null)return;const e=i.style,o=Se();S.hidden=!nt(o),S.dataset.position=e.captions.position,S.dataset.look=e.captions.style;const r=[];let c="";for(const p of(o?.say??"").split(/\s+/))c&&(c+" "+p).length>e.captions.wrapChars?(r.push(c),c=p):c+=(c?" ":"")+p;c&&r.push(c),S.textContent=r.slice(0,e.captions.maxLines).join(`
|
|
24
|
+
`),S.style.fontSize=`max(9px, ${e.captions.size/19.2}cqw)`,S.style.maxHeight=`${e.captions.maxLines*1.3+.8}em`;const d=Ie(e.theme,G,i.resolvedTheme),a={background:d.background,foreground:d.foreground,accent:d.accent,font:ve(e.theme)==="studio"?i.resolvedTheme?.font??e.theme.font:e.theme.font};for(const[p,f]of Object.entries(a))n.style.setProperty(`--video-${p}`,f)}function rt(e,o){const r=Y("",()=>{},`video-trim-${o}`);r.className="trim-handle",r.dataset.edge=o,r.setAttribute("role","slider"),r.setAttribute("aria-label",`${o==="in"?"In":"Out"} trim`);const c=i?.takes[e.id]?.find(a=>a.file===e.take)?.durationSec??e.outSec;r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuemax",String(c)),r.setAttribute("aria-valuenow",String(o==="in"?e.inSec:e.outSec));const d=e.durationSec<=0||e.outSec-e.inSec<=0;return r.disabled=!z()||d,r.onpointerdown=a=>{if(!z()||i===null||d)return;a.preventDefault(),a.stopPropagation();const p=i.version,f=a.clientX,y=r.parentElement.getBoundingClientRect().width||1;let k=e.inSec,j=e.outSec;const he=Q=>{const $e=(Q-f)/y*e.durationSec;o==="in"?k=Math.max(0,Math.min(e.outSec-.5,e.inSec+$e)):j=Math.max(e.inSec+.5,Math.min(c,e.outSec+$e)),r.setAttribute("aria-valuenow",(o==="in"?k:j).toFixed(2));const Ee=u.querySelector(`[data-testid="video-${o}"]`);Ee&&(Ee.value=(o==="in"?k:j).toFixed(2))},xe=Q=>he(Q.clientX),we=Q=>{he(Q.clientX),Ae(),(k!==e.inSec||j!==e.outSec)&&re({op:"chapter-trim",chapter:e.id,inSec:k,outSec:j},p)},Ae=()=>{window.removeEventListener("pointermove",xe),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",Ce)},Ce=()=>{Ae(),$()};window.addEventListener("pointermove",xe),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",Ce,{once:!0})},r.onkeydown=a=>{if(!z()||d||!["ArrowLeft","ArrowRight"].includes(a.key))return;a.preventDefault(),a.stopPropagation();const p=a.key==="ArrowLeft"?-.1:.1,f=o==="in"?Math.max(0,Math.min(e.outSec-.5,e.inSec+p)):e.inSec,y=o==="out"?Math.max(e.inSec+.5,Math.min(c,e.outSec+p)):e.outSec;(f!==e.inSec||y!==e.outSec)&&re({op:"chapter-trim",chapter:e.id,inSec:f,outSec:y})},r}function _t(){const e=i?.proof,o=t("check-list");if(o.replaceChildren(),t("proof").hidden=e===void 0,e===void 0||i===null)return;t("proof-summary").textContent=`${e.verdict??"Pending"}${e.failedAtSec===null?"":` · Failed at ${e.failedAtSec.toFixed(1)}s`}`;const r=!R&&Number.isFinite(s.duration)&&s.duration>0?s.duration:Math.max(1,...i.chapters.filter(a=>a.startSec>=0).map(a=>a.startSec+Math.max(0,a.durationSec)),...e.checks.map(a=>a.atSec??0),e.failedAtSec??0),c=document.createElement("div");c.className="check-track",c.setAttribute("aria-label","Check timeline");const d=(a,p,f,y)=>{if(a<0||!Number.isFinite(a)||r<=0)return;const k=Y(p==="FAIL"?"✗":p==="PASS"?"✓":"·",()=>{R&&(R=!1,oe("video",a)),s.currentTime=a,s.dispatchEvent(new Event("timeupdate"))},y);k.className="check-mark",k.dataset.state=p,k.dataset.sec=String(a),k.style.left=`${Math.min(100,a/r*100)}%`,k.title=`${a.toFixed(1)}s · ${f}`,k.setAttribute("aria-label",k.title),c.append(k)};for(const a of e.checks){const p=i.chapters.find(k=>k.id===a.chapter)?.title??a.chapter,f=`${a.state} · ${p} · ${a.text}`,y=document.createElement("li");y.dataset.testid="video-check",y.dataset.state=a.state,y.textContent=`${f}${a.atSec===null?"":` · ${a.atSec.toFixed(1)}s`}`,o.append(y),a.atSec!==null&&d(a.atSec,a.state,f,"video-check-mark")}e.failedAtSec!==null&&!e.checks.some(a=>a.state==="FAIL"&&a.atSec===e.failedAtSec)&&d(e.failedAtSec,"FAIL","Failed","video-failure-mark"),b.dataset.proof=String(c.childElementCount>0),b.append(c)}function Wt(){const e=t("review-tab");if(e.hidden=g!=="options"||C!=="sheets",e.hidden||i===null)return;const o=i.review;t("review-line").textContent=o?.line??"This is an edited cut. The take’s own review is on its run.";const r=t("review-findings");r.replaceChildren();for(const d of i.proof?.checks??[]){const a=document.createElement("li");a.dataset.testid="video-finding",a.dataset.state=d.state;const p=i.chapters.find(y=>y.id===d.chapter)?.title,f=d.atSec===null?null:Math.max(0,Math.round(d.atSec));a.textContent=`${f===null?"":`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")} · `}${p===void 0?"":`${p} · `}${d.text}`,r.append(a)}const c=`${i.version}|${(o?.sheets??[]).map(d=>d.name).join(",")}`;tt!==c&&(tt=c,Ht(o?.sheets??[]))}async function Ht(e){const o=++ze,r=t("review-sheets");for(const c of ke)URL.revokeObjectURL(c);if(ke=[],r.replaceChildren(),e.length===0){const c=document.createElement("p");c.className="hint",c.textContent="No contact sheets yet.",r.append(c);return}if(O.includes("media.read"))for(const c of e){const d=document.createElement("figure");d.className="sheet",d.dataset.testid="video-sheet",d.dataset.sheet=c.name;const a=document.createElement("figcaption");a.textContent=c.label,d.append(a),r.append(d);const p=await de("artifact.media",{ref:{sheet:c.name}});if(K||o!==ze)return;const f=p.payload?.blob,y=p.payload?.type;if(!p.ok||!(f instanceof Blob)||typeof y!="string"||!y.startsWith("image/")||typeof URL.createObjectURL!="function"){a.textContent=`${c.label} · not available`;continue}const k=URL.createObjectURL(f);ke.push(k);const j=document.createElement("img");j.src=k,j.alt=c.label,d.prepend(j)}}function $(){const e=document.activeElement,o=u.querySelector('[data-testid="video-rename-input"]');o!==null&&(ae=o.value);const r=e===o,c=o?.selectionStart,d=o?.selectionEnd,a=e?.dataset.chapter,p=e?.dataset.testid;if(n.dataset.surface=g,n.dataset.mode=w,n.dataset.head=String(i?.version??0),n.dataset.current=A??"",t("chapters").hidden=g==="card"||g==="options"&&C!=="chapters",t("work").hidden=g==="options",t("inspectors").hidden=g!=="full"||w!=="advanced",Wt(),b.hidden=g!=="full",v.hidden=g!=="card",l.replaceChildren(),v.replaceChildren(),b.replaceChildren(),u.replaceChildren(),b.dataset.proof="false",i===null)return;if(U!==null){const h=Vt();h!==null&&(u.prepend(h),r&&(h.focus(),h.setSelectionRange(c??null,d??null)))}i.chapters.forEach((h,E)=>{const P=document.createElement("li"),F=Y("",()=>pe(h.id),"video-chapter");F.className="chapter",F.dataset.chapter=h.id,F.disabled=h.startSec<0,F.disabled&&(F.title="Not in this recording");const T=document.createElement("span");T.className="number",T.textContent=String(E+1);const je=document.createElement("span");je.textContent=h.title;const He=document.createElement("span");if(He.className="duration",He.textContent=h.durationSec<0?"—":`${h.durationSec.toFixed(1)}s`,F.append(T,je,He),F.setAttribute("aria-current",String(h.id===A)),F.setAttribute("aria-label",`Chapter ${E+1}: ${h.title}`),h.verdict==="PASS"||h.verdict==="FAIL"){const D=document.createElement("span");D.className="chapter-verdict",D.dataset.verdict=h.verdict,D.textContent=h.verdict==="PASS"?"✓":"✗",D.setAttribute("aria-label",h.verdict),F.append(D)}F.ondblclick=()=>{ue()&&st(h)},P.draggable=ue()&&z(),P.ondragstart=D=>{H=h.id,D.dataTransfer?.setData("text/plain",h.id)},P.ondragover=D=>{ue()&&z()&&D.preventDefault()},P.ondrop=D=>{if(D.preventDefault(),H===null||H===h.id||!ue())return;const ft=i.chapters.filter(Xe=>Xe.id!==H),ht=ft.findIndex(Xe=>Xe.id===h.id),mt=P.getBoundingClientRect(),Gt=D.clientY>=mt.top+mt.height/2?h.id:ht===0?null:ft[ht-1].id;re({op:"chapter-move",chapter:H,after:Gt}),H=null},P.ondragend=()=>{H=null},P.append(F),l.append(P);const me=Y(`${E+1} · ${h.title}`,()=>pe(h.id),"video-chip");me.className="chip",me.setAttribute("aria-current",String(h.id===A)),v.append(me),me.disabled=h.startSec<0,me.disabled&&(me.title="Not in this recording");const Le=document.createElement("div");Le.className="segment-box",Le.style.flex=String(h.durationSec<0?1:h.durationSec);const be=Y(`${E+1} · ${h.title}`,()=>pe(h.id),"video-segment");be.className="segment",be.setAttribute("aria-current",String(h.id===A)),Le.append(be),be.disabled=h.startSec<0,be.disabled&&(be.title="Not in this recording"),w==="advanced"&&h.id===A&&Le.append(rt(h,"in"),rt(h,"out")),b.append(Le)}),_t();const f=Se();t("count").textContent=f===void 0?"No chapters":`${i.chapters.findIndex(h=>h.id===f.id)+1} of ${i.chapters.length}`,t("say").value=f?.say??"";const y=i.style.theme,k=Ie(y,G,i.resolvedTheme),j=ve(y);if(t("theme-summary").textContent=`${j==="studio"?"Studio skin (default)":j==="custom"?"Custom colours":"Preset: "+j}
|
|
25
|
+
${j==="studio"?i.resolvedTheme?.font??y.font:y.font}
|
|
26
|
+
Background ${k.background}
|
|
27
|
+
Text ${k.foreground}
|
|
28
|
+
Accent ${k.accent}
|
|
29
|
+
Title card: ${y.titleCard.on?y.titleCard.title:"Off"}
|
|
30
|
+
End card: ${y.endCard.on?y.endCard.title:"Off"}`,_e(),a!==void 0&&Array.from(l.querySelectorAll("[data-chapter]")).find(h=>h.dataset.chapter===a)?.focus(),!ue()||g==="card"||f===void 0)return;const he=document.createElement("div");he.className="buttons";const xe=Y("Rename",()=>st(f),"video-rename"),we=Y("Move up",()=>Ve(f.id,-1),"video-move-up"),Ae=Y("Move down",()=>Ve(f.id,1),"video-move-down");xe.disabled=!z(),we.disabled=!z()||i.chapters[0]?.id===f.id,Ae.disabled=!z()||i.chapters.at(-1)?.id===f.id,he.append(xe,we,Ae),u.append(he);const Ce=i.version,Q=document.createElement("div");Q.className="trim-fields";const $e=(h,E,P)=>{const F=document.createElement("label");F.textContent=h;const T=document.createElement("input");return T.type="number",T.step="0.1",T.min="0",T.value=String(E),T.dataset.testid=P,T.setAttribute("aria-label",h),T.disabled=!z(),T.max=String(i.takes[f.id]?.find(je=>je.file===f.take)?.durationSec??f.outSec),F.append(T),Q.append(F),T},Ee=$e("In (seconds)",f.inSec,"video-in"),We=$e("Out (seconds)",f.outSec,"video-out"),ut=()=>{const h=Ee.valueAsNumber,E=We.valueAsNumber;if(!(h===f.inSec&&E===f.outSec)){if(!Number.isFinite(h)||!Number.isFinite(E)||h<0||E-h<.5||E>Number(We.max)){Ne("Keep at least 0.5 seconds within this take.");return}re({op:"chapter-trim",chapter:f.id,inSec:h,outSec:E},Ce)}};Ee.onchange=ut,We.onchange=ut,u.append(Q);const pt=i.takes[f.id]??[];if(pt.length>1){const h=document.createElement("label");h.textContent="Take";const E=document.createElement("select");E.setAttribute("aria-label","Take"),E.dataset.testid="video-take",E.disabled=!z(),pt.forEach((P,F)=>{const T=document.createElement("option");T.value=P.file,T.textContent=`Take ${F+1} · ${P.durationSec.toFixed(1)}s`,E.append(T)}),E.value=f.take,E.onchange=()=>{E.value!==f.take&&re({op:"chapter-take",chapter:f.id,take:E.value},Ce)},h.append(E),u.append(h),g!=="options"&&u.append(Y("Preview take",()=>{R=!0,oe({chapter:f.id})},"video-preview-take"))}if(p!==void 0&&!p.includes("rename-input")){const h=n.querySelector(`[data-testid="${p}"]`);h&&!h.disabled&&!h.closest("[hidden]")&&h.focus()}}async function Xt(e,o,r){const c=Bt.options?.tabs.find(d=>d.id===e)?.controls?.find(d=>d.id===o);if(i===null||c===void 0||!Dt(c,r)||!O.includes("artifact.theme")||typeof r=="string"&&/[\r\n]/.test(r))return{applied:!1,values:i===null?ot(e):ie(i.style,e,G,i.resolvedTheme),reason:"That style change is not available."};if(M)return{applied:!1,values:ie(i.style,e,G,i.resolvedTheme),reason:"A cut is being saved."};M=!0,$();try{for(let d=0;d<2;d++){const a=Ot(i.style,e,o,r),p=await de("theme.set",{base:i.version,tokens:{kind:"video-style",style:a}});if(p.ok){const f=await fe();return{applied:f,values:ie(i.style,e,G,i.resolvedTheme),...f?{}:{reason:"The saved style could not be read."}}}if(!(p.error?.code==="head_moved"&&d===0&&await fe()))return Be(),{applied:!1,values:ie(i.style,e,G,i.resolvedTheme),reason:p.error?.message??"Style was not changed."}}return{applied:!1,values:ie(i.style,e,G,i.resolvedTheme)}}finally{M=!1,$()}}const lt=()=>{t("play").textContent=s.paused?"Play":"Pause"};s.onplay=lt,s.onpause=lt,t("play").onclick=()=>{q!==null&&(s.paused?s.play().catch(()=>Ne("The video isn't available here")):s.pause())},s.onerror=()=>{t("unavailable").hidden=!1},s.ontimeupdate=()=>{if(i===null||R)return;const e=De(s.currentTime);e!==void 0&&e.id!==A&&(A=e.id,$()),S.hidden=!nt(e)},n.onkeydown=e=>{const o=e.target,r=e.metaKey||e.ctrlKey;if(!At(e,n,c=>Re("ui.key",{key:c}))&&!o.closest("input,textarea,select")&&e.key!=="Tab"){if(e.altKey&&!r&&["ArrowUp","ArrowDown"].includes(e.key)&&ue()&&A!==null){e.preventDefault(),Ve(A,e.key==="ArrowUp"?-1:1);return}if(!(r||e.altKey)){if(["ArrowLeft","ArrowRight","Home","End"].includes(e.key)&&i!==null){e.preventDefault();const c=i.chapters.filter(f=>f.startSec>=0),d=c.findIndex(f=>f.id===A),a=e.key==="Home"?0:e.key==="End"?c.length-1:Math.max(0,Math.min(c.length-1,d+(e.key==="ArrowRight"?1:-1))),p=c[a];p&&pe(p.id);return}o.closest("button")&&[" ","Enter"].includes(e.key)||e.key.length===1&&(e.preventDefault(),Re("ui.typed",{grapheme:e.key}))}}};function ct(){K=!0,++ne,++ye,++ze,qe(),V!==null&&(URL.revokeObjectURL(V),V=null);for(const e of ke)URL.revokeObjectURL(e);ke=[];for(const{timer:e,resolve:o}of ce.values())clearTimeout(e),o({ok:!1,error:{code:"unavailable",message:"Editor closed."}});ce.clear(),x?.close(),window.removeEventListener("message",dt)}function dt(e){const o=e.data;if(x!==null||o?.p!==_||o.v!==W||o.type!=="host.hello"||!e.ports[0])return;const r=kt(o.payload),c=o.payload;g=r.surface,w=r.mode??"simple",C=r.tab??"chapters",L=r.protocol,O=Array.isArray(c.grants)?c.grants.filter(d=>typeof d=="string"):[],at(c.theme),x=e.ports[0],B=new Ct(x,{surface(d,a){const p=g;g=d,a!==null&&(w=a),$(),p==="options"&&d!=="options"&&oe()},mode(d){return w=d,$(),w},action(d){const a=i?.chapters.filter(k=>k.startSec>=0)??[];if(!["next","prev"].includes(d)||i===null||a.length===0)return{handled:!1};const p=a.findIndex(k=>k.id===A),f=Math.max(0,Math.min(a.length-1,p+(d==="next"?1:-1))),y=a[f];return pe(y.id),{handled:!0,status:`Chapter ${i.chapters.indexOf(y)+1} of ${i.chapters.length} · ${y.title}`}},tab(d){C=d,$()},selection(d){const a=d.find(p=>typeof p=="object"&&p!==null&&["chapter","time"].includes(p.kind));a?.kind==="time"&&typeof a.atSec=="number"?qt(a.atSec):typeof a?.id=="string"&&pe(a.id,!1)},optionsChanged:Xt}),x.onmessage=d=>{const a=d.data;if(a?.p!==_||a.v!==W)return;if(typeof a.re=="string"){const f=ce.get(a.re);if(f===void 0)return;clearTimeout(f.timer),ce.delete(a.re),f.resolve({ok:a.ok===!0,...a.payload!==void 0?{payload:a.payload}:{},...a.error===void 0?{}:{error:a.error}});return}if(L===2&&B?.dispatch(a))return;const p=a.payload??{};switch(a.type){case"host.ping":a.id&&x?.postMessage({p:_,v:W,re:a.id,ok:!0,payload:{}});break;case"host.size":if(p.size==="inline"||p.size==="pane"||p.size==="full"){const f=g;g=L===1&&p.size==="pane"?"full":Ze(p.size),$(),f==="options"&&g!=="options"&&oe()}break;case"host.theme":at(p.theme),Be(),it(),_e(),$();break;case"artifact.changed":(typeof p.head!="number"||i===null||p.head>i.version)&&fe();break;case"host.teardown":ct();break;case"selection.cleared":A=null,$();break}},x.start(),$(),fe()}window.addEventListener("message",dt),window.addEventListener("pagehide",ct,{once:!0}),$(),xt("wicked-video",Je)}return et(),Z.start=et,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Z})({});
|
|
31
31
|
</script></body></html>
|