efficient-easel 24.2.0 → 25.1.0
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/README.md +43 -2
- package/dist/{CanvasDragLayer-NZpaX6aq.d.ts → CanvasDragLayer-DXeQGrwJ.d.ts} +42 -3
- package/dist/canvas/index.d.ts +2 -139
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-6NJHYXJM.js → chunk-3XECMGXX.js} +1 -1
- package/dist/{chunk-FRAIEWRC.js → chunk-62UGN7VM.js} +1 -1
- package/dist/{chunk-HNKB2ZYR.js → chunk-6ATIYLUL.js} +1 -1
- package/dist/{chunk-Y53EKN35.js → chunk-6EDVZBUO.js} +1 -1
- package/dist/{chunk-JMAOCKB2.js → chunk-6WTWYHC2.js} +3 -3
- package/dist/chunk-7UFKEX72.js +1 -0
- package/dist/chunk-BBD3FLU3.js +16 -0
- package/dist/chunk-CEC5XLN4.js +1 -0
- package/dist/chunk-CWELHADJ.js +1 -0
- package/dist/chunk-DX3VILZ3.js +6 -0
- package/dist/chunk-ERB6FAZT.js +2 -0
- package/dist/{chunk-TGZCD6IP.js → chunk-EUFDQ4KL.js} +1 -1
- package/dist/chunk-FEP6XMNX.js +1 -0
- package/dist/chunk-FR7EEKFF.js +1 -0
- package/dist/chunk-GDO4QJ4G.js +1 -0
- package/dist/{chunk-GMCZXMOV.js → chunk-GR3XRILS.js} +1 -1
- package/dist/chunk-H6BER2EU.js +1 -0
- package/dist/{chunk-G67G63O5.js → chunk-ITIVCER6.js} +1 -1
- package/dist/chunk-IW5QXREH.js +64 -0
- package/dist/chunk-JIP5JNRB.js +1 -0
- package/dist/chunk-JQQFB7EZ.js +1 -0
- package/dist/{chunk-AGWKB77Q.js → chunk-K53PQAMP.js} +1 -1
- package/dist/{chunk-4ESG53BH.js → chunk-KF3LT7J2.js} +1 -1
- package/dist/{chunk-CLOS6SSX.js → chunk-KO47WAWR.js} +1 -1
- package/dist/chunk-KVIEUWTX.js +11 -0
- package/dist/{chunk-QORC32JO.js → chunk-LUHGBFOD.js} +3 -3
- package/dist/{chunk-DDH2DYQP.js → chunk-LUOY3A3Q.js} +1 -1
- package/dist/chunk-MIX7EGRG.js +2 -0
- package/dist/{chunk-2FYFAAAK.js → chunk-OXOUGEAT.js} +1 -1
- package/dist/chunk-PMRN5Z3T.js +1 -0
- package/dist/{chunk-55KKGABA.js → chunk-PVBDKBJB.js} +1 -1
- package/dist/{chunk-RPMSET77.js → chunk-QTHQPJWA.js} +1 -1
- package/dist/{chunk-ISS72IKO.js → chunk-QZJKWKGH.js} +1 -1
- package/dist/{chunk-IYHO4XQX.js → chunk-S6YOIRXQ.js} +1 -1
- package/dist/{chunk-5PXVT7JY.js → chunk-SBVIW3KJ.js} +1 -1
- package/dist/chunk-SC6E3UUS.js +13 -0
- package/dist/{chunk-LN43DP2A.js → chunk-SQTVXE5D.js} +13 -13
- package/dist/chunk-TOKMFZPB.js +1 -0
- package/dist/chunk-U3LTJSBU.js +20 -0
- package/dist/{chunk-75C6WFNF.js → chunk-UCZQWQNS.js} +1 -1
- package/dist/chunk-UDWXBS46.js +1 -0
- package/dist/{chunk-WYTPBF3Q.js → chunk-VBEVZZTV.js} +11 -11
- package/dist/{chunk-OITNWE52.js → chunk-XLC7HWW3.js} +1 -1
- package/dist/chunk-XTDOSL2M.js +8 -0
- package/dist/chunk-YYD257TD.js +1 -0
- package/dist/copy/index.js +13 -13
- package/dist/copy-place-CQIemdtU.d.ts +25 -0
- package/dist/data/index.d.ts +4 -1
- package/dist/data/index.js +1 -1
- package/dist/dom-BpxMcHFP.d.ts +200 -0
- package/dist/drag/index.d.ts +2 -3
- package/dist/drag/index.js +1 -1
- package/dist/draw/index.d.ts +1 -1
- package/dist/draw/index.js +1 -1
- package/dist/easel/index.d.ts +67 -1
- package/dist/easel/index.js +1 -1
- package/dist/edit-lock/index.d.ts +0 -46
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +6 -40
- package/dist/fields/index.d.ts +1 -6
- package/dist/fields/index.js +1 -1
- package/dist/node-ops/index.js +1 -1
- package/dist/page-copy/index.d.ts +110 -0
- package/dist/page-copy/index.js +5 -0
- package/dist/panel/index.d.ts +29 -34
- package/dist/panel/index.js +1 -1
- package/dist/panel/panel.css +0 -78
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.d.ts +37 -57
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +19 -11
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/SaveControls.d.ts +10 -11
- package/dist/screen/components/SaveControls.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +5 -6
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +8 -9
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +17 -17
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +10 -11
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +9 -10
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/document/block-set-host.d.ts +55 -0
- package/dist/screen/lib/document/block-set-host.js +1 -0
- package/dist/screen/lib/document/block-types-in.js +1 -1
- package/dist/screen/lib/document/box-fields.d.ts +160 -5
- package/dist/screen/lib/document/box-fields.js +1 -9
- package/dist/screen/lib/document/device-fields.js +1 -1
- package/dist/screen/lib/document/palette-sections.d.ts +33 -97
- package/dist/screen/lib/document/palette-sections.js +1 -1
- package/dist/screen/lib/document/preview-dom.js +1 -1
- package/dist/screen/lib/document/section-doc.js +1 -1
- package/dist/screen/lib/document/style-clipboard.d.ts +10 -11
- package/dist/screen/lib/document/style-clipboard.js +1 -1
- package/dist/screen/lib/document/use-section-ops.js +1 -1
- package/dist/screen/lib/document-switch.js +1 -1
- package/dist/screen/lib/failure.js +1 -1
- package/dist/screen/lib/host-inbound.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/media-picker.js +1 -1
- package/dist/screen/lib/page-lock.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +251 -12
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +6 -0
- package/dist/screen/words.d.ts +9 -0
- package/dist/screen/words.js +1 -1
- package/dist/strings/index.d.ts +4 -1
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +0 -32
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +7 -6
- package/dist/text-styles/index.js +37 -36
- package/dist/text-styles/text-styles.css +5 -53
- package/dist/tree/index.d.ts +2 -2
- package/dist/{types-DBy3L69b.d.ts → types-CoUTWUwB.d.ts} +1 -1
- package/dist/words-Dl8Qja4K.d.ts +32 -0
- package/package.json +15 -3
- package/dist/chunk-3FIS2FRS.js +0 -1
- package/dist/chunk-7RSE6KKY.js +0 -1
- package/dist/chunk-CMPFUJ26.js +0 -8
- package/dist/chunk-CZAAGBVL.js +0 -7
- package/dist/chunk-DSKNJXB4.js +0 -1
- package/dist/chunk-FJTCSQWK.js +0 -16
- package/dist/chunk-G7ISR6DI.js +0 -1
- package/dist/chunk-H4Z2V56N.js +0 -21
- package/dist/chunk-K7MMLCTT.js +0 -2
- package/dist/chunk-KRL3IUV3.js +0 -1
- package/dist/chunk-LF3FUSCQ.js +0 -1
- package/dist/chunk-THWO5YVZ.js +0 -1
- package/dist/chunk-TOHOGVAE.js +0 -15
- package/dist/chunk-UKPZ2YWE.js +0 -64
- package/dist/chunk-V7U33NF2.js +0 -1
- package/dist/chunk-VKPOH6MK.js +0 -1
- package/dist/chunk-YU3WHLGI.js +0 -1
- package/dist/repeat-D65bJS8d.d.ts +0 -49
- package/dist/session-EsjORLQ0.d.ts +0 -43
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function w(t,n){return t&&m(t,n)?t[n]:void 0}var b=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=w(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=w(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function I(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??z(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=F(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return M(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return b(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;M(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),b(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?b(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=w(n,f),h=w(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new W("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=et(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...wt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=ct(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
|
|
1
|
+
import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function w(t,n){return t&&m(t,n)?t[n]:void 0}var b=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=w(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=w(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function I(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??z(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=F(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return M(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return b(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;M(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),b(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?b(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=w(n,f),h=w(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new W("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=et(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...wt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=ct(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,bt as clone,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEaselSession as e}from"./chunk-YM4UEGBV.js";import{useHostEscape as n}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-S6YOIRXQ.js";import{styleMenuItems as o}from"./chunk-CWELHADJ.js";import{ROOT_ZONE as l}from"./chunk-TCAAOYQY.js";import{repeatCopyAt as r}from"./chunk-JQQFB7EZ.js";import{easelMenuEntries as i,menuLabel as c}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as s,nodeMenuItems as a}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as u}from"./chunk-WK3AFPXY.js";import{useCanvasEvent as d}from"./chunk-TOKMFZPB.js";import{isTypingTarget as p,framePointToHost as f}from"./chunk-FR7EEKFF.js";import{zoneKey as m,ROOT_SLOT as y,ROOT_ID as h}from"./chunk-EUFDQ4KL.js";import{useState as k,useCallback as b,useRef as v,useEffect as x}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{TrashIcon as w,AddIcon as C,MoveUpIcon as O,MoveDownIcon as z,UndoIcon as P,RedoIcon as A,PasteIcon as E,StylesIcon as j,LayersIcon as D,CopyIcon as K}from"efficient-shell/icons/efficient";import{jsx as M}from"react/jsx-runtime";function T(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var I=s(),L=/* @__PURE__ */new WeakMap;function Y(e){if(e.claimsPage)return I;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",s);let t=L.get(n);return t||(t=s(),L.set(n,t)),t}function S(){return Y(e())}function F(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:y,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function B(e,n,t){const o=e.canPasteAt;if(!o)return m(n.from)===t.zone?F(e,t.zone,t.index+1):null;for(const l of T(e,t)){const t=F(e,l.zone,l.index+1);if(o(n,t))return t}return null}function R(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(p(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function Q(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:B(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function U(e,n){const{zone:t,index:r}=n,i=e.nodeAt(t,r);if(!i)return[];const c=i.props.id,s=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),y=e.permits?.(i)??{duplicate:!0,delete:!0},h=X(e,i,t),k=T(e,n),b=d.held,v=b&&!p?B(e,b,n):null,x=!e.readOnly,g=e.style?o({held:x?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,r,i),words:e.words?.styleClipboard}):[];return a({title:s,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},r=n.zone===l?null:e.slotRung?.(n.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:x&&m&&y.duplicate?()=>d.duplicate(c):void 0,...W(x&&!p,e=>d.canStep(c,e),e=>d.step(c,e)),copy:h.copy?()=>d.copy(c,s):void 0,cut:x&&h.cut?()=>d.cut(c,s):void 0,paste:x&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:x&&e.renamePropOf(i,t)?()=>e.beginRename(t,r):void 0,hide:!x||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:x&&m&&y.delete?()=>d.remove(c):void 0},style:g,extras:N(x?V(e,n.copy):null,e.menuRows?.(i,t,r)),pinnedLine:p?Z(e).pinned:void 0})}function V(e,n){const o=e.copyItem;if(!o||!n)return null;const l=Z(e),r=t.menu,i=e=>l[e]??r[e]??"",c={ownerId:n.ownerId,slot:n.slot,index:n.index,...n.outer?{outer:n.outer}:{}},s=e=>()=>o({...c,action:e});return{make:[{label:i("itemAddAfter"),icon:/* @__PURE__ */M(C,{}),onClick:s("addAfter")},{label:i("itemMoveEarlier"),icon:/* @__PURE__ */M(O,{}),onClick:s("moveEarlier"),disabled:n.index<=0},{label:i("itemMoveLater"),icon:/* @__PURE__ */M(z,{}),onClick:s("moveLater"),disabled:n.index>=n.count-1}],remove:[{label:i("itemDelete"),icon:/* @__PURE__ */M(w,{}),danger:!0,onClick:s("delete")}]}}function N(e,n){if(!e)return n??void 0;if(!n)return e;return Object.fromEntries(["pick","make","change","remove"].map(t=>[t,[...e[t]??[],...n[t]??[]]]).filter(([,e])=>e.length>0))}function W(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var Z=e=>e.words?.screen??t.menu;function G(e){const n=Z(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */M(P,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */M(A,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=F(e,l,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):m(c.from)===l)){const n=s,t=e.words?.menu??u;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */M(E,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const a=[r,i,[...e.openPageStyles?[{label:e.pageStylesLabel??t.pageStyles,icon:/* @__PURE__ */M(j,{}),onClick:e.openPageStyles}]:[],{label:n.collapseAll,icon:/* @__PURE__ */M(D,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function J(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??u,c=Z(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */M(K,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */M(K,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */M(E,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function _(e){return e.shiftKey}function H(e,t){const[o,l]=k(null),i=b(()=>l(null),[]);n(null!==o,i);const c=v(e);c.current=e;const s=b(e=>{const n=c.current,t=n.keys;if(!t)return;const o=R(e);if(!o)return;const l=t.selected();if(!l)return;const r=Q(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;x(()=>{if(!a)return;const e=e=>s(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,s]),d(t,"keydown",s);const u=b(n=>{if(_(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(_(n)||!t)return;const o=n.target?.closest?.("[data-easel-block]")??null,i=o?.getAttribute("data-easel-block"),c=i?e.locate(i):null;n.preventDefault();const s=f(t.frame,n.clientX,n.clientY),a=t.frame,u=o?r(o):null;l(c?{kind:"node",...s,...c,copy:u,owner:a}:{kind:"empty",...s,owner:a})}),d(t,"mousedown",i),d(t,"scroll",i,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */M($,{host:e,target:o,onClose:i}):null,closeMenu:i}}function $({host:e,target:n,onClose:t}){const o="node"===n.kind?U(e,n):"input"===n.kind?J(e,n.el):G(e);return 0===o.length?null:/* @__PURE__ */M(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":c(o),items:i(o)})}export{I as EASEL_NODE_CLIPBOARD,T as ancestorChain,Y as nodeClipboardOf,X as nodeClipboardRules,U as nodeMenuItems,R as nodeShortcut,G as pageMenuItems,B as pastePlace,Q as runNodeShortcut,J as textMenuItems,S as useNodeClipboard,H as useNodeContextMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function e(e){const n=e;if(!n||"string"!=typeof n.tagName)return!1;const o=n.tagName.toUpperCase();if("TEXTAREA"===o||"SELECT"===o)return!0;if("INPUT"===o)return!t.has(String(n.type??"text").toLowerCase());if(n.isContentEditable)return!0;const i=n.closest?.("[contenteditable]");return!(!i||"false"===i.getAttribute("contenteditable"))||null!=n.closest?.('[role="textbox"]')}var n="data-easel-block";function o(t,e=n){const o=t;return o&&"function"==typeof o.closest?o.closest(`[${e}]`)?.getAttribute(e)??null:null}function i(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,c=-1/0;for(const e of Array.from(t.children)){const t=i(e);t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.left+t.width),c=Math.max(c,t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:c-o}}function r(t,e){return t===e||t.contains(e)||e.contains(t)}var c=4;function h(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function l(t,e,n){const o=t.getBoundingClientRect(),i=n?.getBoundingClientRect()??{left:0,top:0},r=h(t);return{left:o.left-i.left+e.left*r,top:o.top-i.top+e.top*r,width:e.width*r,height:e.height*r}}function f(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function u(t,e,n){const o=l(t,e,n),i=f(n);return{left:o.left/i,top:o.top/i,width:o.width/i,height:o.height/i}}function s(t,e,n){const o=t.getBoundingClientRect(),i=f(t);return{x:(e-o.left)/i,y:(n-o.top)/i}}function a(t,e,n,o){const{left:i,top:r}=l(t,{left:e,top:n,width:0,height:0},o);return{x:i,y:r}}function d({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const i=o>0?Math.min(o/e,n):1;return{width:e,scale:i,shownWidth:e*i}}var g="data-es-canvas-style",p=/* @__PURE__ */new WeakMap;function w(t,e){e?p.set(t,e):p.delete(t)}function m(t,e,n){const o=t.head??t.documentElement;let i=x(t,e);if(!i){i=t.createElement("style"),i.setAttribute(g,e);const n=p.get(t);n&&i.setAttribute("nonce",n),o.appendChild(i)}return i.textContent!==n&&(i.textContent=n),i}function b(t,e){x(t,e)?.remove()}function x(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}export{n as BLOCK_ATTRIBUTE,c as WORDS_CLEAR,s as clientPointToLayer,i as drawnBox,f as elementScale,d as fitCanvas,a as framePointToHost,l as frameRectToHost,u as frameRectToLayer,h as frameScale,e as isTypingTarget,o as nodeIdAt,r as related,b as removeCanvasStyle,w as setCanvasNonce,m as upsertCanvasStyle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,n){const a=e.categories??{},o=e.components,s=[],c=/* @__PURE__ */new Map,r=/* @__PURE__ */new Set;for(const e of n.presets??[])r.has(e.key)||o[e.key]||(r.add(e.key),c.set(e.cat,[...c.get(e.cat)??[],e]));const i=(a,o)=>({type:a.key,cat:o,catLabel:t(e,o,n.categoryLabel),name:a.label,desc:a.desc??"",...a.alias?{alias:a.alias}:{},preset:a});for(const[r,l]of Object.entries(a)){if(!1===l?.visible)continue;const a=c.get(r)??[],f=/* @__PURE__ */new Set;for(const c of l?.components??[]){const l=o[c];if(!l)continue;const u=l.label??c,p=n.labelAtLevel(c,"section",u);s.push({type:c,cat:r,catLabel:t(e,r,n.categoryLabel),name:p,desc:n.descriptions[c]??"",...p===u?{}:{alias:u}});for(const e of a)e.after!==c||f.has(e)||(f.add(e),s.push(i(e,r)))}for(const e of a)f.has(e)||s.push(i(e,r))}return s}function t(e,t,n){return n(t)??e.categories?.[t]?.title??t}function n(e,t){return!t||`${e.name} ${e.alias??""} ${e.desc} ${e.type} ${e.catLabel}`.toLowerCase().includes(t)}function a(e,t){return e.find(e=>e.type===t)??null}function o(e,t){return e.filter(e=>e.type!==t)}export{e as buildPaletteSections,t as categoryLabel,n as matchesQuery,o as paletteWithoutPinned,a as pinnedSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-
|
|
1
|
+
import{PAGE_CONFLICT_CODE as e,readEaselFailure as r}from"./chunk-KO47WAWR.js";import{createEditLock as o}from"./chunk-YYD257TD.js";var c=o({readFailure:r,conflictCode:e});function i(i){return i.hostFailures?i.cache("easel:edit-lock",()=>o({readFailure:e=>r(e,i),conflictCode:e})):c}export{i as editLockOf,c as pageEditLock};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DESIGN_GROUP_KEY as t,BUCKET_KEY as o}from"./chunk-3QB2ZQXK.js";import{panelFieldsOf as n}from"./chunk-5XL2RXFU.js";import{withoutDeviceGate as e}from"./chunk-OXOUGEAT.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as c,heldStyle as i,planPaste as p,pasteMessage as u}from"./chunk-CWELHADJ.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as a,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([t.Size,t.Design,t.Layout,t.Position]),w=new Set(Object.values(t)),b=new Set(Object.values(o)),S=new Set(f),k=/* @__PURE__ */new Set(["focal","imageFocal"]),g=[l,m,h];function A(t){return`site:${t??""}`}function O(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,c=o[r]??n[r];if("string"==typeof c)return c;const i=o.options??n.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function v(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function L(t,e){const r=n(t,e)??{},s=[];let c=!0,i=!1;for(const[t,n]of Object.entries(r))b.has(t)?(c=t===o.Design,i=!1):w.has(t)?c&&(i=j.has(t)):i&&n&&"object"==typeof n&&!t.startsWith("_")&&(a(n)||S.has(t)||k.has(t)||v(n)||"slot"!==n.type&&s.push({path:[t],kind:O(n),counted:"mobile"!==y(n)?.tier}));return s}function X(t,o,n,e,r){c({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(t,o,n,e,r,s){const c=i(n);if(!c)return null;const f=p(c,{type:e.type,rows:t(o,e),props:e.props});return{...f,message:u(f,c.sourceLabel,r,s)}}function D(t,o,n,e){X(L,t,o,n,e)}function E(t,o,n,e,r){return d(L,t,o,n,e,r)}var P={scope:t=>A(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>D(e,t,o,n),plan:(t,o,n,e)=>E(e,t,o,n)};function C(t,o){if(!t&&!o)return P;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??P.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>X(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{D as copyNodeStyle,L as nodeStyleRows,E as planNodePaste,O as shopFieldKind,A as siteStyleScope,C as styleClipboardOf};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-
|
|
1
|
+
import{blockRuns as e,offeredChoices as s}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as t}from"./chunk-LUHGBFOD.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-S6YOIRXQ.js";import{useWords as r}from"./chunk-MFIRYGHW.js";import{ItemCount as n,DropdownMenu as c}from"efficient-shell/ui";import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";function m({choices:m,onPick:p}){const{Icon:u}=t(),f=r("screen",l),h=e(s(m)).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */a("span",{className:"flex w-full items-center gap-2",children:[
|
|
2
2
|
/* @__PURE__ */o("span",{children:e.group}),
|
|
3
3
|
/* @__PURE__ */o(n,{count:e.items.length,label:f.blockCount({count:e.items.length}),className:"ml-auto"})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(u,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
4
4
|
return o(c,{align:"start",triggerClassName:"sf-add-card",items:h,trigger:/* @__PURE__ */a(i,{children:[
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-H6BER2EU.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-UCZQWQNS.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-UDWXBS46.js";import{useSectionOps as y}from"./chunk-XLC7HWW3.js";import{PageEditGuardNotices as v}from"./chunk-62UGN7VM.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-ERB6FAZT.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-XTDOSL2M.js";import{keepsSharedSections as B,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as O,SidePanelHead as I,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as T,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as U,useScreenBlockRules as X,useScreenBlockLook as Y,useScreenStorageNamespace as J,useScreenNotify as Q,useScreenCanvasHead as G,isSlotMode as K,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-LUHGBFOD.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-FEP6XMNX.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-S6YOIRXQ.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Be,blockNodeActions as Ne,TREE_MAX_DEPTH as Oe,childSlotsOf as Ie,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Te,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ee,CanvasPartsContext as Le,partHasOwnBox as Ae,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-BBD3FLU3.js";import{TreeRow as De,Subtree as Ve,LayersTree as We,TreeGroupLabel as He,TreeRowAction as Ue,TreeSeam as Xe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ye}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Je}from"./chunk-WK3AFPXY.js";import{toItemSelector as Qe,useNodeOps as Ge,clickPick as Ke}from"./chunk-QTHQPJWA.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as fn,CanvasDragLayer as hn,CanvasInsert as mn}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-3XECMGXX.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as Cn,frameRectToHost as Bn,BLOCK_ATTRIBUTE as Nn,drawnBox as On}from"./chunk-FR7EEKFF.js";import{queryMainCopy as In}from"./chunk-7UFKEX72.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as En}from"./chunk-EUFDQ4KL.js";import{useRef as Ln,useMemo as An,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Un}from"react";import{ColoredBadge as Xn,Button as Yn,Tabs as Jn,toast as Qn,readMediaFileDrag as Gn,Tooltip as Kn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ft}from"react/jsx-runtime";var ht="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Un(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ft,{children:[
|
|
3
|
+
/* @__PURE__ */pt(Yn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */pt(Yn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2:0}`).join("|");return Vn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Bn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=In(t,`[${Nn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?On(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Bn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */pt(Kn,{content:e.reach,children:/* @__PURE__ */ut(Xn,{colorClass:Zn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Xn,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
|
|
7
|
+
return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ft,e?{children:[
|
|
8
|
+
/* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var wt="__rungs",xt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var zt="screen:band",Ct={duplicate:!0,delete:!0},Bt=()=>null;function Nt(){const Sn=he(),Bn=Sn.panels?.Toolbar,Nn=(Sn.panels?.useRight??Bt)(),{target:On,docId:Un,capabilities:Kn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:Ot,flushSave:It,access:Pt,saveUnreachable:$t=!1,readOnly:Tt,readOnlyReason:Mt=null}=w(),jt=T(),Et=M(),{mediaEditing:Lt,hasEditGuard:At,hasPinnedChrome:Rt}=Kn,{appState:Ft,dispatch:Dt,history:Vt,selectedItem:Wt,getSelectorForId:Ht,config:Ut}=je(e=>e),Xt=j(),{first:Yt,firstGroup:Jt,lastGroup:Qt,isSectionGroup:Gt,sectionGroupZone:Kt,panelOf:Zt}=Xt,_t=Zt(Yt),qt=e=>ne(Xt,e),eo=e=>te(Xt,e),no="node"===Xt.firstRow,to=Xt.band??null,oo=un("screen",ve),ro=un("tree",Ye),io=un("drag",gn),lo=un("notice",sn),so=un("lock",pn),ao=un("menu",Je),co=un("styleClipboard",Se),po=un("chrome",dn),uo=E()??`/${Zn}`,fo=L(),ho=A(),mo=y({readOnly:Tt}),go=y({readOnly:Tt,foldIntoHistory:!0}),yo=Ln(null),vo=Ee(),bo=An(()=>({...mo,select:e=>{yo.current=e,mo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=vo.config;yo.current=Qe(e,t,n)}mo.commitDocument(e,n)}}),[mo,vo]),ko=Ft.ui,So=ko.leftSideBarVisible,wo=ko.rightSideBarVisible,{options:xo,widths:zo,initial:Co,fluid:Bo,fit:No}=R(),[Oo,Io]=Rn(Co),Po=le(),$o=Lt&&null!==Po;se(),de();const To=ae();F(Wt?.props.id);const{read:Mo,write:jo,forSelection:Eo}=D(),[Lo,Ao]=Rn(Mo);Fn(()=>{jo(Lo)},[Lo]);const[Ro,Fo]=Rn(0),Do=Ln(null),Vo=Ln(null),Wo=kn(Vo,{readySelector:kt}),Ho=xn(Wo),Uo=d(Vo);a(Vo,Wo);const Xo=S(),Yo=an(Pt),Jo={state:et,offline:Xo||et.failed&&$t,readOnlyReason:Mt,editing:Yo?lo.editing({name:cn(Yo.name,so),noun:oo.noun}):null,conflict:null!=at,notSaving:oo.bar.notSaving},Qo=()=>{Tt||(et.failed?Nt():It())};c(Vo,Wo,Qo);const[Go,Ko]=Rn(!1),Zo=Ln(!1),[_o,qo]=Rn(null),[er,nr]=Rn([]),[tr,or]=Rn(V);W(tr);const rr=e(tr,Wt?.props.id),[ir,lr]=Rn(null);Fn(()=>{ir&&(n(),lr(null))},[ir]);const sr=Ln(Ht);sr.current=Ht;const dr=Dn((e,{scroll:n})=>{Ao(n=>Eo(e,n)),n&&lr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=sr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Rr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ar=Ln(null);Fn(()=>{const e=ar.current;ar.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);or(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Zt(Wt?.type)??V);const o=Wt?.props.id,r=yo.current;if(yo.current=null,!o)return;const i=Ht(o);dr(String(o),{scroll:!t(r,i??null,Be)})},[Wt?.props.id,dr]);const cr=Dn(e=>{or(n=>H(n,e)?n:e),Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Dt]),pr=Ln(()=>{});pr.current=(e,n)=>{const t=e?Mi(e.zone??Be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);or(e=>H(e,n)?e:n),o!==r&&(ar.current={id:o,mode:n},bo.select(e))};const ur=Dn((e,n)=>pr.current(e,n),[]),fr={kind:tr.kind,mode:tr,open:cr,show:e=>or(e),reveal:()=>{wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:ur},hr=U(fr,{data:Ft.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean(Tt),select:e=>{or(V),bo.select({index:e})},replace:(e,n)=>bo.replaceComponent(Be,e,n),scrollTo:e=>l(e)},{device:Oo,refreshes:Ro},{setView:Ao,reveal:()=>{So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),mr=hr.resolveLeftView?hr.resolveLeftView(Lo):"sections",gr=X(),{isLockedBlock:yr,duplicateBlocked:vr,nestDepth:br,newSectionNode:kr,canAddTo:Sr,blockIsOffered:wr}=gr,xr=e=>({id:String(e.props.id??""),data:Ft?.data}),zr=Y(),{labelAtLevel:Cr,Icon:Br,useProducts:Nr}=zr,Or=zr.rowName?(e,n,t)=>zr.rowName(e,n,t):void 0,Ir=Dn(e=>{Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),dr(e,{scroll:!0})},[Dt,dr]),{selectNode:Pr,openPartId:$r}=g({mode:tr,setMode:or,onOpenPart:Ir}),[Tr,Mr]=Rn(null);me(null!==Tr,()=>Mr(null));const jr=f(J()),Er=jr.collapsed,Lr=jr.panelWidths,[Ar,Rr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Fn(()=>{try{window.localStorage.setItem(Er,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Fr,Dr]=Rn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Lr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Lr,JSON.stringify(Fr))}catch{}},300);return()=>clearTimeout(e)},[Fr]);const Vr=Dn((e,n)=>Dr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Vr("left",e),[Vr]),Hr=Dn(e=>Vr("right",e),[Vr]),Ur=e=>Ar.has(e),Xr=e=>Rr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Jr=Ln(null);Fn(()=>{if(Yr.current&&!Go){const e=Jr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vo.current?.querySelector(`button[aria-label="${CSS.escape(oo.add.title)}"]`))?.focus(),Jr.current=null}Yr.current=Go},[Go]),Fn(()=>{if(!Go||!Uo)return;const e=e=>{"Escape"===e.key&&ul()};return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[Go,Uo]),me(Go,()=>ul()),Fn(()=>{!So&&Go&&(Ko(!1),qo(null),Zo.current=!1)},[So]);const Qr=Q(),Gr=(e,n="success",t)=>{if(Qr)return void(t?Qr(e,"error"===n?"error":"info",t):Qr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Qn.error(e,{...o,duration:t?.duration??3200}):Qn.success(e,{...o,duration:t?.duration??1900})},Kr=Ln(null),[Zr,_r]=Rn(0),[qr,ei]=Rn(0),ni=G(),ti=Ln(null),oi=e=>Math.max(0,e.clientHeight-(ti.current?.offsetHeight??0));Fn(()=>{const e=Kr.current;if(!e)return;const n=()=>{_r(e.clientWidth),ei(oi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ti.current&&t.observe(ti.current),()=>t.disconnect()},[]),Vn(()=>{Kr.current&&(_r(Kr.current.clientWidth),ei(oi(Kr.current)))},[Fr,So,wo]);const ri=Oo===Bo?Zr>0?Zr:zo[Bo]:zo[Oo],ii=Zr>0?Math.min(Zr/ri,"shrink"===No?1:2):1,li=ri*ii,si=Zr>0&&li>Zr+1,di={width:li,height:qr||"100%",flex:"none",position:"relative"},ai={width:ri,height:qr?qr/ii:"100%",maxHeight:"none",transform:1!==ii?`scale(${ii})`:void 0,transformOrigin:"top left"},ci=()=>Dt({type:"setUi",ui:{leftSideBarVisible:!So}}),pi=()=>Dt({type:"setUi",ui:{rightSideBarVisible:!wo}}),ui=e=>{Go&&(Ko(!1),qo(null),Zo.current=!1,So&&Lo===e)||(Ao(e),So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{or(_t??V),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Ft.data.content??[],mi=()=>{const e=hi.findIndex(qt),n=hi.findIndex(eo);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},gi=Ut,yi=gr.stripCopy,vi=e=>o(e,yi),bi=pe(),ki=Ge({data:Ft.data,config:gi,readOnly:Boolean(Tt),clipboard:bi,strip:yi?e=>yi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=mi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&or(V);const t=void 0===n||"node"===n?.kind?n:null;bo.commitDocument(e,t)}}),Si=fe(),[wi,xi]=Rn(null),zi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Xt.shared;n&&t&&ki.swap(e,t.detach(n))},Ci=e=>{const n=jn(Ft.data,Ut,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Be?Pi(o):Xi(o),i=t===Be?Xt.shared?.usedOn(o):null;return!!ki.remove(e)&&(Gr(i?oo.shared.removed({count:Math.max(0,i.length-1)}):oo.deleted({name:r}),"success",{duration:8e3,action:{label:oo.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Bi={...ki,remove:Ci},Ni=e=>Cr(e,"block",Ut.components[e]?.label??e),Oi=Dn(e=>Ut.components[e]?.defaultProps??{},[Ut]),Ii=e=>Cr(e,"section",Ni(e)),Pi=e=>we({type:e.type,props:e.props??{}},Ii(e.type),Or),{nodeAddresses:$i,zoneItems:Ti}=An(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Oe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(Ut,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Be,0),{nodeAddresses:e,zoneItems:n}},[hi,Ut]),Mi=Dn(e=>Ti.get(e)??[],[Ti]),ji=e=>{const n=$i.get(e);return n?Mi(n.zone)[n.index]:void 0},Ei=e=>oe(gr,Ut,e),Li=e=>{if(!gr.slotsOf||e===Be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Ei(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Ai=(()=>{if(!K(tr))return null;const e=`${tr.nodeId}:${tr.slot}`;return Li(e)?.slot.panel===tr.kind?e:null})(),Ri=Ln(null);Fn(()=>{const e=Ri.current;if(Ri.current=null,!Ai||!K(tr))return;const n=tr.nodeId;dr(n,{scroll:e!==Ai}),Rr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[tr]);const Fi=e=>{const n=$i.get(e);n&&(n.zone===Be?il(n.index):Tl(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Di=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Fi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ai!==i&&(Ri.current=i),ur(null,r),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Vi=(e,n,t)=>{const o=`${e}:${n}`;if(Rr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Ai!==o&&(Ri.current=o);ur(null,{kind:t,nodeId:e,slot:n})},Wi=(e,n,t)=>{if(Tt||!gr.moveSlot)return;const o=ji(e),r=o?Ei(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=gr.moveSlot(e,n,s);"string"==typeof d&&Vi(e,d,i.panel)},Hi=Nr(),Ui=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Xi=e=>xe(e,Ni,zr.plainText,e=>Ui.get(e),zr.rowName),Yi=(e,n)=>{const t=Ut.components[e.type]?.fields,o=n===Be||rs(n)?"section":"block",r=n===Be&&(qt(e)||eo(e)||Gt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return zr.renamePropOf?zr.renamePropOf(e,o,i):i},Ji=(e,n,t,o)=>{if(!(!Tt&&Tr?.zone===e&&Tr.index===n))return;const r=(t,o)=>{Mr(null),o&&((e,n,t)=>{const o=Mi(e)[n];if(!o)return;const r=Yi(o,e);r&&bo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":oo.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Qi=i(Z(),co),Gi=Qi.scope({target:On,siteId:_n,docId:Un}),Ki=Ut,Zi=(e,n)=>n===Be?Ii(e):Ni(e),_i=(e,n,t)=>{const o=Qi.plan(Gi,t,Zi(t.type,e),Ki);o&&(o.changed&&bo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Gr(o.message))},qi=ue({nodesIn:Mi,nodeAt:(e,n)=>Mi(e)[n]??null,labelOf:(e,n)=>n===Be?Ii(e):Ni(e),renamePropOf:Yi,beginRename:(e,n)=>Mr({zone:e,index:n}),history:{hasPast:Vt.hasPast,hasFuture:Vt.hasFuture,back:()=>Vt.back(),forward:()=>Vt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:oo.pageStyles,words:{menu:ao,styleClipboard:co,screen:oo.menu},readOnly:Boolean(Tt),collapseAll:()=>Rr(new Set(Mi(Be).map(e=>String(e.props.id)))),onPasteRefused:e=>Gr(e?oo.pasteRefused({name:e.label}):oo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ss(e,n),copyItem:hr.onCopyItem,menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Xt.shared;if(!t||n!==Be)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:oo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Tt||yr(e.type,e)?n:{...n,change:[{label:oo.shared.detach,onClick:()=>zi(e.props.id)}],remove:[{label:oo.shared.removeFromPage,danger:!0,onClick:()=>{Ci(e.props.id)}}]}}return Tt||qt(e)||eo(e)||Gt(e.type)?null:B(Si)?{change:[{label:oo.shared.makeShared,onClick:()=>xi({id:e.props.id,name:Pi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>yr(e.type,e),duplicateBlocked:e=>vr(Ft.data,e),permits:e=>{const n=Ne(Ut,e.type);return Xt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Bi,isPinned:(e,n)=>n===Be&&(qt(e)||eo(e)),sectionBand:mi,locate:e=>$i.get(e)??null,rowNameOf:(e,n)=>n===Be?Pi(e):Xi(e),selectAt:(e,n,t,o)=>{e===Be?il(n):Tl(e,n,t,o??"")},slotRung:e=>{const n=Li(e);return n?.slot.panel?{label:n.slot.label,select:()=>Di(n.node,n.slot,!1)}:null},style:{held:()=>be(Gi),canCopy:e=>Qi.rows(Ki,e).some(e=>!1!==e.counted),copy:(e,n)=>Qi.copy(Gi,e,Zi(e.type,n),Ki),paste:(e,n,t)=>_i(e,n,t)},keys:Et?{target:Uo,selected:()=>{const e=Ft.ui.itemSelector;return e?{zone:e.zone??Be,index:e.index}:null},held:()=>bi.get(),readOnly:Boolean(Tt),onDone:({done:e,name:n})=>{"copied"===e&&Gr(oo.copied({name:n}))}}:void 0},Wo),el=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{el.current={copy:(e,n)=>Qi.copy(Gi,e,Zi(e.type,n),Ki),paste:_i,at:()=>{const e=Ft.ui.itemSelector;if(!e)return null;const n=e.zone??Be,t=Mi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Tt)}});const nl=Dn(e=>{const n=ke(e);if(!n)return;const t=el.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Fn(()=>{if(!Uo)return;const e=e=>nl(e);return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[nl,Uo]),zn(Wo,"keydown",nl);const tl=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void nr(e=>e.length?[]:e);const n=hi.findIndex(eo),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:In(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!qt(hi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=St(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}nr(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,tl,Oo,ii,So,wo,Wt?.props.id]);const ol=Wo?.document??null,rl=Wo?.window??null;Fn(()=>{const e=Do.current;if(!e||!ol||!rl)return;const n=[],t=()=>{const n=In(ol,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&rl.scrollTo({left:rl.scrollX,top:rl.scrollY+t,behavior:"instant"}),!0};return Do.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ol,rl]);const il=e=>{or(V),bo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},ll=e=>{const{floor:n,cap:t}=mi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&tr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},sl=(e,n)=>{const{floor:t,cap:o}=mi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(bo.reorderComponent(Be,e,i),bo.select({index:i}),{moved:!0,dest:i})},dl=(e,n,t,o)=>{or(V),bo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Gr(oo.sectionAdded({name:t}))},al=(e,n)=>{const t=ll(n),o=kr(e,{nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr}),r=o?bo.insertNode(Be,t,o):bo.insertSection(e,t);return dl(t,r,Ii(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(Ut,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Sr(e.type,l,d.slice(d.lastIndexOf(":")+1),xr(e)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},cl=e=>pl(Be,e),pl=(e,n)=>{Jr.current=document.activeElement??null,qo(null===n?null:{zone:e,index:n}),Ko(!0),So||(Zo.current=!0,Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ul=()=>{Ko(!1),qo(null),Zo.current&&Dt({type:"setUi",ui:{leftSideBarVisible:!1}}),Zo.current=!1},fl=(e,n)=>zr.rowName?n?qt(e)?zr.rowName(e,"section",oo.header):eo(e)?zr.rowName(e,"section",oo.footer):Gt(e.type)?zr.rowName(e,"section",Ni(e.type)):Pi(e):Xi(e):n?Ii(e.type):Ni(e.type),hl=e=>n=>{e()},ml=(e,n,t)=>{if(Tt)return null;const o=Mi(e)[n];return o&&!Ne(Ut,o.type).delete||o&&yr(o.type,o)?null:/* @__PURE__ */pt(Ue,{kind:"delete",label:e===Be&&o&&Xt.shared?.usedOn(o)?oo.shared.removeFromPage:oo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Mi(e)[n]?.props?.id;null!=t&&Ci(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},gl=e=>zr.rowPreview?.(e)||void 0,yl=e=>zr.rowMarks?.(e)??void 0,vl=(e,n,t)=>zr.rowActions?.(e,n,t)??null,bl=(e,n,t,o)=>{if(Tt)return null;if(yr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return pt(Ue,{kind:"eye",label:r?oo.showNamed({name:o}):oo.hideNamed({name:o}),onClick:()=>Sl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},kl=e=>nd(Be,e),Sl=(e,n,t)=>{bo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},wl=e=>Pe(Ut,e),xl=e=>Ie(Ut,e),zl=e=>gr.slotsOf?Ei(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Te(e,n.slot)})):[{slot:null,rung:null,kids:re(Ut,e)}],Cl=e=>gr.slotsOf?zl(e).flatMap(e=>e.kids):re(Ut,e),Bl=e=>Boolean(gr.slotsOf)&&Ei(e).some(e=>e.rung),Nl=(e,n,t)=>Sr(e.type,n,t??void 0,xr(e)),Ol=(e,n,t)=>{const o=Me(Ut,e.type,n)&&(t||Cl(e).length>0||Bl(e));return{collapsible:o,folded:o&&Ur(String(e.props.id))}},Il=(e,n,t)=>zl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ol(e,r,t(e.type)).collapsible?[String(e.props.id),...Il(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Pl=e=>Cl(e).length>0||Bl(e)||Boolean(Sr(e.type)),$l=e=>Boolean(Sr(e)),Tl=(e,n,t,o)=>{if(or(V),Sr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),bo.select({index:n,zone:e}),l(t)}else bo.select({index:n,zone:e}),l(t)},Ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;bo.insertComponent(i,t,o),Sr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),bo.select({index:o,zone:i})}):bo.select({index:o,zone:i})},jl=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=Sr(e.type)?.spec;if(!n)return;const t=e.props.id;if(jl.current.has(t))return;jl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Oi)).forEach((e,t)=>go.seedChild(o,t,n.childType,e))})},[hi,go,Oi]);const El=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((e,n)=>{const t=e.props.id;if(El.current.has(t))return;const o=r(e,wl(e.type));El.current.add(t),o&&go.replaceComponent(Be,n,{...e,props:o})})},[hi,go]),_(go,Ut);const Ll=hi.findIndex(eo),Al=Ll>=0?hi[Ll]:null,Rl=no?hi.findIndex(qt):-1,Fl=Rl>=0?hi[Rl]:null,Dl=Xt.groupTab,Vl=An(()=>Dl?e=>Gt(e.type):void 0,[Dl]),Wl=Boolean(Xt.groupBadge),Hl=Xt.sharedReach,Ul=e=>Hl?.(e)??void 0,Xl=An(()=>Hl?new Set(hi.filter(e=>Ul(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Yl=An(()=>Xl?e=>Xl.has(e):void 0,[Xl]),Jl=Xt.first?Hl?.({type:Xt.first,props:{id:""}})??void 0:void 0,Ql=Xt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Xn,{tone:"info",size:"xs",children:Xt.groupBadge})}):void 0,Gl=hi.find(e=>e.type===Jt)??null,Kl=hi.find(e=>e.type===Qt)??null,Zl=Ll>=0?Ll:hi.length,_l=[];hi.forEach(e=>{eo(e)||(Pl(e)&&_l.push(String(e.props.id)),_l.push(...Il(e,1,$l)))}),Al&&(_l.push(String(Al.props.id)),_l.push(...Il(Al,1,$l)));const ql=_l.length>0&&_l.every(e=>Ar.has(e)),es=e=>{const n=zr.blockRowName(e,Ni);return zr.rowName?zr.rowName(e,"block",n):n},ns=(e,n,t,o)=>{const r=Mi(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),Mi(n).length)},s=bn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof En))throw e}},ts=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of xl(e))n.add(r),t(o)};for(const t of wl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},os=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=$i.get(n);if(!e)return null;if(e.zone===Be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Gt(e.type)&&String(e.props.id)===n);return t&&Kt(n)===e?t:null},is=(e,n)=>{const t=rs(e);return!t||(!Xt.groupAccepts||Xt.groupAccepts(t.type,n,Mi(e).length))},ls=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Ei(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return cs(e.add,n);const o=Tn(n);if(Gt(e.type))return!1;const r=rs(o),i=rs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!is(o,e.type))&&(n.index>=0&&n.index<=Mi(o).length));if(e.zone===Be||o===Be){if(e.zone!==o)return!1;const{floor:t,cap:r}=mi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Mi(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Xt.lastIsOpen?String(Al.props.id):null;return(!l||os(e.zone)!==l&&os(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Mi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=$i.get(i),s=l?Mi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ts(r).has(n))return!1;const d=Sr(s.type,br(Ft?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),xr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Mi(n),r))})(e.zone,o,e.index,t)},ss=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(n)?is(t,o.type):ls({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=$i.get(n),o=t?Mi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Sr(o.type,br(Ft?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),xr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:Ni(r.spec.childType)}]:[])),l=Li(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:fl(o,t.zone===Be)}},as=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Be||rs(t)?e:ds(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},cs=(e,n)=>{const t=as(e,n),o=Tn(n);if("shared"===t.kind){if(o!==Be||!Xt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(rs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return is(o,e)&&n.index>=0&&n.index<=Mi(o).length}if(o!==Be)return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if(o===Be)return!1;const r=ds(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Mi(o))},ps=(e,n)=>{const t=as(e,n);if("block"!==t.kind&&rs(Tn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&is(n,o)){if("section"===e.kind)bo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;bo.insertNode(n,t,vi(e.template.node))}or(V),bo.select({index:t,zone:n})}})(t,Tn(n),n.index);if("section"===t.kind)return void al(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ll(t),r=bo.insertNode(Be,o,n);dl(o,r,e)})(t.template.name,vi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr});if(!o)return;const r=ll(t),i=bo.insertNode(Be,r,o);dl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Xt.shared?.nodeOf(t.section);if(!e)return;const o=ll(n.index);return void(ki.restore(e,{parentId:Pn,slot:$n,index:o})&&dl(o,e.props.id,t.section.title))}const o=Tn(n),r=ds(o);r&&(r.target.spec?Ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{bo.insertComponent(e,n,t),or(V),bo.select({index:t,zone:e})})(o,t.type,n.index))},us=(e,n)=>{e.media?function(e){const n=Ks();if(!n||!Js)return;_s(n).then(n=>{n&&function(e,n){if(!Js)return;const t=Js.create(e,{nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr}),o=Tn(n);if(o===Be){const e=ll(n.index),o=bo.insertNode(Be,e,t);return void dl(e,o,Ii(t.type))}bo.insertNode(o,n.index,t),or(V),bo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Wi(e.rung.nodeId,e.index,n.index):e.add?ps(e.add,n):e.zone===Be?sl(e.index,n.index):ns(e.zone,Tn(n),e.index,n.index)},[fs]=Rn(()=>yn()),hs=vn({keyOf:e=>e.id,readOnly:Boolean(Tt),session:fs,canDrop:ls,onDrop:us,onStep:(e,n)=>{e.rung?Wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Be?((e,n)=>{const t=Ii(hi[e]?.type??""),o=sl(e,n<0?e-1:e+2);if(!o.moved)return void Gr(n<0?oo.sectionFirst({name:t}):oo.sectionLast({name:t}));const{floor:r,cap:i}=mi();Gr(oo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ns(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ms=Dn(e=>{const{floor:n,cap:t}=mi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=Mi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qt(i)||eo(i)||yr(i.type,i))continue;if(Gt(i.type))continue;const l=Boolean(rs(e)),s=e===Be||l;e===Be&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ii(i.type):Xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Tn(e.list);if(n===Be&&0===e.children.length)return[{...e,addLabel:oo.addSection,addAlways:!0}];const t=ds(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(rs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Tn(e.list),t=n===Be||rs(n)?null:ds(n);return t?.choices.length?fn(e,t.target.spec?.addLabel??oo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ft.data]),gs=null==Wt?.props.id?null:String(Wt.props.id),ys=Wn(Le),vs=ys?.selected()&&Wo?.document&&gs?ys.selectedPart?.(Wo.document)??null:null,bs=vs&&gs&&Ae(Ft.data,Ut,gs,vs)?vs:null,ks=bs?.label?{element:bs.element,label:bs.label}:null,Ss=null!==bs,ws=Dn(e=>{const n=Ut,t=e=>!e.item.rung&&null!==jn(Ft.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(gs);return i?Ss?null:i:r(Ke(Ft.data,n,o.item.id,gs,Vl))??o},[Ft.data,Ut,gs,Vl,Ss]),[xs,zs]=Rn(null),[Cs,Bs]=Rn(null),Ns=zr.canvasTab,Os=Boolean(Dl||Hl||Ns);zn(Wo,"mouseover",e=>{if(!Os)return;const n=Cn(e.target),t=n?yt(Ft.data,Ut,n):null;t!==xs&&zs(t),Ns&&n!==Cs&&Bs(n)}),zn(Wo,"mouseout",e=>{Os&&!e.relatedTarget&&(zs(null),Bs(null))});const Is=e=>qt(e)||eo(e)||Gt(e.type),Ps=e=>{const n=Gt(e.type)?Ni(e.type):qt(e)?oo.header:eo(e)?oo.footer:null;return null===n?Pi(e):zr.rowName?zr.rowName(e,"section",n):n},$s=[];if(Os){const e=gs?yt(Ft.data,Ut,gs):null;for(const n of/* @__PURE__ */new Set([e,xs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=qt(e)||e.type===Jt,o=Ul(e);if(o){$s.push({id:String(e.props.id),label:Ps(e),below:t,reach:o});continue}if(!Dl||!Is(e))continue;const r=Dl(e);r&&$s.push({id:String(e.props.id),label:r,below:t})}for(const e of Ns?/* @__PURE__ */new Set([gs,Cs]):[]){const n=e?ji(e):void 0,t=n?Ns(n):null;t&&!$s.some(n=>n.id===e)&&$s.push({id:e,label:t,below:!1,above:!0})}}const Ts=fe(),Ms=Ln(null);Fn(()=>{const e=Xt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(Is)),t=Ms.current;if(Ms.current={doc:Un,bands:n,index:Vt.index},!t||t.doc!==Un||t.bands===n)return;Vt.hasPast&&Vt.index>=t.index&&!gt.has(Ts)&&(gt.add(Ts),Gr(e,"success",{action:{label:oo.bar.undo,onClick:()=>Vt.back()},duration:8e3}))},[hi]);const js=e=>{or(V),bo.select(e.zone===Be?{index:e.index}:{index:e.index,zone:e.zone})},Es=q(),Ls=()=>({data:Ft.data,device:Oo,ops:bo,inspector:fr}),As=Es?.model,Rs=An(()=>As?e=>As(e,ms(e),Ls()):ms,[As,ms,Oo]),Fs=Es?.measure,Ds=Fs?(e,n)=>Fs(e,n,Ls()):void 0,Vs=Es?.canDrop,Ws=Vs?(e,n)=>Vs(e,n,ls,Ls()):ls,Hs=Es?.drop,Us=Hs?(e,n)=>Hs(e,n,us,Ls()):us,Xs=Es?.pick,Ys=Xs?e=>Xs(e,js,Ls()):js,Js=Es?.media??null,Qs=Ln(null),Gs=An(()=>Js?{id:ht,zone:"",index:-1,type:Js.adds.type,add:{kind:Js.adds.kind,type:Js.adds.type},media:!0}:null,[Js]);Fn(()=>{if(!Gs||Tt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Qs.current=null,fs.start({key:ht,item:Gs}))},n=e=>{fs.get()?.item.media&&(Qs.current=Gn(e.dataTransfer))},t=()=>{fs.get()?.item.media&&fs.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Gs,Tt,fs]);const Ks=()=>{const e=Qs.current;return Qs.current=null,e},Zs=ce(),_s=async e=>{if(!Zs)return e;const n=await Zs(e);return n?{...e,id:n.id,url:n.url}:null};const qs=(e,n)=>{if(!Js)return;const t=jn(vo.getState().appState.data,gi,n);if(!t)return;const o=t.node;bo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Js.replace(o,e),id:o.props.id}})},ed=e=>{const n=Tn(e),t=Li(n);t&&Di(t.node,t.slot,!1),pl(n,e.index)},nd=(e,n)=>/* @__PURE__ */pt(Xe,{...Tt?{}:hs.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),td={rowClick:hl,isCollapsed:Ur,toggleCollapse:Xr},od=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Kt(n),r=Mi(o),i=Ur(n),l=Ni(e.type),s=zr.rowName?zr.rowName(e,"section",l):l,d=e=>nd(o,e);/* @__PURE__ */
|
|
16
|
+
return ut(ft,{children:[
|
|
17
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:e.type,size:13}),name:s,preview:gl(e),marks:yl(e),onSelect:()=>il(t),nameSlot:Ji(Be,t,n,s),selected:rr===n,badge:Ul(e)?void 0:Ql,shared:Ul(e),actions:vl(e,Be,t)??void 0,rowProps:{"data-node-id":n,onClick:hl(()=>il(t))},fold:{open:!i,label:"section",onToggle:()=>Xr(n)}}),!i&&/* @__PURE__ */ut(Ve,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Pi(n),l=Pl(n),s=l&&Ur(r),a=()=>Tl(o,t,r,e.type),{rowProps:c,...p}=hs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:hl(a)});/* @__PURE__ */
|
|
18
|
+
return ut(Hn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:a,nameSlot:Ji(o,t,r,i),selected:rr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Xr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(o,t,i),vl(n,o,t),bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ve,{children:ld(n,2)})]},r)}),d(r.length)]})]})},rd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=hs.dragging,d=!Ur(l)&&s?.rung?.nodeId!==i,a={...Mn(l),index:0},c=s&&!s.rung&&ls(s,a)?a:void 0,p=()=>Di(e,n,!0),{rowProps:u,...f}=hs.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(gr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:hl(p)}),h=Tt?null:gr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return ut(Hn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */pt(De,{words:ro,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Xr(l)},actions:h&&h.length>0?/* @__PURE__ */pt(ft,{children:h.map((t,o)=>/* @__PURE__ */pt(Ue,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Tt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ve,{children:r})]},l)},id=(e,n)=>{const t=zl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return pt(ft,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Nl(e,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>nd(e,n),p=/* @__PURE__ */ut(ft,{children:[i.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),{collapsible:i,folded:s}=Ol(n,l,$l(n.type)),d=String(n.props.id),a=es(n),p=()=>Tl(t,o,d,e.type),{rowProps:u,...f}=hs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:hl(p)});/* @__PURE__ */
|
|
23
|
+
return ut(Hn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:a,preview:gl(n),marks:yl(n),onSelect:p,nameSlot:Ji(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Xr(d)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(t,o,a),vl(n,t,o),bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ve,{children:id(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?rd(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ld=(e,n)=>{const t=br(Ft?.data,e.type,String(e.props.id)),o=zl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return pt(ft,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Nl(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>nd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ut(ft,{children:[l.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),i=Xi(n),l=String(n.props.id),{collapsible:d,folded:a}=Ol(n,s,$l(n.type)),c=wl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:Mi(p).length}:void 0,f=hs.dragging,h=u&&f&&ls(f,u)?u:void 0,g=()=>Tl(t,o,l,e.type),{rowProps:y,...v}=hs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Mn(t),index:o},into:h,canDrag:!yr(n.type,n)},{"data-node-id":l,onClick:hl(g)});/* @__PURE__ */
|
|
26
|
+
return ut(Hn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:g,nameSlot:Ji(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Xr(l)}:void 0,actions:yr(n.type,n)?vl(n,t,o)??void 0:/* @__PURE__ */ut(ft,{children:[ml(t,o,i),vl(n,t,o),bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ve,{children:ld(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */pt(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ml(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?rd(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},sd=Go,dd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:So&&!sd&&mr===e.id,onSelect:()=>ui(e.id)}:e,ad=[...(hr.railLead??[]).map(dd),{id:"sections",label:oo.layers,icon:/* @__PURE__ */pt(ge,{}),active:So&&!sd&&"sections"===mr,onSelect:()=>ui("sections")},...(hr.railTrail??[]).map(dd)],cd=$o?{onPress:To}:Lt?{onPress:()=>{x(Sn,{accept:"image/*",title:po.mediaLibrary})}}:null,pd={value:ad.find(e=>!0===e.active)?.id??"",press:e=>{const n=ad.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ad.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ud=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===mr),fd=Boolean(to?.foldable),hd=to?.label??(At?oo.pageSections:oo.templateSections),md=fd&&Ur(zt),gd=/* @__PURE__ */ut(ft,{children:[hi.map((e,n)=>{if(qt(e)||eo(e)||Gt(e.type))return null;const t=rr===String(e.props.id),o=Boolean(e.props._hidden);xl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Pl(e)||i,s=l&&Ur(r),d=wl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:Mi(a).length}:void 0,p=hs.dragging,u=c&&p&&ls(p,c)?c:void 0,{rowProps:f,...h}=hs.row({item:{id:r,zone:Be,index:n,type:e.type},place:{...Mn(Be),index:n},into:u,canDrag:!yr(e.type,e)},{"data-node-id":r,onClick:hl(()=>il(n))});/* @__PURE__ */
|
|
29
|
+
return ut(Hn,{children:[n>0&&kl(n),
|
|
30
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:e.type,size:13}),name:Pi(e),preview:gl(e),marks:yl(e),shared:Ul(e),onSelect:()=>il(n),nameSlot:Ji(Be,n,r,Pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Xr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(Be,n,Pi(e)),vl(e,Be,n),bl(Be,n,e,Pi(e))]}),rowProps:f}),Pl(e)&&!s&&/* @__PURE__ */ut(Ve,{children:[ld(e,1),hr.partRows?.(e,td)]}),i&&!s&&/* @__PURE__ */pt(Ve,{children:hr.ownRows?.(e,n,td)})]},String(e.props.id??n))}),Zl>0&&kl(Zl)]}),yd=(e,n,t)=>{const o=String(e.props.id),r=Cl(e).length>0||Bl(e)||Boolean(Sr(e.type)),i=r&&Ur(o),l="header"===t?oo.header:oo.footer,s=zr.rowName?zr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return ut(ft,{children:[
|
|
32
|
+
/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:t,size:13}),name:s,preview:gl(e),marks:yl(e),badge:Ul(e)?void 0:Ql,shared:Ul(e),onSelect:()=>il(n),nameSlot:Ji(Be,n,o,s),selected:rr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Xr(o)}:void 0,actions:vl(e,Be,n)??void 0,rowProps:{"data-node-id":o,onClick:hl(()=>il(n))}}),r&&!i&&/* @__PURE__ */pt(Ve,{children:id(e,1)})]})};return(hr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */pt(ee,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Vo,className:"sf-editor es-editor",style:ln(Fr),onContextMenu:qi.onEditorContextMenu,...p(Sn),children:[
|
|
34
|
+
/* @__PURE__ */ut(Ze,{children:[
|
|
35
|
+
/* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[cd?/* @__PURE__ */pt(Yn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:cd.onPress,children:oo.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.undo,disabled:Boolean(Tt)||!Vt.hasPast,onClick:()=>Vt.back(),children:/* @__PURE__ */pt(tt,{})}),
|
|
37
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.redo,disabled:Boolean(Tt)||!Vt.hasFuture,onClick:()=>Vt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
|
|
38
|
+
/* @__PURE__ */ut(qe,{children:[
|
|
39
|
+
/* @__PURE__ */pt(en,{devices:xo,value:Oo,onChange:Io}),
|
|
40
|
+
/* @__PURE__ */pt(_e,{label:oo.bar.refresh,tip:oo.bar.refreshTip,onClick:()=>{Do.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(eo),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=In(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Fo(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */pt(b,{input:Jo,words:oo.saveStatus}),Bn?/* @__PURE__ */pt(Bn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(k,{input:Jo,action:hr.mainAction??{label:oo.done,onPress:()=>{qn(Ft.data)}},readOnly:Boolean(Tt),saveSwitch:jt,onToggleAutoSave:Ot,onSaveNow:Qo,bar:oo.bar,words:oo.saveStatus}):hr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */pt(v,{}),
|
|
44
|
+
/* @__PURE__ */ut("div",{className:"sf-body",children:[So?/* @__PURE__ */ut(ft,{children:[
|
|
45
|
+
/* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":oo.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */pt(O,{side:"left",onHide:ci}),
|
|
48
|
+
/* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */pt(Jn,{variant:"underline",block:!0,"aria-label":oo.bar.views,value:pd.value,onChange:pd.press,items:pd.items})]}),Go?/* @__PURE__ */pt(C,{at:_o?{label:(e=>{const n=rs(e.zone);if(n)return oo.add.addingTo({name:zr.rowName?fl(n,!0):Ni(n.type)});if(e.zone===Be){const n=hi[e.index];return n&&!eo(n)?oo.add.addingBefore({name:fl(n,!0)}):oo.add.addingAtEnd}const t=ds(e.zone);return t?oo.add.addingTo({name:t.parentName}):oo.add.addingHere})(_o),onClear:()=>qo(null)}:void 0,placeBlocks:_o&&_o.zone!==Be?ds(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(cs(e,n))return null;if("shared"===e.kind&&_o.zone===Be&&!Xt.shared?.nodeOf(e.section))return oo.shared.alreadyHere;const t=rs(_o.zone);if(t)return oo.add.notInside({name:fl(t,!0)});if(_o.zone===Be)return oo.add.onlySections;const o=ds(_o.zone);return o?oo.add.notInside({name:o.parentName}):oo.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.index};cs(e,n)&&(ps(e,n),ul())}:void 0,itemFor:e=>({id:`new:${e.kind}:${xt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:xt(e),add:e}),session:fs,siteWide:hr.addPanelRow?.(ul),onClose:ul,readOnly:Boolean(Tt)}):ud?ud.panel({onHide:ci,notify:Gr}):/* @__PURE__ */ut(ft,{children:[
|
|
50
|
+
/* @__PURE__ */pt(I,{icon:/* @__PURE__ */pt(ge,{}),title:oo.layers,context:uo,actions:/* @__PURE__ */ut(ft,{children:[!Tt&&/* @__PURE__ */pt(nn,{label:oo.add.title,onClick:()=>cl(null),children:/* @__PURE__ */pt(it,{size:15})}),
|
|
51
|
+
/* @__PURE__ */pt(nn,{label:ql?oo.expandAll:oo.collapseAll,title:0===_l.length?oo.nothingToFold:void 0,disabled:0===_l.length,onClick:()=>Rr(e=>{const n=new Set(_l);return ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,..._l])}),children:/* @__PURE__ */pt(bt,{expand:ql})})]})}),
|
|
52
|
+
/* @__PURE__ */ut(We,{className:"sf-tree sf-scroll",words:ro,children:[Gl&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),od(Gl)]}),Rt&&!(Wl&&Gl)&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),!no&&/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:"header",size:13}),name:oo.header,badge:Jl?void 0:Ql,shared:Jl,onSelect:fi,selected:tr.kind===_t?.kind,rowProps:{onClick:hl(fi)}})]}),Fl&&!(Wl&&Gl)&&yd(Fl,Rl,"header"),!fd&&/* @__PURE__ */pt(He,{children:hd}),fd?/* @__PURE__ */ut(ft,{children:[
|
|
53
|
+
/* @__PURE__ */pt(De,{words:ro,icon:null,name:hd,fold:{open:!md,label:hd,onToggle:()=>Xr(zt)}}),!md&&/* @__PURE__ */pt(Ve,{children:gd})]}):gd,Rt&&!Wl&&/* @__PURE__ */pt(He,{children:oo.footer}),Al&&!(Wl&&Kl)&&yd(Al,Ll,"footer"),Kl&&od(Kl),hr.treeFoot?.()]})]})]}),
|
|
54
|
+
/* @__PURE__ */pt(tn,{side:"left",width:Fr.left,min:rn.left,max:on,defaultWidth:h.left,label:oo.resizeLeftPanel,onResize:Wr})]}):/* @__PURE__ */pt(P,{side:"left",onShow:ci}),
|
|
55
|
+
/* @__PURE__ */ut("div",{ref:Kr,className:"sf-center sf-scroll","data-sf-canvas-head":ni?"":void 0,style:{overflowX:si?"auto":"hidden",overflowY:"hidden"},children:[ni&&/* @__PURE__ */pt("div",{ref:ti,className:"sf-canvas-head",children:/* @__PURE__ */pt(ni,{device:Oo})}),
|
|
56
|
+
/* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:di,children:[
|
|
57
|
+
/* @__PURE__ */pt("div",{className:"sf-frame "+(Oo===Bo?"":`sf-frame--${Oo}`),style:ai,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
|
|
58
|
+
/* @__PURE__ */pt(Re.Provider,{value:Vl,children:/* @__PURE__ */pt(Fe.Provider,{value:Yl,children:/* @__PURE__ */pt(fo,{},Ro)})}),
|
|
59
|
+
/* @__PURE__ */pt(hn,{canvas:Wo,session:fs,model:Rs,measure:Ds,canDrop:Ws,onDrop:Us,choose:ws,tag:ks,onPick:Ys,dropOn:Js?{accepts:(e,n)=>{if(!e.media||!Js||n.item.rung)return!1;const t=jn(Ft.data,gi,n.item.id);return null!==t&&Js.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ks();n&&Js&&_s(n).then(n=>{n&&qs(n,e.item.id)})})(n),label:()=>oo.canvasReplaceImage}:void 0,onZoneAdd:ed,onSeamAdd:ed,zoneAddLabel:oo.canvasAddBlock,words:io.canvas,readOnly:Boolean(Tt),revision:Ft.data}),er.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:er.map(e=>
|
|
60
|
+
/* @__PURE__ */pt(mn,{index:e.index,label:oo.addSectionHere,onInsert:()=>cl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),Os?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:$s,onSelect:Fi}):null]})]}),wo?/* @__PURE__ */ut(ft,{children:[Nn?
|
|
61
|
+
/* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Nn}):/* @__PURE__ */pt(ft,{children:/* @__PURE__ */pt(u,{value:{selectChild:Tl,addChild:Ml,childRowName:Xi,blockRowName:es},children:/* @__PURE__ */pt(ho,{mode:tr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Pr,onNotify:Gr,onHidePanel:pi,nodeActions:Wt?Ne(Ut,Wt.type):Ct})})}),
|
|
62
|
+
/* @__PURE__ */pt(tn,{side:"right",width:Fr.right,min:rn.right,max:on,defaultWidth:h.right,label:oo.resizeSettingsPanel,onResize:Hr})]}):
|
|
63
|
+
/* @__PURE__ */pt(P,{side:"right",onShow:pi})]}),qi.menu,
|
|
64
|
+
/* @__PURE__ */pt(ie,{}),wi?/* @__PURE__ */pt(mt,{name:wi.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Xt.shared;if(!t||!o)return;let r;try{r=await N(Si).create(n,t)}catch{return void Gr(oo.shared.makeFailed,"error")}o.adopt(t,r),xi(null)})(wi.id,e),onCancel:()=>xi(null)}):null]})}))}export{Nt as ScreenChrome};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mediaPickStoreFor as e}from"./chunk-NCXYC7WI.js";import{newId as t}from"./chunk-EUFDQ4KL.js";var o=/* @__PURE__ */new Map;function i(i,n){if(!i.connected)return Promise.resolve(null);const r=t("mp"),c=e(i);return c?c.request({requestId:r,accept:n.accept,title:n.title,file:n.file??null,...n.options?{options:n.options}:{}}):new Promise(e=>{o.set(r,e),i.send("storefront-editor:open-media-picker",{requestId:r,accept:n.accept,title:n.title,...n.file?{file:n.file}:{}})})}function n(e,t){const i=o.get(e);i&&(o.delete(e),i(t))}export{i as requestMediaPick,n as resolveMediaPick};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{repeatWrapperAt as t,REPEAT_ATTRIBUTE as e,REPEAT_INDEX_ATTRIBUTE as r}from"./chunk-7UFKEX72.js";import{parseZoneKey as n}from"./chunk-EUFDQ4KL.js";var o=`[${e}][${r}]`;function l(l){const c=t(l);if(!c)return null;let i;try{i=n(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(e)===p&&d.add(t.getAttribute(r)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const n of Array.from(t.querySelectorAll(o))){if(n.getAttribute(r)!==String(e.index))continue;const t=l(n);if(t?.wrapper===n&&c(t.copy,e))return n}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{changedProps as e}from"./chunk-
|
|
1
|
+
import{changedProps as e}from"./chunk-EUFDQ4KL.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-LUHGBFOD.js";import{useEaselHost as e}from"./chunk-LX23TCTP.js";import{createEasel as r,EaselProvider as o}from"./chunk-BBD3FLU3.js";import{useState as n,useEffect as s}from"react";import{jsx as a}from"react/jsx-runtime";function i({config:i,data:c,onChange:m,permissions:p,parts:f,children:u}){const[d]=n(()=>r({config:i,data:c,permissions:p}));s(()=>{d.setConfig(i)},[d,i]),s(()=>{if(!m)return;let t=d.getState().appState.data,e=!1;return d.subscribe(()=>{const r=d.getState().appState.data;r!==t&&(t=r,(e||r!==d.loaded)&&(e=!0,m(r)))})},[d,m]),s(()=>{p&&d.setPermissions(p)},[d,p]);const h=e();/* @__PURE__ */
|
|
2
2
|
return a(o,{easel:d,hotkeys:h.ownsDocument,children:/* @__PURE__ */a(t,{parts:f,children:u})})}export{i as ScreenStoreProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-
|
|
1
|
+
import{readHostFailure as e,isBackendError as n,STATUS_UNREACHABLE as s}from"./chunk-KCOBHPN6.js";import{EDIT_LOCK_TAKEN as t}from"./chunk-YYD257TD.js";var a="page_changed_elsewhere",d={unauthorized:401,"changed-elsewhere":409,"lock-taken":409,"not-found":404,invalid:400,unavailable:s};function o(s,o){const c=e(s,o);if(c)return{status:c.status,data:c.data};if(!n(s))return null;const u=e(s.cause,o);if(u)return{status:u.status,data:u.data};const r=d[s.kind];return"changed-elsewhere"===s.kind?{status:r,data:{code:a,saved_by:s.conflict?.savedBy??"",saved_by_you:!0===s.conflict?.savedByYou,seconds_ago:s.conflict?.secondsAgo??0}}:"lock-taken"===s.kind?{status:r,data:{code:t,holder_name:s.holder?.name??"",seconds_since_seen:s.holder?.secondsSinceSeen??0,seconds_since_held:s.holder?.secondsSinceHeld??0}}:{status:r,data:null}}function c(e,n){return 401===o(e,n)?.status}export{a as PAGE_CONFLICT_CODE,c as isExpiredSession,o as readEaselFailure};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{SettingsDefaultReset as e,sidesStartEach as n,SidesInput as t,SidesEachToggle as o}from"./chunk-SC6E3UUS.js";import{deviceField as l}from"./chunk-OXOUGEAT.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as u}from"./chunk-CWELHADJ.js";import{phoneKey as s}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useEasel as p,useSelectedHost as f,useEaselApi as m}from"./chunk-BBD3FLU3.js";import{DEFAULT_PANEL_WORDS as b}from"./chunk-KFV7N2DJ.js";import{SettingsSwitch as h}from"./chunk-OECWLNKJ.js";import{FieldSelect as g}from"./chunk-KFWNGPW3.js";import{SettingsField as v}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as y}from"./chunk-DX3VILZ3.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{useState as C}from"react";import{AlignmentIcon as w,BoxJustifyIcon as x,WrapIcon as j,GapIcon as F,WidthIcon as L,PlacementIcon as O,NudgeIcon as S,DesktopIcon as E,BoxXEndIcon as P,BoxXCenterIcon as I,BoxXStartIcon as B,PaddingAllIcon as A,BoxYBetweenIcon as K,BoxYStretchIcon as W,BoxYEndIcon as M,BoxYCenterIcon as N,BoxYStartIcon as G,BoxXBetweenIcon as R,BoxXStretchIcon as T,BoxItemAlignmentIcon as V}from"efficient-shell/icons/efficient";import{Slider as D,textAlignOptions as $,AlignmentGrid as J,PositionInput as U}from"efficient-shell/ui";import{jsx as X,Fragment as _,jsxs as z}from"react/jsx-runtime";var Y=e=>e;function H(){return null}function Z(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
|
|
2
|
+
return X(H,{},e)}function q(e){return e.type===H}function Q(e){return q(e)?void 0:e}function ee(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&u(t,`section:${n}`);return e}function ne(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */X(_,{})}}function te(e){return ne(e,2)}function oe(e){return ne(e,1)}var le=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ae=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],ie="Wrap",re=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ue="Direction",se=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],ce={min:-32,max:64,step:2,builtIn:0},de={min:30,max:100,step:5,fallback:60},pe=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],fe="bottom-left",me={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},be=pe.map(e=>({value:e,label:me[e]}));function he(e,n=fe){return pe.includes(e)?e:n}var ge=40,ve=e=>"number"==typeof e?e:null;function ye(e,n,t){const o={};for(const l of["x","y"])t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}var ke=["top","right","bottom","left"],Ce={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},we=e=>"number"==typeof e?e:null;function xe(e,n,t){const o={};for(const l of ke)t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}function je(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(ke.map(e=>[e,we(n[e])]))}function Fe(e){const n={};for(const t of ke)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}var Le={fieldKey:s,ownField:!0,read:(e,n)=>e[s(n)],write:(e,n,t)=>({[s(n)]:t})};function Oe(e){const n=n=>{const t=n[e];return t&&"object"==typeof t?t:{}};return{fieldKey:n=>`_${e}_${n}`,read:(e,t)=>n(e)[t],write:(t,o,l)=>{const a={...n(t)};return void 0===l?delete a[o]:a[o]=l,{[e]:Object.keys(a).length?a:void 0}}}}function Se({row:e,desktopKey:n,access:t,props:o}){const l=f(),a=function(){try{return m()}catch{return null}}(),i=l?.values??{},r=i[n];if(t.ownField)return e.render({...o,follows:r});const u=t.read(i,n);return e.render({...o,value:u,storedValue:u,follows:r,onChange:e=>{if(!l)return;const o=a?.getState(),r=o?"root"===l.id?o.appState.data.root.props:o.getItemById(l.id)?.props:void 0;l.onChangeMany(t.write(r??i,n,e))}})}function Ee(e,n,t=Le){const o={...n,render:o=>/* @__PURE__ */X(Se,{row:n,desktopKey:e,access:t,props:o})};return{[e]:l("desktop",n),[t.fieldKey(e)]:l("mobile",o)}}var Pe=["left","center","right"];function Ie(e,{options:n,value:t,onChange:o,ariaLabel:l,disabled:a=!1}){/* @__PURE__ */
|
|
3
|
+
return X(y,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:o,ariaLabel:e(l),disabled:a})}function Be(e,{label:n,value:t,onChange:o,points:l}){const a=l.find(e=>e.disabled),i=l.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
|
|
4
|
+
return X(v,{label:e(n),icon:/* @__PURE__ */X(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */X(J,{label:e(n),value:t,points:i,onChange:o})})}function Ae({say:e,label:n,value:t,onChange:o,pointsFor:l}){const{appState:a,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return Be(e,{label:n,value:t,onChange:o,points:l(a?.data,r)})}function Ke({say:n,o:t}){const o=f(),l=k("panel",b),a=o?.values??{},i={x:ve(a[t.keys.x]),y:ve(a[t.keys.y])},r=n(t.label??"Position"),u=Boolean(i.x||i.y),s=e=>{const n=ye(t.keys,i,e);Object.keys(n).length&&o?.onChangeMany(n)},c=/* @__PURE__ */X(U,{label:r,value:i,onChange:s,words:{x:n("Left and right"),y:n("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:t.min,max:t.max,step:t.step??1}),d=/* @__PURE__ */X(e,{words:l,label:r,changed:u,detail:"0 px, 0 px",onReset:()=>s({x:null,y:null})});return null===t.label?/* @__PURE__ */z("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */X(v,{label:r,icon:/* @__PURE__ */X(S,{}),changed:u,action:d,children:c})}var We={x:{start:/* @__PURE__ */X(B,{}),center:/* @__PURE__ */X(I,{}),end:/* @__PURE__ */X(P,{}),stretch:/* @__PURE__ */X(T,{}),between:/* @__PURE__ */X(R,{})},y:{start:/* @__PURE__ */X(G,{}),center:/* @__PURE__ */X(N,{}),end:/* @__PURE__ */X(M,{}),stretch:/* @__PURE__ */X(W,{}),between:/* @__PURE__ */X(K,{})}},Me=e=>"row"===e?"row":"column";function Ne({say:e,kind:n,label:t,options:o,value:l,onChange:a,o:i}){const r=f(),u="justify"===n==("row"===(i.runs??Me)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Ie(e,{options:o.map(e=>({label:e.label,value:e.value,picture:We[u][e.value]})),value:l,onChange:a,ariaLabel:t})}function Ge({say:e,tier:n,o:t}){const o=f(),l=o?.values??{},a="mobile"===n?t.phoneKeys:t.keys,i=Object.fromEntries(ke.map(e=>[e,we(l[a[e]])])),r="mobile"===n?Object.fromEntries(ke.map(e=>[e,we(l[t.keys[e]])])):null;/* @__PURE__ */
|
|
5
|
+
return X(Te,{say:e,o:t,value:i,follows:r,onChange:e=>{const n=xe(a,i,e);Object.keys(n).length&&o?.onChangeMany(n)}})}function Re({say:e,o:n,props:t}){/* @__PURE__ */
|
|
6
|
+
return X(Te,{say:e,o:n,value:je(t.value),follows:"follows"in t?je(t.follows):null,readOnly:t.readOnly,onChange:e=>t.onChange(Fe(e))})}function Te({say:e,o:l,value:a,follows:i,readOnly:r,onChange:u}){const s=Object.fromEntries(ke.map(e=>[e,String(i?.[e]??l.fallback[e])])),[c,d]=C(()=>n(a,s));/* @__PURE__ */
|
|
7
|
+
return X(v,{label:e("Padding"),icon:/* @__PURE__ */X(A,{}),action:/* @__PURE__ */X(o,{each:c,label:e("Each side"),onChange:d,disabled:r}),children:/* @__PURE__ */X(t,{label:e("Padding"),each:c,value:a,placeholder:s,min:l.min,max:l.max,step:l.step,readOnly:r,onChange:u,words:{sides:{top:e("Padding top"),right:e("Padding right"),bottom:e("Padding bottom"),left:e("Padding left")},vertical:e("Top and bottom"),horizontal:e("Left and right"),unit:"px"}})})}function Ve(n=Y){function t(t,o,l,a,i,u,s="",c){const d="function"==typeof c?{action:c}:c??{},{action:p,clear:f}=d;return{type:"custom",...r({},{type:"number",label:t}),render:r=>{const c="storedValue"in r?r.storedValue:r.value,m="follows"in r,b=m||void 0!==f,h="number"==typeof r.value,g=m&&"number"==typeof r.follows?r.follows:void 0===f?u:"function"==typeof f.hint?f.hint(r):f.hint,y=h?r.value:b?null:u,k=""===s||"px"===s?s:` ${s}`,C=!f?.emptyLabel||m&&"number"==typeof r.follows?void 0:f.emptyLabel,w=C??`${g}${k}`,x=m?n("{value} on desktop").replace("{value}",w):w,j=!0===r.readOnly;/* @__PURE__ */
|
|
8
|
+
return X(v,{label:n(t),icon:Q(o),action:b?/* @__PURE__ */X(e,{label:n(t),changed:h,detail:x,disabled:j,onReset:()=>r.onChange(void 0)}):p?p(c,r.onChange):void 0,children:/* @__PURE__ */X("div",{className:"sf-slider",children:/* @__PURE__ */X(D,{min:l,max:a,step:i,value:y,suffix:s||void 0,showInput:!0,label:n(t),disabled:j,...b?{placeholderValue:g}:{},...C?{emptyLabel:C}:{},...void 0!==d.inputMax?{inputMax:d.inputMax}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?b&&h&&r.onChange(void 0):e!==y&&r.onChange(e)}})})})}}}function o(e){return Ie(n,e)}function u(e,t,l,a){const i=l.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:e,options:i.map(e=>({value:e.value,label:e.label}))}),render:({value:l,onChange:r,field:u})=>/* @__PURE__ */X(v,{label:n(e),icon:Q(t),children:o({options:i,value:i.some(e=>e.value===l)?l:l||u?.currentValue||a,onChange:r,ariaLabel:e})})}}function c(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */X(E,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function d(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function p(e,n,t){return{[e]:l("desktop",n(t)),[s(e)]:l("mobile",n({...t,phone:!0},""))}}function f(e){return c($(e.allow??Pe).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function m(e={},n=e.fallback??"left"){return d(u(e.label??"Text alignment",/* @__PURE__ */X(w,{}),f(e),n),e)}function b(e){const n={left:We.x.start,center:We.x.center,right:We.x.end};return c($((e.allow??Pe).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function y(e={},n=e.fallback??"left"){return d(u(e.label??"Block alignment",/* @__PURE__ */X(x,{}),b(e),n),e)}function k(e,t,o,l,a,i){return{type:"custom",options:l,fallback:a,...r({},{type:"radio",label:t,options:l.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:u,field:s})=>{const c=s.options??l,d=s.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
|
|
9
|
+
return X(v,{label:n(t),icon:Q(o),children:/* @__PURE__ */X(Ne,{say:n,kind:e,label:t,options:c,value:p,onChange:u,o:i})})}}}function C(e={}){return k("justify","Justify",/* @__PURE__ */X(x,{}),le,le[0].value,e)}function O(e={}){return k("align","Item alignment",/* @__PURE__ */X(V,{}),ae,"stretch",e)}function S(){const e=ie;return{type:"custom",options:re,fallback:re[1].value,...r({},{type:"radio",label:e,options:re.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:o,id:l,name:a})=>{const i=`${l??a??e}-label`;/* @__PURE__ */
|
|
10
|
+
return X(v,{label:n(e),labelId:i,icon:/* @__PURE__ */X(j,{}),action:/* @__PURE__ */X(h,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>o(e?re[0].value:re[1].value),ariaLabelledBy:i})});var r}}}function P({offered:e,fallback:n,resolve:t}){const o=t??(t=>e.some(e=>e.value===t)?t:n),l=u(ue,Z("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),o(void 0));return{type:"custom",render:e=>l.render({...e,value:o(e.value),onChange:n=>e.onChange(n)})}}function I({min:e,max:n,step:o,builtIn:l,resolve:a,action:i,mark:r}){const u=t("Gap",/* @__PURE__ */X(F,{}),e,n,o,l,"px",i),s=a??(e=>"number"==typeof e?e:l);return{...r,type:"custom",render:e=>u.render({...e,value:s(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function B(e,{fallback:t=fe,pointsFor:o}={}){return{type:"custom",render:({value:l,onChange:a})=>{const i=he(l,t);return o?/* @__PURE__ */X(Ae,{say:n,label:e,value:i,onChange:a,pointsFor:o}):Be(n,{label:e,value:i,onChange:a,points:be})}}}function A(e){return{[e.keys.x]:{type:"custom",render:()=>/* @__PURE__ */X(Ke,{say:n,o:e})},[e.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),reachedBy:e.keys.x}}}function K(e={}){const t={...Ce,...e.keys},o={keys:t,phoneKeys:Object.fromEntries(ke.map(e=>[e,s(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...e.fallback},min:e.min??0,max:e.max??200,step:e.step??4},r=!1!==e.phone,u=!1===e.group?{}:{_gSpacing:te("Padding")};if(e.object){const t={type:"custom",render:e=>/* @__PURE__ */X(Re,{say:n,o:o,props:e})};return ee({...u,...r?Ee(e.object.key,t,e.object.phone):{[e.object.key]:t}})}const c=e=>{const t={type:"custom",render:()=>/* @__PURE__ */X(Ge,{say:n,tier:e,o:o})};return r?l(e,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),p=ke.filter(e=>"top"!==e);return ee({...u,[o.keys.top]:c("desktop"),...r?{[o.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[o.keys[e],{...d(),reachedBy:o.keys.top}])),...r?Object.fromEntries(p.map(e=>[o.phoneKeys[e],l("mobile",d())])):{}})}return{slider:t,select:function(e,t,o,l,a){return{type:"custom",options:o,fallback:l,...a?{note:a}:{},...r({},{type:"select",label:e}),render:({value:i,onChange:r,field:u})=>{const s=u.options??o,c=u.fallback??l,d=s.some(e=>e.value===i)?i:c;/* @__PURE__ */
|
|
11
|
+
return X(v,{label:n(e),icon:Q(t),children:/* @__PURE__ */X(g,{value:d,ariaLabel:n(e),onChange:r,options:[...a?[{label:n(a),value:"\0note",disabled:!0}]:[],...s.map(e=>({label:n(e.label),value:e.value}))]})})}}},Segmented:o,segmented:u,boxJustifyField:C,boxAlignField:O,boxWrapField:S,directionField:P,gapField:I,placementField:B,PlacementGridView:function(e){return Be(n,e)},positionFields:A,sidesPaddingFields:K,alignmentField:m,alignmentFields:function(e="align",n={}){return p(e,m,n)},AlignmentStrip:function({opts:e={},value:n,onChange:t,ariaLabel:l,disabled:a=!1}){return o({options:f(e),value:n,onChange:t,ariaLabel:l,disabled:a})},blockAlignmentField:y,blockAlignmentFields:function(e="align",n={}){return p(e,y,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:t,ariaLabel:l,disabled:a=!1}){return o({options:b(e),value:n,onChange:t,ariaLabel:l,disabled:a})},boxFieldSet:function(e={}){const n=e.width??de,o=e.nudge?.limit??40,l=e.direction??{offered:se,fallback:"column"},a=l.resolve??(e=>l.offered.some(n=>n.value===e)?e:l.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:te("Layout"),placement:B("Placement",e.placement),width:t("Width",/* @__PURE__ */X(L,{}),n.min,n.max,n.step,n.fallback,"%"),direction:P(l),gap:I(e.gap??ce),justify:C(i),align:O(i),wrap:S(),_gNudge:te("Nudge"),...A({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-o,max:o,label:null}),...K(e.padding)}}}}var{slider:De,select:$e,Segmented:Je,segmented:Ue,boxJustifyField:Xe,boxAlignField:_e,boxWrapField:ze,directionField:Ye,gapField:He,placementField:Ze,PlacementGridView:qe,positionFields:Qe,sidesPaddingFields:en,alignmentField:nn,alignmentFields:tn,AlignmentStrip:on,blockAlignmentField:ln,blockAlignmentFields:an,BlockAlignmentStrip:rn,boxFieldSet:un}=Ve();export{me as ANCHOR_LABELS,on as AlignmentStrip,ae as BOX_ALIGN_POINTS,se as BOX_DIRECTIONS,ue as BOX_DIRECTION_LABEL,ce as BOX_GAP,le as BOX_JUSTIFY_POINTS,ge as BOX_NUDGE_LIMIT,pe as BOX_PLACEMENTS,fe as BOX_PLACEMENT_DEFAULT,de as BOX_WIDTH,ie as BOX_WRAP_LABEL,re as BOX_WRAP_POINTS,rn as BlockAlignmentStrip,be as OPEN_PLACEMENT_POINTS,Le as PHONE_KEY_ACCESS,qe as PlacementGridView,Ce as SIDE_PAD_KEYS,Je as Segmented,nn as alignmentField,tn as alignmentFields,ln as blockAlignmentField,an as blockAlignmentFields,_e as boxAlignField,Ve as boxFieldBuilders,un as boxFieldSet,Xe as boxJustifyField,ze as boxWrapField,Ye as directionField,He as gapField,te as group,Q as iconOf,q as isNoGlyph,Z as noGlyph,he as normaliseBoxPlacement,Oe as phoneObjectAccess,Ee as phoneTwinFields,Ze as placementField,Qe as positionFields,ye as positionPatch,oe as section,Ue as segmented,$e as select,ee as sharedStyleKinds,je as sidesFromObject,en as sidesPaddingFields,xe as sidesPaddingPatch,Fe as sidesToObject,De as slider};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-
|
|
1
|
+
import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-BBD3FLU3.js";import{Inspector as i}from"./chunk-U3LTJSBU.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",L=()=>null,S=()=>{},w={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},B={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},C={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},N={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
|
|
2
2
|
return f(r,{height:"fill"})}function F(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
|
|
3
3
|
return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var I=l({});function T({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return f(I.Provider,{value:n,children:e})}function x(){return s(I)}function A(){return(x().useOwnerName??j)()}function G(){return(x().useDocumentLabel??
|
|
5
|
-
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return x().Inspector??F}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,T as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,
|
|
4
|
+
return f(I.Provider,{value:n,children:e})}function x(){return s(I)}function A(){return(x().useOwnerName??j)()}function G(){return(x().useDocumentLabel??L)()}function U(n,e,t,r){return(x().useBridges??O)(n,e,t,r)}function Y(n){return(x().useStandaloneBridges??O)(n)}function Q(n,e){(x().useDocumentPass??S)(n,e)}function R(){return x().blockRules??w}function V(){return x().blockLook??B}function X(){return x().devices??C}function E(){return x().leftView??D}function H(){return x().pinned??N}function J(){return x().saveSwitch??!0}function K(e){n(!0===x().pickFollowsSelection,e)}function M(){return x().storageNamespace||void 0}function W(){return x().styleClipboard??null}function Z(){return x().nodeKeys??!0}function q(){return x().notify??null}function z(){return x().Canvas??P}function $(){return x().CanvasHead??null}function _(){return x().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return x().Inspector??F}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,T as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,V as useScreenBlockLook,R as useScreenBlockRules,U as useScreenBridges,_ as useScreenCanvasDrag,z as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,X as useScreenDevices,G as useScreenDocumentLabel,Q as useScreenDocumentPass,rn as useScreenInspectorPanel,E as useScreenLeftView,Z as useScreenNodeKeys,q as useScreenNotify,A as useScreenOwnerName,x as useScreenParts,K as useScreenPickFollowsSelection,H as useScreenPinned,J as useScreenSaveSwitch,M as useScreenStorageNamespace,W as useScreenStyleClipboard,Y as useStandaloneScreenBridges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-
|
|
1
|
+
import{HERO_SLIDER_GOTO_EVENT as t}from"./chunk-AJ2SUSET.js";import{queryMainCopy as e}from"./chunk-7UFKEX72.js";import{isPreviewClick as n}from"./chunk-MGVI67QV.js";var o=()=>document.querySelector(".sf-editor #preview-frame");function r(t){n()||requestAnimationFrame(()=>{const n=o()?.contentDocument;n&&e(n,`[data-easel-block="${CSS.escape(t)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function c(e,n){const r=o()?.contentWindow;if(!r)return;const c={id:e,index:n};r.dispatchEvent(new CustomEvent(t,{detail:c}))}function i(){requestAnimationFrame(()=>{o()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function s(t,{passes:e=[150,400],onPinned:n}={}){let r=0,c=!1;const i=[],s=()=>{const r=o(),l=r?.contentWindow,u=r?.contentDocument;if(!l||!u)return!1;const a=t(l,u);if(null==a)return!1;if(l.scrollTo({left:l.scrollX,top:a,behavior:"instant"}),!c){c=!0,n?.();for(const t of e)i.push(setTimeout(s,t))}return!0},l=()=>{!s()&&r++<150&&i.push(setTimeout(l,32))};return l(),()=>i.forEach(clearTimeout)}function l(t){return s((n,o)=>{const r=e(o,`[data-easel-block="${CSS.escape(t)}"]`);return r?n.scrollY+r.getBoundingClientRect().top:null})}function u(t){return s((t,e)=>{if(!e.querySelector("[data-easel-block]"))return null;const n=Math.max(e.documentElement.scrollHeight,e.body?.scrollHeight??0);return n<=e.documentElement.clientHeight?null:n},{passes:[150,400,800,1300,2e3],onPinned:t})}export{c as gotoPreviewSlide,u as pinPreviewToBottom,l as pinPreviewToSection,o as previewFrame,r as scrollPreviewToSection,i as scrollPreviewToTop};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{SettingRow as e}from"efficient-shell/ui";import{jsx as a}from"react/jsx-runtime";function l({label:l,labelId:c,icon:i,value:o,hint:t,changed:n,htmlFor:r,action:m,children:d,className:s}){/* @__PURE__ */
|
|
2
|
+
return a(e,{size:"compact",label:l,labelId:c,icon:i,readout:o,description:t,changed:n,controlId:r,action:m,value:d,className:s})}export{l as SettingsField};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-22I55W37.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-
|
|
1
|
+
import{noControlField as e}from"./chunk-22I55W37.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-S6YOIRXQ.js";import{deviceMetaOf as n,DEVICE_FIELD_MARKER as t}from"./chunk-YCSZAP7T.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{usePreviewDevice as i}from"./chunk-BSPCSC45.js";import{jsx as c}from"react/jsx-runtime";function u(e){return"mobile"===e?"mobile":"desktop"}var s={desktop:null,tablet:r.deviceNote.tablet,mobile:r.deviceNote.mobile},d="data-sf-device-hidden";function m(){/* @__PURE__ */
|
|
2
2
|
return c("span",{hidden:!0,[d]:""})}function f({tier:e,render:r,...n}){const t=i();return"each"===e?/* @__PURE__ */c(r,{...n,tier:u(t)}):u(t)===e?/* @__PURE__ */c(r,{...n}):/* @__PURE__ */c(m,{})}function l(e){return n(e)?.inner??e}function p(e,r){const n=r.render;return{...r,[t]:{tier:e,inner:r},render:r=>/* @__PURE__ */c(f,{tier:e,render:n,...r})}}function a(){const e=o("screen",r).deviceNote,n=i(),t="desktop"===n?null:e[n];return t?/* @__PURE__ */c("div",{className:"sf-device-scope",children:t}):/* @__PURE__ */c(m,{})}function h(){return e({type:"custom",render:()=>/* @__PURE__ */c(a,{})},"always")}export{d as DEVICE_HIDDEN_ATTR,s as DEVICE_NOTE,p as deviceField,h as deviceNote,u as shownTier,l as withoutDeviceGate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Text alignment",marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-
|
|
1
|
+
import{useNow as e,describeSave as t}from"./chunk-RKTF5XLP.js";import{SaveIcon as a}from"./chunk-VBEVZZTV.js";import{SplitButton as l,Kbd as i,CMD_S as n}from"efficient-shell/ui";import{CloudIcon as s,CheckIcon as o}from"efficient-shell/icons/efficient";import{jsx as r,jsxs as d}from"react/jsx-runtime";var c=e=>e.state.failed&&null!=e.state.retryAt||null!=e.state.savedAt;function u({input:l,words:i}){const n=e(c(l)),s=t({...l,now:n},i);/* @__PURE__ */
|
|
2
2
|
return r(a,{state:s.state,label:s.label})}function m({input:a,action:u,readOnly:m,saveSwitch:y,onToggleAutoSave:b,onSaveNow:p,bar:v,words:f}){const k=e(c(a)),h=t({...a,now:k},f),w=h.retry?v.retry:v.saveNow,g=/* @__PURE__ */d("span",{className:"es-savemenu-row",children:[w,
|
|
3
3
|
/* @__PURE__ */r("span",{"aria-hidden":"true",children:/* @__PURE__ */r(i,{keys:n,size:"sm"})})]}),S=[{type:"status",key:"status",label:h.line(u.status)},...(u.goingLive??[]).map((e,t)=>({type:"status",key:`going-live-${t}`,label:e})),{type:"divider",key:"divider"},...y?[{type:"checkbox",key:"auto-save",label:v.autoSave,checked:!a.state.paused,disabled:m,onSelect:b}]:[],{key:"save-now",label:g,icon:/* @__PURE__ */r(s,{}),disabled:m,onSelect:p},...u.menuItems?.length?[{type:"divider",key:"layer-divider"},...u.menuItems.map(e=>({key:`layer-${e.key}`,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onSelect}))]:[]],j=u.quiet??null,x=h.blocked??u.disabledReason??j?.reason??null;/* @__PURE__ */
|
|
4
4
|
return r(l,{variant:j?"secondary":"primary",leftIcon:j?/* @__PURE__ */r(o,{}):void 0,onClick:()=>u.onPress(),disabled:null!==x,disabledReason:x??void 0,tooltip:u.tooltip,loading:!0===u.busy,menuLabel:v.saveOptions,items:S,menuMinWidth:300,children:j?j.label:u.label})}export{m as ScreenMainButton,u as ScreenSaveIcon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-
|
|
1
|
+
import{find as n,remove as t,getList as e,newId as r,duplicate as o,move as l,copyNode as a,insert as c,setProps as i,slotsOf as d}from"./chunk-EUFDQ4KL.js";import{useRef as s,useSyncExternalStore as p,useCallback as u,useMemo as f}from"react";var m=n=>({kind:"node",id:n});function x(r,o,l,a="none"){const c=n(r,o,l),i=t(r,o,l);if("none"===a||!c)return{data:i,select:null};const d=e(r,o,c.place)??[],s=d[c.place.index+1]??d[c.place.index-1];return s?.props?.id?{data:i,select:m(s.props.id)}:"root"!==c.place.parentId?{data:i,select:m(c.place.parentId)}:{data:i,select:null}}function g(t,e,l,a={}){const c=n(t,e,l)?.node,i=a.id??r(c?.type??"Node");return{data:o(t,e,l,{strip:a.strip,id:i}),select:m(i)}}function I(n,t,e,r){return{data:l(n,t,e,r),select:m(e)}}var h=(n,t)=>({min:0,max:t-1});function v(t,r,o,l,a=h){const c=n(t,r,o);if(!c)return!1;const i=e(t,r,c.place)?.length??0,{min:d,max:s}=a(c.place,i),p=c.place.index+l;return c.place.index>=d&&c.place.index<=s&&p>=d&&p<=s}function b(t,e,r,o,l=h){if(!v(t,e,r,o,l))return null;const a=n(t,e,r);return I(t,e,r,{...a.place,index:a.place.index+o})}function k(n,t,e,r,o={}){const l=a(e,t,{strip:o.strip});return{data:c(n,t,r,l),select:m(l.props.id)}}function y(t,r,o,l){if(n(t,r,o.props.id))return null;const a=e(t,r,l)??[],i={...l,index:Math.max(0,Math.min(l.index,a.length))};return{data:c(t,r,i,o),select:m(o.props.id)}}function O(e,r,o,l){const a=n(e,r,o);return a?l.props.id!==o&&n(e,r,l.props.id)?null:{data:c(t(e,r,o),r,a.place,l),select:m(l.props.id)}:null}function z(n,t,e,r){return{data:i(n,t,e,r),select:void 0}}function M(t,e,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return n(t,e,r.parentId)?m(r.parentId):null;const l=n(t,e,r.id);if(!l||"root"===l.place.parentId)return null;const a=n(t,e,l.place.parentId);return a?o(a.node,l.place.slot)?{kind:"slot",parentId:a.node.props.id,slot:l.place.slot}:m(a.node.props.id):null}function B(t,e,r,o){const l=n(t,e,r);if(!l)return[];const a=l.path.filter(n=>"root"!==n.parentId).map(n=>n.parentId);return o?[...a.filter(r=>{const l=n(t,e,r);return!l||!o(l.node)}),r]:[...a,r]}function L(n,t){if(0===n.length)return null;const e=null===t?-1:n.indexOf(t);return-1===e?n[0]:n[Math.min(e+1,n.length-1)]}function R(t,e,r,o,l){const a=n(t,e,r);return a?0===d(a.node,e).length?r:L(B(t,e,r,l),o):null}function $(t,e,r,o,l,a,c){const i=n(t,e,r);if(!i)return null;if(0===d(i.node,e).length)return{node:r,part:o};const s="\0part:"+o,p=L([...B(t,e,r,c),s],l===r&&a===o?s:l);return p===s?{node:r,part:o}:{node:p??r,part:null}}function j(t,e,r){if(!r||"node"!==r.kind)return null;const o=n(t,e,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function w(n,t,r){if(!r)return null;const[o,l]=(r.zone??"root:default-zone").split(/:(.*)/s),a={parentId:o,slot:l},c=e(n,t,a)?.[r.index];return c?.props?.id?m(c.props.id):null}var D={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function E(t){const e=s(t);e.current=t;const r=t.clipboard??D,o=p(r.subscribe,r.get,r.get),l=u(n=>{const t=e.current;if(t.readOnly)return!1;const r=n(t.data,t.config);return!!r&&((r.data!==t.data||void 0!==r.select)&&(t.commit(r.data,{select:r.select}),e.current={...t,data:r.data},!0))},[]);return f(()=>{const t=()=>e.current,r=(e,r)=>{const o=n(t().data,t().config,e);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:n=>l((e,r)=>x(e,r,n,t().afterRemove)),duplicate:n=>l((e,r)=>g(e,r,n,{strip:t().strip})),move:(n,t)=>l((e,r)=>I(e,r,n,t)),step:(n,e)=>l((r,o)=>b(r,o,n,e,t().stepBounds)),canStep:(n,e)=>v(t().data,t().config,n,e,t().stepBounds),setProps:(n,t)=>l((e,r)=>z(e,r,n,t)),copy:(n,e)=>{const o=r(n,e);return o&&(t().clipboard??D).set(o),!!o},cut:(n,e)=>{if(t().readOnly)return!1;const o=r(n,e);return!!o&&((t().clipboard??D).set(o),l((e,r)=>x(e,r,n,t().afterRemove)))},paste:n=>{const e=(t().clipboard??D).get();return!!e&&l((r,o)=>k(r,o,e.node,n,{strip:t().strip}))},restore:(n,t)=>l((e,r)=>y(e,r,n,t)),swap:(n,t)=>l((e,r)=>O(e,r,n,t)),parentOf:n=>M(t().data,t().config,n,t().slotIsLevel)}},[o,l])}export{v as canStep,R as clickPick,$ as clickPickPart,w as fromItemSelector,L as nextInChain,B as nodeChain,M as parentStep,g as planDuplicate,I as planMove,k as planPaste,x as planRemove,y as planRestore,z as planSetProps,b as planStep,O as planSwap,j as toItemSelector,E as useNodeOps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveMediaPick as e}from"./chunk-
|
|
1
|
+
import{resolveMediaPick as e}from"./chunk-JIP5JNRB.js";function t(t){const r=t;switch(r?.type){case"storefront-editor:media-picked":{const r=t;return r.requestId&&e(r.requestId,r.media??null),!0}case"storefront-editor:media-pick-cancelled":{const r=t;return r.requestId&&e(r.requestId,null),!0}default:return!1}}export{t as routeSharedHostMessage};
|