From 594dd8348c37cdf08a039012e27eacf167d97d77 Mon Sep 17 00:00:00 2001 From: prismiwi2015 Date: Sat, 22 Aug 2026 21:59:48 +0200 Subject: [PATCH 1/2] The MailPoet window earns its brand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three fixes from design review of #41, one of them structural. The window would not scroll: `.atfm` was missing from the shared window-root rule, so it never got the flex column and bounded height that let its body own the scrolling — the *window body* scrolled instead, and the shell-scroll pin snapped it back to the top on every wheel tick. The root joins the rule, the body scrolls, the pin now protects instead of fighting. The borrowed logo goes: MailPoet's real wordmark and symbol ship as bundled brand assets, which also lets the window introduce MailPoet properly before it is installed — exactly when the introduction matters. The wordmark carries a proper hero now: warm orange gradient glows, the mark large on a lit white chip, "Turn submissions into subscribers", and a status pill with a live dot. And the window becomes a place worth reading: three cards on why MailPoet is worth meeting (the visual editor, double opt-in, the free tier), doors into their features, guides and pricing, a three-step strip for how connecting works, and form cards wearing the MailPoet symbol — full colour when connected, greyed while not — with the editor grouped under three captions: where they land, who they are, when to subscribe. The `consent` field type joins the opt-in picker, which the QA form showed it was missing from. One CSS lesson recorded where it bit: `overflow: hidden` on a grid item zeroes its automatic minimum size, and the hero collapsed to its padding under it — the gradients it guarded are backgrounds, which cannot overflow anything. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp --- assets/css/builder.css | 353 ++++++++++++++++++++++++++++----- assets/img/mailpoet-logo.png | Bin 0 -> 35802 bytes assets/img/mailpoet-symbol.png | Bin 0 -> 11001 bytes assets/js/builder.js | 99 +++++++-- assets/js/builder.min.js | 6 +- includes/mailpoet.php | 32 +-- src/mailpoet-hub.ts | 113 +++++++++-- src/types.ts | 4 +- 8 files changed, 510 insertions(+), 97 deletions(-) create mode 100644 assets/img/mailpoet-logo.png create mode 100644 assets/img/mailpoet-symbol.png diff --git a/assets/css/builder.css b/assets/css/builder.css index 9dec862..37dc78e 100644 --- a/assets/css/builder.css +++ b/assets/css/builder.css @@ -22,7 +22,8 @@ .atfb, .atfe, .atfs, -.atfa { +.atfa, +.atfm { /* The window's own surface. A window body must not paint a colour of its own choosing behind the shell's chrome. */ --atfb-bg: var( --os-window-bg, #fff ); @@ -132,7 +133,8 @@ .atfb *, .atfe *, -.atfs * { +.atfs *, +.atfm * { box-sizing: border-box; } @@ -155,7 +157,8 @@ .atfb > *, .atfe > *, .atfs > *, -.atfa > * { +.atfa > *, +.atfm > * { --os-ui-accent: var( --atfb-accent ); --wp-admin-theme-color: var( --atfb-accent ); --os-ui-accent-strong: var( --atfb-accent-strong ); @@ -3493,112 +3496,243 @@ os-checkbox-label.atfb-check { /* The MailPoet window */ /* -------------------------------------------------------------------------- */ -/* The hero wears MailPoet's orange — their brand, on the one surface that is - about them — and nothing else does: the working parts below are shell-token - furniture like every other window, so the integration reads as native to - both sides. The logo is MailPoet's own asset served from MailPoet's own - install, on a white chip because their wordmark is drawn for a light - ground and must survive every desktop theme. */ +/* The one window allowed a second brand. MailPoet's orange carries the hero, + the feature cards' icons and the primary call to action — the surfaces that + are *about* MailPoet — and the working furniture below them stays on the + shell's tokens, so the window reads as native to both sides at once. The + wordmark and symbol are the bundled brand PNGs, drawn for a light ground, + so anything that shows them sits on a white chip that survives every + desktop theme. + + `.atfm` itself is part of the shared window-root rule at the top of this + file — that is what gives it the flex column and the bounded height that + let `.atfm__body` own the scrolling. Without it the *window body* scrolled, + and the shell-scroll pin snapped it back to the top on every wheel tick. */ .atfm { --atfm-brand: #fe5301; + --atfm-brand-deep: #d94500; + --atfm-soft: color-mix( in srgb, var( --atfm-brand ) 12%, transparent ); + --atfm-line: color-mix( in srgb, var( --atfm-brand ) 38%, transparent ); +} + +.atfm__bar { + display: flex; + align-items: center; + gap: 8px; + padding: 10px 14px; + color: var( --atfb-muted ); } .atfm__body { + flex: 1 1 auto; + min-block-size: 0; overflow-y: auto; - padding: 20px; + padding: 22px; display: grid; - gap: 18px; + gap: 20px; align-content: start; } +/* ---- Hero ---------------------------------------------------------------- */ + .atfm-hero { - display: flex; - align-items: center; - gap: 18px; - padding: 22px; - border: 1px solid color-mix( in srgb, var( --atfm-brand ) 35%, transparent ); + position: relative; + display: grid; + justify-items: center; + text-align: center; + gap: 14px; + padding: 34px 28px 30px; + border: 1px solid var( --atfm-line ); border-radius: var( --atfb-radius ); background: - radial-gradient( circle at 0% 0%, color-mix( in srgb, var( --atfm-brand ) 14%, transparent ), transparent 55% ), + radial-gradient( 110% 90% at 50% -20%, color-mix( in srgb, var( --atfm-brand ) 22%, transparent ), transparent 60% ), + radial-gradient( 60% 50% at 12% 110%, color-mix( in srgb, var( --atfm-brand ) 12%, transparent ), transparent 70% ), + radial-gradient( 60% 50% at 88% 110%, color-mix( in srgb, var( --atfm-brand ) 12%, transparent ), transparent 70% ), var( --atfb-surface ); } .atfm-hero__logo { - flex: 0 0 auto; display: grid; place-items: center; - padding: 12px 14px; + padding: 16px 26px; background: #fff; border-radius: calc( var( --atfb-radius ) - 2px ); - box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.12 ); + box-shadow: + 0 1px 0 rgba( 255, 255, 255, 0.6 ) inset, + 0 10px 30px color-mix( in srgb, var( --atfm-brand ) 25%, transparent ); } .atfm-hero__logo img { display: block; - max-inline-size: 108px; + inline-size: 210px; block-size: auto; } .atfm-hero__logo--glyph { - font-size: 34px; + font-size: 40px; } -.atfm-hero__words h1 { - margin: 0 0 6px; - font-size: 18px; - line-height: 1.3; +.atfm-hero h1 { + margin: 0; + font-size: 22px; + line-height: 1.25; + letter-spacing: -0.01em; } -.atfm-hero__words p { +.atfm-hero__words { + display: grid; + gap: 8px; + justify-items: center; +} + +.atfm-hero__words > p { margin: 0; - max-inline-size: 52ch; + max-inline-size: 58ch; + font-size: 13px; + line-height: 1.6; color: var( --atfb-muted ); } +/* The status pill: quiet proof the bridge is up. */ .atfm-hero__status { - margin-block-start: 8px !important; + display: inline-flex; + align-items: center; + gap: 7px; + padding: 5px 14px; + border-radius: 999px; + border: 1px solid var( --atfb-border ); + background: var( --atfb-bg ); font-size: 12px; font-weight: 600; - color: var( --atfb-muted ); } -.atfm-hero__status.is-on { - color: var( --atfb-success ); +.atfm-hero__status::before { + content: ''; + inline-size: 7px; + block-size: 7px; + border-radius: 50%; + background: var( --atfb-faint ); } -.atfm-pitch { +.atfm-hero__status.is-on::before { + background: var( --atfb-success ); + box-shadow: 0 0 8px color-mix( in srgb, var( --atfb-success ) 60%, transparent ); +} + +/* ---- Why MailPoet -------------------------------------------------------- */ + +.atfm-why { display: grid; - gap: 12px; - justify-items: start; - padding: 4px 2px; + grid-template-columns: repeat( auto-fit, minmax( 190px, 1fr ) ); + gap: 10px; } -.atfm-pitch p { +.atfm-why__card { + display: grid; + gap: 6px; + align-content: start; + padding: 16px; + border: 1px solid var( --atfb-card-border ); + border-radius: var( --atfb-radius ); + background: var( --atfb-bg ); + transition: border-color 120ms ease, box-shadow 120ms ease; +} + +.atfm-why__card:hover { + border-color: var( --atfm-line ); + box-shadow: var( --os-ui-card-shadow-hover, 0 4px 16px rgba( 0, 0, 0, 0.08 ) ); +} + +.atfm-why__icon { + display: grid; + place-items: center; + inline-size: 34px; + block-size: 34px; + border-radius: 10px; + background: var( --atfm-soft ); + font-size: 17px; +} + +.atfm-why__card strong { + font-size: 13px; +} + +.atfm-why__card p { margin: 0; - max-inline-size: 62ch; + font-size: 12px; + line-height: 1.55; + color: var( --atfb-muted ); } -/* The one control allowed to wear the brand: the step that brings MailPoet in. */ -.atfm-pitch__cta { - display: inline-block; - padding: 8px 18px; - border-radius: var( --atfb-radius-ctl ); - background: var( --atfm-brand ); - color: #fff; +/* The row of doors into MailPoet's own world. */ +.atfm-links { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 4px 18px; + font-size: 12px; +} + +.atfm-links a { + color: var( --atfm-brand ); font-weight: 600; text-decoration: none; } -.atfm-pitch__cta:hover { - filter: brightness( 1.08 ); +.atfm-links a:hover { + text-decoration: underline; +} + +/* ---- How it works -------------------------------------------------------- */ + +.atfm-steps { + display: flex; + align-items: stretch; + justify-content: center; + gap: 10px; + flex-wrap: wrap; +} + +.atfm-step { + flex: 1 1 0; + min-inline-size: 150px; + display: flex; + align-items: center; + gap: 10px; + padding: 10px 14px; + border-radius: var( --atfb-radius ); + background: var( --atfb-surface ); + border: 1px solid var( --atfb-border ); + font-size: 12px; + color: var( --atfb-muted ); +} + +.atfm-step__n { + flex: 0 0 auto; + display: grid; + place-items: center; + inline-size: 22px; + block-size: 22px; + border-radius: 50%; + background: var( --atfm-brand ); color: #fff; + font-size: 11px; + font-weight: 700; } +/* ---- Forms --------------------------------------------------------------- */ + .atfm-forms { display: grid; gap: 10px; } +.atfm-forms__head { + display: grid; + gap: 2px; +} + .atfm-forms h2 { margin: 0; font-size: 14px; @@ -3614,22 +3748,63 @@ os-checkbox-label.atfb-check { border: 1px solid var( --atfb-card-border ); border-radius: var( --atfb-radius ); background: var( --atfb-bg ); + transition: border-color 120ms ease, box-shadow 120ms ease; +} + +.atfm-form:not( .is-open ):hover { + border-color: var( --atfm-line ); + box-shadow: var( --os-ui-card-shadow-hover, 0 4px 16px rgba( 0, 0, 0, 0.08 ) ); +} + +.atfm-form.is-open { + border-color: var( --atfm-line ); } .atfm-form__head { display: flex; align-items: center; - justify-content: space-between; - gap: 10px; + gap: 12px; padding: 12px 14px; } +/* The symbol marks the connected ones — a badge, not a repetition of the + hero. White chip for the same light-ground reason as the wordmark. */ +.atfm-form__mark { + flex: 0 0 auto; + display: grid; + place-items: center; + inline-size: 34px; + block-size: 34px; + border-radius: 9px; + background: #fff; + border: 1px solid var( --atfb-border ); +} + +.atfm-form__mark img { + display: block; + inline-size: 20px; + block-size: 20px; +} + +.atfm-form__mark--off { + background: var( --atfb-well ); +} + +.atfm-form__mark--off img { + filter: grayscale( 1 ) opacity( 0.45 ); +} + .atfm-form__title { + flex: 1 1 auto; display: grid; gap: 2px; min-inline-size: 0; } +.atfm-form__title strong { + font-size: 13px; +} + .atfm-form__status { font-size: 11px; color: var( --atfb-muted ); @@ -3645,10 +3820,19 @@ os-checkbox-label.atfb-check { .atfm-form__body { display: grid; - gap: 12px; - padding: 0 14px 14px; + gap: 14px; + padding: 14px; border-block-start: 1px solid var( --atfb-border ); - padding-block-start: 12px; +} + +.atfm-form__section { + display: grid; + gap: 2px; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.05em; + color: var( --atfb-muted ); } .atfm-lists { @@ -3660,11 +3844,76 @@ os-checkbox-label.atfb-check { display: flex; align-items: center; gap: 8px; + padding: 8px 10px; + border: 1px solid var( --atfb-border ); + border-radius: var( --atfb-radius-ctl ); font-size: 13px; + font-weight: 500; cursor: pointer; + transition: border-color 120ms ease, background 120ms ease; +} + +.atfm-list:hover { + border-color: var( --atfm-line ); +} + +.atfm-list:has( input:checked ) { + border-color: var( --atfm-brand ); + background: var( --atfm-soft ); +} + +.atfm-list input { + accent-color: var( --atfm-brand ); } .atfm-form__actions { display: flex; gap: 8px; } + +/* ---- The pitch, when MailPoet is absent ---------------------------------- */ + +.atfm-pitch { + display: grid; + gap: 12px; + justify-items: center; + text-align: center; + padding: 6px 2px 2px; +} + +.atfm-pitch p { + margin: 0; + max-inline-size: 62ch; + font-size: 13px; + line-height: 1.6; + color: var( --atfb-muted ); +} + +/* The one control that wears the brand outright: the step that brings + MailPoet in. */ +.atfm-pitch__cta { + display: inline-block; + padding: 10px 26px; + border-radius: 999px; + background: linear-gradient( 180deg, var( --atfm-brand ), var( --atfm-brand-deep ) ); + color: #fff; + font-size: 14px; + font-weight: 700; + text-decoration: none; + box-shadow: 0 6px 18px color-mix( in srgb, var( --atfm-brand ) 40%, transparent ); + transition: transform 120ms ease, box-shadow 120ms ease; +} + +.atfm-pitch__cta:hover { + color: #fff; + transform: translateY( -1px ); + box-shadow: 0 10px 24px color-mix( in srgb, var( --atfm-brand ) 50%, transparent ); +} + +@media ( prefers-reduced-motion: reduce ) { + .atfm-pitch__cta, + .atfm-form, + .atfm-why__card { + transition: none; + } +} diff --git a/assets/img/mailpoet-logo.png b/assets/img/mailpoet-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3289aea535dc2371549a9d0d840cab2d91d80eae GIT binary patch literal 35802 zcmeEu`9GB3`~Pjp5+Mo|CY7ZSl6@Il30caXJxR!xeILm#DqD7nys|IZmm$j(F{12@ zEn}U*V3@IdPp|jq^ZEJv2fY2_ez?zd&bhAhyw-EwV)S)2&YZq@8iJrRn)lQnLJ;jB z1W_&1(SW~1TGPFpUSvC~kZcSQFZ7R;eW+^@0o4HWx(9t0{lw z@L%KbFB<-99R3vp^k3ufuN?lrjYAJo5;*J1+o2w}bwjx-4k~`6qJDM#tV?Lx;EoR>ppRkuA?yFh3;x>^^*?O$CO%VW5zMAj2oe^Ma9!qL~Y3 zp7DE|COu+Do}LyH`AlF$``}+^p65>B&_LOqeUD_CUcZGgW*mldTmC?2pZ~k%$a@Gd zGD554AhVKgAdz;bq`MlIo3Zeb7611&W6a-R;k3l;?4iTUe}e^@JAVmIr6Xlx3n$>O zj#@A+LgEUcp85{!32hlSc(9_kj2F%>(dr`#(SRZ%sA-{41C-fxjF- zaRMBtKF>XOc-GGE*ih3Kyn*)q-PVQT%L>-9yrfC6USmzjf;@}%46JD3Nq?wIYJxKZ zSQvs_S^v)e^u}qlNo%pBy4wKpp968%1P$A>$)e$en-+x&=AQR6rE(g-g29Lk`oZz< zz2#|Jy(foH!cWwLOo_;p(44}nT$VqI9&uJL)25D|IKejsOHXX9;ZUU+@)E}P_|s6L z^_}RMtc5@Or1~AtFDRtaOgK2A8tzpvsq$;;;F8s>EiD)C%pV&#(p`W5j9lye46xbo;5Fg;QlFt`^KT&V#Qa#@OM| z{T{A|(|rd@7ryyF{UeWW1_y+IvgHeD{rW6L1*pioPi@bBxGqV5v`4Y!#~LzaSq_6_ z?jyNScGltTA~*9$wFMD|j<#LRm6+_MOgZK_%M}BYg%P`AjTNrkXDQDu3zeREE09Ke z;i46Z&gZ!R58HgoS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(}RyoI1$9o)l+Y%STEg2$l{f@_Sgm}SUQchyArsjVR>c?P2X%agjv3Iv-g(v{X z$90OhtV+kdf>qrA_k96F!0j;xT&y3-;dj$aJKWF z{6AhCuzV~Q^C}npAW28$)0IC2gd2u0u6|%U(76$@b>B4!ql>-+>a-B*?TM^gclrI9 zp<;4v^**dALef4dEiSLfCx!@A^`td2b*=eoly7JY`O>6oN^D;0;R1MRDEH@O}gkPUllz9}OZ%{uA0UDd@*qtnMh)`5Iu6snaHU71pRC;nmt?Gzyyp(DPe9 z;oExHtu@88;~>s7hl0^!Y|5!#?cLs0M2_#ff14Azax- zl()ZW&kB9@e}BpUXWNQAAv&=H`3W|}r|1*D6Q52-2Ju0P`d?%JzZK+91cCVW^}iJq zi2WrdKdOH#oS;w4qx!c3`@e0SjIomn?8M0;3Oif@KE(Zk&NN1{|`*tE4Kgu literal 0 HcmV?d00001 diff --git a/assets/img/mailpoet-symbol.png b/assets/img/mailpoet-symbol.png new file mode 100644 index 0000000000000000000000000000000000000000..9ad2d7fbb446f0ed76bc5f3a6410cb096ba728bc GIT binary patch literal 11001 zcmcI~bySpH_vp|af`E#YA|MQ)G)N;Ttx|(DN=PHp-5?^bpdcM8APpm3LxVI(4&C9< zJ;d(}?|bj{uKV5feZRHt{bSZVbDn*6$JzT#_!G59WW+a!ArJ_e;^T+UAP{UA=0k`N zR_e?@Pk=8XhsU~35C{o1=7R-ENV*1r5UanElY8>S(*BLTlcl`_v!a|Fv%_n9^H(-z z5Qy7&vWA7G#wxAE;nbe2a+u#oW&39|gv`%mBmAy@VB=&VqErfFNgtzm+Hgf)9+$p7 zEez-Vd%t%yPobo5iAM<*STf!RehGW~6Fuws#d^5raH;#ebVPDFZ#Nm*1`7@gaBn=m0-1)+E9`b}6V$ANl zGzjraK8p9mg6Mr@p}|V~0AZ#!3wsE$d;rPo)qX1vf!%{#HCJvHg^Y4T?kVb+KZX>Q zLl8ZbBqb0+QpmlhVZnDHxSkN>_S?7JAVKkvs|q_h;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z*t#WBL(J(rzanrxH{_VGgT93swDAcG<*YIOH4EMeiD9&KvG1p!@bJSBP2@Ln=XshE zy4{UT^|8$OF)_y%DDMxBYwC(i629>*2CmL=^TJn8o3dFTjH_A+i}1SftjZ-)z?FrV zn*fE-hLc~7eViN?V;7YP*@F%$7Cg{o)U#HujdhNLYpzY@>BnvM97mx~R!F@%=*VuM8K( zct!lB1V%yA(OsOAr@%{33o^-EPD5VDH(*!o^_PL^L7JX55{xwbcqll!Cnv2*Kjl}K zfjKJ2STBv;Zj=i>com&*%MT9LRpQwKok7T-W$qTepqb||P;DqFt_Drf^CN}Zjs|{!+^0f9~qXzK%fdW-<_7OM9F3vz|MzK zl^t&$Pvs!h=uKcz0#95KL6G==vnmJewVT|pQrZ#f7`ooH)+V&$(Q+9%B$8zLucAk6 zExX0eQRS|UR>+b2Z%*-n=LQtEU|ckp)mNEM(TO5|Rrq|+06ikvA!Xl`=30AP1c7f8L${aVHE`|2@zj p4I8FQ{MVTN0K%v(8GV5Rv1#*;>}O3A0{<<5D9WonERZ!0_%C=d!yo_v literal 0 HcmV?d00001 diff --git a/assets/js/builder.js b/assets/js/builder.js index 872076c..fd971ba 100644 --- a/assets/js/builder.js +++ b/assets/js/builder.js @@ -1739,9 +1739,9 @@ var allTerrainFormsBuilder = function(exports) { const parsed = parseFloat(String(value ?? "")); return Number.isFinite(parsed) ? parsed : fallback2; } - function nearest(value, steps) { - let best = steps[0]; - for (const step of steps) { + function nearest(value, steps2) { + let best = steps2[0]; + for (const step of steps2) { if (Math.abs(step.at - value) < Math.abs(best.at - value)) { best = step; } @@ -2570,6 +2570,10 @@ var allTerrainFormsBuilder = function(exports) { } function formCard(summary, info, host) { const card = el("section", { class: "atfm-form" }); + const mark = (on) => el("span", { + class: `atfm-form__mark${on ? "" : " atfm-form__mark--off"}`, + children: [el("img", { attrs: { src: info.symbol, alt: "", width: "20", height: "20" } })] + }); const paintClosed = (subscribed) => { clear(card); card.classList.remove("is-open"); @@ -2577,6 +2581,7 @@ var allTerrainFormsBuilder = function(exports) { el("div", { class: "atfm-form__head", children: [ + mark(subscribed.length > 0), el("div", { class: "atfm-form__title", children: [ @@ -2690,10 +2695,12 @@ var allTerrainFormsBuilder = function(exports) { paintClosed(remove ? [] : info.lists.filter((list) => chosen.has(list.id)).map((list) => list.name)); }; clear(card); + const caption = (text) => el("span", { class: "atfm-form__section", text }); card.append( el("div", { class: "atfm-form__head", children: [ + mark(Boolean(action)), el("div", { class: "atfm-form__title", children: [el("strong", { text: summary.title || `Form ${summary.id}` })] @@ -2704,7 +2711,9 @@ var allTerrainFormsBuilder = function(exports) { el("div", { class: "atfm-form__body", children: [ - row("Lists", listsBox, "Where the subscriber lands. MailPoet sends its own confirmation email first."), + caption("Where they land"), + row("Lists", listsBox, "MailPoet sends its own confirmation email before anyone is truly on a list."), + caption("Who they are"), row( "Email address", select(email, fieldOptions(fields, "— pick a field —"), (value) => { @@ -2724,6 +2733,7 @@ var allTerrainFormsBuilder = function(exports) { lastName = value; }) ), + caption("When to subscribe"), row( "Subscribe", select( @@ -2765,7 +2775,7 @@ var allTerrainFormsBuilder = function(exports) { class: "atfm-hero__logo", children: [ el("img", { - attrs: { src: info.logo, alt: "MailPoet", width: "108", height: "65" } + attrs: { src: info.logo, alt: "MailPoet", width: "210", height: "105" } }) ] }) : el("span", { class: "atfm-hero__logo atfm-hero__logo--glyph", text: "📬" }); @@ -2776,22 +2786,77 @@ var allTerrainFormsBuilder = function(exports) { el("div", { class: "atfm-hero__words", children: [ - el("h1", { text: "Grow your audience where it begins" }), + el("h1", { text: "Turn submissions into subscribers" }), el("p", { text: "Every submission is someone choosing to talk to you. Connect a form to MailPoet and the ones who opt in land on your lists by themselves — named, consented, and confirmed by MailPoet’s own double opt-in." }), info.active ? el("p", { class: "atfm-hero__status is-on", - text: 1 === info.lists.length ? "Connected — 1 list available" : `Connected — ${info.lists.length} lists available` + text: 1 === info.lists.length ? "Connected — 1 list ready for subscribers" : `Connected — ${info.lists.length} lists ready for subscribers` }) : el("p", { class: "atfm-hero__status", - text: "MailPoet is not installed on this site yet." + text: "MailPoet is not installed on this site yet" }) ] }) ] }); } + function whyMailPoet() { + const card = (icon2, title, words) => el("div", { + class: "atfm-why__card", + children: [ + el("span", { class: "atfm-why__icon", text: icon2 }), + el("strong", { text: title }), + el("p", { text: words }) + ] + }); + const link = (href, text) => el("a", { text, attrs: { href, target: "_blank", rel: "noreferrer" } }); + return [ + el("div", { + class: "atfm-why", + children: [ + card( + "✉️", + "Beautiful emails, made in WordPress", + "Design newsletters and welcome emails in a drag-and-drop editor that lives in your own admin — no external account to juggle." + ), + card( + "🤝", + "Consent you can stand behind", + "Double opt-in out of the box: every address your forms send over is confirmed by the visitor before a single campaign reaches it." + ), + card( + "🚀", + "Free to grow with", + "Free up to 500 subscribers, welcome automations, WooCommerce emails and open-rate stats included — a paid addon anywhere else." + ) + ] + }), + el("p", { + class: "atfm-links", + children: [ + link("https://www.mailpoet.com/features/", "Explore MailPoet’s features ↗"), + link("https://kb.mailpoet.com/", "Guides & docs ↗"), + link("https://www.mailpoet.com/pricing/", "Plans & the free tier ↗") + ] + }) + ]; + } + function steps() { + const step = (n, words) => el("div", { + class: "atfm-step", + children: [el("span", { class: "atfm-step__n", text: n }), el("span", { text: words })] + }); + return el("div", { + class: "atfm-steps", + children: [ + step("1", "Pick a form below"), + step("2", "Choose the lists it feeds"), + step("3", "Bind it to an opt-in — MailPoet confirms the rest") + ] + }); + } async function mountMailPoetHub() { const root = document.querySelector("[data-atfm-root]"); if (!root || root.dataset.atfmMounted) { @@ -2805,7 +2870,7 @@ var allTerrainFormsBuilder = function(exports) { const [info, forms] = await Promise.all([api.mailpoet(), api.listForms()]); bar?.remove(); clear(body); - body.append(hero(info)); + body.append(hero(info), ...whyMailPoet()); if (!info.active) { body.append( el("div", { @@ -2816,7 +2881,7 @@ var allTerrainFormsBuilder = function(exports) { }), el("a", { class: "atfm-pitch__cta", - text: "Install MailPoet", + text: "Install MailPoet — it’s free", attrs: { href: info.adminUrl, target: "_blank", rel: "noreferrer" } }) ] @@ -2842,13 +2907,19 @@ var allTerrainFormsBuilder = function(exports) { ); return; } + body.append(steps()); const section = el("section", { class: "atfm-forms", children: [ - el("h2", { text: "Your forms" }), - el("p", { - class: "atfm-hint", - text: "Pick a form, choose its lists, and bind the subscription to an opt-in the visitor actually ticks." + el("div", { + class: "atfm-forms__head", + children: [ + el("h2", { text: "Your forms" }), + el("p", { + class: "atfm-hint", + text: "Connected forms wear the MailPoet mark in colour." + }) + ] }) ] }); diff --git a/assets/js/builder.min.js b/assets/js/builder.min.js index 2670d53..f055fe0 100644 --- a/assets/js/builder.min.js +++ b/assets/js/builder.min.js @@ -1,3 +1,3 @@ -var allTerrainFormsBuilder=function(ee){"use strict";class Kt{constructor(){this.targets=[],this.active=null,this.lastEndMs=0}start(e){if(this.active||e.origin.button!==0)return null;const{payload:t,origin:s}=e,a=s.clientX,i=s.clientY;let o=!1,l=!1,c=null,d=null,h=0,w=0;const y=()=>{document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",$),document.removeEventListener("pointercancel",R),document.removeEventListener("keydown",L),window.removeEventListener("blur",R),c?.remove(),c=null,t.source.classList.remove("atf-is-dragging"),document.body.classList.remove("atf-drag-active"),d?.onLeave?.(u),d=null,this.active=null,this.lastEndMs=Date.now()},u={payload:t,isFinished:()=>l,cancel:(v="caller")=>{l||(l=!0,y(),e.onCancel?.(v))}},x=v=>{o=!0,t.source.classList.add("atf-is-dragging"),document.body.classList.add("atf-drag-active");const C=t.source.getBoundingClientRect();h=t.ghost?.offsetX??a-C.left,w=t.ghost?.offsetY??i-C.top,c=t.ghost?.element??t.source.cloneNode(!0),c.classList.add("atf-drag-ghost"),c.style.width=`${C.width}px`,document.body.appendChild(c),g(v)},g=v=>{c&&(c.style.transform=`translate3d(${v.clientX-h}px, ${v.clientY-w}px, 0)`)},f=v=>{if(l)return;if(!o){if(Math.hypot(v.clientX-a,v.clientY-i)<4)return;x(v)}g(v);const C=this.hitTest(v.clientX,v.clientY);C!==d&&(d?.onLeave?.(u),d=C,d?.onEnter?.(u))},$=v=>{if(l)return;if(!o){l=!0,y(),e.onClickOnly?.();return}const C=d;if(l=!0,y(),C&&C.accept(t)){e.onCommit?.(C),C.onDrop(u,{clientX:v.clientX,clientY:v.clientY});return}e.onCancel?.(C?"rejected":"no-target")},R=()=>u.cancel("pointercancel"),L=v=>{v.key==="Escape"&&u.cancel("escape")};return document.addEventListener("pointermove",f),document.addEventListener("pointerup",$),document.addEventListener("pointercancel",R),document.addEventListener("keydown",L),window.addEventListener("blur",R),this.active=u,u}registerDropTarget(e){return this.targets=this.targets.filter(t=>t.id!==e.id),this.targets.push(e),()=>{this.targets=this.targets.filter(t=>t.id!==e.id)}}isDragging(){return this.active!==null}recentlyEndedDrag(e=500){return Date.now()-this.lastEndMso.right||to.bottom)continue;const l=Xt(i.element);if(l>a){s=i,a=l;continue}l===a&&s&&Vt(i.element,s.element)&&(s=i)}return s}}function Xt(n){let e=0,t=n;for(;t;)e++,t=t.parentElement;return e}function Vt(n,e){return(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0}function Se(){return window.wp?.os??null}let Le=null;function K(){const n=Se();return n?.dragManager?n.dragManager:(Le||(Le=new Kt),Le)}function Jt(n){const e=a=>{const i=a.detail?.payload;return i&&n.includes(i.type)?i.source:null},t=a=>{const i=e(a);i&&(i.classList.add("atf-is-dragging"),document.body.classList.add("atf-drag-active"))},s=a=>{const i=e(a);i&&(i.classList.remove("atf-is-dragging"),document.body.classList.remove("atf-drag-active"))};return document.addEventListener("os.drag.start",t),document.addEventListener("os.drag.end",s),()=>{document.removeEventListener("os.drag.start",t),document.removeEventListener("os.drag.end",s)}}function Ee(n,e,t,s,a){const i=e.getBoundingClientRect();return a&&(a.style.width=`${Math.round(i.width)}px`,a.style.maxWidth=`${Math.round(i.width)}px`,a.style.boxSizing="border-box"),{type:n,source:e,data:t,ghost:{element:a,offsetX:s.clientX-i.left,offsetY:s.clientY-i.top,hint:{neutral:"",accept:"",reject:"",hidden:!0}}}}function Ce(n,e,t,s){const a=Array.from(n.querySelectorAll(e)).filter(i=>i!==s&&!i.classList.contains("atf-drag-ghost"));for(let i=0;ia.fetch(l,c,{source:"allterrain-forms"}):(l,c)=>fetch(l,c))(t,{credentials:"same-origin",...e,headers:s});if(!o.ok){let l=`Request failed with status ${o.status}.`,c="";try{const d=await o.json();l=d.message??l,c=d.code??""}catch{}throw new ce(l,o.status,c)}if(o.status!==204)return await o.json()}const U=n=>$e(n);async function Qt(n){if(!W?.wpRestUrl)throw new ce("AllTerrain Forms is not configured on this page.",0);const e=W.nonce?{"X-WP-Nonce":W.nonce}:{},t=Se(),s=Qe(W.wpRestUrl,n),a=t?.fetch?await t.fetch(s,{credentials:"same-origin",headers:e},{source:"allterrain-forms"}):await fetch(s,{credentials:"same-origin",headers:e});if(!a.ok)throw new ce(`Request failed with status ${a.status}.`,a.status);return await a.json()}function es(n){if(!n||!n.includes("&"))return n;const e=document.createElement("textarea");return e.innerHTML=n,e.value}const X=(n,e)=>$e(n,{method:"POST",body:JSON.stringify(e)}),de=n=>$e(n,{method:"DELETE"});function et(n){const e=new URLSearchParams;for(const[s,a]of Object.entries(n))a===void 0||a===""||a===!1||e.set(s,String(a));const t=e.toString();return t?`?${t}`:""}function he(n){const e=n?.schema?.settings;return e&&(!e.themeOverrides||Array.isArray(e.themeOverrides))&&(e.themeOverrides={...e.themeOverrides}),n}const F={config:()=>U("/config"),mailpoet:()=>U("/mailpoet"),listForms:()=>U("/forms"),listArchivedForms:()=>U("/forms?archived=1"),archiveForm:n=>X(`/forms/${n}/archive`,{}),unarchiveForm:n=>X(`/forms/${n}/unarchive`,{}),getForm:n=>U(`/forms/${n}`).then(he),createForm:n=>X("/forms",n).then(he),updateForm:(n,e)=>X(`/forms/${n}`,e).then(he),duplicateForm:n=>X(`/forms/${n}/duplicate`,{}).then(he),deleteForm:n=>de(`/forms/${n}`),preview:(n,e)=>X(`/forms/${n}/preview`,e),pages:()=>Qt("wp/v2/pages?per_page=100&status=publish&orderby=title&order=asc&_fields=id,title").then(n=>n.map(e=>({id:e.id,title:es(e.title?.rendered??"")||`#${e.id}`}))),mergeTags:n=>U(`/forms/${n}/merge-tags`).then(e=>e.groups),analytics:(n,e="")=>U(`/forms/${n}/analytics${e?`?dimension=${encodeURIComponent(e)}`:""}`),demoStatus:()=>U("/demo"),demoSeed:n=>X("/demo",n?{count:n}:{}),demoRemove:()=>de("/demo"),listEntries:n=>U(`/entries${et(n)}`),getEntry:n=>U(`/entries/${n}`),updateEntry:(n,e)=>X(`/entries/${n}`,e),deleteEntry:n=>de(`/entries/${n}`),exportEntries:n=>U(`/entries/export${et(n)}`),listThemes:()=>U("/themes"),saveTheme:n=>X("/themes",n),deleteTheme:n=>de(`/themes/${n}`)};function r(n,e={}){const t=document.createElement(n);e.class&&(t.className=e.class),e.text!==void 0&&(t.textContent=e.text),e.html!==void 0&&(t.innerHTML=e.html),e.title&&(t.title=e.title),e.type&&"type"in t&&(t.type=e.type),e.value!==void 0&&"value"in t&&(t.value=e.value),e.placeholder!==void 0&&"placeholder"in t&&(t.placeholder=e.placeholder),e.href&&"href"in t&&(t.href=e.href);for(const[s,a]of Object.entries(e.attrs??{}))a===void 0||a===!1||t.setAttribute(s,a===!0?"":String(a));Object.assign(t.style,e.style??{});for(const[s,a]of Object.entries(e.on??{}))t.addEventListener(s,a);for(const s of e.children??[])s==null||s===!1||t.append(s);return t}function O(n){n.replaceChildren()}function z(n){return r("span",{class:`dashicons ${n.startsWith("dashicons-")?n:`dashicons-${n}`}`,attrs:{"aria-hidden":"true"}})}function b(n,e,t){const s=e.matches("input, select, textarea, button")?e:e.querySelector("input, select, textarea");if(s){const a=s.id||`atf-c-${Math.random().toString(36).slice(2,9)}`;return s.id=a,r("div",{class:"atfb-row",children:[r("label",{class:"atfb-row__label",text:n,attrs:{for:a}}),e,t?r("p",{class:"atfb-row__hint",text:t}):null]})}return r("div",{class:"atfb-row",children:[r("span",{class:"atfb-row__label",text:n}),e,t?r("p",{class:"atfb-row__hint",text:t}):null]})}function T(n,e,t=""){return r("input",{class:"atfb-input",type:"text",value:n,placeholder:t,on:{input:s=>e(s.target.value)}})}function G(n,e){if(Y("os-number-field")){const t=document.createElement("os-number-field");return t.setAttribute("value",n),t.classList.add("atfb-field"),t.addEventListener("os-input-change",s=>{e(String(s.detail?.value??""))}),t}return r("input",{class:"atfb-input",type:"number",value:n,on:{input:t=>e(t.target.value)}})}function ue(n,e,t=4){const s=r("textarea",{class:"atfb-input atfb-input--area",attrs:{rows:t},on:{input:a=>e(a.target.value)}});return s.value=n,s}function I(n,e,t){if(Y("os-select")&&Y("os-option")){const s=document.createElement("os-select");s.setAttribute("value",n),s.classList.add("atfb-field");for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,s.append(i)}return s.addEventListener("os-pick",a=>{t(String(a.detail?.value??""))}),s}return r("select",{class:"atfb-input atfb-select",on:{change:s=>t(s.target.value)},children:e.map(s=>r("option",{value:s.value,text:s.label,attrs:{selected:s.value===n}}))})}function q(n,e,t){if(Y("os-checkbox-label")){const a=document.createElement("os-checkbox-label");return a.setAttribute("label",n),a.classList.add("atfb-check"),e&&a.setAttribute("checked",""),a.addEventListener("os-checkbox-change",i=>{t(!!i.detail?.checked)}),a}const s=r("input",{type:"checkbox",on:{change:a=>t(a.target.checked)}});return s.checked=e,r("label",{class:"atfb-check",children:[s,r("span",{text:n})]})}function E(n,e,t="secondary",s){const a=[s?z(s):null,r("span",{text:n})];if(Y("os-button")){const i=document.createElement("os-button");i.setAttribute("variant",t),i.setAttribute("type","button"),i.classList.add("atfb-button",`atfb-button--${t}`),i.addEventListener("click",e);for(const o of a)o&&i.append(o);return i}return r("button",{class:`atfb-button atfb-button--${t}`,type:"button",on:{click:e},children:a})}function Y(n){return typeof customElements<"u"&&!!customElements.get(n)}const ts=["os-button","os-checkbox-label","os-number-field","os-select","os-option","os-segmented","os-segment","os-color-field","os-empty-state"];let pe=null;function ss(){if(pe)return pe;const n=window.wp?.os;return pe=n?.loadComponents?n.loadComponents(ts).catch(()=>{}):Promise.resolve(),pe}async function fe(n,e=""){const t=window.wp?.os;return t?.confirm?t.confirm({title:e,message:n,danger:!0}):window.confirm(n)}function N(n,e="",t="info"){const s=window.wp?.os;if(s?.notify){s.notify({title:n,body:e,type:t});return}console.info(`[AllTerrain Forms] ${n}${e?`: ${e}`:""}`)}function ns(n){let e=0,t;return(...s)=>{t=s,!e&&(e=window.requestAnimationFrame(()=>{e=0,n(...t)}))}}function Ae(n,e){let t=0;return(...s)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...s),e)}}function as(n){try{return window.localStorage.getItem(n)??""}catch{return""}}function is(n,e){try{window.localStorage.setItem(n,e)}catch{}}function Te(n){const e=n.closest(".os-window__body");e&&(e.addEventListener("scroll",()=>{e.scrollTop&&(e.scrollTop=0),e.scrollLeft&&(e.scrollLeft=0)},{passive:!0}),e.scrollTop=0,e.scrollLeft=0)}function tt(){const n=[window];try{window.parent&&window.parent!==window&&n.push(window.parent)}catch{}return n}function rs(n){const e=n.wp?.os?.windowManager?.getAll?.()??[];for(const t of e){const s=t.iframe??t.element?.querySelector?.("iframe");if(s&&s.contentWindow===window)return t}return null}const os=4e3,ls=100;function cs(n,e){const t=Date.now()+os,s=()=>{const a=rs(n);if(a&&a.id!==e){typeof a.close=="function"?a.close():n.wp?.os?.windowManager?.remove?.(a.id);return}!a&&Date.now()0?{form:t}:void 0;t>0&&ps(t);for(const a of tt())if(a.wp?.os?.openWindow?.(e,{source:"handoff",params:s})){window.setTimeout(()=>cs(a,e),0);return}}function hs(){document.addEventListener("click",n=>{const e=n.target?.closest?.("[data-atf-open-window]");if(!e)return;n.preventDefault();const t=e.getAttribute("data-atf-open-window")??"";for(const s of tt())if(s.wp?.os?.openWindow?.(t,{source:"handoff"}))return})}const us="allterrain-forms/requested-form";function ps(n){try{window.sessionStorage.setItem(us,String(n))}catch{}}function st(n){return`allterrain-forms/requested-form-${n}`}function fs(n){try{const e=window.sessionStorage.getItem(st(n));return window.sessionStorage.removeItem(st(n)),Number(e)||0}catch{return 0}}const Me={is:"is",is_not:"is not",contains:"contains",not_contains:"does not contain",starts_with:"starts with",ends_with:"ends with",greater:"is more than",less:"is less than",greater_equal:"is at least",less_equal:"is at most",empty:"is empty",not_empty:"has any answer"},Fe=["empty","not_empty"];function nt(n,e){const t=n.find(s=>s.id===e);return t?t.label||"an untitled question":null}function at(n,e,t){return n.find(i=>i.id===e)?.choices?.find(i=>i.value===t)?.label||t}function ms(n,e){const t=Me[n.operator]??String(n.operator);if(Fe.includes(n.operator))return t;const s=at(e,n.field,n.value);return`${n.operator==="is"?"":`${t} `}${s!==""?s:"(nothing)"}`}function it(n,e,t=0){const s=nt(e,n.field),a=Me[n.operator]??String(n.operator);if(s===null)return[{kind:"field",text:"a question that no longer exists",fieldId:n.field,missing:!0}];const i=[{kind:"field",text:s,fieldId:n.field,missing:!1},{kind:"operator",text:a,operator:n.operator,ruleIndex:t}];if(Fe.includes(n.operator))return i;const o=at(e,n.field,n.value);return i.push({kind:"value",text:o!==""?o:"(nothing)",raw:n.value,sourceId:n.field,ruleIndex:t}),i}function bs(n,e){const t=n.logic;if(!t?.enabled||!t.rules.length)return[];const s=[{kind:"verb",text:t.action==="hide"?"Hidden when":"Shown when"}];return t.rules.forEach((a,i)=>{i>0&&s.push({kind:"join",text:t.match==="all"?"and":"or"}),s.push(...it(a,e,i))}),s}function rt(n){return n.map(e=>e.text).join(" ")}function gs(n,e){return rt(it(n,e))}function me(n){const e=[];for(const t of n){const s=t.logic;if(s?.enabled)for(const a of s.rules)!a.field||a.field===t.id||e.push({from:a.field,to:t.id,label:gs(a,n),short:ms(a,n),action:s.action,broken:nt(n,a.field)===null})}return e}function vs(n){const e=new Map,t=new Set;for(const s of me(n)){const a=`${s.from}->${s.to}`;s.broken||t.has(a)||(t.add(a),e.set(s.from,(e.get(s.from)??0)+1))}return e}const ot=10,lt=22,ne="http://www.w3.org/2000/svg";class ys{constructor(e){this.edges=[],this.teardowns=[],this.frame=0,this.host=e,this.svg=document.createElementNS(ne,"svg"),this.svg.setAttribute("class","atfb-logicmap"),this.svg.setAttribute("aria-hidden","true"),this.svg.setAttribute("focusable","false"),e.append(this.svg);const t=()=>this.schedule();window.addEventListener("resize",t),this.teardowns.push(()=>window.removeEventListener("resize",t));const s=e.closest(".atfb__canvas")??e;if(s.addEventListener("scroll",t,{passive:!0}),this.teardowns.push(()=>s.removeEventListener("scroll",t)),typeof ResizeObserver<"u"){const a=new ResizeObserver(t);a.observe(e),this.teardowns.push(()=>a.disconnect())}}setEdges(e){this.edges=e,this.schedule()}highlight(e){this.svg.classList.toggle("is-focused",!!e),this.svg.querySelectorAll("[data-from]").forEach(t=>{const s=e&&(t.dataset.from===e||t.dataset.to===e);t.classList.toggle("is-lit",!!s)})}destroy(){this.teardowns.forEach(e=>e()),this.teardowns=[],this.svg.remove(),this.frame&&cancelAnimationFrame(this.frame)}schedule(){this.frame||(this.frame=requestAnimationFrame(()=>{this.frame=0,this.draw()}))}draw(){this.svg.replaceChildren();const e=this.host.getBoundingClientRect();this.svg.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),this.svg.setAttribute("width",String(e.width)),this.svg.setAttribute("height",String(e.height));const t=new Map;for(const s of this.edges){const a=this.cardRect(s.from),i=this.cardRect(s.to);if(!a||!i)continue;const o=t.get(s.from)??0;t.set(s.from,o+1),this.drawEdge(s,a,i,e,o)}}cardRect(e){const t=this.host.querySelector(`[data-atfb-card="${CSS.escape(e)}"]`);return t?t.getBoundingClientRect():null}drawEdge(e,t,s,a,i){const o=t.right-a.left,l=t.top+t.height/2-a.top,c=s.right-a.left,d=s.top+s.height/2-a.top,h=Math.max(0,a.width-ot-Math.max(o,c)),w=22+i*11+Math.min(22,Math.abs(d-l)/8),y=Math.max(12,Math.min(w,h*.4)),u=document.createElementNS(ne,"path");u.setAttribute("d",`M ${o} ${l} C ${o+y} ${l}, ${c+y} ${d}, ${c} ${d}`),u.setAttribute("class",`atfb-logicmap__path is-${e.action}${e.broken?" is-broken":""}`),u.dataset.from=e.from,u.dataset.to=e.to;const x=document.createElementNS(ne,"title");x.textContent=e.label,u.append(x);const g=document.createElementNS(ne,"circle");g.setAttribute("cx",String(c)),g.setAttribute("cy",String(d)),g.setAttribute("r","3.5"),g.setAttribute("class",`atfb-logicmap__dot is-${e.action}${e.broken?" is-broken":""}`),g.dataset.from=e.from,g.dataset.to=e.to,this.svg.append(u,g);const f=document.createElementNS(ne,"text");f.setAttribute("x",String(a.width-ot)),f.setAttribute("y",String(d+3)),f.setAttribute("text-anchor","end"),f.setAttribute("class","atfb-logicmap__label"),f.dataset.from=e.from,f.dataset.to=e.to,f.textContent=e.short.length>lt?`${e.short.slice(0,lt-1)}…`:e.short;const $=document.createElementNS(ne,"title");$.textContent=e.label,f.append($),this.svg.append(f)}}const ws={text:"text",email:"text",url:"text",tel:"text",number:"text",password:"text",date:"text",time:"text",datetime:"text",date_range:"composite",textarea:"textarea",select:"select",country:"select",multiselect:"options",radio:"options",checkboxes:"options",image_choice:"options",quiz:"options",switch:"toggle",consent:"toggle",file:"file",range:"range",rating:"summary",scale:"summary",likert:"summary",signature:"summary",repeater:"repeater",color:"text",name:"composite",address:"composite",total:"text",hidden:"static",heading:"static",html:"static",divider:"static",spacer:"static",page_break:"static"};function _s(n){return ws[n]??"text"}function ct(n,e){const t=/^choice:(\d+):(label|value)$/.exec(e);return String(t?n.choices?.[Number(t[1])]?.[t[2]]??"":n[e]??"")}function V(n){const{value:e,onInput:t,onCommit:s}=n,a=r("span",{class:`${n.class} atfb-editable`,text:e,attrs:{contenteditable:"plaintext-only",role:"textbox",spellcheck:"false","data-placeholder":n.placeholder}});return n.bind&&(a.dataset.atfbBind=n.bind),a.addEventListener("pointerdown",i=>i.stopPropagation()),a.addEventListener("input",()=>t(a.textContent??"")),a.addEventListener("keydown",i=>{i.key==="Enter"&&(i.preventDefault(),a.blur()),i.key==="Escape"&&(a.textContent=e,a.blur()),i.stopPropagation()}),a.addEventListener("blur",()=>s?.()),a}function xs(n){const e=r("input",{class:"atf-choice__input",type:n==="checkboxes"||n==="multiselect"?"checkbox":"radio"});return e.disabled=!0,e}function dt(n,e,t){const s=_s(n.type),a=V({value:n.label,placeholder:"Write the question…",class:"atf-label",bind:"label",onInput:o=>t.edit(l=>{l.label=o}),onCommit:()=>t.restructure(()=>{})}),i=[s==="static"||s==="toggle"?null:a,Ss(n,e,s,t),ks(n,e,t)];return r("div",{class:"atfb-preview atf-form",children:[r("div",{class:`atf-field atf-field--${n.type}`,children:i})]})}function ks(n,e,t){if(!e?.supports.includes("hint"))return null;const s=V({value:n.hint??"",placeholder:"Add a hint…",class:"atf-hint",bind:"hint",onInput:a=>t.edit(i=>{i.hint=a})});return s.setAttribute("aria-label","Hint"),r("p",{class:"atfb-preview__hint",children:[s]})}function Ss(n,e,t,s){switch(t){case"text":return Ie(n,"atf-input",s);case"textarea":return Ie(n,"atf-input atf-textarea",s,!0);case"select":return r("div",{class:"atfb-preview__select",children:[Ie(n,"atf-input atf-select",s)]});case"options":return $s(n,s);case"toggle":return r("div",{class:n.type==="switch"?"atf-toggle atf-toggle--switch":"atf-toggle",children:[(()=>{const a=r("input",{class:"atf-toggle__input",type:"checkbox"});return a.disabled=!0,a})(),V({value:n.label||"",placeholder:n.type==="consent"?"What are they agreeing to?…":"What does this turn on?…",class:"atf-toggle__label",bind:"label",onInput:a=>s.edit(i=>{i.label=a}),onCommit:()=>s.restructure(()=>{})})]});case"file":return r("div",{class:"atf-file",children:[r("input",{class:"atf-file__input",type:"file"})]});case"range":return r("input",{class:"atf-range__input",type:"range"});case"composite":return r("div",{class:"atf-composite__parts",children:[r("span",{class:"atf-input atfb-preview__ghost",text:""}),r("span",{class:"atf-input atfb-preview__ghost",text:""})]});case"static":return As(n,e,s);case"repeater":return Ls(n,s);default:return r("div",{class:"atfb-preview__stack",children:[r("p",{class:"atfb-preview__summary",text:`${e?.label??n.type} — set this up in the panel on the right.`})]})}}function Ls(n,e){const t=n.fields??[],s=r("div",{class:"atfb-repeater__zone",attrs:{"data-atfb-repeater-zone":n.id}});return t.forEach(a=>s.append(Es(n,a,e))),t.length||s.append(r("p",{class:"atfb-repeater__empty",text:"Drag fields from the palette in here — the visitor gets a fresh copy of each with every row they add."})),r("div",{class:"atfb-repeater",attrs:{"data-atfb-repeater":n.id},children:[r("div",{class:"atf-repeater__row atfb-repeater__frame",children:[r("div",{class:"atf-repeater__row-head",children:[r("span",{class:"atf-repeater__title atfb-repeater__title",children:[V({value:String(n.itemLabel??""),placeholder:"Row",class:"atfb-repeater__item-label",bind:"itemLabel",onInput:a=>e.edit(i=>{i.itemLabel=a})}),r("span",{class:"atfb-repeater__ordinal",text:"1",attrs:{"aria-hidden":"true"}})]})]}),s]}),Cs(n,e)]})}function Es(n,e,t){const s=e.id,a=l=>c=>{const d=(c.fields??[]).find(h=>h.id===s);d&&l(d)},i={edit:l=>t.edit(a(l)),restructure:l=>t.restructure(a(l)),types:t.types,selectedId:t.selectedId},o=t.types?.(e.type);return r("div",{class:`atfb-subcard${t.selectedId===s?" is-selected":""}`,attrs:{"data-atfb-subfield":s,"data-atfb-parent":n.id,tabindex:"0",role:"button","aria-label":`${e.label||o?.label||e.type}, inside ${n.label||"the repeater"}`},children:[r("div",{class:"atfb-subcard__head",children:[r("span",{class:"atfb-subcard__type",text:o?.label??e.type}),e.required?r("span",{class:"atfb-subcard__required",text:"Required"}):null,r("button",{class:"atfb-preview__remove",type:"button",title:"Remove this field from the repeater",attrs:{"aria-label":`Remove ${e.label||o?.label||"this field"}`},on:{pointerdown:l=>l.stopPropagation(),click:l=>{l.stopPropagation(),t.restructure(c=>{const d=c.fields??[],h=d.findIndex(w=>w.id===s);h>=0&&d.splice(h,1)})}},children:[r("span",{text:"×"})]})]}),dt(e,o,i)]})}function Ie(n,e,t,s=!1){const a=V({value:n.placeholder??"",placeholder:n.type==="select"||n.type==="country"?"Choose…":"Placeholder…",class:`${e} atfb-preview__box${s?" atfb-preview__box--tall":""}`,bind:"placeholder",onInput:i=>t.edit(o=>{o.placeholder=i})});return a.setAttribute("aria-label","Placeholder"),a}function De(n,e,t,s,a,i){return r("span",{class:`atf-button ${t} atfb-preview__button`,children:[V({value:n,placeholder:e,class:"atfb-preview__button-text",bind:s,onInput:o=>a.edit(l=>i(l,o))})]})}function Cs(n,e){return De(String(n.addLabel??""),"Add another","atf-button--ghost atfb-repeater__add","addLabel",e,(t,s)=>{t.addLabel=s})}function $s(n,e){const t=r("div",{class:"atf-choices__list"});return(n.choices??[]).forEach((s,a)=>{t.append(r("div",{class:"atf-choice atfb-preview__option",children:[xs(n.type),V({value:s.label,placeholder:"Option…",class:"atf-choice__label",bind:`choice:${a}:label`,onInput:i=>{e.edit(o=>{const l=o.choices?.[a];if(!l)return;const c=!l.value||l.value===l.label;l.label=i,c&&(l.value=i)})}}),r("button",{class:"atfb-preview__remove",type:"button",title:"Remove this option",attrs:{"aria-label":`Remove ${s.label||"this option"}`},on:{pointerdown:i=>i.stopPropagation(),click:i=>{i.stopPropagation(),e.restructure(o=>{o.choices.splice(a,1)})}},children:[r("span",{text:"×"})]})]}))}),t.append(r("button",{class:"atfb-preview__add",type:"button",on:{pointerdown:s=>s.stopPropagation(),click:s=>{s.stopPropagation(),e.restructure(a=>{const i=a.choices.length+1;a.choices.push({label:`Option ${i}`,value:`Option ${i}`})})}},children:[r("span",{text:"+ Add option"})]})),r("fieldset",{class:"atf-choices",children:[t]})}function As(n,e,t){return n.type==="heading"?V({value:n.label,placeholder:"Section heading…",class:"atf-heading",bind:"label",onInput:s=>t.edit(a=>{a.label=s}),onCommit:()=>t.restructure(()=>{})}):n.type==="divider"?r("hr",{class:"atf-divider"}):n.type==="page_break"?r("div",{class:"atfb-preview__stack",children:[r("p",{class:"atfb-progress-name",children:[V({value:n.label,placeholder:"Name this step…",class:"atf-progress__label",bind:"label",onInput:s=>t.edit(a=>{a.label=s}),onCommit:()=>t.restructure(()=>{})})]}),r("p",{class:"atfb-preview__summary",text:"Everything after this is a new page."}),r("div",{class:"atf-nav atfb-preview__nav",children:[De(String(n.prevLabel??""),"Back","atf-button--secondary","prevLabel",t,(s,a)=>{s.prevLabel=a}),De(String(n.nextLabel??""),"Next","","nextLabel",t,(s,a)=>{s.nextLabel=a})]})]}):r("p",{class:"atfb-preview__summary",text:`${e?.label??n.type} — nothing is shown to the visitor here.`})}const qe=new Map;function Oe(n){let e=qe.get(n);return e||(e=F.mergeTags(n).catch(()=>[]),qe.set(n,e)),e}function Ts(n){qe.delete(n)}function Ms(n){const e=new Map;for(const t of n)for(const s of t.items)e.set(s.tag,s);return e}function Fs(n,e){const t=Ms(e);return n.replace(/\{[a-z_]+(?::[^}]*)?\}/gi,s=>{const a=t.get(s.toLowerCase());return a?a.sample:s})}function Is(n){return/\{[a-z_]+(?::[^}]*)?\}/i.test(n)}let te=null;function ie(){te?.remove(),te=null}typeof document<"u"&&(document.addEventListener("pointerdown",n=>{const e=n.target;e?.closest(".atfb-tagpick__open")||te&&!te.contains(e)&&ie()}),document.addEventListener("keydown",n=>{n.key==="Escape"&&te&&(ie(),n.stopPropagation())}));function ht(n,e){const t=n.selectionStart??n.value.length,s=n.selectionEnd??n.value.length;n.value=n.value.slice(0,t)+e+n.value.slice(s);const a=t+e.length;n.setSelectionRange(a,a),n.focus(),n.dispatchEvent(new Event("input",{bubbles:!0}))}function Ds(n){let e=n.parentElement;for(;e&&e!==document.body;){const t=getComputedStyle(e).overflowY;if(t==="auto"||t==="scroll"||t==="hidden")return e.getBoundingClientRect().bottom;e=e.parentElement}return window.innerHeight}function qs(n,e){const t=r("input",{class:"atfb-input atfb-tagpick__search",type:"search",placeholder:"Search values…",attrs:{"aria-label":"Search values"}}),s=r("div",{class:"atfb-tagpick__list"}),a=i=>{s.replaceChildren();const o=i.trim().toLowerCase();let l=0;for(const c of n){const d=c.items.filter(h=>!o||h.label.toLowerCase().includes(o)||h.tag.toLowerCase().includes(o));if(!d.length){c.empty&&!o&&!c.items.length&&s.append(r("p",{class:"atfb-tagpick__group",text:c.label}),r("p",{class:"atfb-tagpick__empty",text:c.empty}));continue}s.append(r("p",{class:"atfb-tagpick__group",text:c.label}));for(const h of d)l+=1,s.append(r("button",{class:"atfb-tagpick__item",type:"button",on:{click:()=>{e(h.tag),ie()}},children:[r("span",{class:"atfb-tagpick__item-main",children:[r("span",{class:"atfb-tagpick__label",text:h.label}),r("code",{class:"atfb-tagpick__tag",text:h.tag})]}),h.hint||h.sample?r("span",{class:"atfb-tagpick__meta",text:h.sample?`e.g. ${h.sample}`:h.hint}):null]}))}!l&&o&&s.append(r("p",{class:"atfb-tagpick__empty",text:`Nothing matches “${i}”.`}))};return a(""),t.addEventListener("input",()=>a(t.value)),r("div",{class:"atfb-tagpick",attrs:{role:"dialog","aria-label":"Insert a value"},children:[r("p",{class:"atfb-tagpick__intro",text:"Pick something to drop in. It is filled in when the form is submitted."}),t,s]})}function ut(n,e){const t=r("button",{class:"atfb-button atfb-button--ghost atfb-tagpick__open",type:"button",title:"Insert a value from the submission",children:[z("shortcode"),r("span",{text:"Insert a value"})]}),s=r("div",{class:"atfb-taggable",children:[n,r("div",{class:"atfb-taggable__tools",children:[t]})]}),a=e.preview===!1?null:r("p",{class:"atfb-taggable__preview"});a&&s.append(a);const i=()=>{if(a){if(!Is(n.value)){a.textContent="",a.hidden=!0;return}Oe(e.formId).then(o=>{a.hidden=!1,a.replaceChildren(r("span",{class:"atfb-taggable__preview-label",text:"Reads as"}),r("span",{text:Fs(n.value,o)}))})}};return n.addEventListener("input",i),i(),t.addEventListener("click",o=>{if(o.stopPropagation(),te&&s.contains(te)){ie();return}ie(),Oe(e.formId).then(l=>{const c=qs(l,d=>{ht(n,d),i()});s.append(c),te=c,(window.innerHeight-c.getBoundingClientRect().topDs(s))&&c.classList.add("atfb-tagpick--above"),c.querySelector(".atfb-tagpick__search")?.focus()})}),s}function pt(n,e){const t=parseFloat(String(n??""));return Number.isFinite(t)?t:e}function ft(n,e){let t=e[0];for(const s of e)Math.abs(s.at-n)n.accent??"#2271b1",apply:n=>({accent:n,"accent-soft":`color-mix( in srgb, ${n} 12%, transparent )`,"border-focus":n,"focus-ring-color":n,"button-bg":n,"button-bg-hover":`color-mix( in srgb, ${n} 88%, #000 )`})},{id:"roundness",label:"Roundness",hint:"Corners, everywhere at once.",kind:"scale",steps:Ne.map(({value:n,label:e})=>({value:n,label:e})),owns:["radius-field","radius-button","radius-card","radius-check"],read:n=>ft(pt(n["radius-field"],4),Ne),apply:n=>{const e=Ne.find(t=>t.value===n)?.at??4;return{"radius-field":`${e}px`,"radius-button":`${e}px`,"radius-card":`${Math.min(e*2,28)}px`,"radius-check":`${Math.min(e,6)}px`}}},{id:"density",label:"Density",hint:"How much air the form has.",kind:"scale",steps:Re.map(({value:n,label:e})=>({value:n,label:e})),owns:["pad-field-x","pad-field-y","gap-fields","gap-label","button-pad-x","button-pad-y"],read:n=>ft(pt(n["pad-field-y"],9),Re),apply:n=>{const e=Re.find(t=>t.value===n)?.at??9;return{"pad-field-y":`${e}px`,"pad-field-x":`${Math.round(e*1.4)}px`,"gap-fields":`${Math.round(e*2.2)}px`,"gap-label":`${Math.max(4,Math.round(e*.7))}px`,"button-pad-y":`${e+2}px`,"button-pad-x":`${Math.round(e*2.2)}px`}}},{id:"shadow",label:"Depth",hint:"How far the form sits off the page.",kind:"scale",steps:Os,owns:["shadow-field","shadow-field-focus","shadow-button","shadow-button-hover","shadow-card"],read:n=>{const e=n["shadow-card"]??"none";return e==="none"||e.trim()===""?n["shadow-field"]&&n["shadow-field"]!=="none"?"hard":"none":e.includes("0 1px")||e.includes("2px")?"subtle":"lifted"},apply:n=>{switch(n){case"subtle":return{"shadow-field":"none","shadow-field-focus":"none","shadow-button":"0 1px 2px rgba( 0, 0, 0, 0.12 )","shadow-button-hover":"0 2px 4px rgba( 0, 0, 0, 0.16 )","shadow-card":"0 1px 3px rgba( 0, 0, 0, 0.1 )"};case"lifted":return{"shadow-field":"none","shadow-field-focus":"0 4px 12px rgba( 0, 0, 0, 0.12 )","shadow-button":"0 4px 10px rgba( 0, 0, 0, 0.16 )","shadow-button-hover":"0 8px 20px rgba( 0, 0, 0, 0.2 )","shadow-card":"0 10px 30px rgba( 0, 0, 0, 0.14 )"};case"hard":return{"shadow-field":"3px 3px 0 currentColor","shadow-field-focus":"5px 5px 0 currentColor","shadow-button":"4px 4px 0 currentColor","shadow-button-hover":"2px 2px 0 currentColor","shadow-card":"none"};default:return{"shadow-field":"none","shadow-field-focus":"none","shadow-button":"none","shadow-button-hover":"none","shadow-card":"none"}}}},{id:"field-style",label:"Fields",hint:"How an input is drawn.",kind:"choice",steps:Ns,owns:["field-style"],read:n=>n["field-style"]??"outline",apply:n=>({"field-style":n})},{id:"labels",label:"Labels",hint:"Where the question sits relative to the answer.",kind:"choice",steps:Rs,owns:["label-position"],read:n=>n["label-position"]??"top",apply:n=>({"label-position":n})}]}function Ps(n){return Pe().find(e=>e.owns.includes(n))??null}function mt(n){let e=n.activeSlug,t={...n.overrides},s=n.themes;const a=p=>{t=p,n.onOverridesReplaced?.({...p})},i=r("div",{class:"atfs-preview__frame"}),o=r("div",{class:"atfs-controls__body"}),l=r("div",{class:"atfs-quick"}),c=r("div",{class:"atfs-themes"}),d=Ae(async()=>{try{const p=await n.previewFor(e,t),m=i.closest(".atf-studio__preview"),_=m?.scrollTop??0;i.innerHTML=p,m&&(m.scrollTop=_),document.dispatchEvent(new CustomEvent("atf-refresh"))}catch(p){O(i),i.append(r("p",{class:"atfb-error",text:p instanceof Error?p.message:"Preview failed."}))}},180),h={"label-position":"atf-labels-","field-style":"atf-fields-"},w=(p,m,_)=>{const S=_.replace(/[^a-z0-9_-]/gi,"");for(const A of[...p.classList])A.startsWith(m)&&p.classList.remove(A);S&&p.classList.add(m+S)},y=p=>{const m=i.querySelector(".atf-form-wrap"),_=m?.querySelector(".atf-form");if(m)for(const[S,A]of Object.entries(p))A===""?m.style.removeProperty(`--atf-${S}`):m.style.setProperty(`--atf-${S}`,A),_&&h[S]&&w(_,h[S],A||(s.find(P=>P.slug===e)?.resolved[S]??""))},u=p=>{y(p.resolved);const m=i.querySelector(".atf-form");m&&(w(m,"atf-theme-",p.slug),m.classList.toggle("atf-is-dark",!!p.dark))},x=p=>t[p.token]!==void 0?t[p.token]:s.find(_=>_.slug===e)?.resolved?.[p.token]??p.default,g=()=>{O(c);for(const p of s){const m=r("button",{class:`atfs-theme${p.slug===e?" is-active":""}`,type:"button",attrs:{"aria-pressed":p.slug===e,title:p.description},children:[r("span",{class:"atfs-theme__chip",style:{background:p.resolved.surface??"#fff",borderColor:p.resolved.border??"#ccc",borderRadius:p.resolved["radius-field"]??"4px",boxShadow:p.resolved["shadow-card"]??"none"},children:[r("span",{class:"atfs-theme__accent",style:{background:p.resolved.accent??"#2271b1",borderRadius:p.resolved["radius-button"]??"4px"}})]}),r("span",{class:"atfs-theme__name",text:p.label}),p.custom?r("span",{class:"atfb-badge",text:"yours"}):null],on:{click:()=>{e=p.slug,a({}),n.onTheme(e),u(p),g(),L(),R(),Yt()}}});c.append(m)}},f=()=>{const m={...s.find(_=>_.slug===e)?.resolved??{}};for(const[_,S]of Object.entries(t))m[_]=S;return m},$=p=>{const m=l.closest(".atf-studio__controls"),_=m?.scrollTop??0;p(),m&&(m.scrollTop=_)},R=Ae(()=>$(k),150),L=()=>{const p=f(),m=l.querySelectorAll(".atfs-dial");Pe().forEach((_,S)=>{const A=m[S];if(!A)return;const P=_.read(p);if(_.kind==="colour"){const D=A.querySelector('input[type="color"]'),Z=A.querySelector("input.atfb-input");D&&document.activeElement!==D&&(D.value=be(P)),Z&&document.activeElement!==Z&&(Z.value=P);return}A.querySelectorAll(".atfs-segment").forEach((D,Z)=>{const Q=_.steps?.[Z]?.value===P;D.classList.toggle("is-on",Q),D.setAttribute("aria-pressed",String(Q))})})},v=(p,m)=>{const _=p.apply(m,f());for(const[S,A]of Object.entries(_))t[S]=A,n.onOverride(S,A);y(_),L(),R()},C=()=>{O(l);const p=f();for(const m of Pe()){const _=m.read(p);let S;if(m.kind==="colour"){const A=r("input",{class:"atfs-color",type:"color",value:be(_),attrs:{"aria-label":m.label},on:{input:P=>v(m,P.target.value)}});S=r("div",{class:"atfs-color-row",children:[A,T(_,P=>v(m,P))]})}else S=r("div",{class:`atfs-segmented atfs-segmented--${m.kind}`,attrs:{role:"group","aria-label":m.label},children:(m.steps??[]).map(A=>r("button",{class:`atfs-segment${A.value===_?" is-on":""}`,type:"button",text:A.label,attrs:{"aria-pressed":A.value===_},on:{click:()=>v(m,A.value)}}))});l.append(r("div",{class:"atfs-dial",children:[r("div",{class:"atfs-dial__head",children:[r("span",{class:"atfs-dial__label",text:m.label}),r("span",{class:"atfs-dial__hint",text:m.hint})]}),S]}))}},k=()=>{O(o);const p=new Map;for(const _ of n.tokens){const S=p.get(_.group)??[];S.push(_),p.set(_.group,S)}const m={colour:"Colour",shape:"Corners and borders",shadow:"Shadows",fields:"Field style",space:"Spacing",type:"Type",labels:"Labels",button:"Buttons",focus:"Focus ring",motion:"Motion"};for(const[_,S]of p)o.append(r("details",{class:"atfs-group",attrs:{open:_==="colour"},children:[r("summary",{text:m[_]??_}),...S.map(A=>B(A))]}))},B=p=>{const m=x(p),_=D=>{D===""?delete t[p.token]:t[p.token]=D,n.onOverride(p.token,D),y({[p.token]:D})};let S;if(p.control==="color"){const D=r("input",{class:"atfs-color",type:"color",value:be(m),attrs:{"aria-label":`${p.label} colour`},on:{input:Q=>{const le=Q.target.value;Z.value=le,_(le)}}}),Z=T(m,Q=>{D.value=be(Q),_(Q)});S=r("div",{class:"atfs-color-row",children:[D,Z]})}else if(p.control==="select")S=I(m,(p.options??[]).map(D=>({value:D,label:D})),_);else if(p.control==="length"){const D=parseFloat(m)||0,Z=p.unit??"px",Q=p.token.includes("radius")?60:80,le=r("input",{class:"atfs-range",type:"range",value:String(D),attrs:{min:"0",max:String(Q),step:"1","aria-label":p.label},on:{input:ke=>{const Zt=`${ke.target.value}${Z}`;Gt.value=Zt,_(Zt)}}}),Gt=T(m,ke=>{le.value=String(parseFloat(ke)||0),_(ke)});S=r("div",{class:"atfs-length-row",children:[le,Gt]})}else S=T(m,_);const A=b(p.label,S),P=Ps(p.token);return P&&(A.classList.add("is-dialled"),A.append(r("span",{class:"atfs-owned",text:P.label}))),t[p.token]!==void 0&&(A.classList.add("is-overridden"),A.append(r("button",{class:"atfs-reset",type:"button",text:"Reset",attrs:{"aria-label":`Reset ${p.label} to the theme's value`},on:{click:()=>{_(""),$(k)}}}))),A},M=async()=>{const p=s.find(S=>S.slug===e),m=p?`${p.label} (mine)`:"My theme",_=window.prompt("Name this theme",m);if(_)try{const S={};for(const P of n.tokens){const D=x(P);D!==P.default&&(S[P.token]=D)}const A=await F.saveTheme({label:_,tokens:S});s=[...s.filter(P=>P.slug!==A.slug),A],n.onThemesChanged(s),e=A.slug,a({}),n.onTheme(e),g(),L(),$(k),N("Theme saved",A.label)}catch(S){N("Could not save the theme",S instanceof Error?S.message:"","error")}},j=async()=>{const p=s.find(m=>m.slug===e);if(p?.custom&&await fe(`Delete “${p.label}”? Forms using it fall back to Clean.`,"Delete theme"))try{await F.deleteTheme(p.id),s=s.filter(_=>_.slug!==p.slug),n.onThemesChanged(s),e="clean",a({}),n.onTheme(e),g(),L(),$(k);const m=s.find(_=>_.slug===e);m&&u(m)}catch(m){N("Could not delete the theme",m instanceof Error?m.message:"","error")}},H=async()=>{const p=s.find(S=>S.slug===e),m={label:p?.label??e,tokens:{...p?.tokens??{},...t}},_=JSON.stringify(m,null," ");try{await navigator.clipboard.writeText(_),N("Theme copied","Paste it into another site to import it.")}catch{window.prompt("Copy this theme",_)}},oe=()=>{const p=window.prompt("Paste a theme");if(p)try{const m=JSON.parse(p);if(!m.tokens||typeof m.tokens!="object")throw new Error("That does not look like a theme.");for(const[_,S]of Object.entries(m.tokens))t[_]=String(S),n.onOverride(_,String(S));y({...t}),L(),$(k)}catch(m){N("Could not read that theme",m instanceof Error?m.message:"","error")}},zt=E("Delete",()=>void j(),"danger"),Yt=()=>{const p=s.find(m=>m.slug===e);zt.hidden=!p?.custom};return g(),C(),k(),d(),Yt(),r("div",{class:"atf-studio",children:[r("div",{class:"atf-studio__top",children:[r("div",{class:"atf-studio__topbar",children:[r("h2",{class:"atf-studio__heading",text:"Theme"}),r("div",{class:"atfs__actions",children:[E("Save as a theme",()=>void M(),"primary"),E("Export",()=>void H()),E("Import",oe),zt]})]}),c]}),r("div",{class:"atf-studio__panes",children:[r("aside",{class:"atf-studio__controls",children:[r("p",{class:"atfb-hint",text:"Changes apply to this form only, until you save them as a theme."}),l,r("details",{class:"atfs-advanced",children:[r("summary",{text:"Every setting"}),r("p",{class:"atfb-hint",text:"The full token list. The dials above write into it."}),o]})]}),r("main",{class:"atf-studio__preview",children:[r("h2",{class:"screen-reader-text",text:"Live preview"}),i]})]})]})}async function Be(){const n=document.querySelector("[data-atfs-root]");if(!n||n.dataset.atfsMounted)return;n.dataset.atfsMounted="1",Te(n);const e=n.querySelector("[data-atfs-bar]"),t=n.querySelector(".atfs__body")??n;try{const[s,a,i]=await Promise.all([F.config(),F.listThemes(),F.listForms()]);if(!i.length){O(t),t.append(r("div",{class:"atfb-empty",children:[r("h2",{text:"No forms to preview"}),r("p",{text:"Make a form first — a theme needs something to dress."})]}));return}let o=i[0],l={},c=o.theme;const d=()=>{O(t),t.append(mt({themes:a,tokens:s.tokens,activeSlug:c,overrides:l,standalone:!0,onTheme:h=>{c=h},onOverride:(h,w)=>{w===""?delete l[h]:l[h]=w},onOverridesReplaced:h=>{l={...h}},previewFor:async(h,w)=>{const y=await F.getForm(o.id);y.schema.settings.theme=h,y.schema.settings.themeOverrides=w;const{html:u}=await F.preview(o.id,{schema:y.schema,theme:h});return u},onThemesChanged:h=>{a.length=0,a.push(...h)}}))};e&&(O(e),e.append(r("span",{class:"atfs__label",text:"Preview against"}),I(String(o.id),i.map(h=>({value:String(h.id),label:h.title||"(untitled)"})),h=>{o=i.find(w=>String(w.id)===h)??i[0],l={},d()}))),d()}catch(s){O(t),t.append(r("p",{class:"atfb-error",text:s instanceof Error?s.message:"Could not load themes."}))}}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>void Be()):Be(),document.addEventListener("os-window-content-loaded",()=>void Be()));function be(n){const e=n.trim();return/^#[0-9a-f]{6}$/i.test(e)?e:/^#[0-9a-f]{3}$/i.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:"#888888"}const Bs="mailpoet",ge="",Hs=["checkbox","checkboxes","toggle","consent","gdpr"],bt=["email"];function gt(n){return n.schema.actions.find(e=>e.type==="mailpoet")}function He(n){const e=n?.settings??{};return{lists:Array.isArray(e.lists)?e.lists.map(Number).filter(Boolean):[],email_field:typeof e.email_field=="string"?e.email_field:"",first_name_field:typeof e.first_name_field=="string"?e.first_name_field:"",last_name_field:typeof e.last_name_field=="string"?e.last_name_field:""}}function js(n){return n?.logic?.enabled?n.logic.rules[0]?.field??ge:ge}function vt(n,e,t){const s=n.find(a=>e.includes(a.type));return s?s.id:t?n.find(a=>t.test(a.label))?.id??"":""}function Ws(n,e,t){const s=r("section",{class:"atfm-form"}),a=o=>{O(s),s.classList.remove("is-open"),s.append(r("div",{class:"atfm-form__head",children:[r("div",{class:"atfm-form__title",children:[r("strong",{text:n.title||`Form ${n.id}`}),o.length?r("span",{class:"atfm-form__status is-on",text:`Subscribing → ${o.join(", ")}`}):r("span",{class:"atfm-form__status",text:"Not connected"})]}),E(o.length?"Edit":"Connect",()=>void i(),"secondary")]}))},i=async()=>{s.classList.add("is-open"),O(s),s.append(r("p",{class:"atfm-hint",text:"Loading the form…"}));let o;try{o=await F.getForm(n.id)}catch{O(s),s.append(r("p",{class:"atfm-hint",text:"Could not load this form."}));return}const l=o.schema.fields.filter(v=>v.type!=="page_break"),c=gt(o),d=He(c),h=new Set(d.lists.filter(v=>e.lists.some(C=>C.id===v)));let w=js(c),y=d.email_field||vt(l,bt,/mail/i),u=d.first_name_field,x=d.last_name_field;l.some(v=>v.id===y)||(y=vt(l,bt,/mail/i));const g=l.filter(v=>Hs.includes(v.type));!c&&g.length&&(w=g[0].id);const f=(v,C)=>[{value:"",label:C},...v.map(k=>({value:k.id,label:k.label||k.id}))],$=r("div",{class:"atfm-lists"});(()=>{O($);for(const v of e.lists){const C=r("input",{attrs:{type:"checkbox"}});C.checked=h.has(v.id),C.addEventListener("change",()=>{C.checked?h.add(v.id):h.delete(v.id)}),$.append(r("label",{class:"atfm-list",children:[C,r("span",{text:v.name})]}))}})();const L=async(v=!1)=>{const C=o.schema.actions.filter(k=>k.type!=="mailpoet");if(!v){if(!h.size){N("Pick a list","A subscription needs at least one MailPoet list.","error");return}if(!y){N("Pick the email field","MailPoet needs to know which answer is the address.","error");return}C.push({id:Bs,type:"mailpoet",enabled:!0,logic:w===ge?{enabled:!1,action:"show",match:"all",rules:[]}:{enabled:!0,action:"show",match:"all",rules:[{field:w,operator:"not_empty",value:""}]},settings:{lists:[...h],email_field:y,first_name_field:u,last_name_field:x}})}o.schema.actions=C;try{await F.updateForm(o.id,{schema:o.schema})}catch(k){N("Could not save",k instanceof Error?k.message:"","error");return}N(v?"Disconnected":"Connected to MailPoet",v?`${n.title} no longer subscribes anyone.`:`${n.title} now subscribes opted-in visitors.`),a(v?[]:e.lists.filter(k=>h.has(k.id)).map(k=>k.name))};O(s),s.append(r("div",{class:"atfm-form__head",children:[r("div",{class:"atfm-form__title",children:[r("strong",{text:n.title||`Form ${n.id}`})]}),E("Close",()=>a(c?e.lists.filter(v=>He(c).lists.includes(v.id)).map(v=>v.name):[]),"ghost")]}),r("div",{class:"atfm-form__body",children:[b("Lists",$,"Where the subscriber lands. MailPoet sends its own confirmation email first."),b("Email address",I(y,f(l,"— pick a field —"),v=>{y=v}),"The answer that carries their address."),b("First name",I(u,f(l,"— none —"),v=>{u=v})),b("Last name",I(x,f(l,"— none —"),v=>{x=v})),b("Subscribe",I(w,[...g.map(v=>({value:v.id,label:`Only when “${v.label||v.id}” is ticked`})),{value:ge,label:"Everyone who submits"}],v=>{w=v}),g.length?"Bind it to a box they tick. Subscribing everyone is rarely what visitors expect.":"Add a checkbox or toggle field to the form to offer a proper opt-in."),r("div",{class:"atfm-form__actions",children:c?[E("Save connection",()=>void L(),"primary"),E("Disconnect",()=>void L(!0),"danger")]:[E("Save connection",()=>void L(),"primary")]})]}))};return a([]),F.getForm(n.id).then(o=>{const l=gt(o);if(l&&!s.classList.contains("is-open")){const c=e.lists.filter(d=>He(l).lists.includes(d.id)).map(d=>d.name);a(c)}}).catch(()=>{}),t.append(s),s}function Us(n){const e=n.logo?r("span",{class:"atfm-hero__logo",children:[r("img",{attrs:{src:n.logo,alt:"MailPoet",width:"108",height:"65"}})]}):r("span",{class:"atfm-hero__logo atfm-hero__logo--glyph",text:"📬"});return r("header",{class:"atfm-hero",children:[e,r("div",{class:"atfm-hero__words",children:[r("h1",{text:"Grow your audience where it begins"}),r("p",{text:"Every submission is someone choosing to talk to you. Connect a form to MailPoet and the ones who opt in land on your lists by themselves — named, consented, and confirmed by MailPoet’s own double opt-in."}),n.active?r("p",{class:"atfm-hero__status is-on",text:n.lists.length===1?"Connected — 1 list available":`Connected — ${n.lists.length} lists available`}):r("p",{class:"atfm-hero__status",text:"MailPoet is not installed on this site yet."})]})]})}async function je(){const n=document.querySelector("[data-atfm-root]");if(!n||n.dataset.atfmMounted)return;n.dataset.atfmMounted="1",Te(n);const e=n.querySelector("[data-atfm-bar]"),t=n.querySelector("[data-atfm-body]")??n;try{const[s,a]=await Promise.all([F.mailpoet(),F.listForms()]);if(e?.remove(),O(t),t.append(Us(s)),!s.active){t.append(r("div",{class:"atfm-pitch",children:[r("p",{text:"MailPoet sends newsletters from right inside WordPress — no external account, free to start. Install it and every form here gets a subscribe switch: reservations feed your announcements, signups feed your schedule, enquiries feed your news."}),r("a",{class:"atfm-pitch__cta",text:"Install MailPoet",attrs:{href:s.adminUrl,target:"_blank",rel:"noreferrer"}})]}));return}if(!s.lists.length){t.append(r("div",{class:"atfm-pitch",children:[r("p",{text:"MailPoet is here, but it has no list yet. Make one, and your forms will have somewhere to send subscribers."}),r("a",{class:"atfm-pitch__cta",text:"Open MailPoet lists",attrs:{href:s.adminUrl,target:"_blank",rel:"noreferrer"}})]}));return}const i=r("section",{class:"atfm-forms",children:[r("h2",{text:"Your forms"}),r("p",{class:"atfm-hint",text:"Pick a form, choose its lists, and bind the subscription to an opt-in the visitor actually ticks."})]});if(t.append(i),!a.length){i.append(r("p",{class:"atfm-hint",text:"No forms yet — make one, then come back to connect it."}));return}for(const o of a)Ws(o,s,i)}catch{e&&(e.textContent="Could not reach the site — reload the window to try again.")}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>void je()):je(),document.addEventListener("os-window-content-loaded",()=>void je());const ve={plain:"",simple:"✓",minimal:"",card:"🎉",check:"",confetti:"🎉",fireworks:"🎆",sparkles:"✨",typewriter:""};function yt(){return{style:"simple",title:"",icon:"",accent:"",intensity:"medium",showButton:!1,buttonLabel:""}}function We(n){const e={...yt(),...n??{}};return e.style in ve||(e.style="simple"),e}function zs(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Ys(n,e,t){const s=We(e),a=document.createElement("div");if(a.className=`atf-confirmation atf-success atf-success--${s.style}`,a.setAttribute("role","status"),a.setAttribute("tabindex","-1"),s.style==="plain")return a.className="atf-confirmation",a.innerHTML=n,a;s.accent&&a.style.setProperty("--atf-accent",s.accent);const i=document.createElement("div");i.className="atf-success__inner",a.append(i);const o=s.icon||ve[s.style];if(s.style==="check")i.insertAdjacentHTML("beforeend",'');else if(o){const c=document.createElement("span");c.className="atf-success__icon",c.setAttribute("aria-hidden","true"),c.textContent=o,i.append(c)}if(s.title){const c=document.createElement("h2");c.className="atf-success__title",c.textContent=s.title,i.append(c)}const l=document.createElement("div");if(l.className="atf-success__message",l.innerHTML=n,i.append(l),s.style==="typewriter"&&a.setAttribute("aria-label",l.textContent??""),s.showButton){const c=document.createElement("button");c.type="button",c.className="atf-button atf-button--ghost atf-success__again",c.textContent=s.buttonLabel||"Fill it in again",c.addEventListener("click",()=>t?t():window.location.reload()),i.append(c)}return a}function Gs(n,e){const t=We(e);if(zs())return()=>{};switch(t.style){case"confetti":return Zs(n,t);case"fireworks":return Ks(t);case"sparkles":return Xs(n,t);case"typewriter":return Vs(n);default:return()=>{}}}function re(n){return{low:.5,medium:1,high:1.8}[n.intensity]}function wt(){const n=document.createElement("canvas");n.className="atf-success-canvas",n.setAttribute("aria-hidden","true");const e=Math.min(window.devicePixelRatio||1,2);n.width=Math.floor(window.innerWidth*e),n.height=Math.floor(window.innerHeight*e),document.body.append(n);const t=n.getContext("2d");return t?.scale(e,e),{canvas:n,ctx:t,stop:()=>n.remove()}}const _t=["#f43f5e","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ec4899","#eab308"];function Zs(n,e){const{ctx:t,stop:s}=wt();if(!t)return s(),()=>{};const a=e.accent?[e.accent,..._t]:_t,i=[],o=n.getBoundingClientRect(),l=o.left+o.width/2,c=Math.min(o.top+40,window.innerHeight-20),d=($,R,L)=>{const v=L?Math.PI*(1.15+.7*Math.random()):0,C=L?9+Math.random()*8:0;return{x:$,y:R,vx:L?Math.cos(v)*C*(Math.random()<.5?1:-1):(Math.random()-.5)*1.5,vy:L?Math.sin(v)*C:1+Math.random()*2,w:6+Math.random()*5,h:8+Math.random()*7,angle:Math.random()*Math.PI,spin:(Math.random()-.5)*.3,color:a[Math.floor(Math.random()*a.length)],wobble:Math.random()*Math.PI*2}},h=Math.round(90*re(e));for(let $=0;${if(y>=w){window.clearInterval(u);return}i.push(d(Math.random()*window.innerWidth,-20,!1)),y++},2e3/w);let x=0;const g=performance.now(),f=$=>{t.clearRect(0,0,window.innerWidth,window.innerHeight);let R=!1;for(const L of i)L.vy+=.16,L.vx*=.99,L.vy*=.985,L.wobble+=.1,L.x+=L.vx+Math.sin(L.wobble)*.8,L.y+=L.vy,L.angle+=L.spin,L.y{window.clearInterval(u),window.cancelAnimationFrame(x),s()}}function Ks(n){const{ctx:e,stop:t}=wt();if(!e)return t(),()=>{};const s=[],a=[],i=Math.round(6*re(n))+2;let o=0;const l=()=>{s.push({x:window.innerWidth*(.15+.7*Math.random()),y:window.innerHeight,vy:-(9+Math.random()*4),targetY:window.innerHeight*(.15+.3*Math.random()),hue:Math.floor(Math.random()*360)}),o++};l();const c=window.setInterval(()=>{if(o>=i){window.clearInterval(c);return}l()},3500/i),d=u=>{const x=Math.round(70*re(n));for(let g=0;g{e.clearRect(0,0,window.innerWidth,window.innerHeight);for(let g=s.length-1;g>=0;g--){const f=s[g];f.y+=f.vy,f.vy+=.08,e.fillStyle=`hsl(${f.hue} 90% 65%)`,e.fillRect(f.x-1.5,f.y,3,10),(f.y<=f.targetY||f.vy>=-1)&&(d(f),s.splice(g,1))}for(let g=a.length-1;g>=0;g--){const f=a[g];if(f.x+=f.vx,f.y+=f.vy,f.vy+=.045,f.vx*=.985,f.vy*=.985,f.life-=f.decay,f.life<=0){a.splice(g,1);continue}const $=f.life*(.7+.3*Math.random());e.globalAlpha=Math.max(0,$),e.fillStyle=`hsl(${f.hue} 95% ${55+25*f.life}%)`,e.beginPath(),e.arc(f.x,f.y,1.1+1.6*f.life,0,Math.PI*2),e.fill()}e.globalAlpha=1,!(o>=i&&s.length===0&&a.length===0)&&u-w<9e3?h=window.requestAnimationFrame(y):t()};return h=window.requestAnimationFrame(y),()=>{window.clearInterval(c),window.cancelAnimationFrame(h),t()}}function Xs(n,e){const t=e.icon||ve.sparkles,s=Math.round(22*re(e)),a=[];let i=0;const o=()=>{const c=document.createElement("span");c.className="atf-success__spark",c.setAttribute("aria-hidden","true"),c.textContent=t,c.style.insetInlineStart=`${4+Math.random()*92}%`,c.style.animationDuration=`${2.6+Math.random()*1.8}s`,c.style.animationDelay=`${Math.random()*.3}s`,c.style.fontSize=`${14+Math.random()*14}px`,c.addEventListener("animationend",()=>c.remove()),n.append(c),a.push(c),i++};o();const l=window.setInterval(()=>{if(i>=s){window.clearInterval(l);return}o()},2800/s);return()=>{window.clearInterval(l),a.forEach(c=>c.remove())}}function Vs(n){const e=n.querySelector(".atf-success__message");if(!e)return()=>{};const t=e.innerHTML,s=e.textContent??"";if(!s)return()=>{};e.textContent="",e.classList.add("is-typing");const a=Math.min(45,3800/s.length);let i=0;const o=window.setInterval(()=>{i++,e.textContent=s.slice(0,i),i>=s.length&&(window.clearInterval(o),e.classList.remove("is-typing"),e.innerHTML=t)},a);return()=>{window.clearInterval(o),e.classList.remove("is-typing"),e.innerHTML=t}}const Js={min:-1,max:-1,sum:-1,avg:-1,round:-1,ceil:1,floor:1,abs:1,sqrt:1,pow:2},xt={"+":{precedence:1,right:!1},"-":{precedence:1,right:!1},"*":{precedence:2,right:!1},"/":{precedence:2,right:!1},"%":{precedence:2,right:!1},"^":{precedence:4,right:!0}};function Qs(n,e,t=[]){if(!n||!n.trim()||n.length>2e3)return null;const s=en(n,e,t),a=an(s);if(!a)return null;const i=on(a);if(!i)return null;const o=ln(i);return o===null||!Number.isFinite(o)?null:o}function en(n,e,t){return n.replace(/\{([a-zA-Z0-9_]+)(?:\.([a-zA-Z0-9_]+))?\}/g,(s,a,i,o)=>tn(n,o,s.length,a,i??"",e,t))}function tn(n,e,t,s,a,i,o){const l=sn(o,s),c=Object.prototype.hasOwnProperty.call(i,s)?i[s]:null;if(a===""){const u=l?.type==="repeater"?kt(c).length:Ue(c,l);return St(u)}const h=(l?.fields??[]).find(u=>u.id===a)??null,w=kt(c).map(u=>Ue(u[a]??"",h));if(!w.length)return"0";const y=w.map(St);return nn(n,e,t)?y.join(", "):y.length===1?y[0]:`( ${y.join(" + ")} )`}function sn(n,e){for(const t of n){if(t.id===e)return t;for(const s of t.fields??[])if(s.id===e)return s}return null}function nn(n,e,t){const s=n.slice(e+t).replace(/^\s+/,"");if(s===""||s[0]!==")")return!1;const a=n.slice(0,e).replace(/\s+$/,""),i=/([a-zA-Z_][a-zA-Z0-9_]*)\s*\($/.exec(a);return!!i&&["sum","avg","min","max"].includes(i[1].toLowerCase())}function kt(n){if(!Array.isArray(n))return[];const e=[];for(const t of n){if(!t||typeof t!="object"||Array.isArray(t))continue;Object.values(t).some(a=>a!==""&&a!==null&&a!==void 0&&a!==!1&&!(Array.isArray(a)&&!a.length))&&e.push(t)}return e}function St(n){const e=n.toFixed(10).replace(/0+$/,"").replace(/\.$/,"");return e===""||e==="-"?"0":e}function Ue(n,e){if(typeof n=="boolean")return n?1:0;if(Array.isArray(n))return n.reduce((a,i)=>a+Ue(i,e),0);if(n==null||n==="")return 0;const t=e?.choices??[];for(const a of t)if(String(a.value)===String(n)){if(typeof a.price=="number")return a.price;if(typeof a.points=="number")return a.points;break}const s=Number(n);return Number.isFinite(s)?s:0}function an(n){const e=[];let t=0;for(;ti.precedence||l.precedence===i.precedence&&!i.right){e.push(t.pop());continue}break}t.push(a);break}case"(":t.push(a);break;case")":{for(;t.length&&t[t.length-1].type!=="(";)e.push(t.pop());if(!t.length)return null;if(t.pop(),t.length&&t[t.length-1].type==="function"){const i=t.pop();i.arity=s.length?s.pop():1,e.push(i)}break}}for(;t.length;){const a=t.pop();if(a.type==="(")return null;e.push(a)}return e}function ln(n){const e=[];for(const t of n)switch(t.type){case"number":e.push(t.value);break;case"unary":{if(!e.length)return null;e.push(-e.pop());break}case"operator":{if(e.length<2)return null;const s=e.pop(),a=e.pop();switch(t.value){case"+":e.push(a+s);break;case"-":e.push(a-s);break;case"*":e.push(a*s);break;case"/":e.push(s===0?0:a/s);break;case"%":e.push(s===0?0:a%s);break;case"^":e.push(Math.pow(a,s));break;default:return null}break}case"function":{const s=t.arity??1;if(e.lengtht+s,0);case"avg":return e.reduce((t,s)=>t+s,0)/e.length;case"round":{const t=Math.max(-10,Math.min(10,Math.trunc(e[1]??0))),s=Math.pow(10,t);return Math.round(e[0]*s)/s}case"ceil":return Math.ceil(e[0]);case"floor":return Math.floor(e[0]);case"abs":return Math.abs(e[0]);case"sqrt":return e[0]<0?0:Math.sqrt(e[0]);case"pow":return Math.pow(e[0],e[1]??2);default:return null}}const dn=["sum","min","max","avg","round","ceil","floor","abs","sqrt","pow"],Lt=["number","range","scale","rating","total","select","multiselect","radio","checkboxes","switch","quiz"];function ze(n,e){return n.filter(t=>t.id!==e&&Lt.includes(t.type))}function hn(n){const e=[];for(const t of n){if(t.type!=="repeater")continue;const s=t.label||t.id;e.push({label:`${s} (how many)`,insert:`{${t.id}}`});for(const a of t.fields??[])Lt.includes(a.type)&&e.push({label:`${s} · ${a.label||a.id}`,insert:`{${t.id}.${a.id}}`})}return e}function un(n,e){const t={};ze(n,e).forEach((s,a)=>{t[s.id]=a+1});for(const s of n){if(s.type!=="repeater"||s.id===e)continue;const a=s.fields??[],i=o=>Object.fromEntries(a.map((l,c)=>[l.id,c+1+o]));t[s.id]=[i(0),i(1)]}return t}function pn(n){const e=r("div",{class:"atfb-overlay"}),t=()=>{e.remove(),document.removeEventListener("keydown",s)},s=u=>{u.key==="Escape"&&t()},a=r("textarea",{class:"atfb-input atfb-formula__input",attrs:{rows:"3","aria-label":"Formula"}});a.value=String(n.field.formula??"");const i=r("p",{class:"atfb-formula__result",attrs:{"aria-live":"polite"}}),o=un(n.fields,n.field.id),l=()=>{const u=a.value.trim();if(u===""){i.textContent="Empty. Reference a question below to start.",i.classList.remove("is-error");return}const x=Qs(u,o,n.fields);if(x===null){i.textContent="This does not compute yet — check the braces and parentheses.",i.classList.add("is-error");return}const g=ze(n.fields,n.field.id).map((f,$)=>`${f.label||f.id} = ${$+1}`).concat(n.fields.filter(f=>f.type==="repeater"&&f.id!==n.field.id).map(f=>`${f.label||f.id} = 2 sample rows`)).join(", ");i.textContent=`With sample answers (${g}): ${x}`,i.classList.remove("is-error")};a.addEventListener("input",l);const c=(u,x,g=0)=>r("button",{class:"atfb-formula__chip",type:"button",text:u,on:{click:()=>{if(ht(a,x),g>0){const f=(a.selectionStart??a.value.length)-g;a.setSelectionRange(f,f)}}}}),d=ze(n.fields,n.field.id),h=hn(n.fields),w=r("div",{class:"atfb-formula__chips",children:d.length||h.length?[...d.map(u=>c(u.label||u.id,`{${u.id}}`)),...h.map(u=>c(u.label,u.insert))]:[r("p",{class:"atfb-hint",text:"No number-shaped questions yet — add a number, scale or priced choice field and it appears here."})]}),y=r("div",{class:"atfb-formula__chips",children:dn.map(u=>c(`${u}()`,`${u}()`,1))});e.append(r("div",{class:"atfb-modal atfb-formula",attrs:{role:"dialog","aria-label":"Formula editor"},children:[r("h2",{text:"Formula"}),a,i,b("Your questions",w,"Click one to reference its answer."),b("Functions",y),r("div",{class:"atfb-modal__actions",children:[E("Cancel",t),E("Save formula",()=>{n.onSave(a.value.trim()),t()},"primary")]})]})),e.addEventListener("click",u=>{u.target===e&&t()}),document.addEventListener("keydown",s),n.root.append(e),l(),a.focus(),a.setSelectionRange(a.value.length,a.value.length)}const fn="allterrain-forms/form";function mn(){return window.wp?.os?.relations??null}function Et(n){const e=n.closest("[data-window-id], .os-window");if(!e)return null;const t=e.getAttribute("data-window-id");if(t)return t;const s=e.id??"";return s?s.replace(/^wp-window-/,""):null}const bn=6e3,Ct=120;function $t(n,e){const t=mn();if(Ye.set(n,e),!t?.set)return;const s=i=>{if(ye.get(n)!==a)return;const o=Et(n);if(!o){Date.now()s(i),Ct);return}try{t.set(o,e)}catch(c){At||(At=!0,console.error("[AllTerrain Forms] The shell refused a window identity.",c,e)),ye.delete(n);return}if(!e||t.get?.(o)?.id===e.id||Date.now()>=i){ye.delete(n);return}window.setTimeout(()=>s(i),Ct)},a=Symbol("atf-identity");ye.set(n,a),s(Date.now()+bn)}let At=!1;const ye=new WeakMap,Ye=new Map;function gn(){for(const[n,e]of Ye){if(!n.isConnected){Ye.delete(n);continue}$t(n,e)}}if(typeof document<"u")for(const n of["os-window-content-loaded","os-window-opened"])document.addEventListener(n,()=>gn());function vn(n,e){return{type:fn,id:n.id,label:n.title||"Untitled form",related:[{id:`allterrain-forms/entries-${n.id}`,label:"Entries for this form",url:`${e}admin.php?page=allterrain-forms-entries&form=${n.id}`,group:"allterrain-forms",groupLabel:"Forms",icon:"dashicons-list-view"}]}}const we={letters:{label:"Letters",chars:"A-Za-zÀ-ÖØ-öø-ÿ"},numbers:{label:"Numbers",chars:"0-9"},spaces:{label:"Spaces",chars:" "},punctuation:{label:`Punctuation ( . , ! ? ' " - )`,chars:`.,!?'"()\\-:;`},symbols:{label:"Symbols ( @ # & _ / + )",chars:"@#&_/+*%="}};function yn(){return{mode:"blocks",starts:"",ends:"",contains:"",notContains:"",chars:[],minLen:"",maxLen:"",regex:"",message:"",tests:[]}}function Tt(n){const e=yn();let t;try{t=JSON.parse(n)}catch{return e}if(!t||typeof t!="object")return e;const s=t;e.mode=s.mode==="regex"?"regex":"blocks";for(const a of["starts","ends","contains","notContains","minLen","maxLen","regex","message"])typeof s[a]=="string"&&(e[a]=s[a]);return Array.isArray(s.chars)&&(e.chars=s.chars.filter(a=>typeof a=="string"&&a in we)),Array.isArray(s.tests)&&(e.tests=s.tests.filter(a=>typeof a=="string").slice(0,10)),e}function _e(n){return n.replace(/[.*+?^${}()|[\]\\/]/g,"\\$&")}function xe(n){if(n.mode==="regex")return n.regex.trim();const e=[],t=n.minLen.trim(),s=n.maxLen.trim();(t!==""||s!=="")&&e.push(`(?=.{${t===""?"0":parseInt(t,10)||0},${s===""?"":parseInt(s,10)||""}}$)`),n.contains!==""&&e.push(`(?=.*${_e(n.contains)})`),n.notContains!==""&&e.push(`(?!.*${_e(n.notContains)})`),n.starts!==""&&e.push(`(?=${_e(n.starts)})`),n.ends!==""&&e.push(`(?=.*${_e(n.ends)}$)`);const a=n.chars.map(o=>we[o]?.chars??"").join(""),i=a?`[${a}]*$`:".*$";return!e.length&&!a?"":`^${e.join("")}${i}`}function Mt(n){if(n.mode==="regex")return n.regex.trim()?`Matches the expression ${n.regex.trim()}`:"";const e=[];if(n.starts&&e.push(`starts with “${n.starts}”`),n.ends&&e.push(`ends with “${n.ends}”`),n.contains&&e.push(`contains “${n.contains}”`),n.notContains&&e.push(`never contains “${n.notContains}”`),n.chars.length){const i=n.chars.map(o=>(we[o]?.label??o).split(" (")[0].toLowerCase());e.push(`uses only ${i.join(" and ")}`)}const t=n.minLen.trim(),s=n.maxLen.trim();return t&&s?e.push(`is ${t}–${s} characters long`):t?e.push(`is at least ${t} characters long`):s&&e.push(`is at most ${s} characters long`),e.length?`The answer ${e.length>1?`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]}.`:""}function wn(n,e){const t=xe(n);if(t==="")return null;try{return new RegExp(t).test(e)}catch{return null}}function _n(){return window.wp?.os?.windowManager??null}const Ft="allterrain-forms-validation";function xn(n){const e=_n(),t=Et(n.root);if(e?.openChild&&t){kn(e,t,n);return}Sn(n)}function kn(n,e,t){const s=`${Ft}-${t.field.id}`;n.getById?.(s)&&n.remove?.(s);const a={saved:!1},i=()=>{const o=n.getById?.(s);o?.close?o.close():n.remove?.(s)};n.openChild?.(e,{id:s,baseId:Ft,url:`#${s}`,title:`Custom rule — ${t.field.label||"this question"}`,icon:"dashicons-yes-alt",native:!0,width:560,height:700,minWidth:440,minHeight:480,ephemeral:!0,autofocus:".atfb-valwin__pane:not([hidden]) input, .atfb-valwin__pane:not([hidden]) textarea",render:o=>{const l=r("div",{class:"atfa atfb-valwin atfb-valwin--window"}),c=r("div",{class:"atfb-valwin__scroll"});l.append(c),It(c,t,a,i,"window");const d=c.querySelector(".atfb-modal__actions");d&&l.append(d),o.append(l)},onClose:()=>{a.saved||t.onCancel?.()}})}function Sn(n){const e=r("div",{class:"atfb-overlay"}),t={saved:!1},s=()=>{e.remove(),document.removeEventListener("keydown",a),t.saved||n.onCancel?.()},a=o=>{o.key==="Escape"&&s()},i=r("div",{class:"atfb-modal atfb-valwin",attrs:{role:"dialog","aria-label":"Custom validation rule"},children:[r("h2",{text:"Custom rule"})]});It(i,n,t,s,"overlay"),e.append(i),e.addEventListener("click",o=>{o.target===e&&s()}),document.addEventListener("keydown",a),n.root.append(e),e.querySelector(".atfb-valwin__pane:not([hidden]) input, .atfb-valwin__pane:not([hidden]) textarea")?.focus()}function It(n,e,t,s,a){const i=Tt(String(e.field.validationRecipe??""));i.mode==="blocks"&&xe(i)===""&&e.field.pattern&&(i.mode="regex",i.regex=String(e.field.pattern)),i.message||(i.message=String(e.field.messages?.invalid??""));const o=(k,B)=>{const M=r("input",{class:"atfb-input",value:i[k],placeholder:B,attrs:{type:"text"}});return M.addEventListener("input",()=>{i[k]=M.value,C()}),M},l=(k,B)=>{const M=r("input",{class:"atfb-input atfb-valwin__len",value:i[k],attrs:{type:"number",min:"0","aria-label":B}});return M.addEventListener("input",()=>{i[k]=M.value,C()}),M},c=r("div",{class:"atfb-valwin__chars",children:Object.entries(we).map(([k,B])=>q(B.label,i.chars.includes(k),M=>{i.chars=M?[...i.chars,k]:i.chars.filter(j=>j!==k),C()}))}),d=r("div",{class:"atfb-valwin__pane",children:[b("Starts with",o("starts","e.g. AT-")),b("Ends with",o("ends","e.g. -2026")),b("Must contain",o("contains","e.g. @")),b("Must not contain",o("notContains","e.g. spaces? type one")),b("Only these characters",c,"Leave every box unticked to allow anything."),b("Length",r("div",{class:"atfb-valwin__lengths",children:[r("span",{text:"between"}),l("minLen","Minimum length"),r("span",{text:"and"}),l("maxLen","Maximum length"),r("span",{text:"characters"})]}),"Leave a box empty for no limit.")]}),h=r("textarea",{class:"atfb-input atfb-valwin__regex",attrs:{rows:"2","aria-label":"Regular expression",placeholder:"^AT-[0-9]{4}$"}});h.value=i.regex,h.addEventListener("input",()=>{i.regex=h.value,C()});const w=r("div",{class:"atfb-valwin__pane",children:[b("Expression",h,"A regular expression, without slashes. Checked against the whole answer only if you anchor it with ^ and $.")]}),y=[["blocks","Easy blocks"],["regex","Expression (advanced)"]],u=k=>{i.mode=k,d.hidden=k!=="blocks",w.hidden=k!=="regex",C()},g=(()=>{if(Y("os-segmented")&&Y("os-segment")){const M=document.createElement("os-segmented");M.setAttribute("value",i.mode),M.setAttribute("label","How to write the rule"),M.classList.add("atfb-valwin__tabs");for(const[j,H]of y){const oe=document.createElement("os-segment");oe.setAttribute("value",j),oe.textContent=H,M.append(oe)}return M.addEventListener("os-pick",j=>{const H=j.detail?.value;(H==="blocks"||H==="regex")&&(M.setAttribute("value",H),u(H))}),M}const k=r("div",{class:"atfb-valwin__tabs",attrs:{role:"tablist"}}),B=()=>{k.replaceChildren(...y.map(([M,j])=>{const H=i.mode===M;return r("button",{class:`atfb-valwin__tab${H?" is-active":""}`,type:"button",text:j,attrs:{role:"tab","aria-selected":H?"true":"false"},on:{click:()=>{u(M),B()}}})}))};return B(),k})();d.hidden=i.mode!=="blocks",w.hidden=i.mode!=="regex";const f=r("input",{class:"atfb-input",value:i.message,placeholder:"That is not in the expected format.",attrs:{type:"text"}});f.addEventListener("input",()=>{i.message=f.value});const $=r("p",{class:"atfb-valwin__summary",attrs:{"aria-live":"polite"}}),R=r("div",{class:"atfb-valwin__samples"}),L=k=>{const B=r("span",{class:"atfb-valwin__verdict",attrs:{"aria-live":"polite"}}),M=r("input",{class:"atfb-input",value:k,placeholder:"Type a sample answer…",attrs:{type:"text"}});M.addEventListener("input",()=>C()),R.append(r("div",{class:"atfb-valwin__sample",children:[M,B]}))};for(const k of i.tests.length?i.tests:["","",""])L(k);const v=()=>Array.from(R.querySelectorAll("input")).map(k=>k.value),C=()=>{const k=Mt(i);$.textContent=k||"Nothing yet — fill in a block above and the rule appears here in plain words.";for(const B of Array.from(R.querySelectorAll(".atfb-valwin__sample"))){const M=B.querySelector("input"),j=B.querySelector(".atfb-valwin__verdict");if(!M||!j)continue;const H=M.value===""?null:wn(i,M.value);j.textContent=H===null?"·":H?"✓ passes":"✗ fails",j.classList.toggle("is-pass",H===!0),j.classList.toggle("is-fail",H===!1)}};n.append(r("p",{class:"atfb-hint",text:`Describe what a good answer to “${e.field.label||"this question"}” looks like — no code needed.`}),g,d,w,r("div",{class:"atfb-valwin__try",children:[r("h3",{text:"Try it out"}),$,R,E("Add another sample",()=>{L(""),C()},"ghost","plus-alt2")]}),b("When it fails, say",f,"Shown to the visitor when their answer breaks the rule. Leave empty for the default wording."),r("div",{class:"atfb-modal__actions",children:[E(a==="window"?"Close without saving":"Cancel",s),E("Save rule",()=>{const k=xe(i);i.tests=v().filter(B=>B!=="").slice(0,10),t.saved=!0,e.onSave({pattern:k,recipe:i,message:i.message.trim()}),s()},"primary")]})),C()}const Ln=["Contact","Numbers & codes","Text shape","Web"],Dt=[{slug:"email",label:"An email address",group:"Contact",example:"jane@example.com",pattern:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",message:"That does not look like an email address."},{slug:"phone",label:"A phone number",group:"Contact",example:"+34 612 345 678",pattern:"^(?=(?:[^0-9]*[0-9]){5,})\\+?[0-9 ().-]{5,24}$",message:"That does not look like a phone number."},{slug:"handle",label:"A username or @handle",group:"Contact",example:"@yourname",pattern:"^@?[A-Za-z0-9_]{2,30}$",message:"That does not look like a username."},{slug:"digits",label:"Numbers only",group:"Numbers & codes",example:"12345",pattern:"^[0-9]+$",message:"Numbers only, please."},{slug:"decimal",label:"A number, decimals allowed",group:"Numbers & codes",example:"3.14",pattern:"^-?[0-9]+([.,][0-9]+)?$",message:"That does not look like a number."},{slug:"price",label:"A price",group:"Numbers & codes",example:"19.99",pattern:"^[0-9]+([.,][0-9]{1,2})?$",message:"That does not look like a price."},{slug:"zip_us",label:"A ZIP code (US)",group:"Numbers & codes",example:"90210",pattern:"^[0-9]{5}(-[0-9]{4})?$",message:"That does not look like a ZIP code."},{slug:"postcode_uk",label:"A postcode (UK)",group:"Numbers & codes",example:"SW1A 1AA",pattern:"^[A-Za-z]{1,2}[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}$",message:"That does not look like a postcode."},{slug:"iban",label:"An IBAN",group:"Numbers & codes",example:"DE89 3704 0044 0532 0130 00",pattern:"^[A-Za-z]{2}[0-9]{2}(?: ?[A-Za-z0-9]){10,32}$",message:"That does not look like an IBAN."},{slug:"credit_card",label:"A card number",group:"Numbers & codes",example:"4242 4242 4242 4242",pattern:"^[0-9](?:[0-9 -]{9,21})?[0-9]$",message:"That does not look like a card number.",luhn:!0},{slug:"letters",label:"Letters only",group:"Text shape",example:"María López",pattern:"^[\\p{L}\\p{M} .'’-]+$",message:"Letters only, please."},{slug:"alphanumeric",label:"Letters and numbers only",group:"Text shape",example:"abc123",pattern:"^[A-Za-z0-9]+$",message:"Letters and numbers only, please."},{slug:"no_spaces",label:"One word, no spaces",group:"Text shape",example:"one-word",pattern:"^\\S+$",message:"No spaces allowed."},{slug:"url",label:"A web address",group:"Web",example:"https://example.com",pattern:"^(https?://)?([A-Za-z0-9-]+\\.)+[A-Za-z]{2,}([/?#]\\S*)?$",message:"That does not look like a web address."},{slug:"ip",label:"An IP address",group:"Web",example:"192.168.0.1",pattern:"^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$",message:"That does not look like an IP address."},{slug:"slug",label:"A URL slug",group:"Web",example:"my-page-title",pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",message:"Lowercase letters, numbers and dashes only."},{slug:"hex_color",label:"A hex colour",group:"Web",example:"#3366ff",pattern:"^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",message:"That does not look like a colour code."}];function En(n){return Dt.find(e=>e.slug===n)??null}function Ge(){return window.wp?.os??null}const qt="allterrain-forms/preview",Ze="allterrain-forms-preview";function Cn(n){const e=Ge();if(!e?.registerTitleBarButton)return()=>{};const t=()=>{try{e.registerTitleBarButton({id:qt,label:"Preview this form",icon:"dashicons-visibility",placement:"right",order:90,match:s=>{const a=s?.id??s?.config?.id??"";return a==="allterrain-forms"||a.startsWith("allterrain-forms#")},onClick:()=>void Ot(n),owner:"allterrain-forms-builder"})}catch{}};return e.ready?e.ready(t):t(),()=>{try{e.unregisterTitleBarButton?.(qt)}catch{}}}async function Ot(n){n.isDirty()&&await n.save();const e=n.current();e&&Nt(e.id,e.title,e.previewUrl)}function Nt(n,e,t){const s=Ge();if(!s?.windowManager?.open){window.open(t,"_blank","noopener");return}s.windowManager.open({id:`${Ze}-${n}`,baseId:Ze,url:t,title:`Preview: ${e}`,icon:"dashicons-visibility"})}function $n(n,e,t){if(!Ge()?.windowManager?.open||!document.querySelector(`[data-window-id="${Ze}-${n}"]`))return;const i=t.includes("?")?"&":"?";Nt(n,e,`${t}${i}atf_r=${Date.now()}`)}const se="allterrain-forms/field",An=["openstation/file","desktop-mode/file","openstation/attachment"],Rt="allterrain-forms/logic-map-v2";function J(n,e){return n.dataset.atfbBind=e,n}const Pt={level:{key:"level",label:"Heading level",control:"select",hint:"Headings should step down one at a time.",options:[{value:"2",label:"Heading 2"},{value:"3",label:"Heading 3"},{value:"4",label:"Heading 4"},{value:"5",label:"Heading 5"},{value:"6",label:"Heading 6"}]},content:{key:"content",label:"HTML",control:"textarea",hint:"Shown as written. Scripts are stripped when the form is saved."},consenttext:{key:"consentText",label:"What they are agreeing to",control:"textarea",hint:"Shown beside the tick box. Links are allowed."},height:{key:"height",label:"Height",control:"number",hint:"In pixels."},columns:{key:"columns",label:"Columns",control:"number",hint:"How many pictures sit side by side."},multiple:{key:"multiple",label:"Let them choose more than one",control:"checkbox"},inline:{key:"inline",label:"Lay the options out in a row",control:"checkbox"},other:{key:"other",label:"Offer an “Other” box",control:"checkbox",hint:"Adds a final option with a box to type in."},filetypes:{key:"filetypes",label:"Accepted file types",control:"commas",hint:"Extensions, separated by commas. Empty accepts anything the site allows."},maxsize:{key:"maxsize",label:"Largest file",control:"number",hint:"In megabytes."},maxfiles:{key:"maxfiles",label:"How many files",control:"number"},minrows:{key:"minRows",label:"Fewest rows",control:"number",also:{key:"maxRows",label:"Most rows"}},itemlabel:{key:"itemLabel",label:"What is one row called?",control:"text",hint:"Names each card — “Attendee 1”, “Attendee 2” — and the Remove button. Also editable on the card itself."},endlabels:{key:"minLabel",label:"Label at the low end",control:"text",also:{key:"maxLabel",label:"Label at the high end"}},points:{key:"points",label:"Points if correct",control:"number"},minchoices:{key:"minChoices",label:"Fewest they may pick",control:"number",also:{key:"maxChoices",label:"Most they may pick"}}},Tn={label:"the canvas edits it in place, and the inspector mirrors it",placeholder:"edited by typing into the control on the canvas",hint:"edited under the control on the canvas",nextlabel:"edited on the page break’s own Next button",prevlabel:"edited on the page break’s own Back button",addlabel:"edited on the repeater’s own Add button",choices:"the choices editor, and the option list on the canvas",required:"the toggle on the card",width:"its own row",css:"its own row",prefill:"its own section",logic:"the conditional logic section",formula:"its own row, with the currency that goes with it",currency:"rendered with the formula",correct:"the choices editor marks the right answer",default:"its own row, typed to match what the field stores",rows:"a row count on a textarea; the statement list on a Likert matrix",parts:"a tick box per part, listed by the server",min:"the validation section, paired with max",max:"the validation section, paired with min",step:"the validation section",minlength:"the validation section, paired with maxlength",maxlength:"the validation section, paired with minlength",mindate:"the validation section, paired with maxdate",maxdate:"the validation section, paired with mindate",mintime:"the validation section, paired with maxtime",maxtime:"the validation section, paired with mintime",pattern:"the validation section",unique:"the validation section",maxchoices:"rendered with minchoices",maxrows:"rendered with minrows"};function Bt(n,e,t){const s=n[e.key],a=i=>t(e.key,i);if(e.control==="checkbox")return q(e.label,!!s,a);if(e.control==="commas"){const i=Array.isArray(s)?s:[];return b(e.label,T(i.join(", "),o=>{a(o.split(",").map(l=>l.trim().replace(/^\./,"").toLowerCase()).filter(Boolean))}),e.hint)}return e.control==="select"?b(e.label,I(String(s??""),e.options??[],a),e.hint):e.control==="textarea"?b(e.label,ue(String(s??""),a),e.hint):e.control==="number"?b(e.label,G(String(s??""),a),e.hint):b(e.label,J(T(String(s??""),a),e.key),e.hint)}function Ht(n,e){const t=new Set(n.map(a=>a.key).filter(Boolean));let s=n.length+1;return e.split(` -`).map(a=>a.trim()).filter(Boolean).map((a,i)=>{const o=n[i]?.key;if(o)return{key:o,label:a};for(;t.has(`r${s}`);)s+=1;return t.add(`r${s}`),{key:`r${s}`,label:a}})}function jt(n,e,t){const s=n.findIndex(i=>i.id===e);if(s<0)return null;const a=Math.max(0,Math.min(t,n.length-1));return a===s?null:{from:s,to:a}}const Ke=[{value:"user:email",label:"Their email address",group:"About the person filling it in",tag:"{user:email}"},{value:"user:display_name",label:"Their name",group:"About the person filling it in",tag:"{user:display_name}"},{value:"user:first_name",label:"Their first name",group:"About the person filling it in"},{value:"user:last_name",label:"Their last name",group:"About the person filling it in"},{value:"user:login",label:"Their username",group:"About the person filling it in"},{value:"date:today",label:"Today’s date",group:"The date and time",tag:"{date}"},{value:"date:now",label:"The time right now",group:"The date and time",tag:"{time}"},{value:"site",label:"This site’s name",group:"About this site",tag:"{site}"},{value:"site:url",label:"This site’s address",group:"About this site",tag:"{site:url}"},{value:"site:admin_email",label:"The site administrator’s email",group:"About this site",tag:"{admin_email}"}],Mn=["About the person filling it in","The date and time","About this site"],Xe=(n,e)=>W?.i18n?.[n]??e;class Wt{constructor(e){this.config=null,this.themes=[],this.forms=[],this.form=null,this.schema=null,this.selected=null,this.tab="build",this.logicMap=null,this.canvasTheme=r("style"),this.canvasThemeSignature="",this.openSections=new Map,this.logicMapOn=as(Rt)!=="off",this.dirty=!1,this.editGeneration=0,this.saveInFlight=!1,this.queuedSave=null,this.teardowns=[],this.canvasTarget=null,this.history=[],this.historyAt=-1,this.autosave=Ae(()=>{this.save(!0)},2500),this.renderInspector=ns(()=>{if(O(this.inspector),!this.schema||(this.root.classList.toggle("atfb--build-only-panes",this.tab!=="build"),this.tab!=="build"))return;const t=this.selected?this.locateField(this.selected):void 0,s=t?.field,a=t?.parent??null;if(this.root.classList.toggle("atfb--has-selection",!!s),!s){this.inspector.append(r("div",{class:"atfb-placeholder",children:[r("p",{text:"Select a field to change it."}),r("p",{class:"atfb-hint",text:"Drag a field from the palette, or press one to add it to the end."})]}));return}const i=this.config?.fieldTypes.find(c=>c.type===s.type),o=i?.supports??[],l=(c,d)=>{const h=this.liveField(s.id);h&&(h[c]=d,this.markDirty(),this.renderCanvas())};this.inspector.append(r("h3",{class:"atfb-inspector__title",text:i?.label??s.type})),a?this.inspector.append(r("p",{class:"atfb-hint atfb-inspector__crumb",text:`Inside ${a.label||"a repeater"} — the visitor answers this once per ${String(a.itemLabel??"")||"row"}.`}),r("p",{class:"atfb-hint",text:`Formulas aggregate it as {${a.id}.${s.id}} — e.g. sum( {${a.id}.${s.id}} ).`})):this.inspector.append(r("p",{class:"atfb-hint",text:`Reference this field as {field:${s.id}}`})),o.includes("label")&&this.inspector.append(b("Label",J(T(s.label,c=>l("label",c)),"label"))),o.includes("placeholder")&&this.inspector.append(b("Placeholder",J(T(s.placeholder,c=>l("placeholder",c)),"placeholder"))),o.includes("hint")&&this.inspector.append(b("Hint",J(T(s.hint,c=>l("hint",c)),"hint"),"Shown under the field, and read out with it.")),o.includes("nextlabel")&&this.inspector.append(b("Next button",J(T(String(s.nextLabel??""),c=>l("nextLabel",c)),"nextLabel"),"Leave empty for “Next”.")),o.includes("prevlabel")&&this.inspector.append(b("Back button",J(T(String(s.prevLabel??""),c=>l("prevLabel",c)),"prevLabel"),"Leave empty for “Back”.")),o.includes("addlabel")&&this.inspector.append(b("Add button",J(T(String(s.addLabel??""),c=>l("addLabel",c)),"addLabel"),"Leave empty for “Add another”.")),o.includes("required")&&this.inspector.append(q("Required",s.required,c=>l("required",c))),o.includes("width")&&this.inspector.append(b("Width",I(s.width,[{value:"full",label:"Full width"},{value:"two-thirds",label:"Two thirds"},{value:"half",label:"Half"},{value:"third",label:"One third"},{value:"quarter",label:"One quarter"}],c=>l("width",c)))),i?.choices&&this.inspector.append(this.renderChoicesEditor(s,l)),this.renderTypeSettings(s,i,o,l),(s.type==="total"||o.includes("formula"))&&this.inspector.append(b("Formula",r("div",{class:"atfb-formula__row",children:[T(String(s.formula??""),c=>l("formula",c)),E("Formula editor",()=>pn({root:this.root,fields:this.schema?.fields??[],field:s,onSave:c=>{l("formula",c),this.renderInspector()}}))]}),"Reference answers with braces — {f1} * {f2} + 10 — or open the editor and click them in."),b("Currency symbol",T(String(s.currency??""),c=>l("currency",c)))),this.inspector.append(this.renderValidationSection(s,o,l)),a||(this.inspector.append(this.renderLogicSection(s)),o.includes("prefill")&&this.inspector.append(this.prefillControl(s,l))),o.includes("css")&&this.inspector.append(b("CSS class",T(s.cssClass,c=>l("cssClass",c))))}),this.root=e,this.bar=e.querySelector("[data-atfb-bar]")??r("div"),this.palette=e.querySelector("[data-atfb-palette]")??r("div"),this.canvas=e.querySelector("[data-atfb-canvas]")??r("div"),this.inspector=e.querySelector("[data-atfb-inspector]")??r("div"),this.canvas.addEventListener("click",t=>{const s=t.target;if(!(this.tab!=="build"||!this.selected||s.closest("[data-atfb-card], button, os-button, a, input, textarea, select, os-select, label, [contenteditable]"))){this.selected=null;for(const a of this.canvas.querySelectorAll(".atfb-card.is-selected"))a.classList.remove("is-selected");this.renderInspector()}})}async start(){try{const[s,a,i]=await Promise.all([F.config(),F.listThemes(),F.listForms()]);this.config=s,this.themes=a,this.forms=i}catch(s){this.fail(s);return}this.teardowns.push(Jt([se])),this.teardowns.push(Cn({current:()=>this.form?{id:this.form.id,title:this.form.title,previewUrl:this.form.previewUrl}:null,isDirty:()=>this.dirty,save:()=>this.save(!0)}));const e=s=>{this.dirty&&(s.preventDefault(),s.returnValue="")};window.addEventListener("beforeunload",e),this.teardowns.push(()=>window.removeEventListener("beforeunload",e));const t=s=>{!(s.metaKey||s.ctrlKey)||s.key.toLowerCase()!=="z"||s.target?.closest("input, textarea, [contenteditable]")||(s.preventDefault(),this.travel(s.shiftKey?1:-1))};if(this.root.addEventListener("keydown",t),this.teardowns.push(()=>this.root.removeEventListener("keydown",t)),this.renderBar(),this.renderPalette(),this.forms.length){const s=fs("builder");await this.open(s&&this.forms.some(a=>a.id===s)?s:this.forms[0].id)}else this.renderFormsList()}destroy(){this.canvasTarget?.(),this.canvasTarget=null,this.teardowns.forEach(e=>e()),this.teardowns=[]}fail(e){O(this.bar),this.bar.append(r("p",{class:"atfb-error",text:e instanceof Error?e.message:"Something went wrong loading your forms."}))}renderBar(){O(this.bar);const e=I(String(this.form?.id??""),[...this.forms.map(a=>({value:String(a.id),label:a.title||"(untitled)"}))],a=>void this.open(Number(a)));e.setAttribute("aria-label","Choose a form");const t=r("input",{class:"atfb-title",type:"text",value:this.form?.title??"",placeholder:"Untitled form",attrs:{"aria-label":"Form title"},on:{input:a=>{this.form&&(this.form.title=a.target.value,this.markDirty())}}}),s=r("div",{class:"atfb-tabs",attrs:{role:"tablist"},children:[["build","Build"],["theme","Theme"],["settings","Settings"],["notify","Notifications"],["confirm","Confirmations"]].map(([a,i])=>r("button",{class:`atfb-tab${this.tab===a?" is-active":""}`,type:"button",text:i,attrs:{role:"tab","aria-selected":this.tab===a},on:{click:()=>{this.tab=a,this.renderBar(),this.renderInspector(),this.renderCanvas()}}}))});this.bar.append(r("div",{class:"atfb-bar__left",children:[this.forms.length>1?e:null,t]}),s,r("div",{class:"atfb-bar__right",children:[this.historyButton("undo","Undo",-1),this.historyButton("redo","Redo",1),E("New",()=>void this.showTemplates(),"secondary","plus-alt2"),E("Export",()=>void this.exportForm(),"secondary","download"),E("Import",()=>void this.importForm(),"secondary","upload"),E("Preview",()=>void this.preview(),"secondary","visibility"),E("Entries",()=>this.openEntries(),"secondary","list-view"),this.logicMapButton(),this.saveButton()]}))}liveField(e){return this.locateField(e)?.field}locateField(e){const t=this.schema?.fields??[];for(let s=0;sthis.rebindCanvas(),{once:!0});return}this.renderCanvas()}snapshot(){if(!this.schema)return;const e=JSON.stringify(this.schema);this.history[this.historyAt]!==e&&(this.history=this.history.slice(0,this.historyAt+1),this.history.push(e),this.history.length>60&&this.history.shift(),this.historyAt=this.history.length-1,this.syncHistoryButtons())}travel(e){const t=this.historyAt+e;!this.schema||t<0||t>=this.history.length||(this.historyAt=t,this.schema=JSON.parse(this.history[t]),this.schema.fields.some(s=>s.id===this.selected)||(this.selected=null),this.markDirty(),this.renderBar(),this.renderCanvas(),this.renderInspector())}historyButton(e,t,s){const a=E(t,()=>this.travel(s),"secondary",e);return a.setAttribute("data-atfb-history",String(s)),a.disabled=!this.canTravel(s),a}canTravel(e){const t=this.historyAt+e;return t>=0&&tURL.revokeObjectURL(s),1e3)}async importForm(){const e=r("input",{type:"file",attrs:{accept:"application/json,.json"}});e.addEventListener("change",async()=>{const t=e.files?.[0];if(t)try{const s=JSON.parse(await t.text());if(!s.schema)throw new Error("That file does not contain a form.");const a=await F.createForm({title:s.title??t.name.replace(/\.json$/i,""),schema:s.schema});this.forms.unshift({id:a.id,title:a.title,status:a.status,modified:a.modified,fields:a.schema.fields.length,theme:a.schema.settings.theme,entries:0,unread:0,views:0,submissions:0,shortcode:a.shortcode}),this.form=a,this.schema=a.schema,this.selected=null,this.dirty=!1,this.history=[],this.historyAt=-1,this.snapshot(),this.renderBar(),this.renderCanvas(),this.renderInspector(),N("Form imported",a.title)}catch(s){N("Could not import that file",s instanceof Error?s.message:"","error")}}),e.click()}saveButton(){const e=E("Save",()=>void this.save(),"primary");return e.disabled=!this.dirty,e.setAttribute("data-atfb-save",""),e}markDirty(){this.dirty=!0,this.editGeneration+=1;const e=this.bar.querySelector("[data-atfb-save]");e&&(e.disabled=!1),this.autosave()}async save(e=!1){if(!this.form||!this.schema)return;if(this.saveInFlight){this.queuedSave={silent:e&&(this.queuedSave?.silent??!0)};return}this.saveInFlight=!0;const t=this.editGeneration;try{const s=await F.updateForm(this.form.id,{title:this.form.title,schema:this.schema});if(t===this.editGeneration){this.form=s,this.schema=s.schema,this.dirty=!1,this.rebindCanvas();const i=this.bar.querySelector("[data-atfb-save]");i&&(i.disabled=!0)}Ts(s.id);const a=this.forms.find(i=>i.id===s.id);a&&(a.title=s.title),$n(s.id,s.title,s.previewUrl),e||N("Form saved",s.title)}catch(s){N(Xe("saveFailed","Could not save"),s instanceof Error?s.message:"","error")}finally{this.saveInFlight=!1;const s=this.queuedSave;this.queuedSave=null,s&&this.save(s.silent)}}async openFormById(e){await this.open(e)}async open(e){if(!(this.dirty&&!await fe("You have unsaved changes. Discard them?"))){try{this.form=await F.getForm(e),this.schema=this.form.schema,this.selected=null,this.dirty=!1,this.history=[],this.historyAt=-1,this.snapshot()}catch(t){this.fail(t);return}this.renderBar(),this.renderCanvas(),this.renderInspector(),this.announceIdentity()}}announceIdentity(){this.form&&$t(this.root,vn(this.form,W?.adminUrl??""))}async showTemplates(){if(!this.config)return;const e=r("div",{class:"atfb-overlay"}),t=i=>{i.key==="Escape"&&s()},s=()=>{e.remove(),document.removeEventListener("keydown",t)},a=r("div",{class:"atfb-templates",children:this.config.templates.map(i=>r("button",{class:"atfb-template",type:"button",on:{click:async()=>{s();try{const o=await F.createForm({template:i.slug});this.forms.unshift({id:o.id,title:o.title,status:o.status,modified:o.modified,fields:o.schema.fields.length,theme:o.schema.settings.theme,entries:0,unread:0,views:0,submissions:0,shortcode:o.shortcode}),this.form=o,this.schema=o.schema,this.selected=null,this.dirty=!1,this.history=[],this.historyAt=-1,this.snapshot(),this.renderBar(),this.renderCanvas(),this.renderInspector(),this.announceIdentity()}catch(o){N("Could not create the form",o instanceof Error?o.message:"","error")}}},children:[z(i.icon),r("strong",{text:i.label}),r("span",{text:i.description})]}))});e.append(r("div",{class:"atfb-modal",attrs:{role:"dialog","aria-label":"Start a new form"},children:[r("h2",{text:"Start a new form"}),a,this.archivedFormsSection(s),r("div",{class:"atfb-modal__actions",children:[E("Cancel",s)]})]})),e.addEventListener("click",i=>{i.target===e&&s()}),document.addEventListener("keydown",t),this.root.append(e),a.querySelector("button")?.focus()}archivedFormsSection(e){const t=r("div",{class:"atfb-archived"});return F.listArchivedForms().then(s=>{s.length&&t.append(r("h3",{class:"atfb-archived__title",text:"Or bring one back from the archive"}),...s.map(a=>r("div",{class:"atfb-archived__row",children:[r("div",{class:"atfb-archived__meta",children:[r("strong",{text:a.title||"(untitled)"}),r("span",{class:"atfb-hint",text:`${a.entries} ${a.entries===1?"entry":"entries"} · ${a.submissions} submissions · ${a.views} views`})]}),E("Restore",async()=>{try{const i=await F.unarchiveForm(a.id);e(),this.forms.unshift(i),N("Form restored",`${i.title||"(untitled)"} is back, with its entries and stats.`),await this.open(i.id)}catch(i){N("Could not restore the form",i instanceof Error?i.message:"","error")}},"secondary","undo")]})))}).catch(()=>{}),t}renderFormsList(){O(this.canvas),this.canvas.append(r("div",{class:"atfb-empty",children:[r("h2",{text:"No forms yet"}),r("p",{text:"Start from a template, or build one from nothing."}),E("New form",()=>void this.showTemplates(),"primary","plus-alt2")]}))}openEntries(){const e=window.wp?.os;if(e?.openWindow){e.openWindow("allterrain-forms-entries");return}window.location.assign(`${W?.adminUrl??""}admin.php?page=allterrain-forms-entries`)}renderPalette(){if(!this.config)return;O(this.palette);const e=new Map;for(const s of this.config.fieldTypes){const a=e.get(s.group)??[];a.push(s),e.set(s.group,a)}const t=r("input",{class:"atfb-input atfb-palette__search",type:"search",placeholder:"Search fields",attrs:{"aria-label":"Search field types"},on:{input:s=>{const a=s.target.value.toLowerCase().trim();this.palette.querySelectorAll(".atfb-chip").forEach(i=>{const o=(i.textContent??"").toLowerCase();i.hidden=a!==""&&!o.includes(a)}),this.palette.querySelectorAll(".atfb-group").forEach(i=>{const o=Array.from(i.querySelectorAll(".atfb-chip")).some(l=>!l.hidden);i.hidden=!o})}}});this.palette.append(t);for(const[s,a]of Object.entries(this.config.groups)){const i=e.get(s);i?.length&&this.palette.append(r("div",{class:"atfb-group",children:[r("h3",{class:"atfb-group__title",text:a}),r("div",{class:"atfb-group__items",children:i.map(o=>this.paletteChip(o))})]}))}}paletteChip(e){const t=r("button",{class:"atfb-chip",type:"button",title:e.description,attrs:{"data-atf-type":e.type},children:[z(e.icon),r("span",{text:e.label})]});return t.addEventListener("pointerdown",s=>{const a=r("div",{class:"atfb-chip atfb-chip--ghost",children:[z(e.icon),r("span",{text:e.label})]});K().start({payload:Ee(se,t,{fieldType:e.type,isNew:!0},s,a),origin:s,onClickOnly:()=>this.addField(e.type)})}),t.addEventListener("click",s=>{K().recentlyEndedDrag()&&s.preventDefault()}),t}renderCanvas(){if(O(this.canvas),!this.schema||!this.form){this.renderFormsList();return}if(this.tab!=="build"){this.canvas.append(this.renderTabCanvas());return}const e=r("div",{class:"atfb-canvas__list",attrs:{"data-atfb-list":""}});this.schema.fields.length||e.append(r("div",{class:"atfb-placeholder",text:Xe("emptyCanvas","Drag a field from the left to begin.")})),this.schema.fields.forEach((s,a)=>{e.append(this.renderFieldCard(s,a))});const t=r("div",{class:"atfb-canvas__inner",children:[r("p",{class:"atfb-shortcode",text:this.form.shortcode,title:"Paste this anywhere to place the form"}),e]});this.canvas.append(t),this.registerCanvasTarget(e),this.paintLogicMap(t),this.paintCanvasTheme()}prefillControl(e,t){const s=e.prefill.startsWith("query:"),a=Ke.some(y=>y.value===e.prefill),i=s?"query":a&&e.prefill||(e.prefill?"custom":""),o=r("div",{class:"atfb-prefill__detail"}),l=r("p",{class:"atfb-row__hint atfb-prefill__preview"}),c=y=>{if(o.replaceChildren(),l.replaceChildren(),y==="query"){const u=e.prefill.startsWith("query:")?e.prefill.slice(6):"";o.append(T(u,x=>{const g=x.trim();t("prefill",g?`query:${g}`:""),d(`query:${g}`)},"utm_source"),r("p",{class:"atfb-row__hint",text:"The name of the parameter in the link people arrive on."}))}y==="custom"&&o.append(T(e.prefill,u=>{t("prefill",u),d(u)},"myplugin:something"),r("p",{class:"atfb-row__hint",text:"For a source another plugin has added through atf_resolve_prefill."})),d(e.prefill)},d=y=>{if(l.replaceChildren(),!y)return;if(y.startsWith("query:")){const x=y.slice(6);x&&(l.textContent=`A visit to …/your-page/?${x}=abc opens the form with “abc” in it.`);return}const u=Ke.find(x=>x.value===y)?.tag;u&&Oe(this.form?.id??0).then(x=>{for(const g of x)for(const f of g.items)if(f.tag===u){const $=y.startsWith("user:");if(!f.sample){l.textContent="Empty unless the visitor is signed in.";return}l.textContent=$?`Opens with “${f.sample}” for you — empty for a visitor who is not signed in.`:`Opens with “${f.sample}”.`;return}})};c(i);const h=r("select",{class:"atfb-input atfb-select",on:{change:y=>{const u=y.target.value;t("prefill",u==="query"||u==="custom"?"":u),c(u)}}});h.append(r("option",{value:"",text:"Nothing — leave it empty",attrs:{selected:i===""}}));for(const y of Mn){const u=document.createElement("optgroup");u.label=y;for(const x of Ke.filter(g=>g.group===y))u.append(r("option",{value:x.value,text:x.label,attrs:{selected:x.value===i}}));h.append(u)}const w=document.createElement("optgroup");return w.label="From the link they arrived on",w.append(r("option",{value:"query",text:"A parameter in the web address",attrs:{selected:i==="query"}})),h.append(w,r("option",{value:"custom",text:"Something else (advanced)",attrs:{selected:i==="custom"}})),b("Pre-fill this with",r("div",{class:"atfb-prefill",children:[h,o,l]}),"What the box already contains when the form opens. They can still change it.")}renderCondition(e,t){const s=t.some(i=>i.kind==="field"&&i.missing),a=r("span",{class:`atfb-cond${s?" is-broken":""}`,attrs:{"aria-label":rt(t)},children:[z("randomize"),...t.map(i=>this.renderConditionToken(e,i))]});return a.addEventListener("pointerdown",i=>i.stopPropagation()),a.addEventListener("click",i=>i.stopPropagation()),a.addEventListener("keydown",i=>i.stopPropagation()),a}editCondition(e,t,s=!0,a=""){const i=this.liveField(e)?.logic;if(i){if(t(i),this.markDirty(),!s){this.logicMap?.setEdges(me(this.schema?.fields??[]));return}this.renderCanvas(),this.renderInspector(),a&&window.requestAnimationFrame(()=>{this.canvas.querySelector(`[data-cond="${CSS.escape(a)}"]`)?.focus()})}}condSelect(e,t,s,a,i){if(Y("os-select")&&Y("os-option")){const o=document.createElement("os-select");o.setAttribute("value",e),o.setAttribute("aria-label",a),o.setAttribute("data-cond",s),o.className="atfb-cond__control",o.title=a;for(const l of t){const c=document.createElement("os-option");c.setAttribute("value",l.value),c.textContent=l.label,o.append(c)}return o.addEventListener("os-pick",l=>{i(String(l.detail?.value??""))}),o}return r("select",{class:"atfb-cond__control atfb-cond__control--native",title:a,attrs:{"aria-label":a,"data-cond":s},on:{change:o=>i(o.target.value)},children:t.map(o=>r("option",{value:o.value,text:o.label,attrs:{selected:o.value===e}}))})}renderConditionToken(e,t){if(t.kind==="field"&&!t.missing)return r("button",{class:"atfb-cond__chip atfb-cond__chip--field",type:"button",text:t.text,title:"Go to this question",on:{click:a=>{a.stopPropagation(),this.selectField(t.fieldId),this.canvas.querySelector(`[data-atfb-card="${CSS.escape(t.fieldId)}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})}}});if(t.kind==="verb")return r("button",{class:"atfb-cond__verb",type:"button",text:t.text,title:"Switch between showing and hiding this field when the condition matches.",attrs:{"data-cond":`${e.id}:verb`},on:{click:()=>this.editCondition(e.id,s=>{s.action=s.action==="hide"?"show":"hide"},!0,`${e.id}:verb`)}});if(t.kind==="join")return r("button",{class:"atfb-cond__join",type:"button",text:t.text,title:"Switch between needing every rule (and) or any one of them (or).",attrs:{"data-cond":`${e.id}:join`},on:{click:()=>this.editCondition(e.id,s=>{s.match=s.match==="all"?"any":"all"},!0,`${e.id}:join`)}});if(t.kind==="operator"){const s=`${e.id}:op:${t.ruleIndex}`;return this.condSelect(t.operator,Object.entries(Me).map(([a,i])=>({value:a,label:i})),s,"How the answer is compared",a=>this.editCondition(e.id,i=>{const o=i.rules[t.ruleIndex];o&&(o.operator=a)},!0,s))}return t.kind==="value"?this.renderConditionValue(e,t):r("span",{class:"atfb-cond__chip atfb-cond__chip--missing",text:t.text})}renderConditionValue(e,t){const s=`${e.id}:value:${t.ruleIndex}`,a=this.schema?.fields.find(c=>c.id===t.sourceId),i=(c,d)=>this.editCondition(e.id,h=>{const w=h.rules[t.ruleIndex];w&&(w.value=c)},d,s);if(a?.choices?.length){const c=a.choices.map(d=>({value:d.value,label:d.label||d.value}));return t.raw!==""&&!a.choices.some(d=>d.value===t.raw)&&c.unshift({value:t.raw,label:t.text}),this.condSelect(t.raw,c,s,"The answer that triggers this",d=>i(d,!0))}const o=["number","range","scale","rating","total"].includes(a?.type??""),l=r("input",{class:"atfb-cond__chip atfb-cond__chip--value atfb-cond__value",value:t.raw,title:"The answer that triggers this. Edit it here.",attrs:{type:"text","aria-label":"The answer that triggers this","data-cond":s,inputmode:o?"decimal":void 0,size:String(Math.max(2,Math.min(24,t.raw.length||2)))}});return l.addEventListener("input",()=>{l.size=Math.max(2,Math.min(24,l.value.length||2)),i(l.value,!1)}),l.addEventListener("change",()=>i(l.value,!0)),l.addEventListener("keydown",c=>{c.key==="Enter"&&(c.preventDefault(),i(l.value,!0))}),l}section(e,t,s,a=!1){const i=r("details",{class:"atfb-section",attrs:{open:this.openSections.get(e)??a},children:[r("summary",{text:t}),...s]});return i.addEventListener("toggle",()=>this.openSections.set(e,i.open)),i}logicMapButton(){const e=me(this.schema?.fields??[]).length>0,t=E(this.logicMapOn?"Hide logic":"Show logic",()=>{this.logicMapOn=!this.logicMapOn,is(Rt,this.logicMapOn?"on":"off"),this.renderBar(),this.renderCanvas()},this.logicMapOn?"primary":"secondary","randomize");return t.title="Draw a line from each question to the ones it decides.",t.hidden=!e,t}paintLogicMap(e){this.logicMap?.destroy(),this.logicMap=null;const t=this.schema?.fields??[],s=me(t);if(!s.length||!this.logicMapOn)return;e.classList.add("has-logicmap");const a=new ys(e);a.setEdges(s),a.highlight(this.selected??""),this.logicMap=a,e.addEventListener("pointerover",i=>{const o=i.target.closest("[data-atfb-card]");a.highlight(o?.dataset.atfbCard??this.selected??"")}),e.addEventListener("pointerleave",()=>a.highlight(this.selected??""))}renderFieldCard(e,t){const s=this.config?.fieldTypes.find(d=>d.type===e.type),a=this.selected===e.id,i=this.schema?.fields??[],o=bs(e,i),l=vs(i).get(e.id)??0,c=r("div",{class:`atfb-card${a?" is-selected":""}`,attrs:{"data-atfb-card":e.id,"data-index":t,tabindex:"0",role:"button","aria-pressed":a,"aria-label":`${e.label||s?.label||e.type}, ${t+1} of ${this.schema?.fields.length??0}`},children:[r("div",{class:"atfb-card__bar",children:[r("div",{class:"atfb-card__grip",attrs:{"aria-hidden":"true"},children:[z("menu")]}),r("div",{class:"atfb-card__head",children:[z(s?.icon??"dashicons-forms"),r("span",{class:"atfb-card__type",text:s?.label??e.type}),this.requiredToggle(e),l?r("span",{class:"atfb-badge atfb-badge--controls",text:l===1?"controls 1 field":`controls ${l} fields`,title:"Other questions appear or disappear based on this answer."}):null]}),r("div",{class:"atfb-card__actions",children:[this.cardAction("admin-page","Duplicate",()=>this.duplicateField(e.id)),this.cardAction("trash","Delete",()=>void this.deleteField(e.id))]})]}),r("div",{class:"atfb-card__body",children:[dt(e,s,{edit:d=>{const h=this.liveField(e.id);if(!h)return;d(h),this.markDirty(),this.syncInspector(h);const w=this.selected?this.locateField(this.selected):void 0;w?.parent&&w.parent.id===h.id&&this.syncInspector(w.field)},restructure:d=>{const h=this.liveField(e.id);h&&(this.snapshot(),d(h),this.markDirty(),this.renderCanvas(),this.renderInspector())},types:d=>this.config?.fieldTypes.find(h=>h.type===d),selectedId:this.selected}),o.length?this.renderCondition(e,o):null]})]});return c.addEventListener("click",d=>{d.target.closest(".atfb-card__actions")||K().recentlyEndedDrag()||this.selectField(e.id)}),c.addEventListener("keydown",d=>{if(d.key==="Enter"||d.key===" "){d.preventDefault(),this.selectField(e.id);return}d.altKey&&(d.key==="ArrowUp"||d.key==="ArrowDown")&&(d.preventDefault(),this.moveField(e.id,d.key==="ArrowUp"?t-1:t+1),window.requestAnimationFrame(()=>{this.canvas.querySelector(`[data-atfb-card="${CSS.escape(e.id)}"]`)?.focus()})),(d.key==="Delete"||d.key==="Backspace")&&(d.preventDefault(),this.deleteField(e.id))}),c.addEventListener("pointerdown",d=>{d.target.closest(".atfb-card__actions")||K().start({payload:Ee(se,c,{fieldId:e.id,field:e,isNew:!1},d),origin:d})}),c}requiredToggle(e){return r("button",{class:`atfb-req${e.required?" is-on":""}`,type:"button",text:e.required?"Required":"Optional",title:e.required?"This must be answered. Click to make it optional.":"Click to make this required.",attrs:{"aria-pressed":e.required?"true":"false"},on:{pointerdown:s=>s.stopPropagation(),click:s=>{s.stopPropagation(),e.required=!e.required,this.markDirty(),this.renderCanvas(),this.renderInspector()}}})}cardAction(e,t,s){return r("button",{class:"atfb-card__action",type:"button",title:t,attrs:{"aria-label":t},on:{click:a=>{a.stopPropagation(),s()}},children:[z(e)]})}registerCanvasTarget(e){this.canvasTarget?.(),this.canvasTarget=null;const t=r("div",{class:"atfb-marker",attrs:{"aria-hidden":"true"}}),s=K().registerDropTarget({id:`atfb-canvas-${this.form?.id??0}`,element:e,accept:o=>o.type===se,onEnter:()=>e.classList.add("is-dropping"),onLeave:()=>{e.classList.remove("is-dropping"),t.remove()},onDrop:(o,l)=>{e.classList.remove("is-dropping"),t.remove();const c=o.payload.data,d=c.fieldId?this.canvas.querySelector(`[data-atfb-card="${CSS.escape(c.fieldId)}"]`):null,h=Ce(e,".atfb-card",l.clientY,d??void 0);if(c.isNew&&c.fieldType){this.addField(c.fieldType,h);return}if(c.fieldId&&this.locateField(c.fieldId)){this.relocateField(c.fieldId,null,h);return}c.field&&this.insertField({...c.field,id:""},h)}}),a=this.wireRepeaterZones(e),i=o=>{const l=o.detail;if(l?.payload?.type!==se||!e.classList.contains("is-dropping"))return;const c=l.payload.data?.fieldId?this.canvas.querySelector(`[data-atfb-card="${CSS.escape(l.payload.data.fieldId)}"]`):null,d=l.clientY??0,h=Ce(e,".atfb-card",d,c??void 0),w=Array.from(e.querySelectorAll(".atfb-card")).filter(y=>y!==c);h>=w.length?e.append(t):w[h].before(t)};document.addEventListener("os.drag.move",i),this.canvasTarget=()=>{s(),a.forEach(o=>o()),document.removeEventListener("os.drag.move",i)}}wireRepeaterZones(e){const t=[];return e.querySelectorAll("[data-atfb-repeater-zone]").forEach(s=>{const a=s.dataset.atfbRepeaterZone??"";t.push(K().registerDropTarget({id:`atfb-repzone-${this.form?.id??0}-${a}`,element:s,accept:i=>{if(i.type!==se)return!1;const o=i.data;if(o.fieldId===a)return!1;const l=o.isNew?o.fieldType:this.locateField(o.fieldId??"")?.field.type??o.field?.type;return!!l&&this.allowedInRepeater(l)},onEnter:()=>s.classList.add("is-dropping"),onLeave:()=>s.classList.remove("is-dropping"),onDrop:(i,o)=>{s.classList.remove("is-dropping");const l=i.payload.data,c=l.fieldId?e.querySelector(`[data-atfb-subfield="${CSS.escape(l.fieldId)}"]`):null,d=Ce(s,".atfb-subcard",o.clientY,c??void 0);if(l.isNew&&l.fieldType){this.addFieldToRepeater(l.fieldType,a,d);return}if(l.fieldId&&this.locateField(l.fieldId)){this.relocateField(l.fieldId,a,d);return}l.field&&this.insertFieldIntoRepeater({...l.field,id:""},a,d)}})),s.querySelectorAll(".atfb-subcard").forEach(i=>{const o=i.dataset.atfbSubfield??"";i.addEventListener("click",l=>{l.target.closest(".atfb-preview__remove")||(l.stopPropagation(),!K().recentlyEndedDrag()&&this.selectField(o))}),i.addEventListener("keydown",l=>{if(l.stopPropagation(),l.key==="Enter"||l.key===" "){l.preventDefault(),this.selectField(o);return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){l.preventDefault();const c=this.locateField(o);c&&(this.relocateField(o,a,l.key==="ArrowUp"?c.index-1:c.index+1),window.requestAnimationFrame(()=>{this.canvas.querySelector(`[data-atfb-subfield="${CSS.escape(o)}"]`)?.focus()}));return}(l.key==="Delete"||l.key==="Backspace")&&(l.preventDefault(),this.deleteField(o))}),i.addEventListener("pointerdown",l=>{if(l.stopPropagation(),l.target.closest(".atfb-preview__remove"))return;const c=this.locateField(o);c&&K().start({payload:Ee(se,i,{fieldId:o,parentId:a,field:c.field,isNew:!1},l),origin:l})})})}),t}addField(e,t){const s=this.buildField(e);s&&this.insertField(s,t)}buildField(e){const t=this.config?.fieldTypes.find(a=>a.type===e);return!t||!this.schema?void 0:{id:this.nextFieldId(),type:e,label:t.input?t.label:"",placeholder:"",hint:"",required:!1,width:"full",cssClass:"",default:"",choices:t.choices?[{label:"First choice",value:"first"},{label:"Second choice",value:"second"}]:[],logic:{enabled:!1,action:"show",match:"all",rules:[]},messages:{},prefill:"",...t.settings}}allowedInRepeater(e){const t=this.config?.fieldTypes.find(s=>s.type===e);return!t||!t.input?!1:!["repeater","page_break","file","signature","total"].includes(e)}addFieldToRepeater(e,t,s){if(!this.allowedInRepeater(e))return;const a=this.buildField(e);a&&this.insertFieldIntoRepeater(a,t,s)}insertFieldIntoRepeater(e,t,s){const a=this.liveField(t);if(!this.schema||!a||a.type!=="repeater")return;e.id||(e.id=this.nextFieldId()),this.snapshot(),Array.isArray(a.fields)||(a.fields=[]);const i=a.fields,o=s===void 0?i.length:Math.max(0,Math.min(s,i.length));i.splice(o,0,e),this.selected=e.id,this.markDirty(),this.renderCanvas(),this.renderInspector(),window.requestAnimationFrame(()=>{this.canvas.querySelector(`[data-atfb-subfield="${CSS.escape(e.id)}"]`)?.focus()})}relocateField(e,t,s){if(!this.schema)return;const a=this.locateField(e);if(!a)return;if(!a.parent&&!t){this.moveField(e,s);return}const i=t?this.liveField(t):null;if(t&&(!i||i.type!=="repeater"||e===t))return;i&&!Array.isArray(i.fields)&&(i.fields=[]);const o=i?i.fields:this.schema.fields;this.snapshot(),a.list.splice(a.index,1);const l=Math.max(0,Math.min(s,o.length));o.splice(l,0,a.field),this.selected=a.field.id,this.markDirty(),this.renderCanvas(),this.renderInspector()}insertField(e,t){if(!this.schema)return;e.id||(e.id=this.nextFieldId()),this.snapshot();const s=t===void 0?this.schema.fields.length:Math.max(0,Math.min(t,this.schema.fields.length));this.schema.fields.splice(s,0,e),this.selected=e.id,this.markDirty(),this.renderCanvas(),this.renderInspector(),window.requestAnimationFrame(()=>{this.canvas.querySelector(`[data-atfb-card="${CSS.escape(e.id)}"]`)?.focus()})}moveField(e,t){if(!this.schema)return;const s=jt(this.schema.fields,e,t);if(!s)return;this.snapshot();const[a]=this.schema.fields.splice(s.from,1);this.schema.fields.splice(s.to,0,a),this.markDirty(),this.renderCanvas()}duplicateField(e){if(!this.schema)return;const t=this.locateField(e);if(!t)return;const s=JSON.parse(JSON.stringify(t.field)),a=this.usedFieldIds(),i=()=>{let o=a.size+1;for(;a.has(`f${o}`);)o++;const l=`f${o}`;return a.add(l),l};s.id=i();for(const o of s.fields??[])o.id=i();if(t.parent){this.snapshot(),t.list.splice(t.index+1,0,s),this.selected=s.id,this.markDirty(),this.renderCanvas(),this.renderInspector();return}this.insertField(s,t.index+1)}async deleteField(e){if(!this.schema)return;const t=this.locateField(e);if(!t)return;const s=this.schema.fields.filter(i=>i.logic?.rules?.some(o=>o.field===e)),a=s.length?`Delete this field? ${s.length} other field${s.length===1?"":"s"} use it in a condition, and those conditions will stop working.`:Xe("confirmDelete","Delete this? It cannot be undone.");await fe(a,"Delete field")&&(this.snapshot(),t.list.splice(t.index,1),this.selected===e&&(this.selected=null),this.markDirty(),this.renderCanvas(),this.renderInspector())}selectField(e){this.selected=e;for(const t of this.canvas.querySelectorAll("[data-atfb-card]")){const s=t.dataset.atfbCard===e;t.classList.toggle("is-selected",s),t.setAttribute("aria-pressed",s?"true":"false")}for(const t of this.canvas.querySelectorAll("[data-atfb-subfield]"))t.classList.toggle("is-selected",t.dataset.atfbSubfield===e);this.logicMap?.highlight(e),this.renderInspector()}nextFieldId(){const e=this.usedFieldIds();let t=e.size+1;for(;e.has(`f${t}`);)t++;return`f${t}`}usedFieldIds(){const e=new Set;for(const t of this.schema?.fields??[]){e.add(t.id);for(const s of t.fields??[])e.add(s.id)}return e}nextEntryId(e,t){const s=new Set(t.map(i=>i.id));let a=t.length+1;for(;s.has(`${e}${a}`);)a++;return`${e}${a}`}renderTypeSettings(e,t,s,a){for(const i of s){const o=Pt[i];o&&(this.inspector.append(Bt(e,o,a)),o.also&&this.inspector.append(Bt(e,{...o,key:o.also.key,label:o.also.label,hint:o.also.hint},a)))}s.includes("rows")&&e.type!=="likert"&&this.inspector.append(b("Lines tall",G(String(e.rows??""),i=>a("rows",i)))),s.includes("rows")&&e.type==="likert"&&this.inspector.append(this.renderStatementList(e,a)),s.includes("parts")&&this.inspector.append(this.renderPartsEditor(e,t,a)),s.includes("default")&&!["files","object"].includes(t?.value??"")&&this.inspector.append(this.renderDefaultControl(e,t,a))}renderStatementList(e,t){const s=Array.isArray(e.rows)?e.rows:[];return b("Statements",ue(s.map(a=>a.label??"").join(` -`),a=>t("rows",Ht(s,a)),5),"One per line. Each becomes a row of the matrix.")}renderPartsEditor(e,t,s){const a=t?.parts??[],i=Array.isArray(e.parts)?e.parts:a.map(l=>l.key),o=a.map(l=>q(l.label,i.includes(l.key),c=>{const d=a.map(h=>h.key).filter(h=>h===l.key?c:i.includes(h));s("parts",d.length?d:[l.key])}));return r("div",{class:"atfb-section",children:[r("h4",{class:"atfb-section__title",text:"Parts to ask for"}),...o]})}renderDefaultControl(e,t,s){const a="Filled in before they start. They can change it.";return e.type==="switch"||e.type==="consent"?q("On by default",!!e.default,i=>s("default",i)):t?.choices&&(e.choices??[]).length?b("Default answer",I(String(e.default??""),[{value:"",label:"Nothing chosen"},...(e.choices??[]).map(i=>({value:String(i.value),label:i.label||String(i.value)}))],i=>s("default",i)),a):b("Default answer",T(String(e.default??""),i=>s("default",i)),a)}renderChoicesEditor(e,t){const s=e.choices??[],a=o=>this.liveField(e.id)?.choices?.[o],i=r("div",{class:"atfb-choices"});return s.forEach((o,l)=>{const c=r("div",{class:"atfb-choice-row",children:[e.type==="image_choice"?this.choiceImageWell(o,l,e):null,J(T(o.label,d=>{const h=a(l);if(!h)return;const w=!h.value||h.value===h.label;h.label=d,w&&(h.value=d),this.markDirty();const y=this.liveField(e.id);y&&this.syncCanvas(y)}),`choice:${l}:label`),J(T(o.value,d=>{const h=a(l);h&&(h.value=d,this.markDirty())},"value"),`choice:${l}:value`),e.type==="quiz"||o.points!==void 0?G(String(o.points??""),d=>{const h=a(l);h&&(h.points=d===""?void 0:Number(d),this.markDirty())}):G(String(o.price??""),d=>{const h=a(l);h&&(h.price=d===""?void 0:Number(d),this.markDirty())}),r("button",{class:"atfb-card__action",type:"button",attrs:{"aria-label":`Remove ${o.label}`},on:{click:()=>{const d=this.liveField(e.id);d&&((d.choices??[]).splice(l,1),t("choices",d.choices),this.renderInspector())}},children:[z("trash")]})]});i.append(c)}),r("div",{class:"atfb-section",children:[r("h4",{text:"Choices"}),r("p",{class:"atfb-hint",text:e.type==="quiz"?"Label, value, points.":"Label, value, and a price for calculations."}),i,E("Add choice",()=>{const o=this.liveField(e.id);if(!o)return;const l=o.choices??[];l.push({label:"",value:""}),t("choices",l),this.renderInspector()},"ghost","plus-alt2"),e.type==="quiz"?b("Correct answer",I(String(e.correct??""),[{value:"",label:"—"},...s.map(o=>({value:o.value,label:o.label}))],o=>t("correct",o))):null]})}choiceImageWell(e,t,s){const a=r("div",{class:`atfb-well${e.image?" has-image":""}`,attrs:{"data-choice":t,"aria-label":`Image for ${e.label||`choice ${t+1}`}`},children:[e.image?r("span",{class:"atfb-well__id",text:`#${e.image}`}):z("format-image")]}),i=K().registerDropTarget({id:`atfb-well-${s.id}-${t}`,element:a,accept:o=>An.includes(o.type),onEnter:()=>a.classList.add("is-dropping"),onLeave:()=>a.classList.remove("is-dropping"),onDrop:o=>{a.classList.remove("is-dropping");const l=o.payload.data,c=Number(l.attachmentId??l.id??l.file?.id??0);if(!c){N("That is not an image this field can use","","error");return}const d=this.liveField(s.id)?.choices?.[t];d&&(d.image=c,this.markDirty(),this.renderInspector())}});return this.teardowns.push(i),a.addEventListener("click",()=>{const o=this.liveField(s.id)?.choices?.[t];o?.image&&(o.image=void 0,this.markDirty(),this.renderInspector())}),a}renderValidationSection(e,t,s){const a=[],i=[];t.includes("minlength")&&i.push(["minlength","Minimum characters"],["maxlength","Maximum characters"]),t.includes("min")?i.push(["min","Minimum"],["max","Maximum"]):t.includes("max")&&i.push(["max","Highest"]),t.includes("step")&&i.push(["step","Steps of"]),t.includes("mindate")&&i.push(["minDate","Earliest date"],["maxDate","Latest date"]),t.includes("mintime")&&i.push(["minTime","Earliest time"],["maxTime","Latest time"]);for(const[l,c]of i)a.push(b(c,T(String(e[l]??""),d=>s(l,d))));t.includes("pattern")&&a.push(...this.renderAnswerShapeRows(e,s)),t.includes("unique")&&a.push(q("No two people may submit the same value",!!e.unique,l=>s("unique",l)));const o=e.messages??{};return t.includes("required")&&a.push(b("Message when required",T(o.required??"",l=>{o.required=l,s("messages",o)}),"Leave empty for the default wording.")),a.length?this.section(`validation:${e.id}`,"Validation",a):r("div",{class:"atfb-section is-empty"})}buildShapePicker(e,t){const s=[{heading:null,options:[{value:"",label:"Anything at all"}]},...Ln.map(i=>({heading:i,options:Dt.filter(o=>o.group===i).map(o=>({value:o.slug,label:o.label}))})),{heading:"Your own",options:[{value:"custom",label:"A custom rule…"}]}];if(Y("os-select")&&Y("os-option")){const i=document.createElement("os-select");i.setAttribute("value",e),i.setAttribute("aria-label","What the answer should look like"),i.classList.add("atfb-field");for(const o of s){if(o.heading){const l=document.createElement("os-option");l.setAttribute("value",`__heading:${o.heading}`),l.setAttribute("disabled",""),l.textContent=o.heading,i.append(l)}for(const l of o.options){const c=document.createElement("os-option");c.setAttribute("value",l.value),c.textContent=l.label,i.append(c)}}return i.addEventListener("os-pick",o=>{t(String(o.detail?.value??""))}),i}const a=r("select",{class:"atfb-input atfb-select",attrs:{"aria-label":"What the answer should look like"},on:{change:i=>t(i.target.value)}});for(const i of s){const o=i.heading?(()=>{const l=document.createElement("optgroup");return l.label=i.heading,a.append(l),l})():a;for(const l of i.options)o.append(r("option",{value:l.value,text:l.label,attrs:{selected:l.value===e}}))}return a}renderAnswerShapeRows(e,t){const a=(typeof e.validation=="string"?e.validation:"")||(e.pattern?"custom":""),i=()=>xn({root:this.root,field:this.liveField(e.id)??e,onSave:h=>{t("validation","custom"),t("pattern",h.pattern),t("validationRecipe",JSON.stringify(h.recipe));const w={...this.liveField(e.id)?.messages??{}};w.invalid=h.message,t("messages",w),this.renderInspector()},onCancel:()=>this.renderInspector()}),o=h=>{if(h==="custom"){i();return}t("validation",h),t("pattern",""),t("validationRecipe",""),this.renderInspector()},l=this.buildShapePicker(a,o),c=En(a),d=[b("The answer should be",l,c?`e.g. ${c.example}`:"Checked as they type, and again on the server.")];if(a==="custom"){const h=Tt(String(e.validationRecipe??"")),w=Mt(h)||(e.pattern?`Matches the expression ${String(e.pattern)}`:"No rule yet — open the builder.");d.push(b("Your rule",r("div",{class:"atfb-valrule",children:[r("p",{class:"atfb-valrule__words",text:w}),E("Edit the rule…",i,"secondary","edit")]}),xe(h)||e.pattern?"Built in the rule builder, with a playground to test it.":void 0))}return d}logicRulesEditor(e,t,s=""){const a=(this.schema?.fields??[]).filter(d=>d.id!==s&&d.type!=="page_break"),i=()=>r("div",{class:"atfb-rule-join",children:[r("button",{class:"atfb-rule-join__chip",type:"button",text:e.match==="all"?"and":"or",title:"Switch between needing every rule (and) or any one of them (or).",on:{click:()=>t(d=>{d.match=d.match==="all"?"any":"all"},!0)}})]}),o=(d,h)=>{const w=r("button",{class:"atfb-card__action",type:"button",attrs:{"aria-label":"Remove this rule"},title:"Remove this rule",on:{click:()=>t(u=>{u.rules.splice(h,1)},!0)},children:[z("trash")]}),y=[r("div",{class:"atfb-rule__top",children:[I(d.field,a.map(u=>({value:u.id,label:u.label||u.id})),u=>t(x=>{const g=x.rules[h];g&&(g.field=u,g.value="")},!0)),w]}),I(d.operator,Object.entries(this.config?.operators??{}).map(([u,x])=>({value:u,label:x})),u=>t(x=>{const g=x.rules[h];g&&(g.operator=u)},!0))];if(!Fe.includes(d.operator)){const u=this.schema?.fields.find(x=>x.id===d.field);if(u?.choices?.length){const x=u.choices.map(g=>({value:g.value,label:g.label||g.value}));d.value!==""&&!u.choices.some(g=>g.value===d.value)&&x.unshift({value:d.value,label:d.value}),y.push(I(d.value,x,g=>t(f=>{const $=f.rules[h];$&&($.value=g)})))}else y.push(T(d.value,x=>t(g=>{const f=g.rules[h];f&&(f.value=x)}),"The answer to compare against"))}return r("div",{class:"atfb-rule",children:y})},l=r("div",{class:"atfb-rules"});e.rules.forEach((d,h)=>{h>0&&l.append(i()),l.append(o(d,h))});const c=E("Add rule",()=>{t(d=>{d.rules.push({field:a[0]?.id??"",operator:"is",value:""})},!0)},"ghost","plus-alt2");return[l,c]}conditionsSection(e,t,s){const a=(o,l=!1)=>{o(s),this.markDirty(),l&&this.renderCanvas()},i=t==="confirmation"?"Use":"Send";return this.section(`conditions:${e}`,"Conditions",[q(`Only ${i.toLowerCase()} this ${t} sometimes`,s.enabled,o=>a(l=>{l.enabled=o},!0)),s.enabled?r("div",{children:[r("div",{class:"atfb-rule-head",children:[r("span",{text:`${i} it when`}),I(s.match,[{value:"all",label:"all"},{value:"any",label:"any"}],o=>a(l=>{l.match=o},!0)),r("span",{text:"of these match:"})]}),...this.logicRulesEditor(s,a)]}):null],s.enabled)}renderLogicSection(e){const t=e.logic,s=()=>this.liveField(e.id)?.logic,a=(o,l=!1)=>{const c=s();c&&(o(c),this.markDirty(),this.renderCanvas(),l&&this.renderInspector())},i=this.logicRulesEditor(t,a,e.id);return this.section(`logic:${e.id}`,"Conditional logic",[q("Only show this field sometimes",t.enabled,o=>{a(l=>{l.enabled=o},!0)}),t.enabled?r("div",{children:[r("div",{class:"atfb-rule-head",children:[I(t.action,[{value:"show",label:"Show"},{value:"hide",label:"Hide"}],o=>a(l=>{l.action=o},!0)),r("span",{text:"this field when"}),I(t.match,[{value:"all",label:"all"},{value:"any",label:"any"}],o=>a(l=>{l.match=o},!0)),r("span",{text:"of these match:"})]}),...i]}):null],t.enabled)}renderTabCanvas(){return this.schema?this.tab==="theme"?mt({themes:this.themes,tokens:this.config?.tokens??[],activeSlug:this.schema.settings.theme,overrides:this.schema.settings.themeOverrides,onTheme:e=>{this.schema.settings.theme=e,this.markDirty()},onOverride:(e,t)=>{t===""?delete this.schema.settings.themeOverrides[e]:this.schema.settings.themeOverrides[e]=t,this.markDirty()},onOverridesReplaced:e=>{this.schema.settings.themeOverrides={...e},this.markDirty()},previewFor:(e,t)=>this.previewHtml(e,t),onThemesChanged:e=>{this.themes=e}}):this.tab==="settings"?this.renderSettingsPane():this.tab==="notify"?this.renderNotificationsPane():this.renderConfirmationsPane():r("div")}async paintCanvasTheme(){if(!this.form||!this.schema)return;const e=this.schema.settings.theme,t=JSON.stringify([e,this.schema.settings.themeOverrides]);if(t!==this.canvasThemeSignature){this.canvasThemeSignature=t;try{const s=await this.previewHtml(e,this.schema.settings.themeOverrides??{});this.root.classList.toggle("atfb--dark-form",/atf-is-dark/.test(s));const a=/