@joryio/web-sdk 1.4.0-beta.5 → 1.4.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/page-edits.d.ts +1 -1
- package/dist/core/page-edits.d.ts.map +1 -1
- package/dist/core/sdk-host-files.d.ts +1 -1
- package/dist/core/sdk-host-files.d.ts.map +1 -1
- package/dist/editor/editor-model.d.ts +21 -0
- package/dist/editor/editor-model.d.ts.map +1 -0
- package/dist/editor/editor-strings.d.ts +89 -0
- package/dist/editor/editor-strings.d.ts.map +1 -0
- package/dist/editor/editor-ui.d.ts +26 -0
- package/dist/editor/editor-ui.d.ts.map +1 -0
- package/dist/editor/liquid-field.d.ts +22 -0
- package/dist/editor/liquid-field.d.ts.map +1 -0
- package/dist/editor/visual-editor.d.ts +65 -8
- package/dist/editor/visual-editor.d.ts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/joryio-cards-ui.min.js +1 -1
- package/dist/joryio-editor.min.js +2 -2
- package/dist/joryio-editor.min.js.map +1 -1
- package/dist/joryio-sw.js +1 -1
- package/dist/joryio.cjs.js +48 -31
- package/dist/joryio.min.js +2 -2
- package/dist/joryio.min.js.map +1 -1
- package/dist/joryio.mjs +48 -31
- package/dist/joryio.umd.js +48 -31
- package/package.json +1 -1
- package/src/core/config.ts +1 -1
- package/src/core/page-edits.ts +43 -22
- package/src/core/sdk-host-files.ts +15 -10
- package/src/editor/editor-model.ts +153 -0
- package/src/editor/editor-strings.ts +112 -0
- package/src/editor/editor-ui.ts +173 -0
- package/src/editor/liquid-field.ts +301 -0
- package/src/editor/visual-editor.ts +1032 -105
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Joryio Web SDK v1.4.0-beta.
|
|
2
|
+
* Joryio Web SDK v1.4.0-beta.7
|
|
3
3
|
* (c) 2026 Joryio. All rights reserved.
|
|
4
4
|
* @license Commercial - see https://github.com/joryio/joryio-web-sdk/blob/main/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
!function(){"use strict";function t(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e||e.length>500)return!1;if(/[{};<@]/.test(e)||e.includes("/*")||e.includes("*/"))return!1;if(/[\u0000-\u001f\u007f]/.test(e))return!1;try{"undefined"!=typeof document&&document.createDocumentFragment().querySelector(e)}catch(t){return!1}return!0}const e=/\/joryio(?:\.umd)?(?:\.min)?\.js$/;function i(t){if(!t||"string"!=typeof t)return null;let i;try{i=new URL(t)}catch(t){return null}return"https:"===i.protocol&&e.test(i.pathname)?`${i.origin}${i.pathname.replace(/[^/]*$/,"")}`:null}!function(){if("undefined"==typeof document)return null;try{const t=document.currentScript,e=i(t&&t.src);if(e||t&&t.src)return e;const n=document.querySelectorAll("script[src]");for(let t=n.length-1;t>=0;t--){const e=i(n[t].src);if(e)return e}}catch(t){}}();const n="__joryioEditor",o=["data-joryio-id","data-testid","data-test","data-qa","data-cy","data-id","name"],r=/^[a-z0-9][a-z0-9_]{0,63}$/,s=(t,e,i)=>{try{const n=t.querySelectorAll(e);return 1===n.length&&n[0]===i}catch(t){return!1}};class c{constructor(t,e,i,n=()=>{}){this.dashboardOrigin=t,this.opener=e,this.logger=i,this.onStop=n,this.listeners=[],this.highlight=null,this.panel=null,this.selected=null,this.active=!1}start(){if(this.active)return;this.active=!0;const t=t=>{const e=t.data;e&&"string"==typeof e.type&&t.origin===this.dashboardOrigin&&t.source===this.opener&&"joryio:editor-close"===e.type&&this.stop()};window.addEventListener("message",t),this.listeners.push(()=>window.removeEventListener("message",t)),this.activate()}isActive(){return this.active}stop(){var t,e;if(this.active){this.send({type:"joryio:editor-closed"}),this.active=!1;for(const t of this.listeners.splice(0))t();null===(t=this.highlight)||void 0===t||t.remove(),null===(e=this.panel)||void 0===e||e.remove(),this.highlight=this.panel=null,this.selected=null;try{this.onStop()}catch(t){this.logger.debug("Joryio editor stop callback failed",t)}}}send(t){if(this.active)try{this.opener.postMessage(t,this.dashboardOrigin)}catch(t){}}activate(){const t=document,e=t.createElement("div");e.setAttribute("data-joryio-editor","highlight"),e.style.cssText="position:fixed;pointer-events:none;z-index:2147483646;border:2px solid #14b8a6;background:rgba(20,184,166,.12);border-radius:3px;display:none";const i=t.createElement("div");i.setAttribute("data-joryio-editor","panel"),i.style.cssText="position:fixed;left:16px;right:16px;bottom:16px;z-index:2147483647;max-width:560px;margin:0 auto;background:#0f172a;color:#fff;font:14px/1.4 system-ui,sans-serif;padding:12px 14px;border-radius:10px;box-shadow:0 8px 30px rgba(0,0,0,.3)",i.textContent="Joryio editor - click an element on the page. Esc to finish.",t.body.appendChild(e),t.body.appendChild(i),this.highlight=e,this.panel=i;const n=t=>t instanceof Element&&!!t.closest("[data-joryio-editor]"),o=t=>{this.selected||n(t.target)||this.outline(t.target instanceof Element?t.target:null)},r=t=>{n(t.target)||(t.preventDefault(),t.stopPropagation(),t.target instanceof Element&&this.select(t.target))},s=t=>{"Escape"===t.key&&(this.selected?this.unselect():this.stop())};t.addEventListener("mousemove",o,!0),t.addEventListener("click",r,!0),t.addEventListener("keydown",s,!0),this.listeners.push(()=>t.removeEventListener("mousemove",o,!0),()=>t.removeEventListener("click",r,!0),()=>t.removeEventListener("keydown",s,!0)),this.send({type:"joryio:editor-active",url:`${location.origin}${location.pathname}`})}outline(t){if(!this.highlight)return;if(!t||t===document.body||t===document.documentElement)return void(this.highlight.style.display="none");const e=t.getBoundingClientRect();Object.assign(this.highlight.style,{display:"block",top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`})}unselect(){this.selected=null,this.panel&&(this.panel.textContent="Joryio editor - click an element on the page. Esc to finish.")}select(e){const i=function(e){const i=e.ownerDocument;if(!i)return null;const n=t=>{if((e=t.id)&&e.length<=64&&!/\d{4,}/.test(e)&&!/^(ember|react|radix|headlessui|mui)[-_:]/i.test(e)&&!/:/.test(e)){const e=`#${function(t){const e=globalThis.CSS;if(e&&"function"==typeof e.escape)return e.escape(t);let i="";for(let e=0;e<t.length;e++){const n=t[e],o=t.charCodeAt(e);0===o?i+="�":/[0-9]/.test(n)&&(0===e||1===e&&"-"===t[0])?i+=`\\${o.toString(16)} `:/[A-Za-z0-9_-]/.test(n)||o>=128?i+=n:i+=`\\${n}`}return i}(t.id)}`;if(s(i,e,t))return e}var e;for(const e of o){const n=t.getAttribute(e);if(!n||n.length>100)continue;const o=`${t.tagName.toLowerCase()}[${e}="${n.replace(/["\\]/g,"\\$&")}"]`;if(s(i,o,t))return o}return null},r=n(e);if(r)return t(r)?r:null;const c=[];let a=e;for(;a&&a!==i.body&&a!==i.documentElement;){const t=c.length?n(a):null;if(t){c.unshift(t);break}const e=a.tagName.toLowerCase(),o=a.parentElement,r=o?Array.from(o.children).filter(t=>t.tagName===a.tagName):[];c.unshift(r.length>1?`${e}:nth-of-type(${r.indexOf(a)+1})`:e),a=o,a===i.body&&c.unshift("body")}const l=c.join(" > ");return l&&t(l)&&s(i,l,e)?l:null}(e);if(!this.panel)return;if(!i)return void(this.panel.textContent="This element has no stable selector. Choose its parent or another element.");this.selected=e,this.outline(e);const n=this.panel;n.textContent="";const r=(t,e=!1)=>{const i=document.createElement("div");i.textContent=t,e&&(i.style.cssText="font-family:ui-monospace,monospace;font-size:12px;opacity:.8;word-break:break-all;margin:4px 0 8px"),n.appendChild(i)};r(`<${e.tagName.toLowerCase()}> ${(e.textContent||"").trim().slice(0,60)}`),r(i,!0);const c=document.createElement("input");c.setAttribute("data-joryio-editor","value"),c.style.cssText="width:100%;box-sizing:border-box;padding:6px 8px;border-radius:6px;border:0;margin-bottom:8px;color:#0f172a",c.placeholder="New text, https:// address or placement key",n.appendChild(c);const a=document.createElement("div");a.style.cssText="display:flex;flex-wrap:wrap;gap:6px";const l={replace_text:"Replace text",replace_image:"Replace image",replace_link:"Replace link",hide:"Hide",insert_placement:"Insert placement after"};for(const t of function(t){const e=[];return"IMG"!==t.tagName&&(t.textContent||"").trim()&&e.push("replace_text"),"IMG"===t.tagName&&e.push("replace_image"),"A"===t.tagName&&e.push("replace_link"),e.push("hide","insert_placement"),e}(e)){const n=document.createElement("button");n.type="button",n.textContent=l[t],n.setAttribute("data-joryio-op",t),n.style.cssText="padding:6px 10px;border-radius:6px;border:0;background:#14b8a6;color:#fff;cursor:pointer",n.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this.pick(e,i,t,c.value.trim())}),a.appendChild(n)}n.appendChild(a)}pick(t,e,i,n){const o={type:"joryio:editor-pick",selector:e,operation:i,tag:t.tagName.toLowerCase(),text:(t.textContent||"").trim().slice(0,200)};let s=null;if("hide"===i?s=o:"replace_text"===i?s=n||o.text?Object.assign(Object.assign({},o),{value:(n||o.text).slice(0,2e3)}):null:"replace_image"===i||"replace_link"===i?s=function(t){if("string"!=typeof t)return!1;const e=t.trim();return!(!e||e.length>2048)&&!/[\u0000-\u001f\u007f\s]/.test(e)&&/^https?:\/\/[^/?#\s]+/i.test(e)}(n)?Object.assign(Object.assign({},o),{value:n}):null:"insert_placement"===i&&(s=r.test(n)?Object.assign(Object.assign({},o),{placementKey:n,position:"after"}):null),!s){if(this.panel){const t=document.createElement("div");t.style.cssText="margin-top:6px;color:#fca5a5",t.textContent="insert_placement"===i?"Enter a placement key (lowercase letters, digits, _).":"Enter an address starting with https:// (or http://).",this.panel.appendChild(t)}return!1}return this.send(s),this.unselect(),!0}}const a={version:1,start({dashboardOrigin:t,opener:e,logger:i,onStop:n}){const o=new c(t,e,i,n);return o.start(),{stop:()=>o.stop()}}};"undefined"==typeof window||window[n]||(window[n]=a)}();
|
|
6
|
+
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const t=["before","after","prepend","append","replace"],e=/^[a-z0-9][a-z0-9_]{0,63}$/;function i(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e||e.length>500)return!1;if(/[{};<@]/.test(e)||e.includes("/*")||e.includes("*/"))return!1;if(/[\u0000-\u001f\u007f]/.test(e))return!1;try{"undefined"!=typeof document&&document.createDocumentFragment().querySelector(e)}catch(t){return!1}return!0}function n(t){if("string"!=typeof t)return!1;const e=t.trim();return!(!e||e.length>2048)&&!/[\u0000-\u001f\u007f\s]/.test(e)&&/^https?:\/\/[^/?#\s]+/i.test(e)}const o=/\/joryio(?:\.umd)?(?:\.min)?\.js$/;function s(t){if(!t||"string"!=typeof t)return null;let e;try{e=new URL(t)}catch(t){return null}return"https:"===e.protocol&&o.test(e.pathname)?`${e.origin}${e.pathname.replace(/[^/]*$/,"")}`:null}!function(){if("undefined"==typeof document)return null;try{const t=document.currentScript,e=s(t&&t.src);if(e||t&&t.src)return e;const i=document.querySelectorAll("script[src]");for(let t=i.length-1;t>=0;t--){const e=s(i[t].src);if(e)return e}}catch(t){}}();const a="joryio:editor-pick",r="__joryioEditor",l={title:"Joryio editor",variant:"Variant {name}",hintPoint:"Point at anything on the page",hintEditing:"Editing · changes show live",editsOne:"1 edit",editsMany:"{n} edits",noEdits:"No edits yet.",undo:"Undo last edit",undoOffline:"Undo is available once the Joryio dashboard is connected",saveReturn:"Save & return to Joryio",clickToEdit:"click to edit",helpTitle:"Not the right box?",helpUp:"Select the section around it",helpDown:"Select something inside it",helpClickKey:"Click",helpClick:"Edit this one",dismiss:"Dismiss",page:"Page",up:"Select the element around it",down:"Select the first element inside it",matchOne:"1 match on page",matchMany:"Matches {n} - all will change",matchNone:"Not found",whatToDo:"What do you want to do?",actText:"Change text",actLink:"Change link",actImage:"Change image",actHide:"Hide it",actSlot:"Add content slot",noText:"No text here",notLink:"Not a link",notImage:"Not an image",newText:"New text",was:'Was: "{value}"',insert:"Insert",fallbackFor:"If {name} is missing",fallbackHelp:"Shown to visitors we don't know yet.",fallbackBad:"Plain text only - no Liquid here.",fallbackDone:"Done",liquid:"Liquid code",more:"More…",search:"Search fields",noMatch:"No matching fields",rawNote:"Shown as code: this text uses Liquid beyond profile fields and fallbacks.",newLink:"New link address",newImage:"New image address",urlBad:"Enter an address starting with https:// (or http://).",hideNote:"The {kind} is removed for people in this campaign's audience. Everyone else still sees it.",hiddenFor:"Hidden for this audience",slotName:"Slot name",savedAs:"Saved as",slotHelp:"Filled by a Placement campaign or a journey step.",slotEmpty:"Enter a name for the slot.",slotCreate:"Create content for this slot →",slotIn:"In this slot:",slotAddAnother:"+ Add another campaign",where:"Where",posBefore:"Above it",posAfter:"Below it",posReplace:"Instead of it",posPrepend:"Inside, at the start",posAppend:"Inside, at the end",slotPreview:"Content slot",css:"CSS selector",cssHelp:"For developers. Matches {n} on this page.",cssBad:"Not a selector this page can use.",cancel:"Cancel",save:"Save · {action}",noSelector:"This element has no stable selector. Choose the element around it (arrow up) or another one.",kHeading:"Heading",kText:"Text",kLink:"Link",kButton:"Button",kImage:"Image",kList:"List",kSection:"Section",kMain:"Main",kHeader:"Header",kFooter:"Footer",kNav:"Navigation",kForm:"Form",kElement:"Element"};function c(t,e={}){return t.replace(/\{(\w+)\}/g,(t,i)=>i in e?String(e[i]):t)}const d=/\{\{-?([\s\S]*?)-?\}\}/g,p=/\|\s*default\s*:\s*("[^"]*"|'[^']*'|[^|}]*?)\s*(?=\||$)/,h=t=>t.trim().replace(/^(["'])([\s\S]*)\1$/,"$2");function u(t){const e=/^\{\{-?([\s\S]*?)-?\}\}$/.exec((t||"").trim()),i=e&&p.exec(e[1].trim());return i?h(i[1]):null}const f=(t,e)=>e?`{{ ${t} | default: ${(t=>t.includes('"')?t.includes("'")?`'${t.replace(/'/g,"’")}'`:`'${t}'`:`"${t}"`)(e)} }}`:`{{ ${t} }}`,b=/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,4}$/,x=t=>t.replace(/^user\.(custom\.)?/,""),g=/^\{\{-?\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*)\s*(?:\|\s*default\s*:\s*(?:"[^"]*"|'[^']*')\s*)?-?\}\}$/;function m(t){const e=[],i=new RegExp(d.source,"g");let n,o=0;for(t=t||"";n=i.exec(t);){const s=g.exec(n[0]);if(!s)return null;n.index>o&&e.push(t.slice(o,n.index)),e.push({name:x(s[1]),path:s[1],src:n[0]}),o=i.lastIndex}return o<t.length&&e.push(t.slice(o)),e.some(t=>"string"==typeof t&&/\{[{%]|[}%]\}/.test(t))?null:e}function k(t){return(t||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,64).replace(/_+$/,"")}const y=()=>`e${Math.random().toString(36).slice(2,10).padEnd(8,"0")}`;function w(t,e=!1){let i=(t||"").toLowerCase();if(e){const t=i.trim().split(/[\s>+~]+/).filter(Boolean),e=/^[a-z][a-z0-9]*/.exec(t[t.length-1]||"");i=e?e[0]:""}return/^h[1-6]$/.test(i)?"kHeading":/^(p|span|strong|em|small|label|blockquote|b|i)$/.test(i)?"kText":"a"===i?"kLink":"button"===i?"kButton":"img"===i||"picture"===i?"kImage":/^(ul|ol|li)$/.test(i)?"kList":"main"===i?"kMain":"header"===i?"kHeader":"footer"===i?"kFooter":"nav"===i?"kNav":"form"===i?"kForm":/^(section|div|article|aside)$/.test(i)?"kSection":"kElement"}function v(t,e,...i){const n=document.createElement(t);for(const[t,i]of Object.entries(e||{}))void 0!==i&&!1!==i&&n.setAttribute(t,!0===i?"":i);for(const t of i)null!=t&&!1!==t&&n.appendChild("string"==typeof t?document.createTextNode(t):t);return n}const j="http://www.w3.org/2000/svg",A={text:["M4 7V5h16v2M9 19h6M12 5v14"],link:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],image:["M3 5h18v14H3z","m3 16 5-5 4 4 3-3 6 6","M15.5 8.5h.01"],hide:["M9.88 9.88a3 3 0 1 0 4.24 4.24","M10.73 5.08A10.4 10.4 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.67 2.68","M6.61 6.61A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.39-1.61","m2 2 20 20"],slot:["M3 3h18v18H3z","M7 9h10v6H7z"],undo:["M3 7v6h6","M21 17a9 9 0 0 0-15-6.7L3 13"],up:["m18 15-6-6-6 6"],down:["m6 9 6 6 6-6"],cursor:["m4 4 7.07 17 2.51-7.39L21 11.07z"],code:["m16 18 6-6-6-6M8 6l-6 6 6 6"],chevron:["m9 18 6-6-6-6"],check:["M20 6 9 17l-5-5"],close:["M18 6 6 18M6 6l12 12"]};function F(t,e=15){const i=document.createElementNS(j,"svg");for(const[t,n]of Object.entries({width:String(e),height:String(e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.9","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))i.setAttribute(t,n);for(const e of A[t]){const t=document.createElementNS(j,"path");t.setAttribute("d",e),i.appendChild(t)}return i}const $='Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif',z='ui-monospace,"SF Mono",Menlo,monospace',E=`font-family:${z};font-size:.8em;font-weight:600;line-height:1;padding:.12em .5em;border-radius:999px;background:rgba(0,169,154,.14);color:#0F766E;box-shadow:inset 0 0 0 1px rgba(0,169,154,.5);white-space:nowrap;unicode-bidi:isolate;font-style:normal;text-transform:none;letter-spacing:0`,O=`.v{${E}}.s,.x{font:12.5px/1.4 ${$};border-radius:10px;padding:14px 16px;text-align:center}.s{border:2px dashed #7A6CFF;background:#F4F2FF;color:#4C3FD1}.s b{font-weight:700}.s code{font-family:${z}}.s div{font-size:11.5px;color:#6B5FD9;margin-top:3px}.x{border:1.5px dashed #F04438;background:#FEF3F2;color:#B42318;text-align:start;padding:10px 12px;font-size:12px}`,_=`\n*{box-sizing:border-box}\n.r{font:13px/1.4 ${$};color:#242B3A;-webkit-font-smoothing:antialiased}\nbutton{font:inherit;color:inherit;cursor:pointer}\nbutton:disabled{cursor:not-allowed}\nbutton:focus-visible,input:focus-visible,textarea:focus-visible,.ce:focus{outline:2px solid #31D6C8;outline-offset:1px}\n.box{position:fixed;pointer-events:none;border:2px dashed #00A99A;background:rgba(0,169,154,.07);border-radius:4px;display:none}\n.box.sel{border-style:solid;background:rgba(0,169,154,.04)}\n.chip{position:absolute;bottom:100%;inset-inline-start:-2px;margin-bottom:2px;background:#00A99A;color:#fff;font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px 6px 6px 0;white-space:nowrap;max-width:60vw;overflow:hidden;text-overflow:ellipsis}\n.help{position:fixed;top:16px;inset-inline-end:16px;width:240px;background:#fff;border:1px solid #E5EAF2;border-radius:10px;box-shadow:0 8px 24px rgba(10,18,64,.14);padding:10px 12px}\n.help h3{margin:0 0 6px;font-size:11px;font-weight:700;color:#6B7280;letter-spacing:.5px;text-transform:uppercase}\n.help .row{display:flex;align-items:center;gap:8px;font-size:12px;padding:3px 0}\n.kbd{min-width:38px;text-align:center;font-size:11px;font-weight:600;border:1px solid #E5EAF2;border-radius:5px;padding:1px 5px;background:#F8FAFC}\n.help .x{position:absolute;top:6px;inset-inline-end:6px;border:0;background:none;color:#8990A8;padding:2px;display:grid}\n.dock{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;background:#071342;color:#fff;border-radius:14px;padding:7px 7px 7px 14px;box-shadow:0 12px 32px rgba(10,18,64,.35);white-space:nowrap;max-width:calc(100vw - 24px)}\n.r.open .dock{left:calc(50% - 190px)}\n.r.open[dir=rtl] .dock{left:calc(50% + 190px)}\n.logo{width:22px;height:22px;border-radius:6px;background:#fff;color:#071342;display:grid;place-items:center;font-weight:800;font-size:13px;flex:none}\n.name{font-size:12.5px;font-weight:600;margin-inline-start:4px;overflow:hidden;text-overflow:ellipsis;max-width:200px}\n.sub{font-size:12px;color:#A8AEC1;overflow:hidden;text-overflow:ellipsis;max-width:220px}\n.sep{width:1px;height:22px;background:#2A3366;margin:0 8px;flex:none}\n.hint{font-size:12px;color:#C9CEDD;display:inline-flex;align-items:center;gap:6px}\n.hint svg{color:#31D6C8}\n.db{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-radius:8px;border:0;background:#1B245A;color:#fff;font-size:12.5px;font-weight:600}\n.ib{height:32px;width:32px;border-radius:8px;border:0;background:transparent;color:#fff;display:grid;place-items:center}\n.ib:disabled{color:#4A527A}\n.go{height:32px;padding:0 14px;border-radius:8px;border:0;background:#31D6C8;color:#071342;font-size:12.5px;font-weight:700}\n.pop{position:absolute;bottom:calc(100% + 10px);left:0;right:0;min-width:280px;max-height:50vh;overflow:auto;background:#fff;color:#242B3A;border-radius:12px;border:1px solid #E5EAF2;box-shadow:0 12px 32px rgba(10,18,64,.18);padding:6px;white-space:normal}\n.pop .e{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:none;border-radius:8px;font-size:12.5px;text-align:start}\n.pop .e:hover{background:#F8FAFC}\n.pop .empty{padding:12px;font-size:12.5px;color:#6B7280}\n.num{width:20px;height:20px;border-radius:99px;background:#071342;color:#fff;font-size:11px;font-weight:700;display:grid;place-items:center;flex:none}\n.panel{position:fixed;top:0;bottom:0;inset-inline-end:0;width:380px;max-width:100vw;background:#fff;border-inline-start:1px solid #E5EAF2;box-shadow:-8px 0 24px rgba(10,18,64,.06);display:flex;flex-direction:column}\n.hd{padding:16px 18px 14px;border-bottom:1px solid #E5EAF2}\n.crumbs{display:flex;align-items:center;flex-wrap:wrap;gap:4px;font-size:11.5px;color:#6B7280;margin-bottom:6px}\n.crumbs svg{color:#A8AEC1}\n.crumb{border:0;background:transparent;color:#6B7280;font-weight:500;font-size:11.5px;padding:2px 6px;border-radius:5px}\n.crumb.cur{background:#E5F9F6;color:#0F766E;font-weight:600}\n.nav{margin-inline-start:auto;display:flex;gap:2px}\n.nav button{border:1px solid #E5EAF2;background:#fff;border-radius:6px;width:24px;height:22px;display:grid;place-items:center;color:#3A4060;padding:0}\n.nav button:disabled{opacity:.4}\n.tr{display:flex;align-items:center;gap:10px}\n.title{font-size:17px;font-weight:700;color:#0A1240;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}\n.pill{margin-inline-start:auto;display:inline-flex;align-items:center;gap:4px;font-size:11.5px;font-weight:600;padding:3px 8px;border-radius:999px;white-space:nowrap;flex:none}\n.pill.ok{background:#E5F9F6;color:#0F766E}\n.pill.many{background:#FFF7E6;color:#92400E}\n.pill.none{background:#FEF3F2;color:#B42318}\n.bd{padding:16px 18px;overflow:auto;flex:1}\n.lbl{display:block;font-size:12.5px;font-weight:600;color:#242B3A;margin-bottom:8px}\n.tiles{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:18px}\n.tile{display:flex;align-items:center;gap:9px;padding:10px 11px;border-radius:10px;text-align:start;background:#fff;border:1.5px solid #E5EAF2;color:#3A4060}\n.tile[aria-checked=true]{background:#E5F9F6;border-color:#00C8B7;color:#0F766E}\n.tile.slot[aria-checked=true]{background:#F4F2FF;border-color:#7A6CFF;color:#4C3FD1}\n.tile:disabled{opacity:.55}\n.tile[data-e]>span::after{content:'';display:inline-block;width:6px;height:6px;border-radius:9px;background:#00A99A;margin-inline-start:6px;vertical-align:middle}\n.tile b{display:block;font-size:12.5px;font-weight:600;color:#0A1240}\n.tile small{display:block;font-size:10.5px;color:#6B7280}\n.fr{display:flex;align-items:baseline;margin-bottom:8px}\n.fr .lbl{margin:0}\n.was{margin-inline-start:auto;font-size:11.5px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:55%}\ntextarea,input,.ce{width:100%;font:inherit;font-size:13.5px;color:#0F1424;padding:10px 12px;border-radius:10px;border:1.5px solid #E5EAF2;background:#fff;outline:none}\ntextarea,.ce{line-height:1.5;resize:vertical;border-color:#00C8B7}\n.ce{min-height:72px;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text}\n.vp{${E};cursor:pointer}\n.vp .vfb{font-weight:400;opacity:.75}\n.fbp .vc{margin-top:8px}\n.slotc{display:flex;flex-direction:column;align-items:flex-start;gap:6px}\n.slotc .lbl{margin:0}\n.lnk{border:0;background:none;padding:0;color:#4C3FD1;font-size:12.5px;font-weight:600;text-align:start}\ntextarea.mono{height:auto}\ninput{height:40px;padding:0 12px}\ninput.slotin{border-color:#7A6CFF}\n.mono{font-family:${z};font-size:12px;height:36px;background:#F8FAFC;border-width:1px}\n.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center}\n.chips span{font-size:11.5px;color:#6B7280;margin-inline-end:2px}\n.vc{font-family:${z};font-size:11.5px;padding:3px 8px;border-radius:6px;border:1px solid #E5EAF2;background:#F8FAFC;color:#3A4060}\n.pk{margin-top:8px;border:1px solid #E5EAF2;border-radius:10px;padding:6px;background:#fff;box-shadow:0 8px 24px rgba(10,18,64,.1)}\n.pk input{height:34px}\n.pk [role=listbox]{max-height:220px;overflow:auto;margin-top:4px}\n.pk .g{font-size:10.5px;font-weight:700;color:#6B7280;text-transform:uppercase;letter-spacing:.4px;padding:8px 8px 3px}\n.pk .o{display:flex;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;border-radius:7px;font-size:12.5px;cursor:pointer}\n.pk .o[aria-selected=true],.pk .o:hover{background:#E5F9F6}\n.pk code{font-family:${z};font-size:11px;color:#6B7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n[hidden]{display:none!important}\n.help2{font-size:11.5px;color:#6B7280;margin-top:5px}\n.err{font-size:11.5px;color:#B42318;margin-top:5px}\n.mt{margin-top:14px}\n.note{background:#FFF7E6;border:1px solid #FCD34D;border-radius:10px;padding:10px 12px;font-size:12.5px;color:#92400E;line-height:1.5}\n.key{font-family:${z};color:#4C3FD1;background:#F4F2FF;padding:1px 6px;border-radius:4px}\n.seg{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;background:#F3F5FA;border-radius:9px;padding:3px}\n.seg button{border:0;background:transparent;border-radius:7px;padding:6px 4px;font-size:12px;color:#3A4060}\n.seg button[aria-checked=true]{background:#fff;color:#0A1240;font-weight:600;box-shadow:0 1px 2px rgba(10,18,64,.08)}\n.css{margin-top:20px;display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;padding:0;color:#6B7280;font-size:12px}\n.ft{padding:12px 18px;border-top:1px solid #E5EAF2;display:flex;gap:10px;background:#F8FAFC}\n.cancel{height:38px;padding:0 14px;border-radius:10px;border:1px solid #E5EAF2;background:#fff;color:#242B3A;font-size:13px;font-weight:600}\n.save{flex:1;height:38px;border-radius:10px;border:0;background:#071342;color:#fff;font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.save:disabled{opacity:.45}\n@media (max-width:760px){.r.open .dock{display:none}.help{display:none}}\n`,S="data-liquid",M=t=>!!t&&1===t.nodeType&&t.hasAttribute(S);function B(t){if(3===t.nodeType)return t.data;if(M(t))return t.getAttribute(S)||"";let e="";for(const i of Array.from(t.childNodes))e+=B(i);return e}const C=["data-joryio-id","data-testid","data-test","data-qa","data-cy","data-id","name"],N=/^[a-z0-9][a-z0-9_]{0,63}$/,D=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,I=2e3,L="jry_editor_help_dismissed",H=t=>!!t&&!!t.closest("[data-joryio-editor]"),P="var";function Z(t){let e=t instanceof Element?t:null;return e&&e.getAttribute("data-joryio-editor")===P&&(e=e.parentElement),e&&!H(e)&&e!==document.body&&e!==document.documentElement?e:null}function T(t){if(!i(t))return[];try{return Array.from(document.querySelectorAll(t)).filter(t=>!H(t))}catch(t){return[]}}const q=(t,e,i)=>{try{const n=Array.from(t.querySelectorAll(e)).filter(t=>!H(t));return 1===n.length&&n[0]===i}catch(t){return!1}};function R(t){const e=t.ownerDocument;if(!e)return null;const n=t=>{if((i=t.id)&&i.length<=64&&!/\d{4,}/.test(i)&&!/^(ember|react|radix|headlessui|mui)[-_:]/i.test(i)&&!/:/.test(i)){const i=`#${function(t){const e=globalThis.CSS;if(e&&"function"==typeof e.escape)return e.escape(t);let i="";for(let e=0;e<t.length;e++){const n=t[e],o=t.charCodeAt(e);0===o?i+="�":/[0-9]/.test(n)&&(0===e||1===e&&"-"===t[0])?i+=`\\${o.toString(16)} `:/[A-Za-z0-9_-]/.test(n)||o>=128?i+=n:i+=`\\${n}`}return i}(t.id)}`;if(q(e,i,t))return i}var i;for(const i of C){const n=t.getAttribute(i);if(!n||n.length>100)continue;const o=`${t.tagName.toLowerCase()}[${i}="${n.replace(/["\\]/g,"\\$&")}"]`;if(q(e,o,t))return o}return null},o=n(t);if(o)return i(o)?o:null;const s=[];let a=t;for(;a&&a!==e.body&&a!==e.documentElement;){const t=s.length?n(a):null;if(t){s.unshift(t);break}const i=a.tagName.toLowerCase(),o=a.parentElement,r=o?Array.from(o.children).filter(t=>t.tagName===a.tagName):[];s.unshift(r.length>1?`${i}:nth-of-type(${r.indexOf(a)+1})`:i),a=o,a===e.body&&s.unshift("body")}const r=s.join(" > ");return r&&i(r)&&q(e,r,t)?r:null}const U=["text","link","image","hide","slot"],V={text:"replace_text",link:"replace_link",image:"replace_image",hide:"hide",slot:"insert_placement"},J={replace_text:"text",replace_link:"link",replace_image:"image",hide:"hide",insert_placement:"slot"},K={text:"actText",link:"actLink",image:"actImage",hide:"actHide",slot:"actSlot"},G={text:"text",link:"link",image:"image",hide:"hide",slot:"slot"},W=[["before","posBefore"],["after","posAfter"],["replace","posReplace"],["prepend","posPrepend"],["append","posAppend"]],X=["user.firstName","user.lastName","user.email","user.custom.city"],Q=/^[A-Za-z0-9_-]{1,64}$/,Y=(t,e)=>"string"==typeof t?t.trim().slice(0,e):"",tt=t=>(t&&t.textContent||"").replace(/\s+/g," ").trim();class et{constructor(t,e,i,n=()=>{}){this.dashboardOrigin=t,this.opener=e,this.logger=i,this.onStop=n,this.listeners=[],this.active=!1,this.host=null,this.root=null,this.wrap=null,this.hoverBox=null,this.selBox=null,this.dock=null,this.panel=null,this.help=null,this.hovered=null,this.selected=null,this.draft=null,this.showCss=!1,this.showLiquid=!1,this.closeOverlay=null,this.popOpen=!1,this.edits=[],this.history=[],this.synced=!1,this.t=Object.assign({},l),this.dir="ltr",this.ctx={campaignName:"",variantName:"",attributes:[],placements:[],sample:{},openSlot:!1},this.previewUndo=[],this.originals=new WeakMap}start(){if(this.active)return;this.active=!0;const t=t=>{const e=t.data;e&&"string"==typeof e.type&&t.origin===this.dashboardOrigin&&t.source===this.opener&&("joryio:editor-close"===e.type?this.stop():"joryio:editor-context"===e.type?this.applyContext(e):"joryio:editor-focus"===e.type&&this.focusEdit(e.id))};window.addEventListener("message",t),this.listeners.push(()=>window.removeEventListener("message",t)),this.activate()}isActive(){return this.active}editList(){return this.edits.slice()}stop(){var t;if(this.active){this.send({type:"joryio:editor-closed"}),this.active=!1;for(const t of this.listeners.splice(0))t();this.clearPreview(),null===(t=this.host)||void 0===t||t.remove(),this.host=this.root=this.wrap=this.hoverBox=this.selBox=this.dock=this.panel=this.help=null,this.selected=this.hovered=null,this.draft=null;try{this.onStop()}catch(t){this.logger.debug("Joryio editor stop callback failed",t)}}}send(t){if(this.active)try{this.opener.postMessage(t,this.dashboardOrigin)}catch(t){}}activate(){const t=document,e=t.createElement("joryio-editor");e.setAttribute("data-joryio-editor","root"),e.setAttribute("style","all:initial !important;position:fixed !important;top:0 !important;left:0 !important;width:0 !important;height:0 !important;z-index:2147483647 !important;display:block !important");const i=e.attachShadow({mode:"closed"});i.appendChild(v("style",null,_));const n=v("div",{class:"r",dir:this.dir});this.hoverBox=v("div",{class:"box","data-j":"hover"}),this.selBox=v("div",{class:"box sel","data-j":"selected"}),n.append(this.hoverBox,this.selBox),i.appendChild(n),t.documentElement.appendChild(e),this.host=e,this.root=i,this.wrap=n;const o=t=>{const e=t.target instanceof Element?t.target:null;H(e)&&e.getAttribute("data-joryio-editor")!==P||(this.hovered=Z(e),this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0))},s=t=>{if(t.target instanceof Element&&t.target.closest('[data-joryio-editor="root"]'))return;t.preventDefault(),t.stopPropagation();const e=Z(t.target);e&&this.select(e)},a=t=>{if("Escape"!==t.key){if(!H(t.target instanceof Element?t.target:null)&&("ArrowUp"===t.key||"ArrowDown"===t.key)){const e=this.selected||this.hovered;if(!e)return;t.preventDefault(),t.stopPropagation(),this.move("ArrowUp"===t.key?"up":"down",e)}}else{if(this.closeOverlay&&this.closeOverlay())return;this.popOpen?this.togglePop(!1):this.panel?this.cancel():this.stop()}},r=()=>{this.place(this.hoverBox,this.hovered===this.selected?null:this.hovered,!0),this.place(this.selBox,this.selected)};t.addEventListener("mousemove",o,!0),t.addEventListener("click",s,!0),t.addEventListener("keydown",a,!0),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),this.listeners.push(()=>t.removeEventListener("mousemove",o,!0),()=>t.removeEventListener("click",s,!0),()=>t.removeEventListener("keydown",a,!0),()=>window.removeEventListener("scroll",r,!0),()=>window.removeEventListener("resize",r)),this.renderDock(),this.renderHelp(),this.send({type:"joryio:editor-active",url:`${location.origin}${location.pathname}`})}applyContext(o){var s;this.synced=!0,this.t=function(t){const e=Object.assign({},l);if(t&&"object"==typeof t)for(const i of Object.keys(l)){const n=t[i];"string"==typeof n&&n.trim()&&n.length<=500&&(e[i]=n)}return e}(o.strings),this.dir="rtl"===o.dir?"rtl":"ltr",null===(s=this.wrap)||void 0===s||s.setAttribute("dir",this.dir);const a=(t,e,i)=>(Array.isArray(t)?t:[]).map(e).filter(t=>null!==t).slice(0,i);if(this.ctx={campaignName:Y(o.campaignName,120),variantName:Y(o.variantName,60),attributes:a(o.attributes,t=>t?"string"==typeof t.key&&b.test(t.key)?{path:t.key,label:Y(t.label,60)||t.key.split(".").pop(),group:Y(t.group,40)}:"string"==typeof t.name&&D.test(t.name)?{path:`user.${!0===t.custom?"custom.":""}${t.name}`,label:t.name,group:""}:null:null,400),placements:a(o.placements,t=>t&&"string"==typeof t.key&&N.test(t.key)?{key:t.key,name:Y(t.name,80),campaigns:a(t.campaigns,t=>t&&"string"==typeof t.id&&Q.test(t.id)?{id:t.id,name:Y(t.name,120)||t.id,status:Y(t.status,30),statusLabel:Y(t.statusLabel,40)}:null,10)}:null,200),sample:{},openSlot:!0===o.openSlot},o.sample&&"object"==typeof o.sample)for(const[t,e]of Object.entries(o.sample).slice(0,100))/^user\.[A-Za-z0-9_.]{1,80}$/.test(t)&&"string"==typeof e&&(this.ctx.sample[t]=e.slice(0,200));Array.isArray(o.edits)&&(this.edits=a(o.edits,o=>function(o){if(!o||"object"!=typeof o||"string"!=typeof o.id||!i(o.selector))return null;const s=Object.assign({id:o.id,selector:o.selector.trim()},!0===o.personalized?{personalized:!0}:{});switch(o.operation){case"hide":return Object.assign(Object.assign({},s),{operation:"hide"});case"replace_text":return"string"==typeof o.value&&o.value.length<=2e3?Object.assign(Object.assign({},s),{operation:"replace_text",value:o.value}):null;case"replace_image":case"replace_link":return n(o.value)?Object.assign(Object.assign({},s),{operation:o.operation,value:o.value.trim()}):null;case"insert_placement":return"string"==typeof o.placementKey&&e.test(o.placementKey)?Object.assign(Object.assign({},s),{operation:"insert_placement",placementKey:o.placementKey,position:t.includes(o.position)?o.position:"after"}):null;default:return null}}(o),100).map(t=>{const{personalized:e}=t,i=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]])}return i}(t,["personalized"]);return i}),this.history=[]),this.renderPreview(),this.renderDock(),this.renderHelp(),this.draft&&this.renderPanel(),"string"==typeof o.focusId&&this.focusEdit(o.focusId)}place(t,e,i=!1){if(!t)return;if(!e||!e.isConnected)return void(t.style.display="none");const n=e.getBoundingClientRect();Object.assign(t.style,{display:"block",top:n.top-2+"px",left:n.left-2+"px",width:`${n.width+4}px`,height:`${n.height+4}px`}),t.textContent="";const o=`${this.t[w(e.tagName)]} · ${e.tagName.toLowerCase()}`;t.appendChild(v("span",{class:"chip","data-j":"label"},i?`${o} - ${this.t.clickToEdit}`:o))}move(t,e){const i="up"===t?e.parentElement:Array.from(e.children).filter(t=>!H(t))[0]||null;i&&i!==document.body&&i!==document.documentElement&&this.select(i)}editsOn(t){if(!t)return[];const e=R(t);return this.edits.filter(i=>i.selector===e||T(i.selector).indexOf(t)>=0)}select(t,e){if(!this.active)return;e=e||this.editsOn(t).pop(),this.selected=t,this.hovered=null,this.place(this.hoverBox,null),this.place(this.selBox,t),this.popOpen=!1;const i=e?e.selector:R(t)||"";this.showCss=!i,this.draft=e?this.draftOf(e):this.newDraft(t,i),this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview()}enabled(t,e){return!e||("text"===t?"IMG"!==e.tagName&&!!this.orig(e).text:"link"===t?"A"===e.tagName:"image"!==t||"IMG"===e.tagName)}newDraft(t,e){const i=this.orig(t),n="IMG"===t.tagName?"image":this.enabled("text",t)?"text":"A"===t.tagName?"link":"hide";return{action:n,text:i.text.slice(0,I),url:("image"===n?i.src:i.href)||"",slotName:"",position:"after",selector:e,editingId:null,touched:!1}}draftOf(t){const e=J[t.operation];return{action:e,text:"replace_text"===t.operation&&t.value||"",url:("link"===e||"image"===e)&&t.value||"",slotName:t.placementKey||"",position:t.position||"after",selector:t.selector,editingId:t.id,touched:!0}}orig(t){return this.originals.get(t)||{text:tt(t),href:t.getAttribute("href"),src:t.getAttribute("src")}}focusEdit(t){const e=this.edits.filter(e=>e.id===t)[0];if(!e||!this.active)return!1;const i=T(e.selector)[0]||null;if(i){try{i.scrollIntoView({block:"center"})}catch(t){}this.select(i,e)}else this.selected=null,this.place(this.selBox,null),this.draft=this.draftOf(e),this.showCss=!0,this.renderPanel(),this.renderDock(),this.renderHelp(),this.renderPreview();return!0}draftEdit(t){const e={id:t.editingId||"",selector:t.selector.trim()};if(!i(e.selector))return null;const o=V[t.action];if("hide"===t.action)return Object.assign(Object.assign({},e),{operation:o});if("text"===t.action)return t.text.trim()&&t.text.length<=I?Object.assign(Object.assign({},e),{operation:o,value:t.text}):null;if("link"===t.action||"image"===t.action)return n(t.url)?Object.assign(Object.assign({},e),{operation:o,value:t.url.trim()}):null;const s=k(t.slotName);return N.test(s)?Object.assign(Object.assign({},e),{operation:o,placementKey:s,position:t.position}):null}save(){var t,e;const i=this.draft,n=i&&this.draftEdit(i);if(!i||!n)return;const o=this.selected||T(n.selector)[0]||null,s=i.editingId||y();this.pick(o,n.selector,n.operation,null!==(e=null!==(t=n.value)&&void 0!==t?t:n.placementKey)&&void 0!==e?e:"",{id:s,position:n.position})&&"insert_placement"===n.operation&&this.ctx.openSlot&&this.focusEdit(s)}openSlot(t,e){if(!this.ctx.openSlot||!N.test(t))return!1;this.send(Object.assign({type:"joryio:editor-open-slot",placementKey:t},e?{campaignId:e}:{}));try{this.opener.focus()}catch(t){}return!0}pick(t,e,o,s,r={}){const l=r.id||y(),c=t?t.tagName.toLowerCase():"",d=t?this.orig(t).text.slice(0,200):"";let p=null;if(i(e)){const t={id:l,selector:e.trim()};if("hide"===o)p=Object.assign(Object.assign({},t),{operation:o});else if("replace_text"===o)p=(s||d)&&(s||d).length<=I?Object.assign(Object.assign({},t),{operation:o,value:s||d}):null;else if("replace_image"===o||"replace_link"===o)p=n(s)?Object.assign(Object.assign({},t),{operation:o,value:s.trim()}):null;else if("insert_placement"===o){const e=k(s);p=N.test(e)?Object.assign(Object.assign({},t),{operation:o,placementKey:e,position:r.position||"after"}):null}}if(!p)return!1;const h=Object.assign(Object.assign({type:a},p),{tag:c,text:d});this.send(h);const u=this.edits.map(t=>t.id).indexOf(l);return this.history.push({id:l,before:u>=0?this.edits[u]:null}),u>=0?this.edits[u]=p:this.edits.push(p),this.closePanel(),!0}cancel(){this.closePanel()}closePanel(){var t,e;this.draft=null,this.selected=null,null===(t=this.panel)||void 0===t||t.remove(),this.panel=null,null===(e=this.wrap)||void 0===e||e.classList.remove("open"),this.place(this.selBox,null),this.renderPreview(),this.renderDock(),this.renderHelp()}undo(){if(!this.synced)return!1;const t=this.history.pop();if(!t)return!1;const e=this.edits.map(t=>t.id).indexOf(t.id);if(t.before){e>=0&&(this.edits[e]=t.before);const i=t.before;this.send(Object.assign(Object.assign({type:a},i),{tag:"",text:""}))}else e>=0&&this.edits.splice(e,1),this.send({type:"joryio:editor-remove",id:t.id});return this.draft?this.closePanel():(this.renderPreview(),this.renderDock()),!0}done(){this.send({type:"joryio:editor-done"}),this.stop();try{this.opener.focus()}catch(t){}try{window.close()}catch(t){}}clearPreview(){for(const t of this.previewUndo.splice(0).reverse())try{t()}catch(t){}}renderPreview(){if(this.clearPreview(),!this.active)return;const t=this.draft,e=t?this.draftEdit(t):null,i=[];for(const n of this.edits)i.push(t&&t.editingId===n.id&&e||n);t&&!t.editingId&&e&&t.touched&&i.push(e);for(const t of i)for(const e of T(t.selector).slice(0,50))this.applyPreview(t,e);this.selected&&this.place(this.selBox,this.selected)}previewNode(t,e="all:initial !important;display:block !important;margin:10px 0 !important",i="preview"){const n=document.createElement("joryio-editor-preview");n.setAttribute("data-joryio-editor",i),n.setAttribute("style",e);const o=n.attachShadow({mode:"open"});return o.appendChild(v("style",null,O)),t(o),n}applyPreview(t,e){this.originals.has(e)||this.originals.set(e,{text:tt(e),href:e.getAttribute("href"),src:e.getAttribute("src")});const i=this.previewUndo,n=(t,n)=>{const o=e.getAttribute(t);null===n?e.removeAttribute(t):e.setAttribute(t,n),i.push(()=>null===o?e.removeAttribute(t):e.setAttribute(t,o))},o=()=>{const t=e.style;if(!t)return;const n=t.getPropertyValue("display"),o=t.getPropertyPriority("display");t.setProperty("display","none","important"),i.push(()=>n?t.setProperty("display",n,o):t.removeProperty("display"))},s=(t,n)=>{const o=e.parentNode;"before"===n&&o?o.insertBefore(t,e):"after"!==n&&"replace"!==n||!o?"prepend"===n?e.insertBefore(t,e.firstChild):e.appendChild(t):o.insertBefore(t,e.nextSibling),i.push(()=>t.parentNode&&t.parentNode.removeChild(t))};switch(t.operation){case"replace_text":{const n=Array.from(e.childNodes);e.textContent="";for(const i of function(t,e){const i=[],n=new RegExp(d.source,"g");let o,s=0;const a=t=>{t&&("string"==typeof i[i.length-1]?i[i.length-1]+=t:i.push(t))};for(t=t||"";o=n.exec(t);){a(t.slice(s,o.index)),s=n.lastIndex;const r=o[1].trim(),l=r.split("|")[0].trim(),c=p.exec(r);Object.prototype.hasOwnProperty.call(e,l)&&""!==e[l]?a(e[l]):c&&h(c[1])?a(h(c[1])):i.push({name:x(l),path:l,src:o[0]})}return a(t.slice(s)),i}(t.value||"",this.ctx.sample))e.appendChild("string"==typeof i?document.createTextNode(i):this.previewNode(t=>t.appendChild(v("span",{class:"v",dir:"auto"},this.labelOf(i.path)||i.name)),"all:unset !important;display:inline !important;unicode-bidi:isolate !important",P));i.push(()=>{e.textContent="";for(const t of n)e.appendChild(t)});break}case"replace_link":n("href",t.value||null);break;case"replace_image":n("srcset",null),n("src",t.value||null);break;case"hide":{const t=`${this.t[w(e.tagName)]} "${this.orig(e).text.slice(0,40)}"`;s(this.previewNode(e=>e.appendChild(v("div",{class:"x"},`${this.t.hiddenFor}: ${t}`))),"after"),o();break}case"insert_placement":{const e=t.position||"after";s(this.previewNode(e=>e.appendChild(v("div",{class:"s"},v("b",null,`${this.t.slotPreview} · `),v("code",null,t.placementKey||""),v("div",null,this.t.slotHelp)))),e),"replace"===e&&o();break}}}renderHelp(){var t;null===(t=this.help)||void 0===t||t.remove(),this.help=null;let e=!1;try{e="1"===localStorage.getItem(L)}catch(t){}if(e||this.draft||!this.wrap)return;const i=this.t,n=(t,e)=>v("div",{class:"row"},v("span",{class:"kbd"},t),e),o=v("button",{class:"x",type:"button","aria-label":i.dismiss,title:i.dismiss,"data-j":"help-dismiss"},F("close",13));o.addEventListener("click",()=>{var t;try{localStorage.setItem(L,"1")}catch(t){}null===(t=this.help)||void 0===t||t.remove(),this.help=null}),this.help=v("div",{class:"help","data-j":"help",role:"note"},o,v("h3",null,i.helpTitle),n("↑",i.helpUp),n("↓",i.helpDown),n(i.helpClickKey,i.helpClick)),this.wrap.appendChild(this.help)}labelOf(t){const e=this.ctx.attributes.filter(e=>e.path===t)[0];return e&&e.label}editTitle(t){const e=T(t.selector)[0],i=this.t[e?w(e.tagName):w(t.selector,!0)];return`${this.t[K[J[t.operation]]]} · ${i}`}togglePop(t){this.popOpen=t,this.renderDock()}renderDock(){var t;if(!this.wrap)return;const e=this.t;null===(t=this.dock)||void 0===t||t.remove();const i=this.edits.length,n=[this.ctx.variantName?c(e.variant,{name:this.ctx.variantName}):"",location.pathname||"/"].filter(Boolean).join(" · "),o=v("button",{class:"db",type:"button","aria-expanded":String(this.popOpen),"data-j":"edits"},1===i?e.editsOne:c(e.editsMany,{n:i}),F(this.popOpen?"down":"up",11));o.addEventListener("click",()=>this.togglePop(!this.popOpen));const s=this.synced&&this.history.length>0,a=v("button",{class:"ib",type:"button","aria-label":e.undo,title:this.synced?e.undo:e.undoOffline,disabled:!s,"data-j":"undo"},F("undo",14));a.addEventListener("click",()=>this.undo());const r=v("button",{class:"go",type:"button","data-j":"done"},e.saveReturn);r.addEventListener("click",()=>this.done());const l=v("div",{class:"dock","data-j":"dock",role:"toolbar","aria-label":e.title},v("span",{class:"logo","aria-hidden":"true"},"J"),v("span",{class:"name","data-j":"campaign"},this.ctx.campaignName||e.title),v("span",{class:"sub"},`· ${n}`),v("span",{class:"sep"}),v("span",{class:"hint","data-j":"hint"},F("cursor",13),this.draft?e.hintEditing:e.hintPoint),v("span",{class:"sep"}),o,a,r);if(this.popOpen){const t=v("div",{class:"pop","data-j":"edit-list",role:"menu"});i||t.appendChild(v("div",{class:"empty"},e.noEdits)),this.edits.forEach((e,i)=>{const n=v("button",{class:"e",type:"button",role:"menuitem","data-j":"edit-item","data-edit-id":e.id},v("span",{class:"num"},String(i+1)),this.editTitle(e));n.addEventListener("click",()=>this.focusEdit(e.id)),t.appendChild(n)}),l.appendChild(t)}this.dock=l,this.wrap.appendChild(l)}renderPanel(){var t;const e=this.draft;if(!e||!this.wrap)return;const n=this.t,o=this.selected;null===(t=this.panel)||void 0===t||t.remove(),this.wrap.classList.add("open");const s=v("div",{class:"crumbs","data-j":"crumbs"});if(o){const t=[];for(let e=o;e&&e!==document.body&&e!==document.documentElement;e=e.parentElement)t.unshift(e);const e=t.slice(-3),i=(t,e,i)=>{const n=v("button",{class:i?"crumb cur":"crumb",type:"button","data-j":"crumb","aria-current":i?"true":void 0,disabled:!e},t);return e&&!i&&n.addEventListener("click",()=>this.select(e)),n};s.appendChild(i(n.page,null,!1));for(const t of e)s.append(F("chevron",9),i(n[w(t.tagName)],t,t===o));const a=v("button",{type:"button","aria-label":n.up,title:n.up,"data-j":"up",disabled:!o.parentElement||o.parentElement===document.body},F("up",12));a.addEventListener("click",()=>this.move("up",o));const r=v("button",{type:"button","aria-label":n.down,title:n.down,"data-j":"down",disabled:!Array.from(o.children).some(t=>!H(t))},F("down",12));r.addEventListener("click",()=>this.move("down",o)),s.appendChild(v("span",{class:"nav"},a,r))}const a=n[o?w(o.tagName):w(e.selector,!0)],r=o?"IMG"===o.tagName?o.getAttribute("alt")||"":this.orig(o).text:"",l=v("div",{class:"title","data-j":"title"},r?`${a} "${r.slice(0,40)}"`:a),d=v("span",{class:"pill","data-j":"matches"}),p=v("div",{class:"hd"},s,v("div",{class:"tr"},l,d)),h=v("div",{class:"tiles",role:"radiogroup","aria-label":n.whatToDo}),u=this.editsOn(o);for(const t of U){const i=e.action===t,s=i||this.enabled(t,o),a=s?"":"link"===t?n.notLink:"image"===t?n.notImage:n.noText,r=u.filter(e=>J[e.operation]===t).pop(),l=v("button",{class:"slot"===t?"tile slot":"tile",type:"button",role:"radio","aria-checked":String(i),disabled:!s,"data-e":!!r,"data-j":`action-${t}`},F(G[t]),v("span",null,v("b",null,n[K[t]]),a?v("small",null,a):null));l.addEventListener("click",()=>{this.draft&&this.draft.action!==t&&(r?this.draft=this.draftOf(r):(o&&this.draft.editingId&&(this.draft=this.newDraft(o,this.draft.selector)),this.draft.action=t,this.draft.touched=!0,"link"!==t&&"image"!==t||!o||(this.draft.url=("image"===t?this.orig(o).src:this.orig(o).href)||"")),this.renderPanel(),this.renderPreview())}),h.appendChild(l)}const f=v("div",{"data-j":"fields"}),b=v("button",{class:"save",type:"button","data-j":"save"}),x=()=>{const t=!!this.draftEdit(e);b.disabled=!t,b.textContent=c(n.save,{action:n[K[e.action]]});const i=T(e.selector).length;d.className="pill "+(1===i?"ok":i>1?"many":"none"),d.textContent=1===i?n.matchOne:i>1?c(n.matchMany,{n:i}):n.matchNone},g=()=>{e.touched=!0,x(),this.renderPreview()};this.renderFields(f,e,o,g);const m=v("button",{class:"css",type:"button","aria-expanded":String(this.showCss),"data-j":"css-toggle"},F("code",13),n.css,F(this.showCss?"up":"down",10));m.addEventListener("click",()=>{this.showCss=!this.showCss,this.renderPanel()});const k=v("div",{class:"bd"},v("span",{class:"lbl"},n.whatToDo),h,f,m);if(this.showCss){const t=v("input",{class:"mono",dir:"ltr","aria-label":n.css,spellcheck:"false","data-j":"selector"});t.value=e.selector;const o=v("div",{class:"help2"}),s=()=>{const t=i(e.selector);o.className=t?"help2":"err",o.textContent=e.selector.trim()?t?c(n.cssHelp,{n:T(e.selector).length}):n.cssBad:n.noSelector};t.addEventListener("input",()=>{e.selector=t.value,s(),g()}),s(),k.append(v("div",{class:"mt"},t,o))}const y=v("button",{class:"cancel",type:"button","data-j":"cancel"},n.cancel);y.addEventListener("click",()=>this.cancel()),b.addEventListener("click",()=>this.save());const j=v("aside",{class:"panel","data-j":"panel",role:"dialog","aria-label":n.whatToDo},p,k,v("div",{class:"ft"},y,b));x(),this.panel=j,this.wrap.appendChild(j)}renderFields(t,e,i,o){const s=this.t;t.textContent="",this.closeOverlay=null;const a=t=>t?v("span",{class:"was",title:t},c(s.was,{value:t.slice(0,60)})):null;if("text"===e.action){let n=null;const r=t=>{var i;e.text=t,n&&n!==(null===(i=this.root)||void 0===i?void 0:i.activeElement)&&(n.value=t),o()},l=function(t){const e=v("div",{"data-j":"text-box"});let i="",n=null,o=null,s=null;const a=()=>{const e=t.root;return(e&&"function"==typeof e.getSelection?e.getSelection():null)||document.getSelection()},r=()=>{const e=a();if(!e||!e.rangeCount)return null;let i=e.getRangeAt(0);const o=e.getComposedRanges;if(t.root&&o&&(!n||!n.contains(i.startContainer)))try{const n=o.call(e,{shadowRoots:[t.root]})[0];i=document.createRange(),i.setStart(n.startContainer,n.startOffset),i.setEnd(n.endContainer,n.endOffset)}catch(t){i=null}return n&&i&&n.contains(i.startContainer)&&n.contains(i.endContainer)?i:null},l=()=>{const t=r();t&&(o=t.cloneRange())},d=()=>{n&&"DIV"===n.tagName&&(i=B(n)),l(),t.onChange(i)},p=t=>{const e=a();try{e&&e.setBaseAndExtent?e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset):e&&(e.removeAllRanges(),e.addRange(t))}catch(t){}o=t.cloneRange()},h=e=>t.labelOf&&t.labelOf(e.path)||e.name,b=e=>{const i=u(e.src),n=h(e),o=t.fallback;return v("span",Object.assign({class:"vp",contenteditable:"false",dir:"auto",title:e.src,[S]:e.src,"data-path":e.path},o?{role:"button",tabindex:"0","aria-haspopup":"dialog","aria-label":i?`${n} · ${i}`:n}:{}),n,i?v("span",{class:"vfb","data-j":"pill-fallback"},` · ${i}`):null)},x=()=>!!s&&(s.remove(),s=null,!0),g=o=>{const a=t.fallback;if(!a||!n||"DIV"!==n.tagName)return;x();let r=o;const l={path:r.getAttribute("data-path")||"",name:"",src:r.getAttribute(S)||""};l.name=l.path.replace(/^user\.(custom\.)?/,"");const d=c(a.title,{name:h(l)}),p=v("input",{dir:"auto","data-j":"fallback","aria-label":d,maxlength:"200"});p.value=u(l.src)||"";const g=v("div",{class:"err","data-j":"fallback-error",role:"alert"}),m=v("button",{class:"vc",type:"button","data-j":"fallback-done"},a.done),k=v("div",{class:"pk fbp",role:"dialog","aria-label":d,"data-j":"fallback-pop"},v("label",{class:"lbl"},d),p,g,v("div",{class:"help2"},a.help),m),y=()=>{x();try{r.focus()}catch(t){}};p.addEventListener("input",()=>{const e=(t=>t.length<=200&&!/\{[{%]|[}%]\}|[\r\n]/.test(t))(p.value);if(g.textContent=e?"":a.bad,!e)return;const o=function(t,e){const i=/^\{\{-?\s*([A-Za-z_][A-Za-z0-9_.]*)/.exec((t||"").trim());return i?f(i[1],e.trim()||null):t}(r.getAttribute(S)||"",p.value),s=b(Object.assign(Object.assign({},l),{src:o}));r.parentNode&&r.parentNode.replaceChild(s,r),r=s,n&&"DIV"===n.tagName&&(i=B(n)),t.onChange(i)}),p.addEventListener("keydown",t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),t.stopPropagation(),y())}),m.addEventListener("click",y),s=k,e.appendChild(k),p.focus()},k=a=>{i=a,o=null,s=null,e.textContent="";const c=m(a);if(!c){const o=v("textarea",{rows:"3",dir:"auto","data-j":"text","aria-label":t.label});return o.value=a,o.addEventListener("input",()=>{i=o.value,t.onChange(i)}),o.addEventListener("blur",()=>m(i)&&k(i)),n=o,void e.append(o,v("div",{class:"help2","data-j":"raw-note"},t.rawNote))}const h=v("div",{class:"ce",contenteditable:"true",role:"textbox","aria-multiline":"true",dir:"auto",spellcheck:"false","data-j":"text","aria-label":t.label});for(const t of c)h.append("string"==typeof t?document.createTextNode(t):b(t));h.addEventListener("input",d),h.addEventListener("keyup",l),h.addEventListener("mouseup",l),h.addEventListener("click",t=>{const e=t.target instanceof Element?t.target.closest(`[${S}]`):null;e&&h.contains(e)&&g(e)}),h.addEventListener("keydown",t=>{const e=t.target instanceof Element&&M(t.target)?t.target:null;if(e&&("Enter"===t.key||" "===t.key))return t.preventDefault(),g(e);if("Enter"===t.key)return t.preventDefault();if("Backspace"!==t.key&&"Delete"!==t.key)return;const i=r();if(!i||!i.collapsed)return;const n="Backspace"===t.key,o=i.startContainer,s=i.startOffset;let a=null;3===o.nodeType?n&&0===s?a=o.previousSibling:n||s!==o.length||(a=o.nextSibling):a=o.childNodes[n?s-1:s]||null,M(a)&&(t.preventDefault(),a.remove(),d())});const u=t=>e=>{const i=r();i&&!i.collapsed&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData("text/plain",B(i.cloneContents())),t&&(i.deleteContents(),d()))};h.addEventListener("copy",u(!1)),h.addEventListener("cut",u(!0)),h.addEventListener("paste",t=>{t.preventDefault();const e=(t.clipboardData&&t.clipboardData.getData("text/plain")||"").replace(/\r/g,""),n=r();if(!e||!n)return;n.deleteContents();const o=document.createTextNode(e);n.insertNode(o),n.setStartAfter(o),n.collapse(!0),p(n),d(),/\{[{%]/.test(e)&&k(i)}),h.addEventListener("blur",()=>Array.from(h.childNodes).some(t=>3===t.nodeType&&/\{[{%]/.test(t.data))&&k(i)),n=h,e.appendChild(h)};return{el:e,set:k,insert:e=>{const s=r()||(o&&n&&n.isConnected&&n.contains(o.startContainer)?o:null);if(!s||!n||"DIV"!==n.tagName)return k(i?`${i.replace(/\s+$/,"")} ${e}`:e),t.onChange(i);const a=m(e),l=a&&a[0];if(!l||"string"==typeof l)return;n.focus(),s.deleteContents();const c=document.createRange();c.selectNodeContents(n),c.setEnd(s.startContainer,s.startOffset);const h=B(c.cloneContents()),u=document.createDocumentFragment();h&&!/\s$/.test(h)&&u.appendChild(document.createTextNode(" "));const f=b(l);u.appendChild(f),s.insertNode(u),s.setStartAfter(f),s.collapse(!0),p(s),d()},closePop:x}}({label:s.newText,rawNote:s.rawNote,root:this.root,onChange:r,labelOf:t=>this.labelOf(t),fallback:{title:s.fallbackFor,help:s.fallbackHelp,bad:s.fallbackBad,done:s.fallbackDone}});l.set(e.text);const d=t=>l.insert(f(t.path)),p=this.ctx.attributes.length?this.ctx.attributes:["firstName","lastName"].map(t=>({path:`user.${t}`,label:t,group:""})),h=X.map(t=>p.filter(e=>e.path===t)[0]).filter(Boolean),b=h.concat(p.filter(t=>h.indexOf(t)<0)).slice(0,4),x=v("div",{class:"chips","data-j":"chips"},v("span",null,s.insert)),g=v("div",{class:"pk","data-j":"var-picker",hidden:!0});for(const t of b){const e=v("button",{class:"vc",type:"button",title:t.path,"data-j":"chip"},t.label);e.addEventListener("mousedown",t=>t.preventDefault()),e.addEventListener("click",()=>d(t)),x.appendChild(e)}if(p.length>b.length){const t=v("button",{class:"vc",type:"button","aria-expanded":"false","data-j":"more"},s.more),e=v("input",{dir:"auto","aria-label":s.search,placeholder:s.search,"data-j":"var-search",role:"combobox","aria-expanded":"true"}),i=v("div",{role:"listbox","aria-label":s.insert,"data-j":"var-list"});g.append(e,i);let n=[],o=0;const a=()=>!g.hidden&&(g.hidden=!0,t.setAttribute("aria-expanded","false"),!0),r=t=>{t&&(a(),d(t))},c=()=>{const t=e.value.trim().toLowerCase();n=p.filter(e=>!t||`${e.label} ${e.path} ${e.group}`.toLowerCase().indexOf(t)>=0).slice(0,200),o=Math.min(o,Math.max(n.length-1,0)),i.textContent="",n.length||i.appendChild(v("div",{class:"g"},s.noMatch));let a=null;n.forEach((t,e)=>{t.group!==a&&(a=t.group,a&&i.appendChild(v("div",{class:"g",role:"presentation"},a)));const n=v("div",{class:"o",role:"option",id:`jv${e}`,"aria-selected":String(e===o),"data-j":"var-option"},v("span",{dir:"auto"},t.label),v("code",{dir:"ltr"},t.path));n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",()=>r(t)),i.appendChild(n)}),e.setAttribute("aria-activedescendant",n.length?`jv${o}`:"")};e.addEventListener("input",()=>{o=0,c()}),e.addEventListener("keydown",t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){t.preventDefault(),o=(o+("ArrowDown"===t.key?1:n.length-1))%Math.max(n.length,1),c();const e=i.querySelector('[aria-selected="true"]');e&&e.scrollIntoView&&e.scrollIntoView({block:"nearest"})}else"Enter"===t.key&&(t.preventDefault(),r(n[o]))}),t.addEventListener("mousedown",t=>t.preventDefault()),t.addEventListener("click",()=>{a()||(g.hidden=!1,t.setAttribute("aria-expanded","true"),e.value="",o=0,c(),e.focus())}),this.closeOverlay=()=>l.closePop()||a(),x.appendChild(t)}const k=v("button",{class:"css",type:"button","aria-expanded":String(this.showLiquid),"data-j":"liquid-toggle"},F("code",13),s.liquid,F(this.showLiquid?"up":"down",10));if(k.addEventListener("click",()=>{this.showLiquid=!this.showLiquid,this.renderPanel()}),this.closeOverlay||(this.closeOverlay=()=>l.closePop()),t.append(v("div",{class:"fr"},v("label",{class:"lbl"},s.newText),a(i?this.orig(i).text:null)),l.el,x,g,k),this.showLiquid){const i=v("textarea",{class:"mono",rows:"3",dir:"ltr",spellcheck:"false","aria-label":s.liquid,"data-j":"liquid"});i.value=e.text,i.addEventListener("input",()=>{l.set(i.value),r(i.value)}),n=i,t.appendChild(v("div",{class:"mt"},i))}}else if("link"===e.action||"image"===e.action){const r=v("input",{type:"url",dir:"ltr",inputmode:"url",placeholder:"https://","data-j":"url","aria-label":"link"===e.action?s.newLink:s.newImage});r.value=e.url;const l=v("div",{class:"err"}),c=()=>l.textContent=e.url.trim()&&!n(e.url)?s.urlBad:"";r.addEventListener("input",()=>{e.url=r.value,c(),o()}),c();const d=i?"image"===e.action?this.orig(i).src:this.orig(i).href:null;t.append(v("div",{class:"fr"},v("label",{class:"lbl"},"link"===e.action?s.newLink:s.newImage),a(d)),r,l)}else if("hide"===e.action){const n=s[i?w(i.tagName):w(e.selector,!0)].toLowerCase();t.appendChild(v("div",{class:"note","data-j":"hide-note"},c(s.hideNote,{kind:n})))}else{const i=v("input",{class:"slotin",dir:"auto","data-j":"slot-name","aria-label":s.slotName,maxlength:"80"});i.value=e.slotName;const n=v("span",{class:"key","data-j":"slot-key"}),a=v("div",{class:"help2"}),r=()=>{const t=k(e.slotName);n.textContent=t||"-",a.textContent="",a.append(`${s.savedAs} `,n,t?"":` · ${s.slotEmpty}`)};if(i.addEventListener("input",()=>{e.slotName=i.value,r(),o()}),r(),t.append(v("label",{class:"lbl"},s.slotName),i,a),this.ctx.placements.length){const n=v("div",{class:"chips","data-j":"placements"});for(const t of this.ctx.placements.slice(0,12)){const s=v("button",{class:"vc",type:"button",title:t.name||t.key,"data-j":"placement"},t.key);s.addEventListener("click",()=>{e.slotName=t.key,i.value=t.key,r(),o()}),n.appendChild(s)}t.appendChild(n)}t.appendChild(v("div",{class:"help2"},s.slotHelp));const l=v("div",{class:"seg",role:"radiogroup","aria-label":s.where,"data-j":"positions"});for(const[t,i]of W){const n=v("button",{type:"button",role:"radio","aria-checked":String(e.position===t),"data-j":`pos-${t}`},s[i]);n.addEventListener("click",()=>{e.position=t;for(const t of Array.from(l.children))t.setAttribute("aria-checked",String(t===n));o()}),l.appendChild(n)}t.append(v("div",{class:"mt"},v("span",{class:"lbl"},s.where),l));const c=this.ctx.openSlot&&e.editingId?this.edits.filter(t=>t.id===e.editingId)[0]:void 0,d=c&&c.placementKey;if(d){const e=(this.ctx.placements.filter(t=>t.key===d)[0]||{campaigns:[]}).campaigns,i=v("div",{class:"mt slotc","data-j":"slot-content"}),n=(t,e,i)=>{const n=v("button",{class:"lnk",type:"button","data-j":e},t);return n.addEventListener("click",()=>this.openSlot(d,i)),n};if(e.length){i.appendChild(v("span",{class:"lbl"},s.slotIn));for(const t of e)i.appendChild(n(t.statusLabel||t.status?`${t.name} (${t.statusLabel||t.status})`:t.name,"slot-campaign",t.id));i.appendChild(n(s.slotAddAnother,"slot-add"))}else i.appendChild(n(s.slotCreate,"slot-create"));t.appendChild(i)}}}}const it={version:1,start({dashboardOrigin:t,opener:e,logger:i,onStop:n}){const o=new et(t,e,i,n);return o.start(),{stop:()=>o.stop()}}};"undefined"==typeof window||window[r]||(window[r]=it)}();
|
|
7
7
|
//# sourceMappingURL=joryio-editor.min.js.map
|