drill-widgets 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4238 @@
1
+ (function(D,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(D=typeof globalThis<"u"?globalThis:D||self,A(D.Begin={}))})(this,function(D){"use strict";/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */var Re;const A=globalThis,se=A.ShadowRoot&&(A.ShadyCSS===void 0||A.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,re=Symbol(),xe=new WeakMap;let _e=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==re)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(se&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=xe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xe.set(t,e))}return e}toString(){return this.cssText}};const We=i=>new _e(typeof i=="string"?i:i+"",void 0,re),L=(i,...e)=>{const t=i.length===1?i[0]:e.reduce((n,s,r)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[r+1],i[0]);return new _e(t,i,re)},He=(i,e)=>{if(se)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),s=A.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=t.cssText,i.appendChild(n)}},ye=se?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return We(t)})(i):i;/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const{is:Ve,defineProperty:je,getOwnPropertyDescriptor:Be,getOwnPropertyNames:Qe,getOwnPropertySymbols:qe,getPrototypeOf:Ge}=Object,M=globalThis,Se=M.trustedTypes,Ye=Se?Se.emptyScript:"",oe=M.reactiveElementPolyfillSupport,W=(i,e)=>i,Y={toAttribute(i,e){switch(e){case Boolean:i=i?Ye:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ae=(i,e)=>!Ve(i,e),we={attribute:!0,type:String,converter:Y,reflect:!1,useDefault:!1,hasChanged:ae};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),M.litPropertyMetadata??(M.litPropertyMetadata=new WeakMap);let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=we){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),s=this.getPropertyDescriptor(e,n,t);s!==void 0&&je(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){const{get:s,set:r}=Be(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??we}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const e=Ge(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const t=this.properties,n=[...Qe(t),...qe(t)];for(const s of n)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,s]of t)this.elementProperties.set(n,s)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const s=this._$Eu(t,n);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const s of n)t.unshift(ye(s))}else e!==void 0&&t.push(ye(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var r;const n=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,n);if(s!==void 0&&n.reflect===!0){const o=(((r=n.converter)==null?void 0:r.toAttribute)!==void 0?n.converter:Y).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){var r,o;const n=this.constructor,s=n._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const a=n.getPropertyOptions(s),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:Y;this._$Em=s,this[s]=d.fromAttribute(t,a.type)??((o=this._$Ej)==null?void 0:o.get(s))??null,this._$Em=null}}requestUpdate(e,t,n){var s;if(e!==void 0){const r=this.constructor,o=this[e];if(n??(n=r.getPropertyOptions(e)),!((n.hasChanged??ae)(o,t)||n.useDefault&&n.reflect&&o===((s=this._$Ej)==null?void 0:s.get(e))&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:s,wrapped:r},o){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,d=this[r];a!==!0||this._$AL.has(r)||d===void 0||this.C(r,void 0,o,d)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(n=this._$EO)==null||n.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var s;return(s=n.hostUpdated)==null?void 0:s.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[W("elementProperties")]=new Map,N[W("finalized")]=new Map,oe==null||oe({ReactiveElement:N}),(M.reactiveElementVersions??(M.reactiveElementVersions=[])).push("2.1.0");/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const H=globalThis,J=H.trustedTypes,ke=J?J.createPolicy("lit-html",{createHTML:i=>i}):void 0,$e="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,De="?"+T,Je=`<${De}>`,F=document,V=()=>F.createComment(""),j=i=>i===null||typeof i!="object"&&typeof i!="function",de=Array.isArray,Ke=i=>de(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",le=`[
14
+ \f\r]`,B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ee=/>/g,z=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Me=/"/g,Te=/^(?:script|style|textarea|title)$/i,Xe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=Xe(1),I=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fe=new WeakMap,U=F.createTreeWalker(F,129);function ze(i,e){if(!de(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}const Ze=(i,e)=>{const t=i.length-1,n=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=B;for(let a=0;a<t;a++){const d=i[a];let p,c,u=-1,h=0;for(;h<d.length&&(o.lastIndex=h,c=o.exec(d),c!==null);)h=o.lastIndex,o===B?c[1]==="!--"?o=Ce:c[1]!==void 0?o=Ee:c[2]!==void 0?(Te.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=z):c[3]!==void 0&&(o=z):o===z?c[0]===">"?(o=s??B,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?z:c[3]==='"'?Me:Ae):o===Me||o===Ae?o=z:o===Ce||o===Ee?o=B:(o=z,s=void 0);const f=o===z&&i[a+1].startsWith("/>")?" ":"";r+=o===B?d+Je:u>=0?(n.push(p),d.slice(0,u)+$e+d.slice(u)+T+f):d+T+(u===-2?a:f)}return[ze(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};class Q{constructor({strings:e,_$litType$:t},n){let s;this.parts=[];let r=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Ze(e,t);if(this.el=Q.createElement(p,n),U.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=U.nextNode())!==null&&d.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const u of s.getAttributeNames())if(u.endsWith($e)){const h=c[o++],f=s.getAttribute(u).split(T),b=/([.?@])?(.*)/.exec(h);d.push({type:1,index:r,name:b[2],strings:f,ctor:b[1]==="."?tt:b[1]==="?"?it:b[1]==="@"?nt:K}),s.removeAttribute(u)}else u.startsWith(T)&&(d.push({type:6,index:r}),s.removeAttribute(u));if(Te.test(s.tagName)){const u=s.textContent.split(T),h=u.length-1;if(h>0){s.textContent=J?J.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],V()),U.nextNode(),d.push({type:2,index:++r});s.append(u[h],V())}}}else if(s.nodeType===8)if(s.data===De)d.push({type:2,index:r});else{let u=-1;for(;(u=s.data.indexOf(T,u+1))!==-1;)d.push({type:7,index:r}),u+=T.length-1}r++}}static createElement(e,t){const n=F.createElement("template");return n.innerHTML=e,n}}function O(i,e,t=i,n){var o,a;if(e===I)return e;let s=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const r=j(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(i),s._$AT(i,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=s:t._$Cl=s),s!==void 0&&(e=O(i,s._$AS(i,e.values),s,n)),e}class et{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,s=((e==null?void 0:e.creationScope)??F).importNode(t,!0);U.currentNode=s;let r=U.nextNode(),o=0,a=0,d=n[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new q(r,r.nextSibling,this,e):d.type===1?p=new d.ctor(r,d.name,d.strings,this,e):d.type===6&&(p=new st(r,this,e)),this._$AV.push(p),d=n[++a]}o!==(d==null?void 0:d.index)&&(r=U.nextNode(),o++)}return U.currentNode=F,s}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class q{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,s){this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=O(this,e,t),j(e)?e===v||e==null||e===""?(this._$AH!==v&&this._$AR(),this._$AH=v):e!==this._$AH&&e!==I&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ke(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==v&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(F.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:n}=e,s=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Q.createElement(ze(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(t);else{const o=new et(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Fe.get(e.strings);return t===void 0&&Fe.set(e.strings,t=new Q(e)),t}k(e){de(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,s=0;for(const r of e)s===t.length?t.push(n=new q(this.O(V()),this.O(V()),this,this.options)):n=t[s],n._$AI(r),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,s,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=v}_$AI(e,t=this,n,s){const r=this.strings;let o=!1;if(r===void 0)e=O(this,e,t,0),o=!j(e)||e!==this._$AH&&e!==I,o&&(this._$AH=e);else{const a=e;let d,p;for(e=r[0],d=0;d<r.length-1;d++)p=O(this,a[n+d],t,d),p===I&&(p=this._$AH[d]),o||(o=!j(p)||p!==this._$AH[d]),p===v?e=v:e!==v&&(e+=(p??"")+r[d+1]),this._$AH[d]=p}o&&!s&&this.j(e)}j(e){e===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class tt extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===v?void 0:e}}class it extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==v)}}class nt extends K{constructor(e,t,n,s,r){super(e,t,n,s,r),this.type=5}_$AI(e,t=this){if((e=O(this,e,t,0)??v)===I)return;const n=this._$AH,s=e===v&&n!==v||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==v&&(n===v||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class st{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){O(this,e)}}const pe=H.litHtmlPolyfillSupport;pe==null||pe(Q,q),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.3.0");const rt=(i,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let s=n._$litPart$;if(s===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=s=new q(e.insertBefore(V(),r),r,void 0,t??{})}return s._$AI(i),s};/**
16
+ * @license
17
+ * Copyright 2017 Google LLC
18
+ * SPDX-License-Identifier: BSD-3-Clause
19
+ */const P=globalThis;let R=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return I}};R._$litElement$=!0,R.finalized=!0,(Re=P.litElementHydrateSupport)==null||Re.call(P,{LitElement:R});const ce=P.litElementPolyfillSupport;ce==null||ce({LitElement:R}),(P.litElementVersions??(P.litElementVersions=[])).push("4.2.0");/**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ */const Ie=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};/**
24
+ * @license
25
+ * Copyright 2017 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */const ot={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:ae},at=(i=ot,e,t)=>{const{kind:n,metadata:s}=t;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),n==="setter"&&((i=Object.create(i)).wrapped=!0),r.set(t.name,i),n==="accessor"){const{name:o}=t;return{set(a){const d=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,d,i)},init(a){return a!==void 0&&this.C(o,void 0,i,a),a}}}if(n==="setter"){const{name:o}=t;return function(a){const d=this[o];e.call(this,a),this.requestUpdate(o,d,i)}}throw Error("Unsupported decorator location: "+n)};function C(i){return(e,t)=>typeof t=="object"?at(i,e,t):((n,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,n),o?Object.getOwnPropertyDescriptor(s,r):void 0})(i,e,t)}/**
28
+ * @license
29
+ * Copyright 2017 Google LLC
30
+ * SPDX-License-Identifier: BSD-3-Clause
31
+ */function _(i){return C({...i,state:!0,attribute:!1})}const y=[];for(let i=0;i<256;++i)y.push((i+256).toString(16).slice(1));function dt(i,e=0){return(y[i[e+0]]+y[i[e+1]]+y[i[e+2]]+y[i[e+3]]+"-"+y[i[e+4]]+y[i[e+5]]+"-"+y[i[e+6]]+y[i[e+7]]+"-"+y[i[e+8]]+y[i[e+9]]+"-"+y[i[e+10]]+y[i[e+11]]+y[i[e+12]]+y[i[e+13]]+y[i[e+14]]+y[i[e+15]]).toLowerCase()}let ue;const lt=new Uint8Array(16);function pt(){if(!ue){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ue=crypto.getRandomValues.bind(crypto)}return ue(lt)}const Ue={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function he(i,e,t){var s;if(Ue.randomUUID&&!i)return Ue.randomUUID();i=i||{};const n=i.random??((s=i.rng)==null?void 0:s.call(i))??pt();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,dt(n)}const ct=L`
32
+ :host {
33
+ display: block;
34
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
35
+ sans-serif;
36
+ background-color: #f9fafb; /* Lighter gray background */
37
+ border-radius: 8px;
38
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
39
+ overflow: hidden;
40
+ min-height: 600px;
41
+ }
42
+
43
+ /* Header */
44
+ .header {
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: flex-end;
48
+ padding: 24px;
49
+ border-bottom: 1px solid #e5e7eb;
50
+ background-color: #ffffff;
51
+ gap: 24px;
52
+ }
53
+
54
+ .header-inputs {
55
+ display: flex;
56
+ gap: 24px;
57
+ flex: 1;
58
+ }
59
+
60
+ .header-actions {
61
+ display: flex;
62
+ gap: 12px;
63
+ flex-shrink: 0;
64
+ }
65
+
66
+ .header-actions button {
67
+ padding: 8px 16px;
68
+ border-radius: 6px;
69
+ font-size: 14px;
70
+ font-weight: 500;
71
+ cursor: pointer;
72
+ transition: all 0.2s ease;
73
+ }
74
+
75
+ .cancel-button {
76
+ background-color: #ffffff;
77
+ color: #374151;
78
+ border: 1px solid #d1d5db;
79
+ }
80
+
81
+ .cancel-button:hover {
82
+ background-color: #f9fafb;
83
+ border-color: #9ca3af;
84
+ }
85
+
86
+ .save-button {
87
+ background-color: #0f766e;
88
+ color: #ffffff;
89
+ border: 1px solid #0f766e;
90
+ padding: 12px 24px;
91
+ font-weight: 600;
92
+ }
93
+
94
+ .save-button:hover {
95
+ background-color: #0d9488;
96
+ border-color: #0d9488;
97
+ }
98
+
99
+ /* Main Content */
100
+ .main-content {
101
+ padding: 0;
102
+ background-color: #f9fafb; /* Lighter gray background continues */
103
+ }
104
+ `,ut=L`
105
+ .form-group {
106
+ display: flex;
107
+ flex-direction: column;
108
+ flex: 1;
109
+ }
110
+
111
+ .form-group label {
112
+ font-weight: 500;
113
+ color: #374151;
114
+ margin-bottom: 8px;
115
+ font-size: 14px;
116
+ }
117
+
118
+ .form-group input,
119
+ .form-group textarea {
120
+ padding: 12px;
121
+ border: 1px solid #d1d5db;
122
+ border-radius: 6px;
123
+ font-size: 14px;
124
+ transition: border-color 0.2s ease;
125
+ }
126
+
127
+ .form-group input:focus,
128
+ .form-group textarea:focus {
129
+ outline: none;
130
+ border-color: #3b82f6;
131
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
132
+ }
133
+
134
+ .form-group input::placeholder,
135
+ .form-group textarea::placeholder {
136
+ color: #9ca3af;
137
+ }
138
+
139
+ /* Two Column Layout */
140
+ .content-columns {
141
+ background-color: #ffffff;
142
+ display: grid;
143
+ grid-template-columns: 2fr 3fr;
144
+ min-height: 500px;
145
+ gap: 1px;
146
+ border: 1px solid #e5e7eb;
147
+ overflow: hidden;
148
+ }
149
+
150
+ /* Checkbox Configuration Styles */
151
+ .question-checkbox-config {
152
+ margin-top: 12px;
153
+ }
154
+
155
+ .checkbox-type-selection {
156
+ display: flex;
157
+ flex-direction: column;
158
+ gap: 8px;
159
+ margin-bottom: 16px;
160
+ }
161
+
162
+ .checkbox-type-label {
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 8px;
166
+ font-size: 14px;
167
+ color: #374151;
168
+ cursor: pointer;
169
+ padding: 8px;
170
+ border-radius: 6px;
171
+ transition: background-color 0.2s ease;
172
+ }
173
+
174
+ .checkbox-type-label:hover {
175
+ background-color: #f9fafb;
176
+ }
177
+
178
+ .checkbox-type-label input[type="radio"] {
179
+ margin: 0;
180
+ cursor: pointer;
181
+ }
182
+
183
+ .single-checkbox-info {
184
+ background-color: #f0f9ff;
185
+ border: 1px solid #bae6fd;
186
+ border-radius: 6px;
187
+ padding: 12px;
188
+ margin-top: 8px;
189
+ }
190
+
191
+ .single-checkbox-info .config-note {
192
+ margin: 0;
193
+ font-size: 14px;
194
+ color: #0369a1;
195
+ font-style: italic;
196
+ }
197
+
198
+ /* Content Element Styles */
199
+ .add-buttons {
200
+ display: flex;
201
+ gap: 8px;
202
+ align-items: center;
203
+ }
204
+
205
+ .content-dropdown {
206
+ position: relative;
207
+ display: inline-block;
208
+ }
209
+
210
+ .content-options {
211
+ position: absolute;
212
+ top: 100%;
213
+ right: 0;
214
+ background: white;
215
+ border: 1px solid #d1d5db;
216
+ border-radius: 6px;
217
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
218
+ z-index: 1000;
219
+ min-width: 120px;
220
+ display: none;
221
+ }
222
+
223
+ .content-dropdown:hover .content-options {
224
+ display: block;
225
+ }
226
+
227
+ .content-options button {
228
+ display: block;
229
+ width: 100%;
230
+ padding: 8px 12px;
231
+ border: none;
232
+ background: white;
233
+ text-align: left;
234
+ font-size: 14px;
235
+ cursor: pointer;
236
+ transition: background-color 0.2s ease;
237
+ }
238
+
239
+ .content-options button:hover {
240
+ background-color: #f3f4f6;
241
+ }
242
+
243
+ .content-item {
244
+ border: 1px solid #e5e7eb;
245
+ border-radius: 6px;
246
+ padding: 16px;
247
+ margin-bottom: 12px;
248
+ background: #f9fafb;
249
+ }
250
+
251
+ .content-header {
252
+ display: flex;
253
+ justify-content: space-between;
254
+ align-items: center;
255
+ margin-bottom: 12px;
256
+ }
257
+
258
+ .content-title {
259
+ margin: 0;
260
+ font-size: 16px;
261
+ font-weight: 600;
262
+ color: #374151;
263
+ }
264
+
265
+ .content-header-controls {
266
+ display: flex;
267
+ gap: 8px;
268
+ align-items: center;
269
+ }
270
+
271
+ .content-type-select {
272
+ padding: 4px 8px;
273
+ border: 1px solid #d1d5db;
274
+ border-radius: 4px;
275
+ font-size: 12px;
276
+ background: white;
277
+ }
278
+
279
+ .content-config-section {
280
+ margin-top: 12px;
281
+ }
282
+
283
+ .config-textarea {
284
+ width: 100%;
285
+ min-height: 80px;
286
+ padding: 8px;
287
+ border: 1px solid #d1d5db;
288
+ border-radius: 4px;
289
+ font-size: 14px;
290
+ font-family: inherit;
291
+ resize: vertical;
292
+ }
293
+
294
+ .config-textarea:focus {
295
+ outline: none;
296
+ border-color: #3b82f6;
297
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
298
+ }
299
+ `,ht=L`
300
+ /* Steps and Questions Sections */
301
+ .section {
302
+ padding: 16px;
303
+ background-color: #ffffff;
304
+ }
305
+
306
+ .section-header {
307
+ display: flex;
308
+ justify-content: space-between;
309
+ align-items: center;
310
+ margin-bottom: 16px;
311
+ }
312
+
313
+ .section-header h2 {
314
+ margin: 0;
315
+ font-size: 18px;
316
+ font-weight: 600;
317
+ color: #111827;
318
+ }
319
+
320
+ .add-button {
321
+ background-color: #f9fafb; /* Gray background to match sections */
322
+ color: #3b82f6;
323
+ border: 1px solid #3b82f6;
324
+ padding: 6px 12px;
325
+ border-radius: 6px;
326
+ font-size: 14px;
327
+ font-weight: 500;
328
+ cursor: pointer;
329
+ transition: all 0.2s ease;
330
+ display: flex;
331
+ align-items: center;
332
+ gap: 6px;
333
+ }
334
+
335
+ .add-button:hover {
336
+ background-color: #f3f4f6; /* Slightly darker gray on hover */
337
+ }
338
+
339
+ .add-button::before {
340
+ content: "+";
341
+ font-size: 16px;
342
+ font-weight: 600;
343
+ }
344
+
345
+ /* Empty States */
346
+ .empty-state {
347
+ text-align: center;
348
+ padding: 48px 24px;
349
+ background-color: transparent; /* No background color */
350
+ border: none; /* No dashed border */
351
+ border-radius: 0;
352
+ margin-top: 16px;
353
+ }
354
+
355
+ .empty-state h3 {
356
+ margin: 0 0 8px 0;
357
+ font-size: 16px;
358
+ font-weight: 600;
359
+ color: #6b7280; /* Gray text color */
360
+ }
361
+
362
+ .empty-state p {
363
+ margin: 0 0 24px 0;
364
+ color: #6b7280;
365
+ font-size: 14px;
366
+ line-height: 1.5;
367
+ }
368
+
369
+ .empty-state .add-button {
370
+ background-color: #f9fafb; /* Lighter gray to match background */
371
+ color: #3b82f6; /* Blue text to match header buttons */
372
+ border: 1px solid #3b82f6; /* Blue border to match header buttons */
373
+ padding: 8px 16px;
374
+ margin: 0 auto; /* Center the button horizontally */
375
+ }
376
+
377
+ .empty-state .add-button:hover {
378
+ background-color: #f3f4f6; /* Slightly darker gray on hover */
379
+ }
380
+
381
+ /* Steps for Questions Section */
382
+ .steps-empty-state {
383
+ padding: 32px 24px;
384
+ text-align: center; /* Center the steps empty state too */
385
+ }
386
+
387
+ .steps-empty-state h3 {
388
+ text-align: center; /* Center the heading */
389
+ margin-bottom: 4px;
390
+ color: #6b7280; /* Gray text color */
391
+ }
392
+
393
+ .steps-empty-state p {
394
+ text-align: center; /* Center the text */
395
+ margin-bottom: 16px;
396
+ color: #6b7280;
397
+ }
398
+
399
+ .steps-empty-state .add-button {
400
+ background-color: #f9fafb; /* Lighter gray to match background */
401
+ color: #3b82f6; /* Blue text to match header buttons */
402
+ border: 1px solid #3b82f6; /* Blue border to match header buttons */
403
+ margin: 0 auto; /* Center the button horizontally */
404
+ }
405
+
406
+ .steps-empty-state .add-button:hover {
407
+ background-color: #f3f4f6; /* Slightly darker gray on hover */
408
+ }
409
+
410
+ /* Disabled States */
411
+ .section.disabled {
412
+ opacity: 0.6;
413
+ }
414
+
415
+ .add-button.disabled,
416
+ .add-button:disabled {
417
+ opacity: 0.5;
418
+ cursor: not-allowed;
419
+ pointer-events: none;
420
+ }
421
+
422
+ /* Question Management Styles */
423
+ .questions-list {
424
+ display: flex;
425
+ flex-direction: column;
426
+ gap: 16px;
427
+ }
428
+
429
+ .question-item {
430
+ padding: 16px;
431
+ border: 1px solid #e5e7eb;
432
+ border-radius: 8px;
433
+ background-color: #f9fafb;
434
+ display: flex;
435
+ flex-direction: column;
436
+ gap: 8px;
437
+ }
438
+
439
+ .question-header {
440
+ display: flex;
441
+ justify-content: space-between;
442
+ align-items: center;
443
+ gap: 12px;
444
+ margin-bottom: 12px;
445
+ }
446
+
447
+ .question-title {
448
+ margin: 0;
449
+ font-size: 16px;
450
+ font-weight: 600;
451
+ color: #111827;
452
+ flex: 1;
453
+ }
454
+
455
+ .question-header-controls {
456
+ display: flex;
457
+ align-items: center;
458
+ gap: 8px;
459
+ }
460
+
461
+ .question-type-select {
462
+ padding: 6px 10px;
463
+ border: 1px solid #d1d5db;
464
+ border-radius: 6px;
465
+ background-color: #ffffff;
466
+ font-size: 13px;
467
+ color: #374151;
468
+ min-width: 140px;
469
+ }
470
+
471
+ .question-type-select:focus {
472
+ outline: none;
473
+ border-color: #3b82f6;
474
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
475
+ }
476
+
477
+ .delete-question-button {
478
+ background: none;
479
+ border: none;
480
+ color: #ef4444;
481
+ font-size: 16px;
482
+ cursor: pointer;
483
+ padding: 4px;
484
+ border-radius: 4px;
485
+ transition: all 0.2s ease;
486
+ }
487
+
488
+ .delete-question-button:hover {
489
+ background-color: #fee2e2;
490
+ }
491
+
492
+ .question-label-input {
493
+ padding: 12px;
494
+ border: 1px solid #d1d5db;
495
+ border-radius: 6px;
496
+ font-size: 14px;
497
+ background-color: #ffffff;
498
+ transition: border-color 0.2s ease;
499
+ }
500
+
501
+ .question-label-input:focus {
502
+ outline: none;
503
+ border-color: #3b82f6;
504
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
505
+ }
506
+
507
+ .question-label-input::placeholder {
508
+ color: #9ca3af;
509
+ }
510
+
511
+ .question-required-label {
512
+ display: flex;
513
+ align-items: center;
514
+ gap: 8px;
515
+ font-size: 14px;
516
+ color: #374151;
517
+ cursor: pointer;
518
+ }
519
+
520
+ .question-required-label input[type="checkbox"] {
521
+ margin: 0;
522
+ cursor: pointer;
523
+ }
524
+
525
+ .add-question-button {
526
+ background-color: #f9fafb;
527
+ color: #3b82f6;
528
+ border: 1px solid #3b82f6;
529
+ padding: 8px 16px;
530
+ border-radius: 6px;
531
+ font-size: 14px;
532
+ font-weight: 500;
533
+ cursor: pointer;
534
+ transition: all 0.2s ease;
535
+ display: flex;
536
+ align-items: center;
537
+ justify-content: center;
538
+ gap: 6px;
539
+ margin-top: 8px;
540
+ }
541
+
542
+ .add-question-button:hover {
543
+ background-color: #f3f4f6;
544
+ }
545
+
546
+ .add-question-button::before {
547
+ content: "+";
548
+ font-size: 16px;
549
+ font-weight: 600;
550
+ }
551
+
552
+ /* Question Type-Specific Configuration Styles */
553
+ .question-options-section,
554
+ .question-config-section {
555
+ margin-top: 8px;
556
+ padding-top: 8px;
557
+ border-top: 1px solid #e5e7eb;
558
+ }
559
+
560
+ .options-label,
561
+ .config-label {
562
+ display: block;
563
+ font-size: 13px;
564
+ font-weight: 500;
565
+ color: #374151;
566
+ margin-bottom: 8px;
567
+ }
568
+
569
+ .options-list {
570
+ display: flex;
571
+ flex-direction: column;
572
+ gap: 6px;
573
+ }
574
+
575
+ .option-item {
576
+ display: flex;
577
+ align-items: center;
578
+ gap: 8px;
579
+ }
580
+
581
+ .option-input {
582
+ flex: 1;
583
+ padding: 8px 10px;
584
+ border: 1px solid #d1d5db;
585
+ border-radius: 4px;
586
+ font-size: 13px;
587
+ background-color: #ffffff;
588
+ }
589
+
590
+ .option-input:focus {
591
+ outline: none;
592
+ border-color: #3b82f6;
593
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
594
+ }
595
+
596
+ .remove-option-button {
597
+ background: none;
598
+ border: none;
599
+ color: #ef4444;
600
+ font-size: 16px;
601
+ cursor: pointer;
602
+ padding: 4px 6px;
603
+ border-radius: 4px;
604
+ transition: all 0.2s ease;
605
+ line-height: 1;
606
+ }
607
+
608
+ .remove-option-button:hover {
609
+ background-color: #fee2e2;
610
+ }
611
+
612
+ .add-option-button {
613
+ background: none;
614
+ border: 1px dashed #d1d5db;
615
+ color: #6b7280;
616
+ padding: 8px 12px;
617
+ border-radius: 4px;
618
+ font-size: 13px;
619
+ cursor: pointer;
620
+ transition: all 0.2s ease;
621
+ margin-top: 4px;
622
+ }
623
+
624
+ .add-option-button:hover {
625
+ border-color: #3b82f6;
626
+ color: #3b82f6;
627
+ background-color: #f8fafc;
628
+ }
629
+
630
+ .config-input {
631
+ width: 100%;
632
+ padding: 8px 10px;
633
+ border: 1px solid #d1d5db;
634
+ border-radius: 4px;
635
+ font-size: 13px;
636
+ background-color: #ffffff;
637
+ margin-top: 4px;
638
+ }
639
+
640
+ .config-input:focus {
641
+ outline: none;
642
+ border-color: #3b82f6;
643
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
644
+ }
645
+
646
+ .config-note {
647
+ margin: 0;
648
+ font-size: 13px;
649
+ color: #6b7280;
650
+ font-style: italic;
651
+ padding: 8px 12px;
652
+ background-color: #f8fafc;
653
+ border-radius: 4px;
654
+ border-left: 3px solid #e5e7eb;
655
+ }
656
+ `,Pe=L`
657
+ /* Builder Step Styles */
658
+ .steps-list {
659
+ display: flex;
660
+ flex-direction: column;
661
+ gap: 8px;
662
+ }
663
+
664
+ .step-item {
665
+ display: flex;
666
+ align-items: center;
667
+ padding: 12px;
668
+ border: 1px solid #e5e7eb;
669
+ border-radius: 6px;
670
+ background-color: #ffffff;
671
+ cursor: pointer;
672
+ transition: all 0.2s ease;
673
+ gap: 12px;
674
+ }
675
+
676
+ .step-item:hover {
677
+ border-color: #d1d5db;
678
+ background-color: #f9fafb;
679
+ }
680
+
681
+ .step-item.selected {
682
+ border-color: #3b82f6;
683
+ background-color: #eff6ff;
684
+ }
685
+
686
+ .step-handle {
687
+ color: #9ca3af;
688
+ font-size: 14px;
689
+ cursor: grab;
690
+ user-select: none;
691
+ }
692
+
693
+ .step-handle:active {
694
+ cursor: grabbing;
695
+ }
696
+
697
+ .step-content {
698
+ flex: 1;
699
+ display: flex;
700
+ flex-direction: column;
701
+ gap: 4px;
702
+ }
703
+
704
+ .step-content strong {
705
+ font-weight: 600;
706
+ color: #111827;
707
+ font-size: 14px;
708
+ }
709
+
710
+ .step-actions {
711
+ display: flex;
712
+ align-items: center;
713
+ }
714
+
715
+ .step-menu {
716
+ background: none;
717
+ border: none;
718
+ color: #9ca3af;
719
+ font-size: 16px;
720
+ cursor: pointer;
721
+ padding: 4px;
722
+ border-radius: 4px;
723
+ transition: all 0.2s ease;
724
+ }
725
+
726
+ .step-menu:hover {
727
+ background-color: #f3f4f6;
728
+ color: #6b7280;
729
+ }
730
+ .runner-layout {
731
+ display: flex;
732
+ width: 100%;
733
+ min-height: 100vh;
734
+ box-sizing: border-box;
735
+ background: #f8fafc;
736
+ gap: 32px;
737
+ overflow: hidden;
738
+ position: relative;
739
+ }
740
+
741
+ /* Loading overlay and spinner */
742
+ .runner-loading-overlay {
743
+ position: absolute;
744
+ top: 0;
745
+ left: 0;
746
+ right: 0;
747
+ bottom: 0;
748
+ background: rgba(0, 0, 0, 0.4);
749
+ display: flex;
750
+ align-items: flex-start;
751
+ justify-content: center;
752
+ z-index: 1000;
753
+ padding-top: 80px;
754
+ box-sizing: border-box;
755
+ }
756
+
757
+ .runner-loading-box {
758
+ background: white;
759
+ border-radius: 8px;
760
+ padding: 24px 48px;
761
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
762
+ 0 1px 2px -1px rgba(0, 0, 0, 0.1);
763
+ display: flex;
764
+ flex-direction: row;
765
+ align-items: center;
766
+ justify-content: center;
767
+ gap: 16px;
768
+ min-width: 200px;
769
+ }
770
+
771
+ .runner-loading-spinner {
772
+ width: 48px;
773
+ height: 48px;
774
+ border: 4px solid #e5e7eb;
775
+ border-top: 4px solid #3b82f6;
776
+ border-radius: 50%;
777
+ animation: runner-spin 1s linear infinite;
778
+ }
779
+
780
+ .runner-loading-text {
781
+ color: #6b7280;
782
+ font-size: 16px;
783
+ font-weight: 500;
784
+ text-align: center;
785
+ }
786
+
787
+ @keyframes runner-spin {
788
+ 0% {
789
+ transform: rotate(0deg);
790
+ }
791
+ 100% {
792
+ transform: rotate(360deg);
793
+ }
794
+ }
795
+
796
+ .runner-sidebar {
797
+ width: 380px;
798
+ min-width: 320px;
799
+ background: #f8fafc;
800
+ border-right: 1px solid #e5e7eb;
801
+ padding: 40px 32px 40px 32px;
802
+ display: flex;
803
+ flex-direction: column;
804
+ align-items: stretch;
805
+ box-sizing: border-box;
806
+ }
807
+
808
+ .runner-sidebar-header {
809
+ font-size: 1.15rem;
810
+ font-weight: 700;
811
+ color: #222;
812
+ margin-bottom: 24px;
813
+ letter-spacing: 0.01em;
814
+ text-align: left;
815
+ }
816
+
817
+ .runner-steps-list {
818
+ list-style: none;
819
+ margin: 0;
820
+ padding: 0;
821
+ display: flex;
822
+ flex-direction: column;
823
+ gap: 18px;
824
+ }
825
+
826
+ .runner-step-item {
827
+ display: flex;
828
+ align-items: flex-start;
829
+ justify-content: space-between;
830
+ padding: 18px 18px 18px 20px;
831
+ border-radius: 12px;
832
+ background: #fff;
833
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
834
+ margin-bottom: 0;
835
+ cursor: pointer;
836
+ border: 2px solid transparent;
837
+ transition: border 0.2s, box-shadow 0.2s;
838
+ gap: 12px;
839
+ }
840
+ .runner-step-item.active {
841
+ border: 2px solid #3b82f6;
842
+ background: #fff;
843
+ box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
844
+ }
845
+ .runner-step-title {
846
+ font-weight: 500;
847
+ color: #111827;
848
+ font-size: 0.97rem;
849
+ flex: 1;
850
+ min-width: 0;
851
+ line-height: 1.4;
852
+ }
853
+ .runner-step-item.active .runner-step-title {
854
+ font-weight: 700;
855
+ font-size: 1.07rem;
856
+ }
857
+ .runner-step-badge {
858
+ background: #e0e7ff;
859
+ color: #3730a3;
860
+ font-size: 12px;
861
+ font-weight: 600;
862
+ border-radius: 6px;
863
+ padding: 2px 10px;
864
+ margin-left: 0;
865
+ flex-shrink: 0;
866
+ align-self: center;
867
+ white-space: nowrap;
868
+ }
869
+
870
+ .runner-main-content {
871
+ flex: 1;
872
+ width: 100%;
873
+ padding: 56px 64px 56px 64px;
874
+ background: #f8fafc;
875
+ min-width: 0;
876
+ display: flex;
877
+ flex-direction: column;
878
+ box-sizing: border-box;
879
+ min-height: 600px;
880
+ overflow: hidden;
881
+ }
882
+
883
+ .runner-main-content form,
884
+ .runner-main-content input,
885
+ .runner-main-content select,
886
+ .runner-main-content textarea {
887
+ max-width: 100%;
888
+ box-sizing: border-box;
889
+ }
890
+
891
+ .runner-step-header h2.runner-step-title {
892
+ font-size: 1.5rem;
893
+ font-weight: 700;
894
+ color: #111827;
895
+ }
896
+
897
+ .runner-step-divider {
898
+ border: none;
899
+ border-top: 1px solid #e5e7eb;
900
+ margin: 20px 0 20px 0;
901
+ width: 100%;
902
+ }
903
+ .runner-step-desc {
904
+ color: #6b7280;
905
+ font-size: 1rem;
906
+ margin: 0;
907
+ }
908
+
909
+ .runner-step-form {
910
+ display: flex;
911
+ flex-direction: column;
912
+ gap: 24px;
913
+ }
914
+
915
+ .runner-form-actions {
916
+ display: flex;
917
+ justify-content: flex-end;
918
+ margin-top: 24px;
919
+ padding-right: 0;
920
+ }
921
+ .next-button {
922
+ background: #3b82f6;
923
+ color: #fff;
924
+ border: none;
925
+ border-radius: 6px;
926
+ padding: 12px 32px;
927
+ font-size: 1.1rem;
928
+ font-weight: 600;
929
+ cursor: pointer;
930
+ transition: background 0.2s;
931
+ max-width: 180px;
932
+ min-width: 100px;
933
+ box-sizing: border-box;
934
+ align-self: flex-end;
935
+ }
936
+ .next-button:hover {
937
+ background: #2563eb;
938
+ }
939
+
940
+ :global(body) {
941
+ background: #f8fafc;
942
+ }
943
+
944
+ .runner-card {
945
+ background: #fff;
946
+ border-radius: 12px;
947
+ padding: 24px 24px 20px 24px;
948
+ margin-bottom: 0;
949
+ box-shadow: none;
950
+ border: none;
951
+ }
952
+
953
+ .runner-question-title {
954
+ font-size: 1rem;
955
+ font-weight: 600;
956
+ margin-bottom: 8px;
957
+ color: #111827;
958
+ display: flex;
959
+ align-items: center;
960
+ }
961
+
962
+ .runner-question-required {
963
+ color: #dc2626;
964
+ font-size: 1.1em;
965
+ margin-left: 4px;
966
+ }
967
+
968
+ .runner-question-divider {
969
+ border: none;
970
+ border-top: 1.5px solid #e5e7eb;
971
+ margin: 12px 0 20px 0;
972
+ }
973
+
974
+ /* Form input styling */
975
+ .runner-card input[type="text"],
976
+ .runner-card input[type="email"],
977
+ .runner-card input[type="number"],
978
+ .runner-card input[type="date"],
979
+ .runner-card textarea,
980
+ .runner-card select {
981
+ width: 100%;
982
+ padding: 12px 16px;
983
+ border: 1px solid #e5e7eb;
984
+ border-radius: 12px;
985
+ font-size: 14px;
986
+ background-color: #f9fafb;
987
+ color: #111827;
988
+ transition: all 0.2s ease;
989
+ box-sizing: border-box;
990
+ }
991
+
992
+ .runner-card input[type="text"]:focus,
993
+ .runner-card input[type="email"]:focus,
994
+ .runner-card input[type="number"]:focus,
995
+ .runner-card input[type="date"]:focus,
996
+ .runner-card textarea:focus,
997
+ .runner-card select:focus {
998
+ outline: none;
999
+ border-color: #3b82f6;
1000
+ background-color: #ffffff;
1001
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
1002
+ }
1003
+
1004
+ .runner-card input[type="text"]::placeholder,
1005
+ .runner-card input[type="email"]::placeholder,
1006
+ .runner-card input[type="number"]::placeholder,
1007
+ .runner-card textarea::placeholder {
1008
+ color: #9ca3af;
1009
+ }
1010
+
1011
+ .runner-card textarea {
1012
+ min-height: 120px;
1013
+ resize: vertical;
1014
+ }
1015
+
1016
+ .runner-card select {
1017
+ cursor: pointer;
1018
+ width: auto;
1019
+ min-width: 450px;
1020
+ max-width: 900px;
1021
+ }
1022
+
1023
+ .runner-card select.placeholder {
1024
+ color: #9ca3af;
1025
+ }
1026
+
1027
+ /* Radio group styling */
1028
+ .radio-group {
1029
+ display: flex;
1030
+ flex-direction: column;
1031
+ gap: 8px;
1032
+ background-color: #ffffff;
1033
+ padding: 16px;
1034
+ }
1035
+
1036
+ .radio-option {
1037
+ display: flex;
1038
+ align-items: center;
1039
+ cursor: pointer;
1040
+ padding: 8px 0;
1041
+ border: none;
1042
+ background-color: transparent;
1043
+ transition: all 0.2s ease;
1044
+ }
1045
+
1046
+ .radio-option:hover {
1047
+ background-color: transparent;
1048
+ }
1049
+
1050
+ .radio-option input[type="radio"] {
1051
+ margin-right: 12px;
1052
+ width: 18px;
1053
+ height: 18px;
1054
+ accent-color: #3b82f6;
1055
+ cursor: pointer;
1056
+ }
1057
+
1058
+ .radio-option input[type="radio"]:checked + .radio-label {
1059
+ font-weight: 600;
1060
+ color: #111827;
1061
+ }
1062
+
1063
+ .radio-label {
1064
+ font-size: 16px;
1065
+ color: #374151;
1066
+ cursor: pointer;
1067
+ flex: 1;
1068
+ }
1069
+
1070
+ .radio-option:has(input[type="radio"]:checked) {
1071
+ border: none;
1072
+ background-color: transparent;
1073
+ box-shadow: none;
1074
+ }
1075
+
1076
+ /* Checkbox group styling */
1077
+ .checkbox-group {
1078
+ display: flex;
1079
+ flex-direction: column;
1080
+ gap: 8px;
1081
+ background-color: #ffffff;
1082
+ padding: 16px;
1083
+ }
1084
+
1085
+ .checkbox-option {
1086
+ display: flex;
1087
+ align-items: center;
1088
+ cursor: pointer;
1089
+ padding: 8px 0;
1090
+ border: none;
1091
+ background-color: transparent;
1092
+ transition: all 0.2s ease;
1093
+ }
1094
+
1095
+ .checkbox-option:hover {
1096
+ background-color: transparent;
1097
+ }
1098
+
1099
+ .checkbox-option input[type="checkbox"] {
1100
+ margin-right: 12px;
1101
+ width: 18px;
1102
+ height: 18px;
1103
+ accent-color: #3b82f6;
1104
+ cursor: pointer;
1105
+ }
1106
+
1107
+ .checkbox-option input[type="checkbox"]:checked + .checkbox-label {
1108
+ font-weight: 600;
1109
+ color: #111827;
1110
+ }
1111
+
1112
+ .checkbox-label {
1113
+ font-size: 16px;
1114
+ color: #374151;
1115
+ cursor: pointer;
1116
+ flex: 1;
1117
+ }
1118
+
1119
+ .checkbox-option:has(input[type="checkbox"]:checked) {
1120
+ border: none;
1121
+ background-color: transparent;
1122
+ box-shadow: none;
1123
+ }
1124
+
1125
+ /* Single checkbox styling */
1126
+ .checkbox-single {
1127
+ display: flex;
1128
+ align-items: center;
1129
+ cursor: pointer;
1130
+ padding: 8px 0;
1131
+ border: none;
1132
+ background-color: transparent;
1133
+ transition: all 0.2s ease;
1134
+ margin-top: 8px;
1135
+ }
1136
+
1137
+ .checkbox-single:hover {
1138
+ background-color: transparent;
1139
+ }
1140
+
1141
+ .checkbox-single input[type="checkbox"] {
1142
+ margin-right: 12px;
1143
+ width: 18px;
1144
+ height: 18px;
1145
+ accent-color: #3b82f6;
1146
+ cursor: pointer;
1147
+ }
1148
+
1149
+ .checkbox-single input[type="checkbox"]:checked + .checkbox-label {
1150
+ font-weight: 600;
1151
+ color: #111827;
1152
+ }
1153
+
1154
+ .checkbox-single:has(input[type="checkbox"]:checked) {
1155
+ border: none;
1156
+ background-color: transparent;
1157
+ box-shadow: none;
1158
+ }
1159
+
1160
+ /* Signature styling */
1161
+ .signature-container {
1162
+ display: flex;
1163
+ flex-direction: column;
1164
+ gap: 12px;
1165
+ }
1166
+
1167
+ .signature-canvas {
1168
+ width: 100%;
1169
+ height: 200px;
1170
+ border: 1px solid #e5e7eb;
1171
+ border-radius: 8px;
1172
+ background-color: #ffffff;
1173
+ cursor: crosshair;
1174
+ max-width: 700px;
1175
+ }
1176
+
1177
+ .signature-controls {
1178
+ display: flex;
1179
+ gap: 8px;
1180
+ }
1181
+
1182
+ .signature-clear-btn {
1183
+ background: #f3f4f6;
1184
+ color: #374151;
1185
+ border: 1px solid #d1d5db;
1186
+ border-radius: 6px;
1187
+ padding: 8px 16px;
1188
+ font-size: 14px;
1189
+ font-weight: 500;
1190
+ cursor: pointer;
1191
+ transition: all 0.2s ease;
1192
+ }
1193
+
1194
+ .signature-clear-btn:hover {
1195
+ background: #e5e7eb;
1196
+ border-color: #9ca3af;
1197
+ }
1198
+
1199
+ .signature-save-btn {
1200
+ background: #3b82f6;
1201
+ color: white;
1202
+ border: 1px solid #2563eb;
1203
+ border-radius: 6px;
1204
+ padding: 8px 16px;
1205
+ font-size: 14px;
1206
+ font-weight: 500;
1207
+ cursor: pointer;
1208
+ transition: all 0.2s ease;
1209
+ }
1210
+
1211
+ .signature-save-btn:hover {
1212
+ background: #2563eb;
1213
+ border-color: #1d4ed8;
1214
+ }
1215
+
1216
+ .signature-saved {
1217
+ color: #059669;
1218
+ font-size: 14px;
1219
+ font-weight: 500;
1220
+ display: flex;
1221
+ align-items: center;
1222
+ gap: 4px;
1223
+ }
1224
+
1225
+ .signature-replace-btn {
1226
+ background: #3b82f6;
1227
+ color: white;
1228
+ border: none;
1229
+ padding: 8px 16px;
1230
+ border-radius: 4px;
1231
+ cursor: pointer;
1232
+ font-size: 0.875rem;
1233
+ font-weight: 500;
1234
+ transition: background-color 0.2s ease;
1235
+ display: inline-flex;
1236
+ align-items: center;
1237
+ gap: 6px;
1238
+ }
1239
+
1240
+ .signature-replace-btn:hover {
1241
+ background: #2563eb;
1242
+ }
1243
+
1244
+ .signature-cancel-btn {
1245
+ background: #6b7280;
1246
+ color: white;
1247
+ border: none;
1248
+ padding: 8px 16px;
1249
+ border-radius: 4px;
1250
+ cursor: pointer;
1251
+ font-size: 0.875rem;
1252
+ font-weight: 500;
1253
+ transition: background-color 0.2s ease;
1254
+ }
1255
+
1256
+ .signature-cancel-btn:hover {
1257
+ background: #4b5563;
1258
+ }
1259
+
1260
+ /* File Upload Styles */
1261
+ .file-upload-container {
1262
+ display: flex;
1263
+ flex-direction: column;
1264
+ gap: 12px;
1265
+ }
1266
+
1267
+ .file-input {
1268
+ display: none;
1269
+ }
1270
+
1271
+ .file-placeholder {
1272
+ background: #f9fafb;
1273
+ border: 2px dashed #d1d5db;
1274
+ border-radius: 8px;
1275
+ padding: 24px;
1276
+ text-align: center;
1277
+ color: #6b7280;
1278
+ cursor: pointer;
1279
+ transition: all 0.2s ease;
1280
+ }
1281
+
1282
+ .file-placeholder:hover {
1283
+ border-color: #3b82f6;
1284
+ background: #f0f9ff;
1285
+ color: #3b82f6;
1286
+ }
1287
+
1288
+ .file-info {
1289
+ display: flex;
1290
+ align-items: center;
1291
+ gap: 12px;
1292
+ background: #f0f9ff;
1293
+ border: 1px solid #bae6fd;
1294
+ border-radius: 8px;
1295
+ padding: 12px 16px;
1296
+ }
1297
+
1298
+ .file-name {
1299
+ font-weight: 500;
1300
+ color: #0c4a6e;
1301
+ flex: 1;
1302
+ }
1303
+
1304
+ .file-size {
1305
+ color: #0369a1;
1306
+ font-size: 0.875rem;
1307
+ }
1308
+
1309
+ .file-remove-btn {
1310
+ background: #dc2626;
1311
+ color: white;
1312
+ border: none;
1313
+ border-radius: 6px;
1314
+ padding: 6px 12px;
1315
+ font-size: 0.875rem;
1316
+ font-weight: 500;
1317
+ cursor: pointer;
1318
+ transition: background-color 0.2s ease;
1319
+ }
1320
+
1321
+ .file-remove-btn:hover {
1322
+ background: #b91c1c;
1323
+ }
1324
+
1325
+ /* Error message styling */
1326
+ .error-message {
1327
+ color: #dc2626;
1328
+ font-size: 0.875rem;
1329
+ margin-top: 8px;
1330
+ margin-bottom: 0;
1331
+ font-weight: 500;
1332
+ }
1333
+
1334
+ .question.error input,
1335
+ .question.error textarea,
1336
+ .question.error select {
1337
+ border-color: #dc2626;
1338
+ background-color: #fef2f2;
1339
+ }
1340
+
1341
+ .question.error input:focus,
1342
+ .question.error textarea:focus,
1343
+ .question.error select:focus {
1344
+ border-color: #dc2626;
1345
+ background-color: #ffffff;
1346
+ box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
1347
+ }
1348
+
1349
+ /* Content Element Styles */
1350
+ .content-element {
1351
+ margin-bottom: 16px;
1352
+ }
1353
+
1354
+ .text-content p {
1355
+ font-size: 1rem;
1356
+ line-height: 1.6;
1357
+ color: #374151;
1358
+ margin: 0;
1359
+ }
1360
+
1361
+ .markdown-content {
1362
+ font-size: 1rem;
1363
+ line-height: 1.6;
1364
+ color: #374151;
1365
+ }
1366
+
1367
+ .markdown-content h1 {
1368
+ font-size: 1.5rem;
1369
+ font-weight: 700;
1370
+ margin: 24px 0 16px 0;
1371
+ color: #111827;
1372
+ }
1373
+
1374
+ .markdown-content h2 {
1375
+ font-size: 1.25rem;
1376
+ font-weight: 600;
1377
+ margin: 20px 0 12px 0;
1378
+ color: #111827;
1379
+ }
1380
+
1381
+ .markdown-content h3 {
1382
+ font-size: 1.125rem;
1383
+ font-weight: 600;
1384
+ margin: 16px 0 8px 0;
1385
+ color: #111827;
1386
+ }
1387
+
1388
+ .markdown-content strong {
1389
+ font-weight: 600;
1390
+ }
1391
+
1392
+ .markdown-content em {
1393
+ font-style: italic;
1394
+ }
1395
+
1396
+ .markdown-content code {
1397
+ background: #f3f4f6;
1398
+ padding: 2px 6px;
1399
+ border-radius: 4px;
1400
+ font-family: "Courier New", monospace;
1401
+ font-size: 0.9em;
1402
+ }
1403
+
1404
+ .markdown-content blockquote {
1405
+ background: #f8fafc;
1406
+ border-left: 4px solid #3b82f6;
1407
+ padding: 12px 16px;
1408
+ margin: 16px 0;
1409
+ border-radius: 0 4px 4px 0;
1410
+ font-style: italic;
1411
+ color: #374151;
1412
+ }
1413
+
1414
+ .markdown-content ul {
1415
+ margin: 12px 0;
1416
+ padding-left: 24px;
1417
+ }
1418
+
1419
+ .markdown-content ol {
1420
+ margin: 12px 0;
1421
+ padding-left: 24px;
1422
+ }
1423
+
1424
+ .markdown-content li {
1425
+ margin: 4px 0;
1426
+ }
1427
+
1428
+ .divider-content {
1429
+ text-align: center;
1430
+ margin: 24px 0;
1431
+ }
1432
+
1433
+ .content-divider {
1434
+ border: none;
1435
+ border-top: 2px solid #e5e7eb;
1436
+ margin: 0 0 8px 0;
1437
+ }
1438
+
1439
+ .divider-caption {
1440
+ font-size: 0.875rem;
1441
+ color: #6b7280;
1442
+ font-style: italic;
1443
+ }
1444
+
1445
+ .html-content-wrapper {
1446
+ line-height: 1.6;
1447
+ }
1448
+
1449
+ .image-placeholder,
1450
+ .video-placeholder,
1451
+ .file-placeholder {
1452
+ background: #f9fafb;
1453
+ border: 2px dashed #d1d5db;
1454
+ border-radius: 8px;
1455
+ padding: 24px;
1456
+ text-align: center;
1457
+ color: #6b7280;
1458
+ }
1459
+
1460
+ .image-placeholder p,
1461
+ .video-placeholder p,
1462
+ .file-placeholder p {
1463
+ margin: 0 0 8px 0;
1464
+ font-weight: 500;
1465
+ }
1466
+
1467
+ .image-placeholder small,
1468
+ .video-placeholder small,
1469
+ .file-placeholder small {
1470
+ font-size: 0.875rem;
1471
+ color: #9ca3af;
1472
+ }
1473
+
1474
+ .unknown-element {
1475
+ background: #fef2f2;
1476
+ border: 1px solid #fecaca;
1477
+ border-radius: 8px;
1478
+ padding: 16px;
1479
+ color: #dc2626;
1480
+ text-align: center;
1481
+ }
1482
+
1483
+ .unknown-element p {
1484
+ margin: 0;
1485
+ font-weight: 500;
1486
+ }
1487
+
1488
+ /* Submission Success View Styles */
1489
+ .submission-container {
1490
+ display: flex;
1491
+ flex-direction: column;
1492
+ align-items: center;
1493
+ justify-content: center;
1494
+ text-align: center;
1495
+ min-height: 50vh;
1496
+ padding: 64px 32px;
1497
+ max-width: 600px;
1498
+ margin: 0 auto;
1499
+ }
1500
+
1501
+ .submission-success-icon {
1502
+ width: 48px;
1503
+ height: 48px;
1504
+ color: #22c55e;
1505
+ margin-bottom: 32px;
1506
+ display: flex;
1507
+ align-items: center;
1508
+ justify-content: center;
1509
+ }
1510
+
1511
+ .check-circle {
1512
+ width: 100%;
1513
+ height: 100%;
1514
+ }
1515
+
1516
+ .submission-title {
1517
+ font-size: 1.25rem; /* 20px */
1518
+ font-weight: 600;
1519
+ color: #111827;
1520
+ margin: 0 0 16px 0;
1521
+ line-height: 1.4;
1522
+ }
1523
+
1524
+ .submission-message {
1525
+ font-size: 1rem; /* 16px */
1526
+ color: #6b7280;
1527
+ margin: 0;
1528
+ line-height: 1.5;
1529
+ }
1530
+
1531
+ /* Legacy styles for backward compatibility */
1532
+ .submitted-view {
1533
+ text-align: center;
1534
+ padding: 48px 32px;
1535
+ max-width: 500px;
1536
+ margin: 0 auto;
1537
+ }
1538
+
1539
+ .submitted-icon {
1540
+ font-size: 4rem;
1541
+ margin-bottom: 24px;
1542
+ display: block;
1543
+ }
1544
+
1545
+ .submitted-title {
1546
+ font-size: 1.75rem;
1547
+ font-weight: 700;
1548
+ color: #16a34a;
1549
+ margin: 0 0 16px 0;
1550
+ line-height: 1.3;
1551
+ }
1552
+
1553
+ .submitted-details {
1554
+ background: #f9fafb;
1555
+ border: 1px solid #e5e7eb;
1556
+ border-radius: 8px;
1557
+ padding: 20px;
1558
+ text-align: left;
1559
+ }
1560
+
1561
+ .submitted-details p {
1562
+ margin: 0 0 8px 0;
1563
+ font-size: 0.95rem;
1564
+ color: #6b7280;
1565
+ }
1566
+
1567
+ .submitted-details p:last-child {
1568
+ margin-bottom: 0;
1569
+ }
1570
+
1571
+ .submitted-details strong {
1572
+ color: #374151;
1573
+ font-weight: 600;
1574
+ }
1575
+
1576
+ /* Disabled step styles for submitted state */
1577
+ .runner-step-item.disabled {
1578
+ pointer-events: none;
1579
+ }
1580
+
1581
+ .runner-step-item.disabled .runner-step-badge {
1582
+ background: #e5e7eb;
1583
+ color: #6b7280;
1584
+ }
1585
+
1586
+ /* Loading state styles */
1587
+ .runner-step-item.loading-disabled {
1588
+ pointer-events: none;
1589
+ opacity: 0.6;
1590
+ cursor: not-allowed;
1591
+ }
1592
+
1593
+ .runner-mobile-step-tab.loading-disabled {
1594
+ pointer-events: none;
1595
+ opacity: 0.6;
1596
+ cursor: not-allowed;
1597
+ }
1598
+
1599
+ .runner-step-item.completed .runner-step-badge {
1600
+ background: #dcfce7;
1601
+ color: #16a34a;
1602
+ }
1603
+
1604
+ /* Disabled form elements in submitted state */
1605
+ .signature-container.disabled {
1606
+ pointer-events: none;
1607
+ opacity: 0.6;
1608
+ }
1609
+
1610
+ .file-placeholder.disabled {
1611
+ pointer-events: none;
1612
+ opacity: 0.6;
1613
+ cursor: not-allowed !important;
1614
+ }
1615
+
1616
+ /* Save feedback styling for admin mode */
1617
+ .next-button.saved-state {
1618
+ background-color: #16a34a !important;
1619
+ color: white !important;
1620
+ transition: background-color 0.3s ease;
1621
+ }
1622
+
1623
+ .next-button.saved-state:hover {
1624
+ background-color: #15803d !important;
1625
+ }
1626
+
1627
+ /* Not assigned view styles */
1628
+ .not-assigned-view {
1629
+ display: flex;
1630
+ align-items: center;
1631
+ justify-content: center;
1632
+ min-height: 100vh;
1633
+ padding: 40px;
1634
+ background: #f8fafc;
1635
+ }
1636
+
1637
+ .not-assigned-container {
1638
+ text-align: center;
1639
+ max-width: 480px;
1640
+ background: #fff;
1641
+ border-radius: 16px;
1642
+ padding: 48px 40px;
1643
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
1644
+ }
1645
+
1646
+ .not-assigned-icon {
1647
+ margin: 0 auto 24px;
1648
+ width: 48px;
1649
+ height: 48px;
1650
+ color: #6b7280;
1651
+ }
1652
+
1653
+ .not-assigned-title {
1654
+ font-size: 1.5rem;
1655
+ font-weight: 600;
1656
+ color: #111827;
1657
+ margin: 0 0 16px 0;
1658
+ line-height: 1.4;
1659
+ }
1660
+
1661
+ .not-assigned-description {
1662
+ font-size: 1rem;
1663
+ color: #6b7280;
1664
+ margin: 0;
1665
+ line-height: 1.6;
1666
+ }
1667
+
1668
+ /* View-Only Mode Styles */
1669
+ .file-upload-view-only {
1670
+ display: flex;
1671
+ align-items: center;
1672
+ padding: 12px 16px;
1673
+ background: #f8fafc;
1674
+ border: 1px solid #e2e8f0;
1675
+ border-radius: 6px;
1676
+ min-height: 48px;
1677
+ }
1678
+
1679
+ .signature-view-only,
1680
+ .signature-admin-display {
1681
+ display: flex;
1682
+ flex-direction: column;
1683
+ align-items: center;
1684
+ padding: 16px;
1685
+ background: #f8fafc;
1686
+ border: 1px solid #e2e8f0;
1687
+ border-radius: 6px;
1688
+ }
1689
+
1690
+ .signature-existing {
1691
+ display: flex;
1692
+ flex-direction: column;
1693
+ align-items: center;
1694
+ margin-bottom: 12px;
1695
+ }
1696
+
1697
+ .signature-admin-actions {
1698
+ display: flex;
1699
+ justify-content: center;
1700
+ }
1701
+
1702
+ .signature-image {
1703
+ max-width: 100%;
1704
+ max-height: 200px;
1705
+ border: 1px solid #e2e8f0;
1706
+ border-radius: 4px;
1707
+ background: white;
1708
+ padding: 8px;
1709
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
1710
+ }
1711
+
1712
+ .signature-svg-container {
1713
+ max-width: 100%;
1714
+ max-height: 200px;
1715
+ border: 1px solid #e2e8f0;
1716
+ border-radius: 4px;
1717
+ background: white;
1718
+ padding: 8px;
1719
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
1720
+ display: flex;
1721
+ align-items: center;
1722
+ justify-content: center;
1723
+ overflow: hidden;
1724
+ }
1725
+
1726
+ .signature-svg-container svg {
1727
+ max-width: 100%;
1728
+ max-height: 100%;
1729
+ height: auto;
1730
+ width: auto;
1731
+ }
1732
+
1733
+ .signature-fallback {
1734
+ padding: 20px;
1735
+ text-align: center;
1736
+ }
1737
+
1738
+ .signature-error {
1739
+ color: #dc2626;
1740
+ font-style: italic;
1741
+ font-size: 0.875rem;
1742
+ }
1743
+
1744
+ .file-link {
1745
+ display: inline-flex;
1746
+ align-items: center;
1747
+ gap: 8px;
1748
+ color: #2563eb;
1749
+ text-decoration: none;
1750
+ font-weight: 500;
1751
+ padding: 8px 12px;
1752
+ border-radius: 4px;
1753
+ transition: all 0.2s ease;
1754
+ background: #eff6ff;
1755
+ border: 1px solid #bfdbfe;
1756
+ font-size: 0.875rem;
1757
+ }
1758
+
1759
+ .file-link:hover {
1760
+ color: #1d4ed8;
1761
+ background: #dbeafe;
1762
+ border-color: #93c5fd;
1763
+ text-decoration: none;
1764
+ }
1765
+
1766
+ .file-link:active {
1767
+ transform: translateY(1px);
1768
+ }
1769
+
1770
+ .file-size-info {
1771
+ margin-left: 8px;
1772
+ color: #6b7280;
1773
+ font-size: 0.875rem;
1774
+ font-style: italic;
1775
+ }
1776
+
1777
+ /* Print mode file info styles */
1778
+ .file-upload-print-info {
1779
+ background: #f8fafc;
1780
+ border: 1px solid #e2e8f0;
1781
+ border-radius: 6px;
1782
+ padding: 16px;
1783
+ margin: 8px 0;
1784
+ }
1785
+
1786
+ .file-details {
1787
+ display: flex;
1788
+ flex-direction: column;
1789
+ gap: 8px;
1790
+ }
1791
+
1792
+ .file-detail-row {
1793
+ display: flex;
1794
+ align-items: center;
1795
+ font-size: 0.875rem;
1796
+ line-height: 1.4;
1797
+ }
1798
+
1799
+ .file-detail-row strong {
1800
+ min-width: 80px;
1801
+ color: #374151;
1802
+ font-weight: 600;
1803
+ margin-right: 8px;
1804
+ }
1805
+
1806
+ .hidden {
1807
+ display: none !important;
1808
+ }
1809
+
1810
+ .no-file,
1811
+ .no-signature {
1812
+ color: #6b7280;
1813
+ font-style: italic;
1814
+ font-size: 0.875rem;
1815
+ }
1816
+
1817
+ /* Print Mode Styles */
1818
+ .print-layout {
1819
+ width: 100%;
1820
+ max-width: none;
1821
+ background: #fff;
1822
+ padding: 40px;
1823
+ box-sizing: border-box;
1824
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
1825
+ sans-serif;
1826
+ }
1827
+
1828
+ .print-step {
1829
+ margin-bottom: 60px;
1830
+ page-break-inside: avoid;
1831
+ break-inside: avoid;
1832
+ }
1833
+
1834
+ .print-step:last-child {
1835
+ margin-bottom: 0;
1836
+ }
1837
+
1838
+ /* Ensure print cards don't have unnecessary shadows/borders for clean printing */
1839
+ .print-layout .runner-card {
1840
+ box-shadow: none;
1841
+ border: 1px solid #e5e7eb;
1842
+ margin-bottom: 20px;
1843
+ }
1844
+
1845
+ /* Better spacing for print */
1846
+ .print-layout .runner-question-title {
1847
+ margin-bottom: 12px;
1848
+ }
1849
+
1850
+ .print-layout .content-element {
1851
+ margin-bottom: 20px;
1852
+ }
1853
+
1854
+ /* Mobile Steps Navigation (hidden by default, shown on mobile) */
1855
+ .runner-mobile-steps {
1856
+ display: none;
1857
+ width: 100%;
1858
+ background: #fff;
1859
+ border-bottom: 1px solid #e5e7eb;
1860
+ padding: 16px;
1861
+ box-sizing: border-box;
1862
+ overflow-x: auto;
1863
+ -webkit-overflow-scrolling: touch;
1864
+ }
1865
+
1866
+ .runner-mobile-steps-container {
1867
+ display: flex;
1868
+ gap: 8px;
1869
+ min-width: min-content;
1870
+ padding-bottom: 4px;
1871
+ }
1872
+
1873
+ .runner-mobile-step-tab {
1874
+ display: flex;
1875
+ flex-direction: column;
1876
+ align-items: center;
1877
+ justify-content: center;
1878
+ background: #f8fafc;
1879
+ border: 2px solid #e5e7eb;
1880
+ border-radius: 8px;
1881
+ padding: 12px 16px;
1882
+ font-size: 12px;
1883
+ font-weight: 500;
1884
+ color: #6b7280;
1885
+ cursor: pointer;
1886
+ transition: all 0.2s;
1887
+ min-width: 80px;
1888
+ max-width: 120px;
1889
+ flex-shrink: 0;
1890
+ box-sizing: border-box;
1891
+ }
1892
+
1893
+ .runner-mobile-step-tab:hover:not(:disabled):not(.active) {
1894
+ background: #f1f5f9;
1895
+ border-color: #cbd5e1;
1896
+ }
1897
+
1898
+ .runner-mobile-step-tab:focus {
1899
+ outline: none;
1900
+ }
1901
+
1902
+ .runner-mobile-step-tab:focus:not(.active) {
1903
+ outline: 2px solid #3b82f6;
1904
+ outline-offset: 2px;
1905
+ }
1906
+
1907
+ .runner-mobile-step-tab.active {
1908
+ background: #3b82f6 !important;
1909
+ border-color: #3b82f6 !important;
1910
+ color: #fff !important;
1911
+ }
1912
+
1913
+ .runner-mobile-step-tab.disabled {
1914
+ opacity: 0.5;
1915
+ cursor: not-allowed;
1916
+ }
1917
+
1918
+ .runner-mobile-step-tab.unassigned {
1919
+ opacity: 0.6;
1920
+ }
1921
+
1922
+ .runner-mobile-step-title {
1923
+ display: -webkit-box;
1924
+ -webkit-line-clamp: 2;
1925
+ -webkit-box-orient: vertical;
1926
+ text-align: center;
1927
+ line-height: 1.2;
1928
+ font-weight: 600;
1929
+ margin-bottom: 4px;
1930
+ overflow: hidden;
1931
+ word-wrap: break-word;
1932
+ hyphens: auto;
1933
+ max-width: 100%;
1934
+ }
1935
+
1936
+ .runner-mobile-step-badge {
1937
+ display: block;
1938
+ text-align: center;
1939
+ font-size: 10px;
1940
+ font-weight: 600;
1941
+ line-height: 1;
1942
+ background: rgba(255, 255, 255, 0.2);
1943
+ border-radius: 4px;
1944
+ padding: 2px 6px;
1945
+ margin: 0 auto;
1946
+ max-width: fit-content;
1947
+ white-space: nowrap;
1948
+ }
1949
+
1950
+ /* Enhance mobile tab styling for completed/active states */
1951
+ .runner-mobile-step-tab.completed:not(.active) {
1952
+ background: #22c55e;
1953
+ border-color: #22c55e;
1954
+ color: #fff;
1955
+ }
1956
+
1957
+ .runner-mobile-step-tab.completed .runner-mobile-step-badge {
1958
+ background: rgba(255, 255, 255, 0.3);
1959
+ color: #fff;
1960
+ }
1961
+
1962
+ .runner-mobile-step-tab.active .runner-mobile-step-badge {
1963
+ background: rgba(255, 255, 255, 0.3);
1964
+ color: #fff;
1965
+ }
1966
+
1967
+ .runner-mobile-step-tab:not(.active):not(.completed)
1968
+ .runner-mobile-step-badge {
1969
+ background: rgba(0, 0, 0, 0.1);
1970
+ color: inherit;
1971
+ }
1972
+
1973
+ /* Mobile Responsive Styles */
1974
+ @media (max-width: 768px) {
1975
+ .runner-layout {
1976
+ flex-direction: column;
1977
+ min-height: 100vh;
1978
+ gap: 0;
1979
+ overflow: visible;
1980
+ }
1981
+
1982
+ /* Hide sidebar on mobile */
1983
+ .runner-sidebar {
1984
+ display: none;
1985
+ }
1986
+
1987
+ /* Show mobile steps navigation */
1988
+ .runner-mobile-steps {
1989
+ display: block;
1990
+ order: -1;
1991
+ }
1992
+
1993
+ /* Adjust main content for mobile */
1994
+ .runner-main-content {
1995
+ padding: 20px 16px;
1996
+ min-height: auto;
1997
+ flex: 1;
1998
+ overflow: visible;
1999
+ }
2000
+
2001
+ /* Mobile-friendly form styling */
2002
+ .runner-card {
2003
+ padding: 20px 16px;
2004
+ border-radius: 8px;
2005
+ }
2006
+
2007
+ .runner-step-header h2.runner-step-title {
2008
+ font-size: 1.25rem;
2009
+ line-height: 1.3;
2010
+ }
2011
+
2012
+ .runner-step-desc {
2013
+ font-size: 0.9rem;
2014
+ }
2015
+
2016
+ /* Form inputs mobile optimization */
2017
+ .runner-card input[type="text"],
2018
+ .runner-card input[type="email"],
2019
+ .runner-card input[type="number"],
2020
+ .runner-card input[type="date"],
2021
+ .runner-card textarea,
2022
+ .runner-card select {
2023
+ padding: 14px 16px;
2024
+ font-size: 16px; /* Prevents zoom on iOS */
2025
+ border-radius: 8px;
2026
+ }
2027
+
2028
+ .runner-card textarea {
2029
+ min-height: 120px;
2030
+ }
2031
+
2032
+ /* Question styling for mobile */
2033
+ .runner-question-title {
2034
+ font-size: 0.95rem;
2035
+ margin-bottom: 10px;
2036
+ }
2037
+
2038
+ /* Form actions mobile optimization */
2039
+ .runner-form-actions {
2040
+ margin-top: 32px;
2041
+ padding: 0;
2042
+ }
2043
+
2044
+ .next-button {
2045
+ width: 100%;
2046
+ max-width: none;
2047
+ padding: 16px 24px;
2048
+ font-size: 1rem;
2049
+ border-radius: 8px;
2050
+ }
2051
+
2052
+ /* Radio and checkbox mobile optimization */
2053
+ .radio-group,
2054
+ .checkbox-group {
2055
+ gap: 16px;
2056
+ }
2057
+
2058
+ .radio-option,
2059
+ .checkbox-option {
2060
+ padding: 16px;
2061
+ font-size: 0.95rem;
2062
+ }
2063
+
2064
+ /* File upload mobile optimization */
2065
+ .file-upload-area {
2066
+ padding: 32px 16px;
2067
+ font-size: 0.9rem;
2068
+ }
2069
+
2070
+ .upload-instruction {
2071
+ font-size: 0.85rem;
2072
+ }
2073
+
2074
+ /* Signature pad mobile optimization */
2075
+ .signature-container {
2076
+ margin: 16px 0;
2077
+ }
2078
+
2079
+ .signature-canvas {
2080
+ max-width: 100%;
2081
+ height: auto;
2082
+ min-height: 200px;
2083
+ }
2084
+
2085
+ .signature-controls {
2086
+ flex-direction: column;
2087
+ gap: 12px;
2088
+ margin-top: 16px;
2089
+ }
2090
+
2091
+ .signature-controls button {
2092
+ width: 100%;
2093
+ padding: 12px;
2094
+ font-size: 0.9rem;
2095
+ }
2096
+
2097
+ /* Status views mobile optimization */
2098
+ .submission-container,
2099
+ .submitted-view,
2100
+ .not-assigned-view,
2101
+ .user-steps-submitted-view {
2102
+ padding: 32px 16px;
2103
+ text-align: center;
2104
+ min-height: 40vh;
2105
+ }
2106
+
2107
+ .submission-success-icon {
2108
+ width: 40px;
2109
+ height: 40px;
2110
+ margin-bottom: 24px;
2111
+ }
2112
+
2113
+ .submission-title,
2114
+ .submitted-title,
2115
+ .not-assigned-title,
2116
+ .user-steps-submitted-title {
2117
+ font-size: 1.125rem; /* 18px on mobile */
2118
+ margin-bottom: 16px;
2119
+ }
2120
+
2121
+ .submission-message,
2122
+ .submitted-message,
2123
+ .not-assigned-message,
2124
+ .user-steps-submitted-message {
2125
+ font-size: 0.875rem; /* 14px on mobile */
2126
+ margin-bottom: 20px;
2127
+ }
2128
+ }
2129
+
2130
+ /* Smaller mobile devices */
2131
+ @media (max-width: 480px) {
2132
+ .runner-main-content {
2133
+ padding: 16px 12px;
2134
+ }
2135
+
2136
+ .runner-card {
2137
+ padding: 16px 12px;
2138
+ }
2139
+
2140
+ .runner-mobile-steps {
2141
+ padding: 12px;
2142
+ }
2143
+
2144
+ .runner-mobile-step-tab {
2145
+ min-width: 70px;
2146
+ max-width: 100px;
2147
+ padding: 10px 12px;
2148
+ font-size: 11px;
2149
+ }
2150
+
2151
+ .runner-mobile-step-badge {
2152
+ font-size: 9px;
2153
+ padding: 1px 4px;
2154
+ }
2155
+
2156
+ .runner-step-header h2.runner-step-title {
2157
+ font-size: 1.15rem;
2158
+ }
2159
+
2160
+ .runner-card input[type="text"],
2161
+ .runner-card input[type="email"],
2162
+ .runner-card input[type="number"],
2163
+ .runner-card input[type="date"],
2164
+ .runner-card textarea,
2165
+ .runner-card select {
2166
+ padding: 12px 14px;
2167
+ }
2168
+ }
2169
+
2170
+ /* Print media queries for actual printing */
2171
+ @media print {
2172
+ .print-layout {
2173
+ padding: 20px;
2174
+ background: #fff !important;
2175
+ }
2176
+
2177
+ .print-step {
2178
+ page-break-inside: avoid;
2179
+ margin-bottom: 40px;
2180
+ }
2181
+
2182
+ .print-layout .runner-card {
2183
+ box-shadow: none !important;
2184
+ border: 1px solid #ccc !important;
2185
+ margin-bottom: 15px;
2186
+ }
2187
+
2188
+ /* Hide any interactive elements in print */
2189
+ button,
2190
+ input[type="button"],
2191
+ input[type="submit"] {
2192
+ display: none !important;
2193
+ }
2194
+
2195
+ /* Ensure proper text color for print */
2196
+ * {
2197
+ color: #000 !important;
2198
+ background: transparent !important;
2199
+ }
2200
+
2201
+ /* Print-specific file info styling */
2202
+ .file-upload-print-info {
2203
+ border: 1px solid #000 !important;
2204
+ background: transparent !important;
2205
+ margin-bottom: 15px;
2206
+ }
2207
+
2208
+ .file-detail-row strong {
2209
+ color: #000 !important;
2210
+ }
2211
+ }
2212
+
2213
+ /* Clean print mode styles */
2214
+ .print-response-value {
2215
+ font-size: 1rem;
2216
+ line-height: 1.5;
2217
+ color: #111827;
2218
+ padding: 0;
2219
+ margin: 0 0 8px 0;
2220
+ background: transparent;
2221
+ border: none;
2222
+ min-height: auto;
2223
+ }
2224
+
2225
+ .print-response-value.textarea-response {
2226
+ white-space: pre-wrap;
2227
+ word-wrap: break-word;
2228
+ }
2229
+
2230
+ .print-response-value.file-response {
2231
+ font-weight: 500;
2232
+ }
2233
+
2234
+ .print-response-value .file-size {
2235
+ color: #6b7280;
2236
+ font-weight: normal;
2237
+ font-size: 0.9em;
2238
+ }
2239
+
2240
+ .print-response-value.signature-response {
2241
+ padding: 8px 0;
2242
+ }
2243
+
2244
+ .print-response-value.signature-response .signature-image {
2245
+ max-width: 200px;
2246
+ max-height: 100px;
2247
+ border: 1px solid #e5e7eb;
2248
+ background: white;
2249
+ }
2250
+
2251
+ .print-no-response {
2252
+ color: #9ca3af;
2253
+ font-style: italic;
2254
+ font-size: 0.9em;
2255
+ }
2256
+
2257
+ /* Clean radio and checkbox groups for print */
2258
+ .radio-group.print-mode,
2259
+ .checkbox-group.print-mode {
2260
+ background: transparent;
2261
+ padding: 8px 0;
2262
+ border: none;
2263
+ }
2264
+
2265
+ .checkbox-single.print-mode {
2266
+ background: transparent;
2267
+ padding: 8px 0;
2268
+ }
2269
+
2270
+ /* Hide interactive elements in print mode but keep visual checkboxes/radios */
2271
+ @media screen {
2272
+ .radio-group.print-mode input[type="radio"],
2273
+ .checkbox-group.print-mode input[type="checkbox"],
2274
+ .checkbox-single.print-mode input[type="checkbox"] {
2275
+ pointer-events: none;
2276
+ }
2277
+ }
2278
+
2279
+ /* Print mode question layout - no borders, horizontal separators */
2280
+ .question-print {
2281
+ margin: 0;
2282
+ padding: 0;
2283
+ background: transparent;
2284
+ border: none;
2285
+ box-shadow: none;
2286
+ }
2287
+
2288
+ /* Print mode content layout - consistent with questions */
2289
+ .content-print {
2290
+ margin: 0;
2291
+ padding: 0;
2292
+ background: transparent;
2293
+ border: none;
2294
+ box-shadow: none;
2295
+ }
2296
+
2297
+ /* Ensure no card styling bleeds through in print mode */
2298
+ body[data-mode="print"] .runner-card,
2299
+ .print-mode .runner-card {
2300
+ background: transparent !important;
2301
+ border: none !important;
2302
+ border-radius: 0 !important;
2303
+ box-shadow: none !important;
2304
+ padding: 0 !important;
2305
+ margin: 0 !important;
2306
+ }
2307
+
2308
+ /* Print mode title (18pt) - Instance name */
2309
+ .print-instance-title {
2310
+ font-size: 18pt;
2311
+ font-weight: 600;
2312
+ color: #111827;
2313
+ margin: 0 0 20px 0;
2314
+ line-height: 1.3;
2315
+ }
2316
+
2317
+ /* Print mode step titles (14pt) */
2318
+ .print-step-title {
2319
+ font-size: 14pt;
2320
+ font-weight: 600;
2321
+ color: #111827;
2322
+ margin: 0 0 8px 0;
2323
+ line-height: 1.4;
2324
+ }
2325
+
2326
+ /* Print mode question titles (12pt) */
2327
+ .print-question-title {
2328
+ font-size: 12pt;
2329
+ font-weight: 600;
2330
+ color: #111827;
2331
+ margin: 0 0 4px 0;
2332
+ line-height: 1.4;
2333
+ }
2334
+
2335
+ .print-step-description {
2336
+ font-size: 1rem;
2337
+ font-weight: 400;
2338
+ color: #6b7280;
2339
+ margin: 8px 0;
2340
+ line-height: 1.5;
2341
+ }
2342
+
2343
+ .print-question-separator {
2344
+ border: none;
2345
+ border-top: 1px solid #e5e7eb;
2346
+ margin: 16px 0;
2347
+ width: 100%;
2348
+ }
2349
+
2350
+ /* Clean styling for checkbox lists in print */
2351
+ .print-response-value.checkbox-response div {
2352
+ margin: 2px 0;
2353
+ line-height: 1.4;
2354
+ }
2355
+ `,gt=L`
2356
+ /* Modal Styles */
2357
+ .modal-overlay {
2358
+ position: fixed;
2359
+ top: 0;
2360
+ left: 0;
2361
+ right: 0;
2362
+ bottom: 0;
2363
+ background-color: rgba(0, 0, 0, 0.5);
2364
+ display: flex;
2365
+ align-items: center;
2366
+ justify-content: center;
2367
+ z-index: 1000;
2368
+ }
2369
+
2370
+ .modal-container {
2371
+ background-color: #ffffff;
2372
+ border-radius: 12px;
2373
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
2374
+ width: 90%;
2375
+ max-width: 600px;
2376
+ max-height: 90vh;
2377
+ overflow-y: auto;
2378
+ position: relative;
2379
+ }
2380
+
2381
+ .modal-header {
2382
+ display: flex;
2383
+ justify-content: space-between;
2384
+ align-items: center;
2385
+ padding: 24px 24px 0 24px;
2386
+ margin-bottom: 24px;
2387
+ }
2388
+
2389
+ .modal-header h2 {
2390
+ margin: 0;
2391
+ font-size: 20px;
2392
+ font-weight: 600;
2393
+ color: #111827;
2394
+ }
2395
+
2396
+ .modal-close {
2397
+ background: none;
2398
+ border: none;
2399
+ font-size: 24px;
2400
+ color: #6b7280;
2401
+ cursor: pointer;
2402
+ padding: 4px;
2403
+ border-radius: 4px;
2404
+ transition: background-color 0.2s ease;
2405
+ }
2406
+
2407
+ .modal-close:hover {
2408
+ background-color: #f3f4f6;
2409
+ }
2410
+
2411
+ .modal-body {
2412
+ padding: 0 24px 24px 24px;
2413
+ }
2414
+
2415
+ .modal-form-group {
2416
+ margin-bottom: 20px;
2417
+ }
2418
+
2419
+ .modal-form-group label {
2420
+ display: block;
2421
+ font-weight: 600;
2422
+ color: #111827;
2423
+ margin-bottom: 8px;
2424
+ font-size: 14px;
2425
+ }
2426
+
2427
+ .modal-form-group input,
2428
+ .modal-form-group textarea {
2429
+ width: 100%;
2430
+ padding: 12px;
2431
+ border: 1px solid #d1d5db;
2432
+ border-radius: 8px;
2433
+ font-size: 14px;
2434
+ transition: border-color 0.2s ease;
2435
+ box-sizing: border-box;
2436
+ }
2437
+
2438
+ .modal-form-group input:focus,
2439
+ .modal-form-group textarea:focus {
2440
+ outline: none;
2441
+ border-color: #3b82f6;
2442
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
2443
+ }
2444
+
2445
+ .modal-form-group textarea {
2446
+ min-height: 80px;
2447
+ resize: vertical;
2448
+ }
2449
+
2450
+ .modal-form-group input::placeholder,
2451
+ .modal-form-group textarea::placeholder {
2452
+ color: #9ca3af;
2453
+ }
2454
+
2455
+ .modal-footer {
2456
+ display: flex;
2457
+ justify-content: flex-end;
2458
+ gap: 12px;
2459
+ padding: 24px;
2460
+ border-top: 1px solid #e5e7eb;
2461
+ margin-top: 24px;
2462
+ }
2463
+
2464
+ .modal-footer button {
2465
+ padding: 10px 20px;
2466
+ border-radius: 8px;
2467
+ font-size: 14px;
2468
+ font-weight: 500;
2469
+ cursor: pointer;
2470
+ transition: all 0.2s ease;
2471
+ }
2472
+
2473
+ .modal-cancel-button {
2474
+ background-color: #ffffff;
2475
+ color: #374151;
2476
+ border: 1px solid #d1d5db;
2477
+ }
2478
+
2479
+ .modal-cancel-button:hover {
2480
+ background-color: #f9fafb;
2481
+ }
2482
+
2483
+ .modal-create-button {
2484
+ background-color: #3b82f6;
2485
+ color: #ffffff;
2486
+ border: 1px solid #3b82f6;
2487
+ }
2488
+
2489
+ .modal-create-button:hover {
2490
+ background-color: #2563eb;
2491
+ }
2492
+ `;var ft=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,E=(i,e,t,n)=>{for(var s=n>1?void 0:n?mt(e,t):e,r=i.length-1,o;r>=0;r--)(o=i[r])&&(s=(n?o(e,t,s):o(s))||s);return n&&s&&ft(e,t,s),s};const Le=[{id:"wf-1",name:"Onboarding Checklist",description:"Standard checklist for new employees.",steps:[{id:"step-1",title:"Welcome Information",description:"Basic details collection.",order:1,assignment:{category:"individual",type:"specific_user",email:"hr@example.com"},elements:[{id:"c1",type:"text",content:"Welcome to our company! We're excited to have you join our team. This onboarding process will help you get set up quickly and efficiently.",order:1},{id:"c2",type:"divider",content:"",caption:"Personal Information",order:2},{id:"q1",type:"text_input",label:"Full Name",order:3,required:!0},{id:"q2",type:"text_input",label:"Email Address",order:4,required:!0},{id:"c3",type:"markdown",content:`## Next Steps
2493
+
2494
+ After completing this form, you'll receive:
2495
+
2496
+ * **Welcome email** with your login credentials
2497
+ * **Schedule** for your orientation meeting
2498
+ * **Access** to company resources
2499
+
2500
+ ### Important Notes
2501
+
2502
+ Please ensure all information is *accurate* before proceeding. If you need to make changes later, contact your HR representative.
2503
+
2504
+ ### What to Expect
2505
+
2506
+ 1. **Immediate**: Confirmation email
2507
+ 2. **Within 24 hours**: Welcome package
2508
+ 3. **This week**: Orientation meeting
2509
+
2510
+ > **Pro tip**: Save this information for future reference!
2511
+
2512
+ You can use \`code snippets\` like this for technical details.`,order:5}],status:"pending"},{id:"step-2",title:"Department Setup",description:"",order:2,assignment:{category:"individual",type:"instance_assignee_select"},elements:[{id:"c4",type:"text",content:"Now let's set up your department and role information. This will help us assign you to the right teams and provide appropriate access.",order:1},{id:"q3",type:"select",label:"Department",order:2,required:!0,options:["Engineering","Sales","Marketing","HR"]},{id:"q4",type:"text_input",label:"Role/Title",order:3,required:!0},{id:"c5",type:"divider",content:"",order:4},{id:"c6",type:"html",content:"<div style='background: #f0f9ff; padding: 16px; border-radius: 8px; border-left: 4px solid #3b82f6;'><strong>Note:</strong> Your department assignment will determine your initial access permissions and team assignments. You can request changes through your manager after onboarding.</div>",order:5}],status:"pending"},{id:"step-3",title:"Feedback",description:"Any initial comments?",order:3,assignment:{category:"individual",type:"subject"},elements:[{id:"c7",type:"text",content:"We'd love to hear your feedback about the onboarding process. Your input helps us improve the experience for future team members.",order:1},{id:"q5",type:"textarea",label:"Comments",order:2,required:!1},{id:"c8",type:"image",content:"",url:"https://example.com/onboarding-complete.jpg",alt:"Onboarding Complete",caption:"Congratulations on completing your onboarding!",order:3}],status:"pending"}]},{id:"wf-2",name:"IT Asset Request",description:"Request new hardware or software.",steps:[{id:"s1",title:"Request Details",order:1,assignment:{category:"individual",type:"subject"},elements:[{id:"itq1",type:"select",label:"Asset Type",order:1,required:!1,options:["Laptop","Monitor","Software License"]}],status:"pending"},{id:"s2",title:"Justification",order:2,assignment:{category:"role",type:"instance_role_assignee_select",targetId:"manager"},elements:[{id:"itq2",type:"textarea",label:"Reason",order:1,required:!0}],status:"pending"}]}];JSON.parse(JSON.stringify(Le[0].steps)),JSON.parse(JSON.stringify(Le[1].steps));let w=class extends R{constructor(){super(...arguments),this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[]}connectedCallback(){super.connectedCallback(),this._templateData=this._getDefaultWorkflowData()}_getDefaultWorkflowData(){const i={id:"step-1",title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:he(),name:"",description:"",steps:[i]}}_handleTitleChange(i){const e=i.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(i){const e=i.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var i;console.log("🚫 Builder Widget: Cancel button clicked"),(i=this.onCancel)==null||i.call(this)}_handleSave(){var i,e;if((i=this._templateData.name)!=null&&i.trim()){const t={id:this._templateData.id||he(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[]};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(t,null,2)),console.log("🔄 Calling onSave callback with workflow template"),(e=this.onSave)==null||e.call(this,t)}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._stepFormData={title:"",description:""}}_handleStepFormInput(i){const e=i.target,{name:t,value:n}=e;this._stepFormData={...this._stepFormData,[t]:n}}_createStep(){var t,n;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const i=this._templateData.steps||[],e={id:he(),title:this._stepFormData.title.trim(),description:((n=this._stepFormData.description)==null?void 0:n.trim())||"",order:i.length+1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...i,e]},this._selectedStepId=e.id,console.log("✅ Step created and selected:",e),this._closeStepModal()}_selectStep(i){this._selectedStepId=i,console.log("🎯 Step selected:",i)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(i=>i.id===this._selectedStepId)||null}_handleDragStart(i,e){this._draggedStepId=e,i.dataTransfer&&(i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(i){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(i,e){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(i){const e=i.relatedTarget;i.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(i,e){if(i.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],n=t.findIndex(a=>a.id===this._draggedStepId),s=t.findIndex(a=>a.id===e);if(n===-1||s===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,d)=>`${d+1}: ${a.title}`));const r=[...t],[o]=r.splice(n,1);r.splice(s,0,o),r.forEach((a,d)=>{a.order=d+1}),console.log("🔄 After reorder:",r.map((a,d)=>`${d+1}: ${a.title}`)),this._templateData={...this._templateData,steps:r},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(i="text_input"){var n,s;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(i)){let r={id:`c-${Date.now()}`,type:i,order:(((n=e.elements)==null?void 0:n.length)||0)+1};switch(i){case"text":r.content="Enter your text content here...";break;case"html":r.content="<p>Enter your HTML content here...</p>";break;case"divider":r.content="",r.caption="Section Divider";break;case"markdown":r.content=`## Enter your markdown content here...
2513
+
2514
+ Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const r={id:`q-${Date.now()}`,type:i,label:this._getQuestionTypeDisplayName(i),order:(((s=e.elements)==null?void 0:s.length)||0)+1,required:!1};["select","radio","checkbox"].includes(i)&&(r.options=["Option 1","Option 2"]);const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],r]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(i){var s;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add content without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}let t={id:`c-${Date.now()}`,type:i,order:(((s=e.elements)==null?void 0:s.length)||0)+1};switch(i){case"text":t.content="Enter your text content here...";break;case"html":t.content="<p>Enter your HTML content here...</p>";break;case"image":t.content="",t.url="",t.alt="",t.caption="";break;case"video":t.content="",t.url="",t.caption="";break;case"file":t.content="",t.url="",t.caption="";break;case"divider":t.content="",t.caption="Section Divider";break;case"markdown":t.content=`## Enter your markdown content here...
2515
+
2516
+ Use **bold** and *italic* text.`;break}const n=this._templateData.steps.map(r=>r.id===this._selectedStepId?{...r,elements:[...r.elements||[],t]}:r);this._templateData={...this._templateData,steps:n},console.log("✅ Content element added to step:",this._selectedStepId)}_updateQuestion(i,e){var n;if(!this._selectedStepId)return;const t=(n=this._templateData.steps)==null?void 0:n.map(s=>{var r;return s.id===this._selectedStepId?{...s,elements:((r=s.elements)==null?void 0:r.map(o=>o.id===i?{...o,...e}:o))||[]}:s});this._templateData={...this._templateData,steps:t}}_updateContentElement(i,e){var n;if(!this._selectedStepId)return;const t=(n=this._templateData.steps)==null?void 0:n.map(s=>{var r;return s.id===this._selectedStepId?{...s,elements:((r=s.elements)==null?void 0:r.map(o=>o.id===i?{...o,...e}:o))||[]}:s});this._templateData={...this._templateData,steps:t}}_deleteQuestion(i){var t;if(!this._selectedStepId)return;const e=(t=this._templateData.steps)==null?void 0:t.map(n=>{var s;return n.id===this._selectedStepId?{...n,elements:((s=n.elements)==null?void 0:s.filter(r=>r.id!==i))||[]}:n});this._templateData={...this._templateData,steps:e},console.log("🗑️ Question deleted:",i)}_renderQuestionTypeSpecificFields(i){switch(i.type){case"select":case"radio":return l`
2517
+ <div class="question-options-section">
2518
+ <label class="options-label">Options:</label>
2519
+ <div class="options-list">
2520
+ ${(i.options||[]).map((e,t)=>l`
2521
+ <div class="option-item">
2522
+ <input
2523
+ type="text"
2524
+ class="option-input"
2525
+ placeholder="Option ${t+1}"
2526
+ .value=${e}
2527
+ @input=${n=>{const s=n.target,r=[...i.options||[]];r[t]=s.value,this._updateQuestion(i.id,{options:r})}}
2528
+ />
2529
+ <button
2530
+ class="remove-option-button"
2531
+ @click=${()=>{const n=[...i.options||[]];n.splice(t,1),this._updateQuestion(i.id,{options:n})}}
2532
+ title="Remove option"
2533
+ >
2534
+ ×
2535
+ </button>
2536
+ </div>
2537
+ `)}
2538
+ <button
2539
+ class="add-option-button"
2540
+ @click=${()=>{const e=[...i.options||[],""];this._updateQuestion(i.id,{options:e})}}
2541
+ >
2542
+ + Add Option
2543
+ </button>
2544
+ </div>
2545
+ </div>
2546
+ `;case"checkbox":return l`
2547
+ <div class="question-checkbox-config">
2548
+ <div class="checkbox-type-selection">
2549
+ <label class="checkbox-type-label">
2550
+ <input
2551
+ type="radio"
2552
+ name="checkbox-type-${i.id}"
2553
+ value="single"
2554
+ .checked=${!i.options||i.options.length===0}
2555
+ @change=${e=>{e.target.checked&&this._updateQuestion(i.id,{options:void 0})}}
2556
+ />
2557
+ Single Checkbox (Yes/No)
2558
+ </label>
2559
+ <label class="checkbox-type-label">
2560
+ <input
2561
+ type="radio"
2562
+ name="checkbox-type-${i.id}"
2563
+ value="group"
2564
+ .checked=${i.options&&i.options.length>0}
2565
+ @change=${e=>{e.target.checked&&this._updateQuestion(i.id,{options:i.options&&i.options.length>0?i.options:["Option 1","Option 2"]})}}
2566
+ />
2567
+ Checkbox Group (Multiple selections)
2568
+ </label>
2569
+ </div>
2570
+
2571
+ ${i.options&&i.options.length>0?l`
2572
+ <div class="question-options-section">
2573
+ <label class="options-label">Checkbox Options:</label>
2574
+ <div class="options-list">
2575
+ ${(i.options||[]).map((e,t)=>l`
2576
+ <div class="option-item">
2577
+ <input
2578
+ type="text"
2579
+ class="option-input"
2580
+ placeholder="Option ${t+1}"
2581
+ .value=${e}
2582
+ @input=${n=>{const s=n.target,r=[...i.options||[]];r[t]=s.value,this._updateQuestion(i.id,{options:r})}}
2583
+ />
2584
+ <button
2585
+ class="remove-option-button"
2586
+ @click=${()=>{const n=[...i.options||[]];n.splice(t,1),this._updateQuestion(i.id,{options:n})}}
2587
+ title="Remove option"
2588
+ >
2589
+ ×
2590
+ </button>
2591
+ </div>
2592
+ `)}
2593
+ <button
2594
+ class="add-option-button"
2595
+ @click=${()=>{const e=[...i.options||[],""];this._updateQuestion(i.id,{options:e})}}
2596
+ >
2597
+ + Add Option
2598
+ </button>
2599
+ </div>
2600
+ </div>
2601
+ `:l`
2602
+ <div class="single-checkbox-info">
2603
+ <p class="config-note">
2604
+ Single checkbox - users can check/uncheck for Yes/No
2605
+ response
2606
+ </p>
2607
+ </div>
2608
+ `}
2609
+ </div>
2610
+ `;case"textarea":return l`
2611
+ <div class="question-config-section">
2612
+ <label class="config-label">
2613
+ Placeholder:
2614
+ <input
2615
+ type="text"
2616
+ class="config-input"
2617
+ placeholder="Enter placeholder text"
2618
+ .value=${i.placeholder||""}
2619
+ @input=${e=>{const t=e.target;this._updateQuestion(i.id,{placeholder:t.value})}}
2620
+ />
2621
+ </label>
2622
+ </div>
2623
+ `;case"text_input":return l`
2624
+ <div class="question-config-section">
2625
+ <label class="config-label">
2626
+ Placeholder:
2627
+ <input
2628
+ type="text"
2629
+ class="config-input"
2630
+ placeholder="Enter placeholder text"
2631
+ .value=${i.placeholder||""}
2632
+ @input=${e=>{const t=e.target;this._updateQuestion(i.id,{placeholder:t.value})}}
2633
+ />
2634
+ </label>
2635
+ </div>
2636
+ `;case"number":return l`
2637
+ <div class="question-config-section">
2638
+ <label class="config-label">
2639
+ Placeholder:
2640
+ <input
2641
+ type="text"
2642
+ class="config-input"
2643
+ placeholder="Enter placeholder text"
2644
+ .value=${i.placeholder||""}
2645
+ @input=${e=>{const t=e.target;this._updateQuestion(i.id,{placeholder:t.value})}}
2646
+ />
2647
+ </label>
2648
+ </div>
2649
+ `;case"file_upload":return l`
2650
+ <div class="question-config-section">
2651
+ <p class="config-note">
2652
+ File upload field - users can upload files
2653
+ </p>
2654
+ </div>
2655
+ `;case"signature":return l`
2656
+ <div class="question-config-section">
2657
+ <p class="config-note">
2658
+ Digital signature pad - users can sign with mouse/touch
2659
+ </p>
2660
+ </div>
2661
+ `;case"date":return l`
2662
+ <div class="question-config-section">
2663
+ <p class="config-note">Date picker field</p>
2664
+ </div>
2665
+ `;default:return l``}}_renderContentTypeSpecificFields(i){switch(i.type){case"text":return l`
2666
+ <div class="content-config-section">
2667
+ <label class="config-label">
2668
+ Text Content:
2669
+ <textarea
2670
+ class="config-textarea"
2671
+ placeholder="Enter your text content..."
2672
+ .value=${i.content||""}
2673
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{content:t.value})}}
2674
+ ></textarea>
2675
+ </label>
2676
+ </div>
2677
+ `;case"html":return l`
2678
+ <div class="content-config-section">
2679
+ <label class="config-label">
2680
+ HTML Content:
2681
+ <textarea
2682
+ class="config-textarea"
2683
+ placeholder="Enter your HTML content..."
2684
+ .value=${i.content||""}
2685
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{content:t.value})}}
2686
+ ></textarea>
2687
+ </label>
2688
+ </div>
2689
+ `;case"image":return l`
2690
+ <div class="content-config-section">
2691
+ <label class="config-label">
2692
+ Image URL:
2693
+ <input
2694
+ type="url"
2695
+ class="config-input"
2696
+ placeholder="https://example.com/image.jpg"
2697
+ .value=${i.url||""}
2698
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{url:t.value})}}
2699
+ />
2700
+ </label>
2701
+ <label class="config-label">
2702
+ Alt Text:
2703
+ <input
2704
+ type="text"
2705
+ class="config-input"
2706
+ placeholder="Describe the image"
2707
+ .value=${i.alt||""}
2708
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{alt:t.value})}}
2709
+ />
2710
+ </label>
2711
+ <label class="config-label">
2712
+ Caption:
2713
+ <input
2714
+ type="text"
2715
+ class="config-input"
2716
+ placeholder="Image caption"
2717
+ .value=${i.caption||""}
2718
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{caption:t.value})}}
2719
+ />
2720
+ </label>
2721
+ </div>
2722
+ `;case"video":return l`
2723
+ <div class="content-config-section">
2724
+ <label class="config-label">
2725
+ Video URL:
2726
+ <input
2727
+ type="url"
2728
+ class="config-input"
2729
+ placeholder="https://example.com/video.mp4"
2730
+ .value=${i.url||""}
2731
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{url:t.value})}}
2732
+ />
2733
+ </label>
2734
+ <label class="config-label">
2735
+ Caption:
2736
+ <input
2737
+ type="text"
2738
+ class="config-input"
2739
+ placeholder="Video caption"
2740
+ .value=${i.caption||""}
2741
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{caption:t.value})}}
2742
+ />
2743
+ </label>
2744
+ </div>
2745
+ `;case"file":return l`
2746
+ <div class="content-config-section">
2747
+ <label class="config-label">
2748
+ File URL:
2749
+ <input
2750
+ type="url"
2751
+ class="config-input"
2752
+ placeholder="https://example.com/document.pdf"
2753
+ .value=${i.url||""}
2754
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{url:t.value})}}
2755
+ />
2756
+ </label>
2757
+ <label class="config-label">
2758
+ Caption:
2759
+ <input
2760
+ type="text"
2761
+ class="config-input"
2762
+ placeholder="File description"
2763
+ .value=${i.caption||""}
2764
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{caption:t.value})}}
2765
+ />
2766
+ </label>
2767
+ </div>
2768
+ `;case"divider":return l`
2769
+ <div class="content-config-section">
2770
+ <label class="config-label">
2771
+ Caption:
2772
+ <input
2773
+ type="text"
2774
+ class="config-input"
2775
+ placeholder="Section divider caption"
2776
+ .value=${i.caption||""}
2777
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{caption:t.value})}}
2778
+ />
2779
+ </label>
2780
+ </div>
2781
+ `;case"markdown":return l`
2782
+ <div class="content-config-section">
2783
+ <label class="config-label">
2784
+ Markdown Content:
2785
+ <textarea
2786
+ class="config-textarea"
2787
+ placeholder="Enter your markdown content..."
2788
+ .value=${i.content||""}
2789
+ @input=${e=>{const t=e.target;this._updateContentElement(i.id,{content:t.value})}}
2790
+ ></textarea>
2791
+ </label>
2792
+ </div>
2793
+ `;default:return l``}}_getQuestionTypeDisplayName(i){switch(i){case"text_input":return"Text Input";case"textarea":return"Long Text";case"select":return"Select";case"radio":return"Radio";case"checkbox":return"Checkbox";case"number":return"Number";case"date":return"Date";case"file_upload":return"File Upload";case"signature":return"Signature";default:return"Question"}}_getContentTypeDisplayName(i){switch(i){case"text":return"Text";case"html":return"HTML";case"image":return"Image";case"video":return"Video";case"file":return"File";case"divider":return"Divider";case"markdown":return"Markdown";default:return"Content"}}_getCheckboxTypeDisplayName(i){return i.options&&i.options.length>0?"Checkbox Group":"Single Checkbox"}_hasSteps(){const i=!!(this._templateData.steps&&this._templateData.steps.length>0);return i&&!this._selectedStepId&&this._templateData.steps&&(this._selectedStepId=this._templateData.steps[0].id,console.log("🎯 Auto-selected first step:",this._templateData.steps[0].title)),!i&&this._selectedStepId&&(this._selectedStepId=null),i}_getAssignmentDisplayText(i){switch(i.category){case"individual":switch(i.type){case"subject":return"Assigned to: Subject";case"creator":return"Assigned to: Creator";case"instance_assignee_select":return"Assigned to: To be selected";case"specific_user":return i.email?`Assigned to: ${i.email}`:"Assigned to: Specific user";default:return"Assigned to: Individual"}case"role":switch(i.type){case"instance_role_assignee_select":return i.targetId?`Assigned to: ${i.targetId} role`:"Assigned to: Role";default:return"Assigned to: Role"}default:return"Assignment not configured"}}render(){this._hasSteps();const i=this._getSelectedStep();return l`
2794
+ <div class="header">
2795
+ <div class="header-inputs">
2796
+ <div class="form-group">
2797
+ <label for="template-title">Title</label>
2798
+ <input
2799
+ type="text"
2800
+ id="template-title"
2801
+ placeholder="Title"
2802
+ .value=${this._templateData.name||""}
2803
+ @input=${this._handleTitleChange}
2804
+ />
2805
+ </div>
2806
+ <div class="form-group">
2807
+ <label for="template-description">Description</label>
2808
+ <input
2809
+ type="text"
2810
+ id="template-description"
2811
+ placeholder="Description"
2812
+ .value=${this._templateData.description||""}
2813
+ @input=${this._handleDescriptionChange}
2814
+ />
2815
+ </div>
2816
+ </div>
2817
+ <div class="header-actions">
2818
+ <button class="save-button" @click=${this._handleSave}>
2819
+ Save template
2820
+ </button>
2821
+ </div>
2822
+ </div>
2823
+
2824
+ <div class="main-content">
2825
+ <!-- Steps and Questions -->
2826
+ <div class="content-columns">
2827
+ <!-- Steps Section -->
2828
+ <div class="section">
2829
+ <div class="section-header">
2830
+ <h2>Steps</h2>
2831
+ <button class="add-button" @click=${this._addStep}>Add</button>
2832
+ </div>
2833
+
2834
+ <div class="steps-list">
2835
+ <div
2836
+ class="step-item selected"
2837
+ @click=${()=>this._selectStep("step-1")}
2838
+ >
2839
+ <div class="step-handle">⋮⋮</div>
2840
+ <div class="step-content">
2841
+ <strong>Step 1</strong>
2842
+ </div>
2843
+ <div class="step-actions">
2844
+ <button class="step-menu">⋯</button>
2845
+ </div>
2846
+ </div>
2847
+ </div>
2848
+ </div>
2849
+
2850
+ <!-- Questions Section -->
2851
+ <div class="section">
2852
+ <div class="section-header">
2853
+ <h2>Questions</h2>
2854
+ <button class="add-button" @click=${()=>this._addQuestion()}>
2855
+ Add
2856
+ </button>
2857
+ </div>
2858
+
2859
+ ${i&&i.elements&&i.elements.length>0?l`
2860
+ <div class="elements-list">
2861
+ ${i.elements.map(e=>{const t="label"in e&&"required"in e,n="content"in e;if(t){const s=e;return l`
2862
+ <div class="question-item">
2863
+ <div class="question-header">
2864
+ <h3 class="question-title">
2865
+ ${s.label||(s.type==="checkbox"?this._getCheckboxTypeDisplayName(s):this._getQuestionTypeDisplayName(s.type))}
2866
+ </h3>
2867
+ <div class="question-header-controls">
2868
+ <select
2869
+ class="question-type-select"
2870
+ .value=${s.type||"text_input"}
2871
+ style="color: #000 !important;"
2872
+ @change=${r=>{const a=r.target.value;if(["text","html","divider","markdown"].includes(a)){this._addQuestion(a),this._deleteQuestion(s.id);return}const p={type:a};["select","radio","checkbox"].includes(a)&&!s.options&&(p.options=["Option 1","Option 2"]);const c=this._getQuestionTypeDisplayName(s.type);(!s.label||s.label===c)&&(p.label=this._getQuestionTypeDisplayName(a)),this._updateQuestion(s.id,p)}}
2873
+ >
2874
+ <optgroup label="Questions">
2875
+ <option value="text_input">
2876
+ Text Input (short)
2877
+ </option>
2878
+ <option value="textarea">
2879
+ Text Input (long)
2880
+ </option>
2881
+ <option value="select">Select</option>
2882
+ <option value="radio">Radio</option>
2883
+ <option value="checkbox">Checkbox</option>
2884
+ <option value="file_upload">
2885
+ File Upload
2886
+ </option>
2887
+ <option value="signature">Signature</option>
2888
+ <option value="number">Number</option>
2889
+ <option value="date">Date</option>
2890
+ </optgroup>
2891
+ <optgroup label="Content">
2892
+ <option value="text">Text</option>
2893
+ <option value="html">HTML</option>
2894
+ <option value="divider">Divider</option>
2895
+ <option value="markdown">Markdown</option>
2896
+ </optgroup>
2897
+ </select>
2898
+ <button
2899
+ class="delete-question-button"
2900
+ @click=${()=>this._deleteQuestion(s.id)}
2901
+ title="Delete question"
2902
+ >
2903
+ 🗑️
2904
+ </button>
2905
+ </div>
2906
+ </div>
2907
+
2908
+ <input
2909
+ type="text"
2910
+ class="question-label-input"
2911
+ placeholder="Question label"
2912
+ .value=${s.label||""}
2913
+ @input=${r=>{const o=r.target;this._updateQuestion(s.id,{label:o.value}),this.requestUpdate()}}
2914
+ />
2915
+
2916
+ ${this._renderQuestionTypeSpecificFields(s)}
2917
+
2918
+ <label class="question-required-label">
2919
+ <input
2920
+ type="checkbox"
2921
+ .checked=${s.required||!1}
2922
+ @change=${r=>{const o=r.target;this._updateQuestion(s.id,{required:o.checked})}}
2923
+ />
2924
+ Required
2925
+ </label>
2926
+ </div>
2927
+ `}else if(n){const s=e;return l`
2928
+ <div class="question-item">
2929
+ <div class="question-header">
2930
+ <h3 class="question-title">
2931
+ ${this._getContentTypeDisplayName(s.type)}
2932
+ </h3>
2933
+ <div class="question-header-controls">
2934
+ <select
2935
+ class="question-type-select"
2936
+ .value=${e.type||"text"}
2937
+ style="color: #000 !important;"
2938
+ @change=${r=>{const a=r.target.value;if(!["text","html","divider","markdown"].includes(a)){this._addQuestion(a),this._deleteQuestion(e.id);return}this._addQuestion(a),this._deleteQuestion(e.id)}}
2939
+ >
2940
+ <optgroup label="Questions">
2941
+ <option value="text_input">
2942
+ Text Input (short)
2943
+ </option>
2944
+ <option value="textarea">
2945
+ Text Input (long)
2946
+ </option>
2947
+ <option value="select">Select</option>
2948
+ <option value="radio">Radio</option>
2949
+ <option value="checkbox">Checkbox</option>
2950
+ <option value="file_upload">
2951
+ File Upload
2952
+ </option>
2953
+ <option value="signature">Signature</option>
2954
+ <option value="number">Number</option>
2955
+ <option value="date">Date</option>
2956
+ </optgroup>
2957
+ <optgroup label="Content">
2958
+ <option value="text">Text</option>
2959
+ <option value="html">HTML</option>
2960
+ <option value="divider">Divider</option>
2961
+ <option value="markdown">Markdown</option>
2962
+ </optgroup>
2963
+ </select>
2964
+ <button
2965
+ class="delete-question-button"
2966
+ @click=${()=>this._deleteQuestion(e.id)}
2967
+ title="Delete content"
2968
+ >
2969
+
2970
+ </button>
2971
+ </div>
2972
+ </div>
2973
+ <div class="question-content">
2974
+ ${this._renderContentTypeSpecificFields(s)}
2975
+ </div>
2976
+ </div>
2977
+ `}else{const s=e;return l`
2978
+ <div class="question-item">
2979
+ <div class="question-header">
2980
+ <h3 class="question-title">Unknown Element</h3>
2981
+ <div class="question-header-controls">
2982
+ <button
2983
+ class="delete-question-button"
2984
+ @click=${()=>this._deleteQuestion(s.id)}
2985
+ title="Delete element"
2986
+ >
2987
+
2988
+ </button>
2989
+ </div>
2990
+ </div>
2991
+ </div>
2992
+ `}})}
2993
+ </div>
2994
+ `:l`
2995
+ <div class="empty-state">
2996
+ <h3>Add questions</h3>
2997
+ <p>Use the add button to start building your workflow</p>
2998
+ <button class="add-button" @click=${()=>this._addQuestion()}>
2999
+ Add
3000
+ </button>
3001
+ </div>
3002
+ `}
3003
+ </div>
3004
+ </div>
3005
+ </div>
3006
+ `}};w.styles=L`
3007
+ ${ct}
3008
+ ${ut}
3009
+ ${ht}
3010
+ ${Pe}
3011
+ ${gt}
3012
+ `,E([_()],w.prototype,"_templateData",2),E([_()],w.prototype,"_showStepModal",2),E([_()],w.prototype,"_stepFormData",2),E([_()],w.prototype,"_draggedStepId",2),E([_()],w.prototype,"_dragOverStepId",2),E([_()],w.prototype,"_selectedStepId",2),E([_()],w.prototype,"_questions",2),E([C({attribute:!1})],w.prototype,"onCancel",2),E([C({attribute:!1})],w.prototype,"onSave",2),w=E([Ie("builder-widget")],w);class bt{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,n){if(n==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let s=!0;const r={};for(const o of e.elements)if(this.isQuestionElement(o)){const a=o;if(a.required){const d=this.validateQuestion(a,t[a.id]);d&&(s=!1,r[a.id]=d.message)}}return{isValid:s,errors:r}}validateQuestion(e,t){switch(e.type){case"checkbox":return this.validateCheckbox(e,t);case"signature":return this.validateSignature(e,t);case"file_upload":return this.validateFileUpload(e,t);default:return this.validateBasicField(e,t)}}validateCheckbox(e,t){if(e.options&&e.options.length>0){if(!Array.isArray(t)||t.length===0)return{questionId:e.id,message:`${e.label} is required.`}}else if(t!==!0)return{questionId:e.id,message:`${e.label} is required.`};return null}validateSignature(e,t){const n=this.signaturePads.get(e.id);return!n||n.isEmpty()?{questionId:e.id,message:`${e.label} is required.`}:this.savedSignatures.has(e.id)?null:{questionId:e.id,message:`Please save your ${e.label} before continuing.`}}validateFileUpload(e,t){return!t||t===null||t===void 0?{questionId:e.id,message:`${e.label} is required.`}:null}validateBasicField(e,t){return t==null||t===""?{questionId:e.id,message:`${e.label} is required.`}:null}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e.type)}}class vt{getStorageKey(e){return`runner-form-data-${e||"default"}`}saveFormData(e,t,n,s,r,o){var c,u,h;const a=this.getStorageKey(e),d=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[n])==null?void 0:u.id,completedSteps:Array.from(r),updatedAt:new Date,steps:(h=o.steps)==null?void 0:h.map(f=>({...f,responses:f.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:n,savedSignatures:Array.from(s),completedSteps:Array.from(r),instance:d};try{localStorage.setItem(a,JSON.stringify(p))}catch(f){console.warn("Failed to save form data to localStorage:",f)}}restoreFormData(e){const t=this.getStorageKey(e);try{const n=localStorage.getItem(t);if(!n)return null;const s=JSON.parse(n);return{formData:s.formData||{},stepIndex:s.stepIndex||0,savedSignatures:new Set(s.savedSignatures||[]),completedSteps:new Set(s.completedSteps||[]),savedInstance:s.instance||null}}catch(n){return console.warn("Failed to restore form data from localStorage:",n),null}}clearFormData(e,t="completed workflow"){const n=this.getStorageKey(e);try{localStorage.removeItem(n),console.log(`Cleared saved form data for ${t}`)}catch(s){console.warn("Failed to clear saved form data:",s)}}shouldRestoreData(e){return e==="default"}}/*!
3013
+ * Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
3014
+ * (c) 2025 Szymon Nowak | Released under the MIT license
3015
+ */class X{constructor(e,t,n,s){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=s||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class ge{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,s=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],n,s,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const s=e.x-t.x,r=e.y-t.y,o=t.x-n.x,a=t.y-n.y,d={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+n.x)/2,y:(t.y+n.y)/2},c=Math.sqrt(s*s+r*r),u=Math.sqrt(o*o+a*a),h=d.x-p.x,f=d.y-p.y,b=c+u==0?0:u/(c+u),$={x:p.x+h*b,y:p.y+f*b},ie=t.x-$.x,ne=t.y-$.y;return{c1:new X(d.x+ie,d.y+ne),c2:new X(p.x+ie,p.y+ne)}}constructor(e,t,n,s,r,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=s,this.startWidth=r,this.endWidth=o}length(){let t=0,n,s;for(let r=0;r<=10;r+=1){const o=r/10,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),d=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const p=a-n,c=d-s;t+=Math.sqrt(p*p+c*c)}n=a,s=d}return t}point(e,t,n,s,r){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*s*(1-e)*e*e+r*e*e*e}}class xt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}}function _t(i,e=250){let t=0,n=null,s,r,o;const a=()=>{t=Date.now(),n=null,s=i.apply(r,o),n||(r=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return r=this,o=p,u<=0||u>e?(n&&(clearTimeout(n),n=null),t=c,s=i.apply(r,o),n||(r=null,o=[])):n||(n=window.setTimeout(a,u)),s}}class Z extends xt{constructor(e,t={}){var n,s,r;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=(n=t.throttle)!==null&&n!==void 0?n:16,this.minDistance=(s=t.minDistance)!==null&&s!==void 0?s:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=(r=t.canvasContextOptions)!==null&&r!==void 0?r:{},this._strokeMoveUpdate=this.throttle?_t(Z.prototype._strokeUpdate,this.throttle):Z.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(e,t={}){return new Promise((n,s)=>{const r=new Image,o=t.ratio||window.devicePixelRatio||1,a=t.width||this.canvas.width/o,d=t.height||this.canvas.height/o,p=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),r.onload=()=>{this._ctx.drawImage(r,p,c,a,d),n()},r.onerror=u=>{s(u)},r.crossOrigin="anonymous",r.src=e,this._isEmpty=!1})}toDataURL(e="image/png",t){switch(e){case"image/svg+xml":return typeof t!="object"&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!="number"&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:(e=this.canvas.ownerDocument.defaultView)!==null&&e!==void 0?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)===1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){!this._isLeftButtonPressed(e,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return typeof this._strokePointerId>"u"?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){this._drawingStroke||!this._isLeftButtonPressed(e)||!this._allowPointerId(e,!0)||(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){this._isLeftButtonPressed(e)||!this._allowPointerId(e)||(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:n}=this._getListenerFunctions();switch(e.event.type){case"mousedown":n("mousemove",this._handleMouseMove,{passive:!1}),n("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":n("touchmove",this._handleTouchMove,{passive:!1}),n("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":n("pointermove",this._handlePointerMove,{passive:!1}),n("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const s=this._getPointGroupOptions(),r=Object.assign(Object.assign({},s),{points:[]});this._data.push(r),this._reset(s),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],s=n.points,r=s.length>0&&s[s.length-1],o=r?t.distanceTo(r)<=this.minDistance:!1,a=this._getPointGroupOptions(n);if(!r||!(r&&o)){const d=this._addPoint(t,a);r?d&&this._drawCurve(d,a):this._drawDot(t,a),s.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){const s=this.canvas.getBoundingClientRect();return new X(e-s.left,t-s.top,n,new Date().getTime())}_addPoint(e,t){const{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);const s=this._calculateCurveWidths(n[1],n[2],t),r=ge.fromPoints(n,s);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){const s=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(s,n),o={end:r,start:this._lastWidth};return this._lastVelocity=s,this._lastWidth=r,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){const s=this._ctx;s.moveTo(e,t),s.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const n=this._ctx,s=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let o=0;o<r;o+=1){const a=o/r,d=a*a,p=d*a,c=1-a,u=c*c,h=u*c;let f=h*e.startPoint.x;f+=3*u*a*e.control1.x,f+=3*c*d*e.control2.x,f+=p*e.endPoint.x;let b=h*e.startPoint.y;b+=3*u*a*e.control1.y,b+=3*c*d*e.control2.y,b+=p*e.endPoint.y;const $=Math.min(e.startWidth+p*s,t.maxWidth);this._drawCurveSegment(f,b,$)}n.closePath(),n.fill()}_drawDot(e,t){const n=this._ctx,s=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,s),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(const s of e){const{points:r}=s,o=this._getPointGroupOptions(s);if(r.length>1)for(let a=0;a<r.length;a+=1){const d=r[a],p=new X(d.x,d.y,d.pressure,d.time);a===0&&this._reset(o);const c=this._addPoint(p,o);c&&t(c,o)}else this._reset(o),n(r[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,n=Math.max(window.devicePixelRatio||1,1),s=0,r=0,o=this.canvas.width/n,a=this.canvas.height/n,d=document.createElementNS("http://www.w3.org/2000/svg","svg");if(d.setAttribute("xmlns","http://www.w3.org/2000/svg"),d.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),d.setAttribute("viewBox",`${s} ${r} ${o} ${a}`),d.setAttribute("width",o.toString()),d.setAttribute("height",a.toString()),e&&this.backgroundColor){const p=document.createElement("rect");p.setAttribute("width","100%"),p.setAttribute("height","100%"),p.setAttribute("fill",this.backgroundColor),d.appendChild(p)}return this._fromData(t,(p,{penColor:c})=>{const u=document.createElement("path");if(!isNaN(p.control1.x)&&!isNaN(p.control1.y)&&!isNaN(p.control2.x)&&!isNaN(p.control2.y)){const h=`M ${p.startPoint.x.toFixed(3)},${p.startPoint.y.toFixed(3)} C ${p.control1.x.toFixed(3)},${p.control1.y.toFixed(3)} ${p.control2.x.toFixed(3)},${p.control2.y.toFixed(3)} ${p.endPoint.x.toFixed(3)},${p.endPoint.y.toFixed(3)}`;u.setAttribute("d",h),u.setAttribute("stroke-width",(p.endWidth*2.25).toFixed(3)),u.setAttribute("stroke",c),u.setAttribute("fill","none"),u.setAttribute("stroke-linecap","round"),d.appendChild(u)}},(p,{penColor:c,dotSize:u,minWidth:h,maxWidth:f})=>{const b=document.createElement("circle"),$=u>0?u:(h+f)/2;b.setAttribute("r",$.toString()),b.setAttribute("cx",p.x.toString()),b.setAttribute("cy",p.y.toString()),b.setAttribute("fill",c),d.appendChild(b)}),d.outerHTML}}class yt{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const n=t==null?void 0:t.getElementById(`signature-${e}`);if(!n)return null;this.clearSignaturePad(e),this.resizeCanvas(n);const s=new Z(n,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,s),this.canvasElements.set(e,n),s.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),s}handleSignatureChange(e){var r;const t=this.signaturePads.get(e);if(!t)return;const n=!t.isEmpty(),s=n?t.toData():null;(r=this.onSignatureChange)==null||r.call(this,{questionId:e,hasSignature:n,signatureData:s})}clearSignature(e){const t=this.signaturePads.get(e);t&&(t.clear(),this.handleSignatureChange(e))}saveSignature(e){const t=this.signaturePads.get(e);if(!t||t.isEmpty())return null;const n=t.toSVG(),s=t.toDataURL();return{questionId:e,svgData:n,dataURL:s}}restoreSignature(e,t){const n=this.signaturePads.get(e);if(!n||!t)return!1;try{return n.clear(),n.fromData(t),!0}catch(s){return console.warn(`Failed to restore signature for ${e}:`,s),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const n=this.canvasElements.get(t);if(n){this.resizeCanvas(n);const s=e.toData();e.clear(),e.fromData(s)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),n=window.getComputedStyle(e),s=parseFloat(n.width),r=parseFloat(n.height);e.width=s*t,e.height=r*t;const o=e.getContext("2d");o&&o.scale(t,t)}clearSignaturePad(e){var t;this.signaturePads.has(e)&&((t=this.signaturePads.get(e))==null||t.off(),this.signaturePads.delete(e),this.canvasElements.delete(e))}getSignaturePad(e){return this.signaturePads.get(e)}hasSignaturePads(){return this.signaturePads.size>0}getAllSignaturePads(){return new Map(this.signaturePads)}destroy(){this.signaturePads.forEach(e=>{e.off()}),this.signaturePads.clear(),this.canvasElements.clear()}}class St{trackQuestionResponse(e,t,n){if(!e)return;e.responses||(e.responses=[]);const s=e.responses.findIndex(o=>o.elementId===t),r={elementId:t,value:n,answeredAt:new Date};s>=0?e.responses[s]=r:e.responses.push(r)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(n=>{n.responses||(n.responses=[]),n.elements.forEach(s=>{if(this.isQuestionElement(s.type)){const r=t[s.id];if(r!==void 0&&n.responses){let o=n.responses.find(a=>a.elementId===s.id);o?(o.value=r,o.answeredAt=new Date):(o={elementId:s.id,value:r,answeredAt:new Date},n.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),t}hasChangedFromPrevious(e,t,n){if(!(n!=null&&n.steps))return!0;for(const s of n.steps)if(s.responses){const r=s.responses.find(o=>o.elementId===e);if(r)return r.value!==t}return!0}isQuestionElement(e){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(e)}}class wt{constructor(e,t){this.mode=e,this.currentUser=t}updateMode(e){this.mode=e}updateCurrentUser(e){this.currentUser=e}isStepAssignedToUser(e){if(!this.currentUser)return!1;const t=e.assignment;return!!(this.currentUser.targetId&&t.targetId&&this.currentUser.targetId===t.targetId||this.currentUser.email&&t.email&&this.currentUser.email===t.email)}getAssignedSteps(e){return e!=null&&e.steps?e.steps.filter(t=>this.isStepAssignedToUser(t)):[]}findNextAssignedStep(e,t){if(!(t!=null&&t.steps))return-1;if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print")return e+1<t.steps.length?e+1:-1;for(let n=e+1;n<t.steps.length;n++){const s=t.steps[n];if(this.isStepAssignedToUser(s))return n}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const n=t==null?void 0:t.steps;return e===((n==null?void 0:n.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,n,s,r,o){if((r||o)&&this.mode!=="admin"&&this.mode!=="view-only"&&this.mode!=="print")return{canNavigate:!1,newStepIndex:t,reason:"Navigation blocked: workflow submitted"};if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const p=n.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=n.steps;if(!a||e<0||e>=a.length)return{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"};const d=a[e];if(this.isStepAssignedToUser(d)){const p=s.has(d.id),c=this.isStepWithinAllowedRange(e,n,s);return p||c?{canNavigate:!0,newStepIndex:e}:{canNavigate:!1,newStepIndex:t,reason:"Step not accessible yet"}}else return{canNavigate:!0,newStepIndex:e}}isStepWithinAllowedRange(e,t,n){if(!(t!=null&&t.steps))return!1;const r=this.getAssignedSteps(t).map(d=>t.steps.findIndex(p=>p.id===d.id)).sort((d,p)=>d-p);let o=-1;for(const d of r){const p=t.steps[d];n.has(p.id)&&(o=d)}let a=-1;for(const d of r)if(d>o){a=d;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const ee=class ee{constructor(){this.formData={},this.validationErrors={}}updateFormData(e){this.formData={...e}}mergeFormData(e){this.formData={...this.formData,...e}}setFormField(e,t){this.formData={...this.formData,[e]:t}}removeFormField(e){const t={...this.formData};delete t[e],this.formData=t}getFormData(){return{...this.formData}}getFormField(e){return this.formData[e]}hasFormField(e){return e in this.formData}setValidationErrors(e){this.validationErrors={...e}}getValidationErrors(){return{...this.validationErrors}}clearValidationError(e){if(this.validationErrors[e]){const t={...this.validationErrors};delete t[e],this.validationErrors=t}}hasValidationError(e){return!!this.validationErrors[e]}setValidationError(e,t){this.validationErrors={...this.validationErrors,[e]:t}}clearAllValidationErrors(){this.validationErrors={}}initializeFromResponses(e){const t={};e.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return ee.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var n;const t={};return(n=e.elements)==null||n.forEach(s=>{if(this.isQuestionElement(s)){const r=s,o=this.formData[r.id];o!==void 0&&(t[r.id]=o)}}),t}hasFormData(){return Object.keys(this.formData).length>0}getFormFieldIds(){return Object.keys(this.formData)}getValidationErrorCount(){return Object.keys(this.validationErrors).length}};ee.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let fe=ee;const te=class te{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,n){var p,c,u,h,f;const s=t.target,r=(p=s.files)==null?void 0:p[0];if(!r){this.clearFile(e),(c=n.onRequestUpdate)==null||c.call(n);return}const o=this.validateFileSize(r);if(o){this.handleFileValidationError(e,o,s),(u=n.onRequestUpdate)==null||u.call(n);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(r);this.formStateManager.setFormField(e,a);const d=this.hasFileChanged(e,a,n.savedInstance);d&&n.mode!=="preview"?this.executeFileUploadCallback(e,r,a,n):this.logSkippedCallback(e,n.mode,d),(h=n.onRequestUpdate)==null||h.call(n),n.mode!=="admin"&&((f=n.onFormDataSave)==null||f.call(n))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>te.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,n){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),n.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,n){if(!(n!=null&&n.steps))return!0;for(const s of n.steps)if(s.responses){const r=s.responses.find(o=>o.elementId===e);if(r&&r.value&&typeof r.value=="object"){const o=r.value;return o.name!==t.name||o.size!==t.size||o.type!==t.type||o.lastModified!==t.lastModified}}return!0}executeFileUploadCallback(e,t,n,s){var r,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!s.onFileUploaded),s.onFileUploaded&&s.onFileUploaded({instanceId:(r=s.instance)==null?void 0:r.id,stepId:(o=s.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:n.name,fileSize:n.size,fileType:n.type})}logSkippedCallback(e,t,n){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):n||console.log("File unchanged, skipping callback for:",e)}};te.MAX_FILE_SIZE=5*1024*1024;let me=te;class S{static _isInputDisabled(e){return(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="admin"||e.mode==="view-only"||e.mode==="print"||e.mode==="default"&&!e.handlers.isCurrentStepAssigned()}static _formatFileSize(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,s)).toFixed(2))+" "+n[s]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),n=t[t.length-1];return n&&n.includes(".")?n:"Uploaded File"}}static _guessFileTypeFromUrl(e){var r;const n=(r=S._extractFilenameFromUrl(e).split(".").pop())==null?void 0:r.toLowerCase();return n?{pdf:"PDF Document",doc:"Word Document",docx:"Word Document",xls:"Excel Spreadsheet",xlsx:"Excel Spreadsheet",png:"PNG Image",jpg:"JPEG Image",jpeg:"JPEG Image",gif:"GIF Image",svg:"SVG Image",txt:"Text File",csv:"CSV File",zip:"ZIP Archive",mp4:"MP4 Video",mp3:"MP3 Audio"}[n]||`${n.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,n){return n.mode==="print"?l`<div class="print-response-value textarea-response">
3016
+ ${t||l`<span class="print-no-response">No response</span>`}
3017
+ </div>`:l`<textarea
3018
+ id=${e.id}
3019
+ .value=${t}
3020
+ ?required=${e.required}
3021
+ ?disabled=${this._isInputDisabled(n)}
3022
+ placeholder="Your Response"
3023
+ @input=${s=>n.handlers.handleInputChange(e.id,s)}
3024
+ ></textarea>`}static renderSelect(e,t,n){var s;return n.mode==="print"?l`<div class="print-response-value select-response">
3025
+ ${t||l`<span class="print-no-response">No selection made</span>`}
3026
+ </div>`:l`<select
3027
+ id=${e.id}
3028
+ .value=${t}
3029
+ ?required=${e.required}
3030
+ ?disabled=${this._isInputDisabled(n)}
3031
+ class=${t===""?"placeholder":""}
3032
+ @change=${r=>n.handlers.handleInputChange(e.id,r)}
3033
+ >
3034
+ <option value="">Choose</option>
3035
+ ${(s=e.options)==null?void 0:s.map(r=>l`<option value=${r}>${r}</option>`)}
3036
+ </select>`}static renderRadio(e,t,n){var o;const s=this._isInputDisabled(n),r=n.mode==="print";return r?l`<div class="print-response-value radio-response">
3037
+ ${t||l`<span class="print-no-response">No selection made</span>`}
3038
+ </div>`:l`<div class="radio-group ${r?"print-mode":""}">
3039
+ ${(o=e.options)==null?void 0:o.map(a=>l`
3040
+ <label class="radio-option">
3041
+ <input
3042
+ type="radio"
3043
+ name=${e.id}
3044
+ value=${a}
3045
+ .checked=${t===a}
3046
+ ?disabled=${s}
3047
+ @change=${r?null:d=>n.handlers.handleInputChange(e.id,d)}
3048
+ />
3049
+ <span class="radio-label">${a}</span>
3050
+ </label>
3051
+ `)}
3052
+ </div>`}static renderCheckbox(e,t,n){var o;const s=this._isInputDisabled(n),r=n.mode==="print";if(e.options&&e.options.length>0){if(r){const a=Array.isArray(t)?t:[];return l`<div class="print-response-value checkbox-response">
3053
+ ${a.length>0?a.map(d=>l`<div>• ${d}</div>`):l`<span class="print-no-response">No selections made</span>`}
3054
+ </div>`}return l`<div
3055
+ class="checkbox-group ${r?"print-mode":""}"
3056
+ >
3057
+ ${(o=e.options)==null?void 0:o.map(a=>l`
3058
+ <label class="checkbox-option">
3059
+ <input
3060
+ type="checkbox"
3061
+ name=${e.id}
3062
+ value=${a}
3063
+ .checked=${Array.isArray(t)?t.includes(a):!1}
3064
+ ?disabled=${s}
3065
+ @change=${r?null:d=>n.handlers.handleCheckboxGroupChange(e.id,a,d)}
3066
+ />
3067
+ <span class="checkbox-label">${a}</span>
3068
+ </label>
3069
+ `)}
3070
+ </div>`}else return r?l`<div class="print-response-value checkbox-response">
3071
+ ${t?"Yes":"No"}
3072
+ </div>`:l`<label
3073
+ class="checkbox-single ${r?"print-mode":""}"
3074
+ >
3075
+ <input
3076
+ type="checkbox"
3077
+ id=${e.id}
3078
+ .checked=${!!t}
3079
+ ?disabled=${s}
3080
+ @change=${r?null:a=>n.handlers.handleCheckboxChange(e.id,a)}
3081
+ />
3082
+ <span class="checkbox-label">${e.label}</span>
3083
+ </label>`}static renderSignature(e,t,n){const s=n.formData[e.id],r=!!n.formData[e.id],o=n.savedSignatures.has(e.id),a=n.replacingSignatures.has(e.id);if(n.mode==="print")return s&&typeof s=="string"?l`
3084
+ <div class="print-response-value signature-response">
3085
+ <img
3086
+ src="${s}"
3087
+ alt="Digital Signature"
3088
+ class="signature-image"
3089
+ @error=${d=>{var u;const p=d.target;p.style.display="none";const c=(u=p.parentElement)==null?void 0:u.querySelector(".signature-fallback");c&&c.classList.remove("hidden")}}
3090
+ />
3091
+ <div class="signature-fallback hidden">
3092
+ <span class="signature-error">Unable to display signature</span>
3093
+ </div>
3094
+ </div>
3095
+ `:l`<div class="print-response-value signature-response">
3096
+ <span class="print-no-response">No signature provided</span>
3097
+ </div>`;if(n.mode==="view-only")return s&&typeof s=="string"?l`
3098
+ <div class="signature-view-only">
3099
+ <img
3100
+ src="${s}"
3101
+ alt="Digital Signature"
3102
+ class="signature-image"
3103
+ @error=${d=>{var u;const p=d.target;p.style.display="none";const c=(u=p.parentElement)==null?void 0:u.querySelector(".signature-fallback");c&&c.classList.remove("hidden")}}
3104
+ />
3105
+ <div class="signature-fallback hidden">
3106
+ <span class="signature-error">Unable to display signature</span>
3107
+ </div>
3108
+ </div>
3109
+ `:l`
3110
+ <div class="signature-view-only">
3111
+ <span class="no-signature">No signature captured</span>
3112
+ </div>
3113
+ `;if(n.mode==="admin"&&s&&typeof s=="string"&&!a){const d=s.trim().startsWith("<svg");return l`
3114
+ <div class="signature-admin-display">
3115
+ <div class="signature-existing">
3116
+ ${d?l`
3117
+ <div
3118
+ class="signature-svg-container"
3119
+ .innerHTML=${s}
3120
+ ></div>
3121
+ `:l`
3122
+ <img
3123
+ src="${s}"
3124
+ alt="Digital Signature"
3125
+ class="signature-image"
3126
+ @error=${p=>{var h;const c=p.target;c.style.display="none";const u=(h=c.parentElement)==null?void 0:h.querySelector(".signature-fallback");u&&u.classList.remove("hidden")}}
3127
+ />
3128
+ <div class="signature-fallback hidden">
3129
+ <span class="signature-error"
3130
+ >Unable to display signature</span
3131
+ >
3132
+ </div>
3133
+ `}
3134
+ </div>
3135
+ <div class="signature-admin-actions">
3136
+ <button
3137
+ type="button"
3138
+ class="signature-replace-btn"
3139
+ @click=${()=>n.handlers.startReplaceSignature(e.id)}
3140
+ >
3141
+ ✏️ Replace Signature
3142
+ </button>
3143
+ </div>
3144
+ </div>
3145
+ `}return l`
3146
+ <div
3147
+ class="signature-container ${this._isInputDisabled(n)?"disabled":""}"
3148
+ >
3149
+ <canvas id="signature-${e.id}" class="signature-canvas"></canvas>
3150
+ <div class="signature-controls">
3151
+ <button
3152
+ type="button"
3153
+ class="signature-clear-btn"
3154
+ ?disabled=${this._isInputDisabled(n)}
3155
+ @click=${()=>n.handlers.clearSignature(e.id)}
3156
+ >
3157
+ Clear
3158
+ </button>
3159
+ ${r&&!o?l`
3160
+ <button
3161
+ type="button"
3162
+ class="signature-save-btn"
3163
+ ?disabled=${this._isInputDisabled(n)}
3164
+ @click=${()=>n.handlers.saveSignature(e.id)}
3165
+ >
3166
+ Save
3167
+ </button>
3168
+ `:""}
3169
+ ${o?l` <span class="signature-saved">✓ Saved</span> `:""}
3170
+ ${n.mode==="admin"&&a?l`
3171
+ <button
3172
+ type="button"
3173
+ class="signature-cancel-btn"
3174
+ @click=${()=>n.handlers.cancelReplaceSignature(e.id)}
3175
+ >
3176
+ Cancel
3177
+ </button>
3178
+ `:""}
3179
+ </div>
3180
+ </div>
3181
+ `}static renderFileUpload(e,t,n){const s=n.formData[e.id];if(n.mode==="view-only"||n.mode==="print")if(s){const r=typeof s=="string",o=typeof s=="object"&&s.name;if(n.mode==="print"){if(o)return l`
3182
+ <div class="print-response-value file-response">
3183
+ 📎 ${s.name}
3184
+ ${s.size?l` <span class="file-size"
3185
+ >(${S._formatFileSize(s.size)})</span
3186
+ >`:""}
3187
+ </div>
3188
+ `;if(r){const a=S._extractFilenameFromUrl(s);return l`
3189
+ <div class="print-response-value file-response">
3190
+ 📎 ${a}
3191
+ </div>
3192
+ `}else return l`
3193
+ <div class="print-response-value file-response">
3194
+ 📎 ${s}
3195
+ </div>
3196
+ `}else{const a=r?s:"#",d=o?s.name:r?S._extractFilenameFromUrl(s):"View File";return l`
3197
+ <div class="file-upload-view-only">
3198
+ <a href="${a}" target="_blank" class="file-link">
3199
+ 📎 ${d}
3200
+ </a>
3201
+ ${o&&s.size?l`
3202
+ <span class="file-size-info"
3203
+ >(${S._formatFileSize(s.size)})</span
3204
+ >
3205
+ `:""}
3206
+ </div>
3207
+ `}}else return n.mode==="print"?l`
3208
+ <div class="print-response-value file-response">
3209
+ <span class="print-no-response">No file uploaded</span>
3210
+ </div>
3211
+ `:l`
3212
+ <div class="file-upload-view-only">
3213
+ <span class="no-file">No file uploaded</span>
3214
+ </div>
3215
+ `;return l`
3216
+ <div class="file-upload-container">
3217
+ <input
3218
+ type="file"
3219
+ id=${e.id}
3220
+ ?required=${e.required}
3221
+ ?disabled=${this._isInputDisabled(n)}
3222
+ @change=${r=>n.handlers.handleFileUpload(e.id,r)}
3223
+ />
3224
+ ${s?l`
3225
+ <div class="file-preview">
3226
+ <span class="file-name"
3227
+ >${s.name||"File selected"}</span
3228
+ >
3229
+ <button
3230
+ type="button"
3231
+ class="file-clear-btn"
3232
+ ?disabled=${this._isInputDisabled(n)}
3233
+ @click=${()=>{n.formData[e.id]=null,n.handlers.trackQuestionResponse(e.id,null)}}
3234
+ >
3235
+
3236
+ </button>
3237
+ </div>
3238
+ `:""}
3239
+ </div>
3240
+ `}static renderDefaultInput(e,t,n){if(n.mode==="print"){const r=e.type==="date"&&t?new Date(t).toLocaleDateString():t;return l`<div class="print-response-value input-response">
3241
+ ${r||l`<span class="print-no-response">No response</span>`}
3242
+ </div>`}const s=e.type==="number"?"number":e.type==="date"?"date":"text";return l`<input
3243
+ type=${s}
3244
+ id=${e.id}
3245
+ .value=${t}
3246
+ ?required=${e.required}
3247
+ ?disabled=${this._isInputDisabled(n)}
3248
+ placeholder="Your Response"
3249
+ @input=${r=>n.handlers.handleInputChange(e.id,r)}
3250
+ />`}static render(e,t){const n=t.formData[e.id]??"",s=t.validationErrors[e.id],r=()=>{switch(e.type){case"textarea":return S.renderTextArea(e,n,t);case"select":return S.renderSelect(e,n,t);case"radio":return S.renderRadio(e,n,t);case"checkbox":return S.renderCheckbox(e,n,t);case"signature":return S.renderSignature(e,n,t);case"file_upload":return S.renderFileUpload(e,n,t);default:return S.renderDefaultInput(e,n,t)}},o=e.type==="checkbox"&&(!e.options||e.options.length===0);return t.mode==="print"?l`
3251
+ <div class="question-print">
3252
+ ${o?"":l` <div class="print-question-title">${e.label}:</div> `}
3253
+ ${r()}
3254
+ <hr class="print-question-separator" />
3255
+ </div>
3256
+ `:l`
3257
+ <div class="question ${s?"error":""}">
3258
+ ${o?"":l`
3259
+ <div class="runner-question-title">
3260
+ ${e.label}${e.required?l`<span class="runner-question-required">*</span>`:""}
3261
+ </div>
3262
+ <hr class="runner-question-divider" />
3263
+ `}
3264
+ ${r()}
3265
+ ${s?l`<div class="error-message">${s}</div>`:""}
3266
+ </div>
3267
+ `}}/**
3268
+ * @license
3269
+ * Copyright 2017 Google LLC
3270
+ * SPDX-License-Identifier: BSD-3-Clause
3271
+ */const kt={CHILD:2},$t=i=>(...e)=>({_$litDirective$:i,values:e});class Dt{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
3272
+ * @license
3273
+ * Copyright 2017 Google LLC
3274
+ * SPDX-License-Identifier: BSD-3-Clause
3275
+ */class be extends Dt{constructor(e){if(super(e),this.it=v,e.type!==kt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===v||e==null)return this._t=void 0,this.it=e;if(e===I)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}be.directiveName="unsafeHTML",be.resultType=1;const Ne=$t(be);class k{static renderMarkdown(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*?)\*/gim,"<em>$1</em>").replace(/`(.*?)`/gim,"<code>$1</code>").replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/\n/gim,"<br>")}static renderText(e){return l`
3276
+ <div class="content-element text-content">
3277
+ <p>${e.content}</p>
3278
+ </div>
3279
+ `}static renderMarkdownElement(e){return l`
3280
+ <div class="content-element markdown-content">
3281
+ <div class="markdown-text">
3282
+ ${Ne(k.renderMarkdown(e.content))}
3283
+ </div>
3284
+ </div>
3285
+ `}static renderDivider(e){return l`
3286
+ <div class="content-element divider-content">
3287
+ <hr class="content-divider" />
3288
+ ${e.caption?l`<div class="divider-caption">${e.caption}</div>`:""}
3289
+ </div>
3290
+ `}static renderHtml(e){return l`
3291
+ <div class="content-element html-content">
3292
+ <div class="html-content-wrapper">${Ne(e.content)}</div>
3293
+ </div>
3294
+ `}static renderImage(e){return l`
3295
+ <div class="content-element image-content">
3296
+ <div class="image-placeholder">
3297
+ <p>📷 Image: ${e.caption||e.alt||"Image content"}</p>
3298
+ <small>URL: ${e.url||"No URL provided"}</small>
3299
+ </div>
3300
+ </div>
3301
+ `}static renderVideo(e){return l`
3302
+ <div class="content-element video-content">
3303
+ <div class="video-placeholder">
3304
+ <p>🎥 Video: ${e.caption||"Video content"}</p>
3305
+ <small>URL: ${e.url||"No URL provided"}</small>
3306
+ </div>
3307
+ </div>
3308
+ `}static renderFile(e){return l`
3309
+ <div class="content-element file-content">
3310
+ <div class="file-placeholder">
3311
+ <p>📄 File: ${e.caption||"File content"}</p>
3312
+ <small>URL: ${e.url||"No URL provided"}</small>
3313
+ </div>
3314
+ </div>
3315
+ `}static renderUnknown(e){return l`
3316
+ <div class="content-element unknown-content">
3317
+ <p>⚠️ Unknown content type: ${e.type}</p>
3318
+ </div>
3319
+ `}static render(e,t){const n=()=>{switch(e.type){case"text":return k.renderText(e);case"markdown":return k.renderMarkdownElement(e);case"divider":return k.renderDivider(e);case"html":return k.renderHtml(e);case"image":return k.renderImage(e);case"video":return k.renderVideo(e);case"file":return k.renderFile(e);default:return k.renderUnknown(e)}};return(t==null?void 0:t.mode)==="print"?l`
3320
+ <div class="content-print">
3321
+ ${n()}
3322
+ ${e.type!=="divider"?l`<hr class="print-question-separator" />`:""}
3323
+ </div>
3324
+ `:n()}}class Oe{static renderMobileStepsForStatus(e){const{steps:t,disabled:n=!1}=e;return l`
3325
+ <div class="runner-mobile-steps">
3326
+ <nav aria-label="Workflow steps">
3327
+ <div class="runner-mobile-steps-container">
3328
+ ${t==null?void 0:t.map((s,r)=>{const o=e.isStepAssignedToUser(s),a=e.completedSteps.has(s.id);return l`
3329
+ <div
3330
+ class="runner-mobile-step-tab ${a?"completed":""} ${o?"":"unassigned"} ${n?"disabled":""}"
3331
+ style="cursor: not-allowed; opacity: ${n?"0.6":o?"1":"0.6"};"
3332
+ >
3333
+ <span class="runner-mobile-step-title">${s.title}</span>
3334
+ <span class="runner-mobile-step-badge">
3335
+ ${a?"Completed":o?"Your Step":"Other User"}
3336
+ </span>
3337
+ </div>
3338
+ `})}
3339
+ </div>
3340
+ </nav>
3341
+ </div>
3342
+ `}static renderNotAssignedView(){return l`
3343
+ <div class="runner-content not-assigned-view">
3344
+ <div class="not-assigned-container">
3345
+ <div class="not-assigned-icon">
3346
+ <svg
3347
+ width="48"
3348
+ height="48"
3349
+ viewBox="0 0 24 24"
3350
+ fill="none"
3351
+ stroke="currentColor"
3352
+ stroke-width="2"
3353
+ >
3354
+ <rect width="18" height="11" x="3" y="11" rx="2" ry="2"></rect>
3355
+ <path d="m7 11V7a5 5 0 0 1 10 0v4"></path>
3356
+ </svg>
3357
+ </div>
3358
+ <h2 class="not-assigned-title">
3359
+ This workflow is not assigned to you
3360
+ </h2>
3361
+ <p class="not-assigned-description">
3362
+ You don't have any steps assigned in this workflow. Please contact
3363
+ your administrator if you believe this is an error.
3364
+ </p>
3365
+ </div>
3366
+ </div>
3367
+ `}static renderUnifiedSubmissionView(e){var t,n,s;return l`
3368
+ <div class="runner-layout">
3369
+ <!-- Mobile Steps Navigation (visible only on mobile) -->
3370
+ ${this.renderMobileStepsForStatus({steps:(t=e.instance)==null?void 0:t.steps,isStepAssignedToUser:e.isStepAssignedToUser,completedSteps:e.completedSteps,disabled:!0})}
3371
+
3372
+ <!-- Sidebar: Steps List (read-only, hidden on mobile) -->
3373
+ <aside class="runner-sidebar">
3374
+ <div class="runner-sidebar-header">Steps</div>
3375
+ <nav aria-label="Workflow steps">
3376
+ <ul class="runner-steps-list">
3377
+ ${(s=(n=e.instance)==null?void 0:n.steps)==null?void 0:s.map((r,o)=>{const a=e.isStepAssignedToUser(r),d=e.completedSteps.has(r.id);return l`
3378
+ <li
3379
+ class="runner-step-item ${d?"completed":""} ${a?"":"unassigned"}"
3380
+ style="opacity: ${a?"1":"0.6"}; cursor: not-allowed;"
3381
+ >
3382
+ <span class="runner-step-title">${r.title}</span>
3383
+ <span class="runner-step-badge">
3384
+ ${d?"Submitted":a?"Your Step":"Other User"}
3385
+ </span>
3386
+ </li>
3387
+ `})}
3388
+ </ul>
3389
+ </nav>
3390
+ </aside>
3391
+
3392
+ <!-- Main Content: Unified Submission View -->
3393
+ <main class="runner-main-content">
3394
+ <div class="submission-container">
3395
+ <div class="submission-success-icon">
3396
+ <svg
3397
+ width="64"
3398
+ height="64"
3399
+ viewBox="0 0 24 24"
3400
+ fill="none"
3401
+ stroke="currentColor"
3402
+ stroke-width="2"
3403
+ stroke-linecap="round"
3404
+ stroke-linejoin="round"
3405
+ class="check-circle"
3406
+ >
3407
+ <path d="M9 12l2 2 4-4" />
3408
+ <circle cx="12" cy="12" r="10" />
3409
+ </svg>
3410
+ </div>
3411
+ <h2 class="submission-title">Your response has been submitted.</h2>
3412
+ <p class="submission-message">You may now close this window.</p>
3413
+ </div>
3414
+ </main>
3415
+ </div>
3416
+ `}}class G{static isStepCompleted(e,t,n){return!!(t.completedSteps.has(e.id)||(t.isSubmitted||t.userStepsSubmitted)&&n)}static renderSidebar(e){const{steps:t}=e;return l`
3417
+ <aside class="runner-sidebar">
3418
+ <div class="runner-sidebar-header">Steps</div>
3419
+ <nav aria-label="Workflow steps">
3420
+ <ul class="runner-steps-list">
3421
+ ${t==null?void 0:t.map((n,s)=>{const r=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(n),o=s===e.currentStepIndex,a=this.isStepCompleted(n,e,r),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print";e.mode;const p=e.isLoading;return l`
3422
+ <li
3423
+ class="runner-step-item ${o?"active":""} ${a?"completed":""} ${r?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
3424
+ @click=${()=>!p&&e.goToStep(s)}
3425
+ style="${d?"opacity: 0.5; cursor: not-allowed;":""}"
3426
+ >
3427
+ <span class="runner-step-title">${n.title}</span>
3428
+ <span class="runner-step-badge">
3429
+ ${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":r?"Assigned":"Not Assigned"}
3430
+ </span>
3431
+ </li>
3432
+ `})}
3433
+ </ul>
3434
+ </nav>
3435
+ </aside>
3436
+ `}static renderMobileSteps(e){const{steps:t}=e;return l`
3437
+ <div class="runner-mobile-steps">
3438
+ <nav aria-label="Workflow steps">
3439
+ <div class="runner-mobile-steps-container">
3440
+ ${t==null?void 0:t.map((n,s)=>{const r=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(n),o=s===e.currentStepIndex,a=this.isStepCompleted(n,e,r),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print";e.mode;const p=e.isLoading;return l`
3441
+ <button
3442
+ class="runner-mobile-step-tab ${o?"active":""} ${a?"completed":""} ${r?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
3443
+ @click=${()=>!p&&e.goToStep(s)}
3444
+ ?disabled=${d||p}
3445
+ aria-current=${o?"step":"false"}
3446
+ >
3447
+ <span class="runner-mobile-step-title">${n.title}</span>
3448
+ <span class="runner-mobile-step-badge">
3449
+ ${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":r?"Assigned":"Not Assigned"}
3450
+ </span>
3451
+ </button>
3452
+ `})}
3453
+ </div>
3454
+ </nav>
3455
+ </div>
3456
+ `}static renderStepHeader(e){const{step:t,mode:n}=e;return n==="print"?l`
3457
+ <div class="step-print-header">
3458
+ <div class="print-step-title">${t.title}</div>
3459
+ ${t.description?l`<div class="print-step-description">
3460
+ ${t.description}
3461
+ </div>`:""}
3462
+ <hr class="print-question-separator" />
3463
+ </div>
3464
+ `:l`
3465
+ <section class="runner-step-header">
3466
+ <h2 class="runner-step-title">${t.title}</h2>
3467
+ <hr class="runner-step-divider" />
3468
+ ${t.description?l`<p class="runner-step-desc">${t.description}</p>`:""}
3469
+ </section>
3470
+ `}}class Ct{static renderFormActions(e){return e.mode==="preview"||e.mode==="view-only"||e.mode==="print"||!e.isCurrentStepAssigned?l``:l`
3471
+ <div class="runner-form-actions">
3472
+ <button
3473
+ class="next-button ${e.mode==="admin"&&e.justSaved?"saved-state":""}"
3474
+ @click=${e.mode==="admin"?e.handlers.saveStep:e.isLastStepInWorkflow?e.handlers.submit:e.isLastStep?e.handlers.submitUserSteps:e.handlers.nextStep}
3475
+ type="button"
3476
+ >
3477
+ ${e.mode==="admin"?e.justSaved?"✓ Saved!":"Save":e.isLastStep?"Submit":"Next"}
3478
+ </button>
3479
+ </div>
3480
+ `}}class ve{static handleInputChange(e,t,n,s,r,o){const a=t.target;let d;a.type==="radio"?d=a.value:a.type==="checkbox"?d=a.checked:d=a.value;const p={...n,[e]:d};s(p),o!=="preview"&&r(e,d)}static handleCheckboxChange(e,t,n,s,r,o){const d=t.target.checked,p={...n,[e]:d};s(p),o!=="preview"&&r(e,d)}static handleCheckboxGroupChange(e,t,n,s,r,o,a){const d=n.target,p=s[e];let c=Array.isArray(p)?[...p]:[];d.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...s,[e]:c};r(u),a!=="preview"&&o(e,c)}}var Et=Object.defineProperty,At=Object.getOwnPropertyDescriptor,x=(i,e,t,n)=>{for(var s=n>1?void 0:n?At(e,t):e,r=i.length-1,o;r>=0;r--)(o=i[r])&&(s=(n?o(e,t,s):o(s))||s);return n&&s&&Et(e,t,s),s};let m=class extends R{constructor(){super(...arguments),this.mode="default",this.isLoading=!1,this._currentStepIndex=0,this._formData={},this._validationErrors={},this._internalCompletedSteps=new Set,this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._isSubmitted=!1,this._userStepsSubmitted=!1,this._justSaved=!1}willUpdate(i){(i.has("mode")||i.has("currentUser"))&&this._updateNavigationService(),(i.has("instance")||i.has("workflow")||i.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var i;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(i=this.signatureManager)==null||i.destroy()}_initializeServices(){this.persistenceManager=new vt,this.responseTracker=new St,this.formStateManager=new fe,this.signatureManager=new yt(i=>this._handleSignatureChange(i)),this.fileUploadManager=new me(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var i;this.validationService=new bt(((i=this.signatureManager)==null?void 0:i.getAllSignaturePads())||new Map,this._savedSignatures)}_getRenderContext(){return{formData:this._formData,validationErrors:this._validationErrors,currentStepIndex:this._currentStepIndex,internalCompletedSteps:this._internalCompletedSteps,savedSignatures:this._savedSignatures,replacingSignatures:this._replacingSignatures,isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,justSaved:this._justSaved,validationService:this.validationService,persistenceManager:this.persistenceManager,signatureManager:this.signatureManager,responseTracker:this.responseTracker,navigationService:this.navigationService,formStateManager:this.formStateManager,fileUploadManager:this.fileUploadManager,mode:this.mode||"default",instance:this.instance,workflow:this.workflow,currentUser:this.currentUser,isLoading:this.isLoading,handlers:{handleInputChange:this._handleInputChange.bind(this),handleCheckboxChange:this._handleCheckboxChange.bind(this),handleCheckboxGroupChange:this._handleCheckboxGroupChange.bind(this),startReplaceSignature:this._startReplaceSignature.bind(this),cancelReplaceSignature:this._cancelReplaceSignature.bind(this),clearSignature:this._clearSignature.bind(this),saveSignature:this._saveSignature.bind(this),handleFileUpload:this._handleFileUpload.bind(this),trackQuestionResponse:this._trackQuestionResponse.bind(this),isCurrentStepAssigned:this._isCurrentStepAssigned.bind(this)}}}_handleSignatureChange(i){this.formStateManager.setFormField(i.questionId,i.hasSignature),this.formStateManager.setFormField(`${i.questionId}_signatureData`,i.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(i.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==i.questionId))),this._clearValidationError(i.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(i){this.formStateManager.clearValidationError(i),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(i){this.formStateManager.updateFormData(i),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(i){this._clearValidationError(i)}_initializeState(){var i,e,t;if((i=this.formStateManager)==null||i.reset(),this._validationErrors={},this._formData={},this._formRestorationComplete=!1,this._savedSignatures=new Set,this._replacingSignatures=new Set,this._savedInstance=void 0,this._justSaved=!1,this._isSubmitted=((e=this.instance)==null?void 0:e.status)==="completed"||!1,this.instance&&this.instance.status!=="completed"){const n=this._getAssignedSteps(),s=n.filter(r=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(r.id)});this._userStepsSubmitted=n.length>0&&s.length===n.length}else this._userStepsSubmitted=((t=this.instance)==null?void 0:t.status)==="completed"||!1;this.mode==="preview"&&this.workflow?this._initializePreviewMode():this.mode==="view-only"&&this.instance?this._initializeViewOnlyMode():this.mode==="print"&&this.instance?this._initializePrintMode():this.instance&&this._initializeDefaultMode()}_initializePreviewMode(){var i;if(console.log("Initializing preview mode..."),!((i=this.workflow)!=null&&i.steps)||this.workflow.steps.length===0){console.warn("Workflow has no steps in preview mode.");return}this.formStateManager.reset(),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this._internalCompletedSteps=new Set,console.log("Preview mode initialized with empty form data.")}_initializeDefaultMode(){var i;!((i=this.instance)!=null&&i.steps)||this.instance.steps.length===0||(this.instance.completedSteps?this._internalCompletedSteps=new Set(this.instance.completedSteps):this._internalCompletedSteps=new Set(this.instance.steps.filter(e=>e.status==="completed").map(e=>e.id)),this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=this.instance.steps.findIndex(e=>{var t;return e.id===((t=this.instance)==null?void 0:t.currentStepId)}),this._currentStepIndex<0&&(this._currentStepIndex=0),this.instance.steps.forEach((e,t)=>{this._internalCompletedSteps.has(e.id)?e.status="completed":t===this._currentStepIndex?e.status="active":e.status="pending"}))}_initializeViewOnlyMode(){var i;!((i=this.instance)!=null&&i.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("View-only mode initialized with existing responses:",this._formData))}_initializePrintMode(){var i;!((i=this.instance)!=null&&i.steps)||this.instance.steps.length===0||(this.formStateManager.initializeFromResponses(this.instance.steps),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=0,this.instance.steps.forEach(e=>{e.responses&&e.responses.length>0?(e.status="completed",this._internalCompletedSteps.add(e.id)):e.status="pending"}),console.log("Print mode initialized with existing responses:",this._formData))}_isStepAssignedToUser(i){return this.navigationService.isStepAssignedToUser(i)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const i=this._currentStep;return!i||this.mode!=="default"?!0:this._isStepAssignedToUser(i)}_renderNotAssignedView(){return Oe.renderNotAssignedView()}get _currentStep(){var i,e,t;return this.mode==="preview"&&this.workflow?(i=this.workflow.steps)==null?void 0:i[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const i=this._currentStep;if(!i)return!1;const e=this.validationService.validateStep(i,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(i,e){ve.handleInputChange(i,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(i)}_handleCheckboxChange(i,e){ve.handleCheckboxChange(i,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(i)}_handleCheckboxGroupChange(i,e,t){ve.handleCheckboxGroupChange(i,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(i)}_initializeSignaturePad(i){this.signatureManager.initializeSignaturePad(i,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(i){this.signatureManager.clearSignature(i)}_startReplaceSignature(i){this._replacingSignatures=new Set([...this._replacingSignatures,i]),this.formStateManager.setFormField(i,!1),this.formStateManager.setFormField(`${i}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==i)),this.requestUpdate()}_cancelReplaceSignature(i){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==i))}_saveSignature(i){var n,s,r;const e=this.signatureManager.saveSignature(i);if(!e)return;const t=this._hasSignatureChanged(i,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,i]),this._replacingSignatures.has(i)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==i))),this._trackQuestionResponse(i,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",i),console.log("Callback function exists:",!!this.onSignatureCaptured),(r=this.onSignatureCaptured)==null||r.call(this,{instanceId:(n=this.instance)==null?void 0:n.id,stepId:(s=this._currentStep)==null?void 0:s.id,questionId:i,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",i):console.log("Signature unchanged, skipping callback for:",i),this._clearValidationError(i),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(i,e){return this.responseTracker.hasChangedFromPrevious(i,e,this._savedInstance)}_restoreInstanceResponses(){var i,e;!((i=this._savedInstance)!=null&&i.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,n)=>{var s;(s=this.instance)!=null&&s.steps&&this.instance.steps[n]&&(this.instance.steps[n].responses=t.responses||[])})}_handleFileUpload(i,e){this.fileUploadManager.handleFileUpload(i,e,{instance:this.instance,currentStep:this._currentStep,mode:this.mode||"default",savedInstance:this._savedInstance,onFileUploaded:this.onFileUploaded,onFormDataSave:()=>this._saveFormDataToHistory(),onRequestUpdate:()=>{this._formData=this.formStateManager.getFormData(),this._validationErrors=this.formStateManager.getValidationErrors();const t=this._formData[i];t&&this._trackQuestionResponse(i,t),this.requestUpdate()}})}_captureSignaturesFromStep(i){console.log("Capturing signatures from step:",i.id)}_trackQuestionResponse(i,e){this.responseTracker.trackQuestionResponse(this._currentStep,i,e)}_renderQuestion(i){return S.render(i,this._getRenderContext())}_renderContentElement(i){return k.render(i,this._getRenderContext())}_isQuestionElement(i){return m.QUESTION_ELEMENT_TYPES.includes(i.type)}_isContentElement(i){return m.CONTENT_ELEMENT_TYPES.includes(i.type)}_renderStepElement(i){return this.mode==="print"?this._isQuestionElement(i)?this._renderQuestion(i):this._isContentElement(i)?this._renderContentElement(i):l`<div class="unknown-element">
3481
+ <p>⚠️ Unknown element type: ${i.type}</p>
3482
+ </div>`:this._isQuestionElement(i)?l`<div class="runner-card">
3483
+ ${this._renderQuestion(i)}
3484
+ </div>`:this._isContentElement(i)?l`<div class="runner-card">
3485
+ ${this._renderContentElement(i)}
3486
+ </div>`:l`<div class="runner-card">
3487
+ <div class="unknown-element">
3488
+ <p>⚠️ Unknown element type: ${i.type}</p>
3489
+ </div>
3490
+ </div>`}_renderStepWithElements(i){return l`
3491
+ <div class="print-step">
3492
+ <!-- Step Header -->
3493
+ ${G.renderStepHeader({step:i,mode:"print"})}
3494
+
3495
+ <!-- Step Elements -->
3496
+ ${i.elements.map(e=>this._renderStepElement(e))}
3497
+ </div>
3498
+ `}_renderAllStepsForPrint(){var i;return!((i=this.instance)!=null&&i.steps)||this.instance.steps.length===0?l`<div class="runner-content">
3499
+ No workflow instance loaded or instance has no steps.
3500
+ </div>`:l`
3501
+ <div class="print-layout">
3502
+ <!-- Instance Title at top -->
3503
+ <div class="print-instance-title">
3504
+ ${this.instance.name||"Untitled Form"}
3505
+ </div>
3506
+ <hr class="print-question-separator" />
3507
+
3508
+ ${this.instance.steps.map(e=>this._renderStepWithElements(e))}
3509
+ </div>
3510
+ `}_nextStep(){var t,n,s,r;if(!this._validateStep())return;const i=this._currentStep;i&&this._captureSignaturesFromStep(i);const e=this._findNextAssignedStep(this._currentStepIndex);if(e!==-1){const o=(t=this._currentStep)==null?void 0:t.id;if(this._currentStepIndex=e,o&&((n=this.instance)!=null&&n.steps)){const d=this.instance.steps.find(p=>p.id===o);d&&(d.status="completed")}const a=(r=(s=this.instance)==null?void 0:s.steps)==null?void 0:r[this._currentStepIndex];a&&(a.status="active"),this._updateInstanceData(o,"step_navigation",{direction:"next",fromStepIndex:this._currentStepIndex-1,toStepIndex:this._currentStepIndex,completedStepId:o}),this.mode!=="admin"&&this._saveFormDataToHistory(),this._scrollToTop()}}_findNextAssignedStep(i){return this.instance?this.navigationService.findNextAssignedStep(i,this.instance):-1}_isLastAssignedStep(){return this.navigationService.isLastAssignedStep(this._currentStepIndex,this.instance)}_isLastStepInWorkflow(){var e;const i=(e=this.instance)==null?void 0:e.steps;return i?this._currentStepIndex===i.length-1:!1}_goToStep(i){var n;console.log(`🎯 _goToStep called: stepIndex=${i}, mode=${this.mode}, currentStep=${this._currentStepIndex}`);const e=this.mode==="preview"?this.workflow:this.instance;if(console.log("📊 Data source:",e?`${((n=e.steps)==null?void 0:n.length)||0} steps`:"null"),!e){console.log("❌ No data source available");return}const t=this.navigationService.canNavigateToStep(i,this._currentStepIndex,e,this._internalCompletedSteps,this._isSubmitted,this._userStepsSubmitted);console.log("🚦 Navigation result:",t),t.canNavigate?(this._currentStepIndex=t.newStepIndex,console.log(`✅ Navigated to step ${t.newStepIndex}`),this._scrollToTop()):console.log("❌ Navigation blocked:",t.reason)}_submitUserSteps(){var t;if(!this._validateStep())return;const i=this._currentStep;if(i&&this._captureSignaturesFromStep(i),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("User completing their assigned steps:",this.instance.id),console.log("Form data:",this._formData),this._userStepsSubmitted=!0,this._clearSavedFormData("user steps submission"),this._updateInstanceData(e,"user_steps_submission"),this._scrollToTop()}_submit(){var t;if(!this._validateStep())return;const i=this._currentStep;if(i&&this._captureSignaturesFromStep(i),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;e&&this._internalCompletedSteps.add(e),console.log("Submitting entire workflow:",this.instance.id),console.log("Final form data:",this._formData),this.instance&&(this.instance.status="completed",this.instance.updatedAt=new Date,this.instance.currentStepId=void 0,this.instance.completedSteps=Array.from(this._internalCompletedSteps)),this._isSubmitted=!0,this._clearSavedFormData("full workflow submission"),this._scrollToTop(),this._updateInstanceData(e,"submission")}_saveStep(){var t;if(!this._validateStep())return;const i=this._currentStep;if(i&&this._captureSignaturesFromStep(i),!this.instance){console.error("Cannot save, instance data is missing.");return}const e=(t=this._currentStep)==null?void 0:t.id;if(e&&(this._internalCompletedSteps.add(e),this.instance.steps)){const n=this.instance.steps.find(s=>s.id===e);n&&(n.status="completed")}this._updateInstanceData(e,"admin_save",{stepId:e,adminMode:!0}),this._justSaved=!0,this.requestUpdate(),setTimeout(()=>{this._justSaved=!1,this.requestUpdate()},2e3)}_clearSavedFormData(i){var e;this.persistenceManager.clearFormData((e=this.instance)==null?void 0:e.id,i)}_scrollToTop(){requestAnimationFrame(()=>{var t,n;this.scrollIntoView({behavior:"smooth",block:"start"});const i=(t=this.shadowRoot)==null?void 0:t.querySelector(".runner-layout");i&&i.scrollTo({top:0,behavior:"smooth"});const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".runner-main-content");e&&e.scrollTo({top:0,behavior:"smooth"})})}_updateInstanceData(i,e,t){var d,p,c,u,h,f,b;i&&this._internalCompletedSteps.add(i);let n=(p=(d=this.instance)==null?void 0:d.steps)==null?void 0:p.find($=>$.id===i);if(!n&&this._internalCompletedSteps.size>0){const $=Array.from(this._internalCompletedSteps),ie=$[$.length-1];n=(u=(c=this.instance)==null?void 0:c.steps)==null?void 0:u.find(ne=>ne.id===ie)}const s=e==="submission",r=((h=this.instance)==null?void 0:h.steps)&&this._internalCompletedSteps.size>=this.instance.steps.length,o=s||r?null:this._currentStep?{id:this._currentStep.id,title:this._currentStep.title}:null,a={instanceId:(f=this.instance)==null?void 0:f.id,workflowId:(b=this.instance)==null?void 0:b.workflowId,completedStepId:i||(n?n.id:null),completedStepData:n?{id:n.id,title:n.title,responses:n.responses||[]}:null,completedSteps:Array.from(this._internalCompletedSteps),currentStep:o,mode:this.mode};this.dispatchEvent(new CustomEvent("instance-updated",{detail:a,bubbles:!0,composed:!0}))}_restoreFormData(){var e;if(!this.persistenceManager.shouldRestoreData(this.mode||"default")){console.log("Skipping form data restoration - showing official instance data");return}const i=this.persistenceManager.restoreFormData((e=this.instance)==null?void 0:e.id);i?(this.formStateManager.updateFormData(i.formData),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=i.stepIndex,this._savedSignatures=i.savedSignatures,this._internalCompletedSteps=i.completedSteps,this._savedInstance=i.savedInstance||void 0):this._updateCompletedStepsFromCurrentIndex()}_updateCompletedStepsFromCurrentIndex(){var i;if((i=this.instance)!=null&&i.steps){this._internalCompletedSteps=new Set(this.instance.completedSteps||[]);for(let e=0;e<this._currentStepIndex;e++)this.instance.steps[e]&&this._internalCompletedSteps.add(this.instance.steps[e].id)}}_restoreFormDataFromDOM(){this._restoreFormData(),this._restoreFormValuesToDOM()}_restoreFormValuesToDOM(){this.updateComplete.then(()=>{var e,t;(e=this.shadowRoot)!=null&&e.querySelector(".runner-step-form")&&(Object.entries(this._formData).forEach(([n,s])=>{var o;if(n.endsWith("_signatureData"))return;const r=(o=this.shadowRoot)==null?void 0:o.getElementById(n);if(r){if(r.type==="checkbox"){const a=r;typeof s=="boolean"?a.checked=s:Array.isArray(s)&&(a.checked=s.includes(a.value))}else if(r.type==="radio"){const a=r;a.checked=a.value===s}else if(r.type==="file"){const a=r;a.value=""}else r.value=String(s||"");console.log(`Restored value for ${n}:`,s)}}),this._restoreSignatures(),console.log("Form values restored to DOM elements"),this._updateInstanceWithFormData(!0),(t=this._savedInstance)!=null&&t.steps&&this._restoreInstanceResponses())})}_updateInstanceWithFormData(i=!1){this.instance&&this.instance.steps&&this.instance.steps.forEach(e=>{e.responses||(e.responses=[]),e.elements.forEach(t=>{if(t.type==="text_input"||t.type==="textarea"||t.type==="select"||t.type==="number"||t.type==="radio"||t.type==="checkbox"||t.type==="date"||t.type==="file_upload"||t.type==="signature"){const n=t,s=this._formData[n.id];if(s!==void 0&&e.responses){let r=e.responses.find(o=>o.elementId===n.id);r?(r.value=s,r.answeredAt=new Date):(r={elementId:n.id,value:s,answeredAt:new Date},e.responses.push(r))}}})})}_restoreSignatures(){Object.entries(this._formData).forEach(([i,e])=>{if(i.endsWith("_signatureData")&&e){const t=i.replace("_signatureData",""),n=this.signatureManager.getSignaturePad(t);if(n&&e)try{n.clear(),n.fromData(e)}catch{}}})}_saveFormDataToHistory(){var i;this.persistenceManager.saveFormData((i=this.instance)==null?void 0:i.id,this._formData,this._currentStepIndex,this._savedSignatures,this._internalCompletedSteps,this.instance||null)}_extractFormDataFromDOM(){var n;const i={},e=(n=this.shadowRoot)==null?void 0:n.querySelector(".runner-step-form");if(!e)return i;const t=e.elements;for(let s=0;s<t.length;s++){const r=t[s];if(r.name||r.id){const o=r.id||r.name;if(r.type==="checkbox"){const a=r;a.name&&a.name===o?(i[o]||(i[o]=[]),a.checked&&i[o].push(a.value)):i[o]=a.checked}else if(r.type==="radio"){const a=r;a.checked&&(i[o]=a.value)}else i[o]=r.value}}return i}_updateInstanceFromFormData(i=!1){const e=this._extractFormDataFromDOM();Object.keys(e).length>0?(this.formStateManager.mergeFormData(e),this._formData=this.formStateManager.getFormData(),this.instance&&this.instance.steps&&this.instance.steps.forEach(n=>{n.responses||(n.responses=[]),n.elements.forEach(s=>{if(s.type==="text_input"||s.type==="textarea"||s.type==="select"||s.type==="number"||s.type==="radio"||s.type==="checkbox"||s.type==="date"||s.type==="file_upload"||s.type==="signature"){const r=s,o=this._formData[r.id];if(o!==void 0&&n.responses){let a=n.responses.find(d=>d.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},n.responses.push(a))}}})}),console.log("Instance updated from form data:",this.instance),i&&this._updateInstanceData(void 0,"form_data_update",{updatedFormDataKeys:Object.keys(this._formData),updatedCompletedSteps:Array.from(this._internalCompletedSteps)})):console.log("No new form data to update instance with")}updateInstanceFromFormData(i=!1){this._updateInstanceFromFormData(i)}getFormData(){return this.formStateManager.getFormData()}restoreFormData(){this._restoreFormDataFromDOM()}clearSavedFormData(i){this._clearSavedFormData(i)}_renderUnifiedSubmissionView(){const i={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this)};return Oe.renderUnifiedSubmissionView(i)}_isInstanceCompleted(){var i;return((i=this.instance)==null?void 0:i.status)==="completed"}_areUserStepsCompleted(){var e;if(!((e=this.instance)!=null&&e.steps))return!1;const i=this._getAssignedSteps();return i.length===0?!1:i.every(t=>t.status==="completed")}_shouldShowCompletionView(){var i;return this.mode!=="default"?!1:!!(this._isInstanceCompleted()||((i=this.instance)==null?void 0:i.status)==="active"&&this._areUserStepsCompleted())}_renderModeBasedContent(){var e,t;if(this._shouldShowCompletionView())return this._renderUnifiedSubmissionView();if(this.mode==="print")return this._renderAllStepsForPrint();const i=this.mode==="preview"?(e=this.workflow)==null?void 0:e.steps:(t=this.instance)==null?void 0:t.steps;return!i||i.length===0?l`<div class="runner-content">
3511
+ ${this.mode==="preview"?"No workflow loaded or workflow has no steps.":"No workflow instance loaded or instance has no steps."}
3512
+ </div>`:this.mode==="default"&&this._getAssignedSteps().length===0?this._renderNotAssignedView():null}_validateCurrentStep(){return this._currentStep}_initializeStepAssets(i){this.updateComplete.then(()=>{i.elements.forEach(e=>{var t;e.type==="signature"&&((t=this.shadowRoot)!=null&&t.getElementById(`signature-${e.id}`))&&this._initializeSignaturePad(e.id)}),this._restoreSignatures(),setTimeout(()=>{this._formRestorationComplete||(this._restoreFormDataFromDOM(),this._formRestorationComplete=!0)},100)})}_renderCurrentStepLayout(i){var s,r;const e=this._isLastAssignedStep(),t=this._isLastStepInWorkflow(),n=this.mode==="preview"?(s=this.workflow)==null?void 0:s.steps:(r=this.instance)==null?void 0:r.steps;return l`
3513
+ <!-- Mobile Steps Navigation (visible only on mobile) -->
3514
+ ${G.renderMobileSteps({steps:n,currentStepIndex:this._currentStepIndex,mode:this.mode||"default",isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,completedSteps:this._internalCompletedSteps,isLoading:this.isLoading,isStepAssignedToUser:this._isStepAssignedToUser.bind(this),goToStep:this._goToStep.bind(this)})}
3515
+
3516
+ <!-- Sidebar: Steps List (hidden on mobile) -->
3517
+ ${G.renderSidebar({steps:n,currentStepIndex:this._currentStepIndex,mode:this.mode||"default",isSubmitted:this._isSubmitted,userStepsSubmitted:this._userStepsSubmitted,completedSteps:this._internalCompletedSteps,isLoading:this.isLoading,isStepAssignedToUser:this._isStepAssignedToUser.bind(this),goToStep:this._goToStep.bind(this)})}
3518
+
3519
+ <!-- Main Content: Step Details and Questions -->
3520
+ <main class="runner-main-content">
3521
+ ${this.mode==="print"?G.renderStepHeader({step:i,mode:this.mode}):l`<div class="runner-card">
3522
+ ${G.renderStepHeader({step:i,mode:this.mode})}
3523
+ </div>`}
3524
+ <form
3525
+ class="runner-step-form"
3526
+ @submit=${o=>o.preventDefault()}
3527
+ >
3528
+ ${i.elements.map(o=>this._renderStepElement(o))}
3529
+ ${Ct.renderFormActions({mode:this.mode||"default",isLastStep:e,isLastStepInWorkflow:t,justSaved:this._justSaved,isCurrentStepAssigned:this._isCurrentStepAssigned(),handlers:{saveStep:this._saveStep.bind(this),nextStep:this._nextStep.bind(this),submitUserSteps:this._submitUserSteps.bind(this),submit:this._submit.bind(this)}})}
3530
+ </form>
3531
+ </main>
3532
+ `}_renderMainContent(){const i=this._renderModeBasedContent();if(i)return i;const e=this._validateCurrentStep();return e?(this._initializeStepAssets(e),this._renderCurrentStepLayout(e)):l`<div class="runner-content">Invalid current step.</div>`}render(){return l`
3533
+ <div class="runner-layout">
3534
+ ${this._renderMainContent()}
3535
+
3536
+ <!-- Loading overlay with white box (conditionally rendered) -->
3537
+ ${this.isLoading?l`
3538
+ <div class="runner-loading-overlay">
3539
+ <div class="runner-loading-box">
3540
+ <div class="runner-loading-spinner"></div>
3541
+ <div class="runner-loading-text">Processing...</div>
3542
+ </div>
3543
+ </div>
3544
+ `:""}
3545
+ </div>
3546
+ `}};m.styles=[Pe],m.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],m.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],x([C({type:Object})],m.prototype,"instance",2),x([C({type:Object})],m.prototype,"workflow",2),x([C({type:String})],m.prototype,"mode",2),x([C({type:Boolean})],m.prototype,"isLoading",2),x([C({type:Object})],m.prototype,"currentUser",2),x([C({type:Function})],m.prototype,"onSignatureCaptured",2),x([C({type:Function})],m.prototype,"onFileUploaded",2),x([_()],m.prototype,"_currentStepIndex",2),x([_()],m.prototype,"_formData",2),x([_()],m.prototype,"_validationErrors",2),x([_()],m.prototype,"_internalCompletedSteps",2),x([_()],m.prototype,"_formRestorationComplete",2),x([_()],m.prototype,"_savedSignatures",2),x([_()],m.prototype,"_replacingSignatures",2),x([_()],m.prototype,"_savedInstance",2),x([_()],m.prototype,"_isSubmitted",2),x([_()],m.prototype,"_userStepsSubmitted",2),x([_()],m.prototype,"_justSaved",2),m=x([Ie("runner-widget")],m);function Mt(i,e={}){const{title:t=i.name||"Workflow Instance",includeStyles:n=!0,customCSS:s="",showTimestamps:r=!1}=e,o=new Date;if(!(i!=null&&i.steps)||i.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
3547
+ <html lang="en">
3548
+ <head>
3549
+ <meta charset="UTF-8">
3550
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
3551
+ <title>${g(t)}</title>
3552
+ ${n?`<style>${Yt()}</style>`:""}
3553
+ ${s?`<style>${s}</style>`:""}
3554
+ </head>
3555
+ <body>
3556
+ <div class="print-layout">
3557
+ <!-- Instance Title at top -->
3558
+ <div class="print-instance-title">
3559
+ ${g(i.name||"Untitled Form")}
3560
+ </div>
3561
+ <hr class="print-question-separator" />
3562
+
3563
+ ${r?Bt(i,o):""}
3564
+ ${i.steps.map(d=>Tt(d)).join(`
3565
+ `)}
3566
+ </div>
3567
+ </body>
3568
+ </html>`,title:t,generatedAt:o}}function Tt(i){return`
3569
+ <div class="print-step">
3570
+ <!-- Step Header -->
3571
+ ${Ft(i)}
3572
+
3573
+ <!-- Step Elements -->
3574
+ ${i.elements.map(e=>zt(e,i)).join(`
3575
+ `)}
3576
+ </div>
3577
+ `}function Ft(i){return`
3578
+ <div class="step-print-header">
3579
+ <div class="print-step-title">${g(i.title)}</div>
3580
+ ${i.description?`<div class="print-step-description">${g(i.description)}</div>`:""}
3581
+ <hr class="print-question-separator" />
3582
+ </div>
3583
+ `}function zt(i,e){return Vt(i)?It(i,e):Ut(i)}function It(i,e){const t=jt(i.id,e.responses),n=t==null?void 0:t.value,r=i.type==="checkbox"&&(!i.options||i.options.length===0)?"":`
3584
+ <div class="print-question-title">
3585
+ ${g(i.label)}:
3586
+ </div>
3587
+ `,o='<hr class="print-question-separator" />';switch(i.type){case"text_input":case"number":case"date":return r+Pt(i,n)+o;case"textarea":return r+Lt(i,n)+o;case"select":return r+Nt(i,n)+o;case"radio":return r+Ot(i,n)+o;case"checkbox":return r+Rt(i,n)+o;case"file_upload":return r+Wt(i,n)+o;case"signature":return r+Ht(i,n)+o;default:return r+`
3588
+ <div class="unknown-element">
3589
+ <p>⚠️ Unknown question type: ${g(i.type)}</p>
3590
+ </div>
3591
+ `+o}}function Ut(i){const e=i.type!=="divider"?'<hr class="print-question-separator" />':"";switch(i.type){case"text":return`
3592
+ <div class="content-print">
3593
+ <div class="content-element">
3594
+ <div class="text-content">
3595
+ <p>${g(i.content)}</p>
3596
+ </div>
3597
+ </div>
3598
+ ${e}
3599
+ </div>
3600
+ `;case"html":return`
3601
+ <div class="content-print">
3602
+ <div class="content-element">
3603
+ <div class="html-content-wrapper">
3604
+ ${i.content}
3605
+ </div>
3606
+ </div>
3607
+ ${e}
3608
+ </div>
3609
+ `;case"markdown":return`
3610
+ <div class="content-print">
3611
+ <div class="content-element">
3612
+ <div class="markdown-content">
3613
+ ${Gt(i.content)}
3614
+ </div>
3615
+ </div>
3616
+ ${e}
3617
+ </div>
3618
+ `;case"divider":return`
3619
+ <div class="content-print">
3620
+ <div class="content-element">
3621
+ <div class="divider-content">
3622
+ <hr class="content-divider" />
3623
+ ${i.caption?`<div class="divider-caption">${g(i.caption)}</div>`:""}
3624
+ </div>
3625
+ </div>
3626
+ </div>
3627
+ `;case"image":return`
3628
+ <div class="content-print">
3629
+ <div class="content-element">
3630
+ <div class="image-placeholder">
3631
+ <p>📷 Image: ${g(i.content)}</p>
3632
+ ${i.caption?`<small>${g(i.caption)}</small>`:""}
3633
+ </div>
3634
+ </div>
3635
+ ${e}
3636
+ </div>
3637
+ `;case"video":return`
3638
+ <div class="content-print">
3639
+ <div class="content-element">
3640
+ <div class="video-placeholder">
3641
+ <p>🎥 Video: ${g(i.content)}</p>
3642
+ ${i.caption?`<small>${g(i.caption)}</small>`:""}
3643
+ </div>
3644
+ </div>
3645
+ ${e}
3646
+ </div>
3647
+ `;case"file":return`
3648
+ <div class="content-print">
3649
+ <div class="content-element">
3650
+ <div class="file-placeholder">
3651
+ <p>📎 File: ${g(i.content)}</p>
3652
+ ${i.caption?`<small>${g(i.caption)}</small>`:""}
3653
+ </div>
3654
+ </div>
3655
+ ${e}
3656
+ </div>
3657
+ `;default:return`
3658
+ <div class="content-print">
3659
+ <div class="content-element">
3660
+ <div class="unknown-element">
3661
+ <p>⚠️ Unknown content type: ${g(i.type)}</p>
3662
+ </div>
3663
+ </div>
3664
+ ${e}
3665
+ </div>
3666
+ `}}function Pt(i,e){const t=e!=null?g(String(e)):"";return`
3667
+ <div class="print-response-value input-response">
3668
+ ${(i.type==="date"&&e?new Date(e).toLocaleDateString():t)||'<span class="print-no-response">No response</span>'}
3669
+ </div>
3670
+ `}function Lt(i,e){return`
3671
+ <div class="print-response-value textarea-response">
3672
+ ${(e!=null?g(String(e)):"")||'<span class="print-no-response">No response</span>'}
3673
+ </div>
3674
+ `}function Nt(i,e){const t=e!=null?String(e):"";return`
3675
+ <div class="print-response-value select-response">
3676
+ ${t?g(t):'<span class="print-no-response">No selection made</span>'}
3677
+ </div>
3678
+ `}function Ot(i,e){const t=e!=null?String(e):"";return`
3679
+ <div class="print-response-value radio-response">
3680
+ ${t?g(t):'<span class="print-no-response">No selection made</span>'}
3681
+ </div>
3682
+ `}function Rt(i,e){if((i.options||[]).length===0)return`
3683
+ <div class="print-response-value checkbox-response">
3684
+ ${e===!0||e==="true"?"Yes":"No"}
3685
+ </div>
3686
+ `;{const n=Array.isArray(e)?e.map(String):[];return`
3687
+ <div class="print-response-value checkbox-response">
3688
+ ${n.length>0?n.map(s=>`<div>• ${g(s)}</div>`).join(""):'<span class="print-no-response">No selections made</span>'}
3689
+ </div>
3690
+ `}}function Wt(i,e){if(!e)return'<div class="print-response-value file-response"><span class="print-no-response">No file uploaded</span></div>';const t=typeof e=="string";if(typeof e=="object"&&e.name)return`
3691
+ <div class="print-response-value file-response">
3692
+ 📎 ${g(e.name)}
3693
+ ${e.size?` <span class="file-size">(${Qt(e.size)})</span>`:""}
3694
+ </div>
3695
+ `;if(t){const s=qt(e);return`
3696
+ <div class="print-response-value file-response">
3697
+ 📎 ${g(s)}
3698
+ </div>
3699
+ `}else return`
3700
+ <div class="print-response-value file-response">
3701
+ 📎 ${g(String(e))}
3702
+ </div>
3703
+ `}function Ht(i,e){if(!e)return'<div class="print-response-value signature-response"><span class="print-no-response">No signature provided</span></div>';const t=typeof e=="string"?e:e.url||e.dataURL;return t?`
3704
+ <div class="print-response-value signature-response">
3705
+ <img
3706
+ src="${g(t)}"
3707
+ alt="Digital Signature"
3708
+ class="signature-image"
3709
+ />
3710
+ </div>
3711
+ `:`
3712
+ <div class="signature-fallback">
3713
+ <div class="signature-error">Unable to display signature</div>
3714
+ </div>
3715
+ `}function Vt(i){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(i.type)}function jt(i,e){return e==null?void 0:e.find(t=>t.elementId===i)}function Bt(i,e){return`
3716
+ <div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
3717
+ <div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
3718
+ <div>
3719
+ <h3 style="margin: 0 0 8px 0; color: #111827; font-size: 1.25rem;">
3720
+ ${g(i.name)}
3721
+ </h3>
3722
+ <p style="margin: 0; color: #6b7280; font-size: 0.875rem;">
3723
+ <strong>Status:</strong> ${g(i.status)} |
3724
+ <strong>Generated:</strong> ${e.toLocaleString()}
3725
+ </p>
3726
+ </div>
3727
+ <div style="text-align: right; color: #6b7280; font-size: 0.875rem;">
3728
+ <p style="margin: 0;"><strong>Instance ID:</strong> ${g(i.id)}</p>
3729
+ <p style="margin: 0;"><strong>Workflow ID:</strong> ${g(i.workflowId)}</p>
3730
+ </div>
3731
+ </div>
3732
+ </div>
3733
+ `}function g(i){if(i==null)return"";const e=String(i);return{innerHTML:""}.innerHTML||e.replace(/[&<>"']/g,n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[n])}function Qt(i){if(i===0)return"0 Bytes";const e=1024,t=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(e));return parseFloat((i/Math.pow(e,n)).toFixed(2))+" "+t[n]}function qt(i){try{return new URL(i).pathname.split("/").pop()||""||"Uploaded File"}catch{const e=i.split("/"),t=e[e.length-1];return t&&t.includes(".")?t:"Uploaded File"}}function Gt(i){return i==null?"":String(i).replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`(.*)`/gim,"<code>$1</code>").replace(/\n/gim,"<br>")}function Yt(){return`
3734
+ /* Print Layout Styles - Extracted from step-styles.ts */
3735
+ .print-layout {
3736
+ width: 100%;
3737
+ max-width: none;
3738
+ background: #fff;
3739
+ padding: 40px;
3740
+ box-sizing: border-box;
3741
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
3742
+ }
3743
+
3744
+ .print-step {
3745
+ margin-bottom: 60px;
3746
+ page-break-inside: avoid;
3747
+ break-inside: avoid;
3748
+ }
3749
+
3750
+ .print-step:last-child {
3751
+ margin-bottom: 0;
3752
+ }
3753
+
3754
+ .runner-card {
3755
+ background: transparent;
3756
+ border-radius: 0;
3757
+ padding: 0;
3758
+ margin: 0;
3759
+ box-shadow: none;
3760
+ border: none;
3761
+ }
3762
+
3763
+ .runner-step-header h2.runner-step-title {
3764
+ font-size: 1.5rem;
3765
+ font-weight: 700;
3766
+ color: #111827;
3767
+ margin: 0;
3768
+ }
3769
+
3770
+ .runner-step-divider {
3771
+ border: none;
3772
+ border-top: 1px solid #e5e7eb;
3773
+ margin: 20px 0 20px 0;
3774
+ width: 100%;
3775
+ }
3776
+
3777
+ .runner-step-desc {
3778
+ color: #6b7280;
3779
+ font-size: 1rem;
3780
+ margin: 0;
3781
+ }
3782
+
3783
+ .runner-question-title {
3784
+ font-size: 1rem;
3785
+ font-weight: 600;
3786
+ margin-bottom: 8px;
3787
+ color: #111827;
3788
+ display: flex;
3789
+ align-items: center;
3790
+ }
3791
+
3792
+ .runner-question-required {
3793
+ color: #dc2626;
3794
+ font-size: 1.1em;
3795
+ margin-left: 4px;
3796
+ }
3797
+
3798
+ .runner-question-divider {
3799
+ border: none;
3800
+ border-top: 1.5px solid #e5e7eb;
3801
+ margin: 12px 0 20px 0;
3802
+ }
3803
+
3804
+ /* Form input styling */
3805
+ input[type="text"],
3806
+ input[type="email"],
3807
+ input[type="number"],
3808
+ input[type="date"],
3809
+ textarea,
3810
+ select {
3811
+ width: 100%;
3812
+ padding: 12px 16px;
3813
+ border: 1px solid #e5e7eb;
3814
+ border-radius: 12px;
3815
+ font-size: 14px;
3816
+ background-color: #f9fafb;
3817
+ color: #111827;
3818
+ box-sizing: border-box;
3819
+ }
3820
+
3821
+ textarea {
3822
+ min-height: 120px;
3823
+ resize: vertical;
3824
+ }
3825
+
3826
+ select {
3827
+ cursor: pointer;
3828
+ width: auto;
3829
+ min-width: 450px;
3830
+ max-width: 900px;
3831
+ }
3832
+
3833
+ /* Radio group styling */
3834
+ .radio-group {
3835
+ display: flex;
3836
+ flex-direction: column;
3837
+ gap: 8px;
3838
+ background-color: #ffffff;
3839
+ padding: 16px;
3840
+ }
3841
+
3842
+ .radio-option {
3843
+ display: flex;
3844
+ align-items: center;
3845
+ padding: 8px 0;
3846
+ }
3847
+
3848
+ .radio-option input[type="radio"] {
3849
+ margin-right: 12px;
3850
+ width: 18px;
3851
+ height: 18px;
3852
+ accent-color: #3b82f6;
3853
+ }
3854
+
3855
+ .radio-label {
3856
+ font-size: 16px;
3857
+ color: #374151;
3858
+ flex: 1;
3859
+ }
3860
+
3861
+ /* Checkbox group styling */
3862
+ .checkbox-group {
3863
+ display: flex;
3864
+ flex-direction: column;
3865
+ gap: 8px;
3866
+ background-color: #ffffff;
3867
+ padding: 16px;
3868
+ }
3869
+
3870
+ .checkbox-option {
3871
+ display: flex;
3872
+ align-items: center;
3873
+ padding: 8px 0;
3874
+ }
3875
+
3876
+ .checkbox-option input[type="checkbox"] {
3877
+ margin-right: 12px;
3878
+ width: 18px;
3879
+ height: 18px;
3880
+ accent-color: #3b82f6;
3881
+ }
3882
+
3883
+ .checkbox-label {
3884
+ font-size: 16px;
3885
+ color: #374151;
3886
+ flex: 1;
3887
+ }
3888
+
3889
+ /* Single checkbox styling */
3890
+ .checkbox-single {
3891
+ display: flex;
3892
+ align-items: center;
3893
+ padding: 8px 0;
3894
+ margin-top: 8px;
3895
+ }
3896
+
3897
+ .checkbox-single input[type="checkbox"] {
3898
+ margin-right: 12px;
3899
+ width: 18px;
3900
+ height: 18px;
3901
+ accent-color: #3b82f6;
3902
+ }
3903
+
3904
+ /* Content Element Styles */
3905
+ .content-element {
3906
+ margin-bottom: 16px;
3907
+ }
3908
+
3909
+ /* Print mode content layout */
3910
+ .content-print {
3911
+ margin: 0;
3912
+ padding: 0;
3913
+ background: transparent;
3914
+ border: none;
3915
+ box-shadow: none;
3916
+ }
3917
+
3918
+ .text-content p {
3919
+ font-size: 1rem;
3920
+ line-height: 1.6;
3921
+ color: #374151;
3922
+ margin: 0;
3923
+ }
3924
+
3925
+ .markdown-content {
3926
+ font-size: 1rem;
3927
+ line-height: 1.6;
3928
+ color: #374151;
3929
+ }
3930
+
3931
+ .markdown-content h1 {
3932
+ font-size: 1.5rem;
3933
+ font-weight: 700;
3934
+ margin: 24px 0 16px 0;
3935
+ color: #111827;
3936
+ }
3937
+
3938
+ .markdown-content h2 {
3939
+ font-size: 1.25rem;
3940
+ font-weight: 600;
3941
+ margin: 20px 0 12px 0;
3942
+ color: #111827;
3943
+ }
3944
+
3945
+ .markdown-content h3 {
3946
+ font-size: 1.125rem;
3947
+ font-weight: 600;
3948
+ margin: 16px 0 8px 0;
3949
+ color: #111827;
3950
+ }
3951
+
3952
+ .markdown-content strong {
3953
+ font-weight: 600;
3954
+ }
3955
+
3956
+ .markdown-content em {
3957
+ font-style: italic;
3958
+ }
3959
+
3960
+ .markdown-content code {
3961
+ background: #f3f4f6;
3962
+ padding: 2px 6px;
3963
+ border-radius: 4px;
3964
+ font-family: "Courier New", monospace;
3965
+ font-size: 0.9em;
3966
+ }
3967
+
3968
+ .divider-content {
3969
+ text-align: center;
3970
+ margin: 24px 0;
3971
+ }
3972
+
3973
+ .content-divider {
3974
+ border: none;
3975
+ border-top: 2px solid #e5e7eb;
3976
+ margin: 0 0 8px 0;
3977
+ }
3978
+
3979
+ .divider-caption {
3980
+ font-size: 0.875rem;
3981
+ color: #6b7280;
3982
+ font-style: italic;
3983
+ }
3984
+
3985
+ .html-content-wrapper {
3986
+ line-height: 1.6;
3987
+ }
3988
+
3989
+ .image-placeholder,
3990
+ .video-placeholder,
3991
+ .file-placeholder {
3992
+ background: #f9fafb;
3993
+ border: 2px dashed #d1d5db;
3994
+ border-radius: 8px;
3995
+ padding: 24px;
3996
+ text-align: center;
3997
+ color: #6b7280;
3998
+ }
3999
+
4000
+ .image-placeholder p,
4001
+ .video-placeholder p,
4002
+ .file-placeholder p {
4003
+ margin: 0 0 8px 0;
4004
+ font-weight: 500;
4005
+ }
4006
+
4007
+ .image-placeholder small,
4008
+ .video-placeholder small,
4009
+ .file-placeholder small {
4010
+ font-size: 0.875rem;
4011
+ color: #9ca3af;
4012
+ }
4013
+
4014
+ .unknown-element {
4015
+ background: #fef2f2;
4016
+ border: 1px solid #fecaca;
4017
+ border-radius: 8px;
4018
+ padding: 16px;
4019
+ color: #dc2626;
4020
+ text-align: center;
4021
+ }
4022
+
4023
+ .unknown-element p {
4024
+ margin: 0;
4025
+ font-weight: 500;
4026
+ }
4027
+
4028
+ /* Print mode file info styles */
4029
+ .file-upload-print-info {
4030
+ background: #f8fafc;
4031
+ border: 1px solid #e2e8f0;
4032
+ border-radius: 6px;
4033
+ padding: 16px;
4034
+ margin: 8px 0;
4035
+ }
4036
+
4037
+ .file-details {
4038
+ display: flex;
4039
+ flex-direction: column;
4040
+ gap: 8px;
4041
+ }
4042
+
4043
+ .file-detail-row {
4044
+ display: flex;
4045
+ align-items: center;
4046
+ font-size: 0.875rem;
4047
+ line-height: 1.4;
4048
+ }
4049
+
4050
+ .file-detail-row strong {
4051
+ min-width: 80px;
4052
+ color: #374151;
4053
+ font-weight: 600;
4054
+ margin-right: 8px;
4055
+ }
4056
+
4057
+ .no-file,
4058
+ .no-signature {
4059
+ color: #6b7280;
4060
+ font-style: italic;
4061
+ font-size: 0.875rem;
4062
+ }
4063
+
4064
+ /* Signature styles */
4065
+ .signature-view-only {
4066
+ display: flex;
4067
+ flex-direction: column;
4068
+ align-items: center;
4069
+ padding: 16px;
4070
+ background: #f8fafc;
4071
+ border: 1px solid #e2e8f0;
4072
+ border-radius: 6px;
4073
+ }
4074
+
4075
+ .signature-existing {
4076
+ display: flex;
4077
+ flex-direction: column;
4078
+ align-items: center;
4079
+ margin-bottom: 12px;
4080
+ }
4081
+
4082
+ .signature-image {
4083
+ max-width: 100%;
4084
+ max-height: 200px;
4085
+ border: 1px solid #e2e8f0;
4086
+ border-radius: 4px;
4087
+ background: white;
4088
+ padding: 8px;
4089
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
4090
+ }
4091
+
4092
+ .signature-fallback {
4093
+ padding: 20px;
4094
+ text-align: center;
4095
+ }
4096
+
4097
+ .signature-error {
4098
+ color: #dc2626;
4099
+ font-style: italic;
4100
+ font-size: 0.875rem;
4101
+ }
4102
+
4103
+ /* Print media queries for actual printing */
4104
+ @media print {
4105
+ .print-layout {
4106
+ padding: 20px;
4107
+ background: #fff !important;
4108
+ }
4109
+
4110
+ .print-step {
4111
+ page-break-inside: avoid;
4112
+ margin-bottom: 40px;
4113
+ }
4114
+
4115
+ .runner-card {
4116
+ box-shadow: none !important;
4117
+ border: 1px solid #ccc !important;
4118
+ margin-bottom: 15px;
4119
+ }
4120
+
4121
+ /* Hide any interactive elements in print */
4122
+ button,
4123
+ input[type="button"],
4124
+ input[type="submit"] {
4125
+ display: none !important;
4126
+ }
4127
+
4128
+ /* Ensure proper text color for print */
4129
+ * {
4130
+ color: #000 !important;
4131
+ background: transparent !important;
4132
+ }
4133
+
4134
+ /* Print-specific file info styling */
4135
+ .file-upload-print-info {
4136
+ border: 1px solid #000 !important;
4137
+ background: transparent !important;
4138
+ margin-bottom: 15px;
4139
+ }
4140
+
4141
+ .file-detail-row strong {
4142
+ color: #000 !important;
4143
+ }
4144
+ }
4145
+
4146
+ /* Clean print mode styles */
4147
+ .print-response-value {
4148
+ font-size: 1rem;
4149
+ line-height: 1.5;
4150
+ color: #111827;
4151
+ padding: 0;
4152
+ margin: 0 0 8px 0;
4153
+ background: transparent;
4154
+ border: none;
4155
+ min-height: auto;
4156
+ }
4157
+
4158
+ .print-response-value.textarea-response {
4159
+ white-space: pre-wrap;
4160
+ word-wrap: break-word;
4161
+ }
4162
+
4163
+ .print-response-value.file-response {
4164
+ font-weight: 500;
4165
+ }
4166
+
4167
+ .print-response-value .file-size {
4168
+ color: #6b7280;
4169
+ font-weight: normal;
4170
+ font-size: 0.9em;
4171
+ }
4172
+
4173
+ .print-response-value.signature-response {
4174
+ padding: 8px 0;
4175
+ }
4176
+
4177
+ .print-response-value.signature-response .signature-image {
4178
+ max-width: 200px;
4179
+ max-height: 100px;
4180
+ border: 1px solid #e5e7eb;
4181
+ background: white;
4182
+ }
4183
+
4184
+ .print-no-response {
4185
+ color: #9ca3af;
4186
+ font-style: italic;
4187
+ font-size: 0.9em;
4188
+ }
4189
+
4190
+ /* Print mode 3-level text hierarchy */
4191
+ /* Title level (18pt) - Instance name */
4192
+ .print-instance-title {
4193
+ font-size: 18pt;
4194
+ font-weight: 600;
4195
+ color: #111827;
4196
+ margin: 0 0 20px 0;
4197
+ line-height: 1.3;
4198
+ }
4199
+
4200
+ /* Step level (14pt) */
4201
+ .print-step-title {
4202
+ font-size: 14pt;
4203
+ font-weight: 600;
4204
+ color: #111827;
4205
+ margin: 0 0 8px 0;
4206
+ line-height: 1.4;
4207
+ }
4208
+
4209
+ /* Question level (12pt) */
4210
+ .print-question-title {
4211
+ font-size: 12pt;
4212
+ font-weight: 600;
4213
+ color: #111827;
4214
+ margin: 0 0 4px 0;
4215
+ line-height: 1.4;
4216
+ }
4217
+
4218
+ .print-step-description {
4219
+ font-size: 1rem;
4220
+ font-weight: 400;
4221
+ color: #6b7280;
4222
+ margin: 8px 0;
4223
+ line-height: 1.5;
4224
+ }
4225
+
4226
+ .print-question-separator {
4227
+ border: none;
4228
+ border-top: 1px solid #e5e7eb;
4229
+ margin: 16px 0;
4230
+ width: 100%;
4231
+ }
4232
+
4233
+ /* Clean styling for checkbox lists in print */
4234
+ .print-response-value.checkbox-response div {
4235
+ margin: 2px 0;
4236
+ line-height: 1.4;
4237
+ }
4238
+ `}function Jt(i,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(i);if(!t)return console.error(`Error: Target element with ID '${i}' not found.`),null;t.innerHTML="";const n=document.createElement("builder-widget");return e.onWorkflowCreated&&(n.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(n.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(n.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(n),console.log(`Begin Builder mounted on #${i}`),n}function Kt(i,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(i);if(!t)return console.error(`Error: Target element with ID '${i}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const n=document.createElement("runner-widget");return e.mode==="preview"?(n.workflow=e.workflow,n.mode="preview"):(n.instance=e.instance,n.mode=e.mode||"default"),e.mode&&(n.mode=e.mode),e.isLoading!==void 0&&(n.isLoading=e.isLoading),e.onSignatureCaptured&&(n.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(n.onFileUploaded=e.onFileUploaded),e.currentUser&&(n.currentUser=e.currentUser),e.onInstanceUpdated&&n.addEventListener("instance-updated",s=>{const r=s;try{e.onInstanceUpdated(r.detail)}catch(o){console.error("Error executing onInstanceUpdated callback:",o)}}),t.appendChild(n),console.log(`Begin Runner mounted on #${i}`),n}function Xt(i,e){const t=i.getFormData(),n=JSON.parse(JSON.stringify(e));return n.steps&&n.steps.forEach(s=>{s.responses||(s.responses=[]),s.elements.forEach(r=>{if(r.type==="text_input"||r.type==="textarea"||r.type==="select"||r.type==="number"||r.type==="radio"||r.type==="checkbox"||r.type==="date"||r.type==="file_upload"||r.type==="signature"){const o=t[r.id];if(o!==void 0){let a=s.responses.find(d=>d.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},s.responses.push(a))}}})}),n}function Zt(i,e){const t={};e.steps&&e.steps.forEach(n=>{n.responses&&n.responses.forEach(s=>{t[s.elementId]=s.value})}),i.restoreFormData(),console.log("Form data restored to runner widget:",t)}D.createBuilder=Jt,D.createRunner=Kt,D.generateInstanceHTML=Mt,D.restoreFormDataToRunner=Zt,D.updateInstanceFromRunnerForm=Xt,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});