drill-widgets 2.7.15 → 2.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drill-widgets.es.js +1725 -1181
- package/dist/drill-widgets.umd.js +1041 -537
- package/dist/lib.d.ts +25 -1
- package/package.json +1 -1
|
@@ -1,42 +1,117 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(A=typeof globalThis<"u"?globalThis:A||self,M(A.Drill={}))})(this,function(A){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var Oe;const M=globalThis,
|
|
5
|
+
*/var Oe;const M=globalThis,ne=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oe=Symbol(),_e=new WeakMap;let ye=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==oe)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(ne&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=_e.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&_e.set(t,e))}return e}toString(){return this.cssText}};const Re=s=>new ye(typeof s=="string"?s:s+"",void 0,oe),L=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(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.")})(r)+s[n+1],s[0]);return new ye(t,s,oe)},Ve=(s,e)=>{if(ne)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=M.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},we=ne?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Re(t)})(s):s;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:We,defineProperty:
|
|
9
|
+
*/const{is:We,defineProperty:He,getOwnPropertyDescriptor:je,getOwnPropertyNames:Be,getOwnPropertySymbols:Qe,getPrototypeOf:Ge}=Object,T=globalThis,Se=T.trustedTypes,Ye=Se?Se.emptyScript:"",ae=T.reactiveElementPolyfillSupport,W=(s,e)=>s,K={toAttribute(s,e){switch(e){case Boolean:s=s?Ye:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},de=(s,e)=>!We(s,e),ke={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:de};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),T.litPropertyMetadata??(T.litPropertyMetadata=new WeakMap);let O=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=ke){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 i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&He(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=je(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get:r,set(o){const a=r==null?void 0:r.call(this);n==null||n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ke}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,i=[...Be(t),...Qe(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(we(r))}else e!==void 0&&t.push(we(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i: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 i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ve(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 i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:K).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n,o;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=i.getPropertyOptions(r),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)==null?void 0:n.fromAttribute)!==void 0?a.converter:K;this._$Em=r,this[r]=d.fromAttribute(t,a.type)??((o=this._$Ej)==null?void 0:o.get(r))??null,this._$Em=null}}requestUpdate(e,t,i){var r;if(e!==void 0){const n=this.constructor,o=this[e];if(i??(i=n.getPropertyOptions(e)),!((i.hasChanged??de)(o,t)||i.useDefault&&i.reflect&&o===((r=this._$Ej)==null?void 0:r.get(e))&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:r,wrapped:n},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??t??this[e]),n!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),r===!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 i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r){const{wrapped:a}=o,d=this[n];a!==!0||this._$AL.has(n)||d===void 0||this.C(n,void 0,o,d)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),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){}};O.elementStyles=[],O.shadowRootOptions={mode:"open"},O[W("elementProperties")]=new Map,O[W("finalized")]=new Map,ae==null||ae({ReactiveElement:O}),(T.reactiveElementVersions??(T.reactiveElementVersions=[])).push("2.1.0");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const H=globalThis,J=H.trustedTypes,$e=J?J.createPolicy("lit-html",{createHTML:s=>s}):void 0,De="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,Ce="?"+F,qe=`<${Ce}>`,z=document,j=()=>z.createComment(""),B=s=>s===null||typeof s!="object"&&typeof s!="function",le=Array.isArray,Ke=s=>le(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",pe=`[
|
|
14
|
+
\f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ae=/-->/g,Ee=/>/g,I=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Me=/'/g,Te=/"/g,Fe=/^(?:script|style|textarea|title)$/i,Je=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),l=Je(1),U=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),ze=new WeakMap,P=z.createTreeWalker(z,129);function Ie(s,e){if(!le(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return $e!==void 0?$e.createHTML(e):e}const Xe=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":e===3?"<math>":"",o=Q;for(let a=0;a<t;a++){const d=s[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===Q?c[1]==="!--"?o=Ae:c[1]!==void 0?o=Ee:c[2]!==void 0?(Fe.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=I):c[3]!==void 0&&(o=I):o===I?c[0]===">"?(o=r??Q,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,p=c[1],o=c[3]===void 0?I:c[3]==='"'?Te:Me):o===Te||o===Me?o=I:o===Ae||o===Ee?o=Q:(o=I,r=void 0);const m=o===I&&s[a+1].startsWith("/>")?" ":"";n+=o===Q?d+qe:u>=0?(i.push(p),d.slice(0,u)+De+d.slice(u)+F+m):d+F+(u===-2?a:m)}return[Ie(s,n+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class G{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,d=this.parts,[p,c]=Xe(e,t);if(this.el=G.createElement(p,i),P.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=P.nextNode())!==null&&d.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith(De)){const h=c[o++],m=r.getAttribute(u).split(F),x=/([.?@])?(.*)/.exec(h);d.push({type:1,index:n,name:x[2],strings:m,ctor:x[1]==="."?et:x[1]==="?"?tt:x[1]==="@"?it:X}),r.removeAttribute(u)}else u.startsWith(F)&&(d.push({type:6,index:n}),r.removeAttribute(u));if(Fe.test(r.tagName)){const u=r.textContent.split(F),h=u.length-1;if(h>0){r.textContent=J?J.emptyScript:"";for(let m=0;m<h;m++)r.append(u[m],j()),P.nextNode(),d.push({type:2,index:++n});r.append(u[h],j())}}}else if(r.nodeType===8)if(r.data===Ce)d.push({type:2,index:n});else{let u=-1;for(;(u=r.data.indexOf(F,u+1))!==-1;)d.push({type:7,index:n}),u+=F.length-1}n++}}static createElement(e,t){const i=z.createElement("template");return i.innerHTML=e,i}}function R(s,e,t=s,i){var o,a;if(e===U)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=B(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=R(s,r._$AS(s,e.values),r,i)),e}class Ze{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:i}=this._$AD,r=((e==null?void 0:e.creationScope)??z).importNode(t,!0);P.currentNode=r;let n=P.nextNode(),o=0,a=0,d=i[0];for(;d!==void 0;){if(o===d.index){let p;d.type===2?p=new Y(n,n.nextSibling,this,e):d.type===1?p=new d.ctor(n,d.name,d.strings,this,e):d.type===6&&(p=new st(n,this,e)),this._$AV.push(p),d=i[++a]}o!==(d==null?void 0:d.index)&&(n=P.nextNode(),o++)}return P.currentNode=z,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Y{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.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=R(this,e,t),B(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==U&&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!==_&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(z.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=G.createElement(Ie(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Ze(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new G(e)),t}k(e){le(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new Y(this.O(j()),this.O(j()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=_}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=R(this,e,t,0),o=!B(e)||e!==this._$AH&&e!==U,o&&(this._$AH=e);else{const a=e;let d,p;for(e=n[0],d=0;d<n.length-1;d++)p=R(this,a[i+d],t,d),p===U&&(p=this._$AH[d]),o||(o=!B(p)||p!==this._$AH[d]),p===_?e=_:e!==_&&(e+=(p??"")+n[d+1]),this._$AH[d]=p}o&&!r&&this.j(e)}j(e){e===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class et extends X{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_?void 0:e}}class tt extends X{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==_)}}class it extends X{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=R(this,e,t,0)??_)===U)return;const i=this._$AH,r=e===_&&i!==_||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==_&&(i===_||r);r&&this.element.removeEventListener(this.name,this,i),n&&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,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){R(this,e)}}const ce=H.litHtmlPolyfillSupport;ce==null||ce(G,Y),(H.litHtmlVersions??(H.litHtmlVersions=[])).push("3.3.0");const rt=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new Y(e.insertBefore(j(),n),n,void 0,t??{})}return r._$AI(s),r};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const N=globalThis;let V=class extends O{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 U}};V._$litElement$=!0,V.finalized=!0,(Oe=N.litElementHydrateSupport)==null||Oe.call(N,{LitElement:V});const ue=N.litElementPolyfillSupport;ue==null||ue({LitElement:V}),(N.litElementVersions??(N.litElementVersions=[])).push("4.2.0");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Ue=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const nt={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:de},ot=(s=nt,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),i==="setter"&&((s=Object.create(s)).wrapped=!0),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const d=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,d,s)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(i==="setter"){const{name:o}=t;return function(a){const d=this[o];e.call(this,a),this.requestUpdate(o,d,s)}}throw Error("Unsupported decorator location: "+i)};function D(s){return(e,t)=>typeof t=="object"?ot(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/function
|
|
31
|
+
*/function b(s){return D({...s,state:!0,attribute:!1})}const S=[];for(let s=0;s<256;++s)S.push((s+256).toString(16).slice(1));function at(s,e=0){return(S[s[e+0]]+S[s[e+1]]+S[s[e+2]]+S[s[e+3]]+"-"+S[s[e+4]]+S[s[e+5]]+"-"+S[s[e+6]]+S[s[e+7]]+"-"+S[s[e+8]]+S[s[e+9]]+"-"+S[s[e+10]]+S[s[e+11]]+S[s[e+12]]+S[s[e+13]]+S[s[e+14]]+S[s[e+15]]).toLowerCase()}let he;const dt=new Uint8Array(16);function lt(){if(!he){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");he=crypto.getRandomValues.bind(crypto)}return he(dt)}const Pe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function E(s,e,t){var r;if(Pe.randomUUID&&!s)return Pe.randomUUID();s=s||{};const i=s.random??((r=s.rng)==null?void 0:r.call(s))??lt();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,at(i)}const pt=L`
|
|
32
32
|
:host {
|
|
33
|
+
/* Color tokens (defaults) */
|
|
34
|
+
--bg: #f9fafb;
|
|
35
|
+
--card-bg: #ffffff;
|
|
36
|
+
--text: #111827;
|
|
37
|
+
--muted: #6b7280;
|
|
38
|
+
--border: #e5e7eb;
|
|
39
|
+
|
|
40
|
+
--header-bg: #f9fafb;
|
|
41
|
+
--header-border-color: var(--border);
|
|
42
|
+
--header-border-width: 1px;
|
|
43
|
+
|
|
44
|
+
--cancel-bg: #ffffff;
|
|
45
|
+
--cancel-text: #374151;
|
|
46
|
+
|
|
47
|
+
--accent: #0f766e;
|
|
48
|
+
--accent-hover: #0d9488;
|
|
49
|
+
|
|
50
|
+
--radius: 8px;
|
|
51
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
52
|
+
|
|
33
53
|
display: block;
|
|
34
54
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
35
|
-
background-color:
|
|
36
|
-
border-radius:
|
|
37
|
-
box-shadow:
|
|
55
|
+
background-color: var(--bg);
|
|
56
|
+
border-radius: var(--radius);
|
|
57
|
+
box-shadow: var(--shadow);
|
|
38
58
|
overflow: hidden;
|
|
39
59
|
min-height: 600px;
|
|
60
|
+
color: var(--text);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* allow consumers to toggle dark theme on the host */
|
|
64
|
+
:host([theme="dark"]),
|
|
65
|
+
:host([data-theme="dark"]) {
|
|
66
|
+
--bg: #121212;
|
|
67
|
+
--card-bg: #161616;
|
|
68
|
+
--text: #f9fafb;
|
|
69
|
+
--muted: #94a3b8;
|
|
70
|
+
--border: #1f2937;
|
|
71
|
+
|
|
72
|
+
--header-bg: #222222;
|
|
73
|
+
--header-border-color: var(--border);
|
|
74
|
+
--header-border-width: 1px;
|
|
75
|
+
|
|
76
|
+
--cancel-bg: #0b1220;
|
|
77
|
+
--cancel-text: #ffffff;
|
|
78
|
+
|
|
79
|
+
--accent: #0f766e;
|
|
80
|
+
--accent-hover: #0d9488;
|
|
81
|
+
|
|
82
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* also provide sensible defaults when not using shadow DOM via prefers-color-scheme */
|
|
86
|
+
@media (prefers-color-scheme: dark) {
|
|
87
|
+
:host {
|
|
88
|
+
--bg: #121212;
|
|
89
|
+
--card-bg: #161616;
|
|
90
|
+
--text: #f9fafb;
|
|
91
|
+
--muted: #94a3b8;
|
|
92
|
+
--border: #1f2937;
|
|
93
|
+
|
|
94
|
+
--header-bg: #222222;
|
|
95
|
+
--header-border-color: var(--border);
|
|
96
|
+
--header-border-width: 1px;
|
|
97
|
+
|
|
98
|
+
--cancel-bg: #0b1220;
|
|
99
|
+
--cancel-text: #ffffff;
|
|
100
|
+
|
|
101
|
+
--accent: #0f766e;
|
|
102
|
+
--accent-hover: #0d9488;
|
|
103
|
+
|
|
104
|
+
--shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.h2 {
|
|
109
|
+
background-color: var(--header-bg);
|
|
110
|
+
color: var(--text);
|
|
111
|
+
}
|
|
112
|
+
.section-header h2 {
|
|
113
|
+
background-color: var(--header-bg);
|
|
114
|
+
color: var(--text);
|
|
40
115
|
}
|
|
41
116
|
|
|
42
117
|
/* Header */
|
|
@@ -45,9 +120,10 @@
|
|
|
45
120
|
justify-content: space-between;
|
|
46
121
|
align-items: flex-end;
|
|
47
122
|
padding: 24px;
|
|
48
|
-
border-bottom:
|
|
49
|
-
background-color:
|
|
123
|
+
border-bottom: var(--header-border-width) solid var(--header-border-color);
|
|
124
|
+
background-color: var(--header-bg);
|
|
50
125
|
gap: 24px;
|
|
126
|
+
color: var(--text);
|
|
51
127
|
}
|
|
52
128
|
|
|
53
129
|
.header-inputs {
|
|
@@ -72,35 +148,126 @@
|
|
|
72
148
|
}
|
|
73
149
|
|
|
74
150
|
.cancel-button {
|
|
75
|
-
background-color:
|
|
76
|
-
color:
|
|
77
|
-
border: 1px solid
|
|
151
|
+
background-color: var(--cancel-bg);
|
|
152
|
+
color: var(--cancel-text);
|
|
153
|
+
border: 1px solid var(--border);
|
|
78
154
|
}
|
|
79
155
|
|
|
80
156
|
.cancel-button:hover {
|
|
81
|
-
background-color:
|
|
82
|
-
border-color:
|
|
157
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
158
|
+
border-color: var(--muted);
|
|
83
159
|
}
|
|
84
160
|
|
|
85
161
|
.save-button {
|
|
86
|
-
background-color:
|
|
87
|
-
color:
|
|
88
|
-
border: 1px solid
|
|
162
|
+
background-color: var(--accent);
|
|
163
|
+
color: var(--card-bg);
|
|
164
|
+
border: 1px solid var(--accent);
|
|
89
165
|
padding: 12px 24px;
|
|
90
166
|
font-weight: 600;
|
|
91
167
|
}
|
|
92
168
|
|
|
93
169
|
.save-button:hover {
|
|
94
|
-
background-color:
|
|
95
|
-
border-color:
|
|
170
|
+
background-color: var(--accent-hover);
|
|
171
|
+
border-color: var(--accent-hover);
|
|
96
172
|
}
|
|
97
173
|
|
|
98
174
|
/* Main Content */
|
|
99
175
|
.main-content {
|
|
100
176
|
padding: 0;
|
|
101
|
-
background-color:
|
|
177
|
+
background-color: var(--bg);
|
|
178
|
+
}
|
|
179
|
+
`,ct=L`
|
|
180
|
+
:host {
|
|
181
|
+
/* tokens - defaults (light) */
|
|
182
|
+
--form-label: #374151;
|
|
183
|
+
--form-label-size: 14px;
|
|
184
|
+
|
|
185
|
+
--input-bg: #ffffff;
|
|
186
|
+
--input-border: #d1d5db;
|
|
187
|
+
--input-border-focus: #3b82f6;
|
|
188
|
+
--input-focus-ring: rgba(59, 130, 246, 0.1);
|
|
189
|
+
--placeholder: #9ca3af;
|
|
190
|
+
--input-radius: 6px;
|
|
191
|
+
|
|
192
|
+
--content-columns-bg: #ffffff;
|
|
193
|
+
--content-columns-border: #e5e7eb;
|
|
194
|
+
--content-item-bg: #f9fafb;
|
|
195
|
+
|
|
196
|
+
--checkbox-label-color: #374151;
|
|
197
|
+
--checkbox-hover-bg: #f9fafb;
|
|
198
|
+
|
|
199
|
+
--single-checkbox-bg: #f0f9ff;
|
|
200
|
+
--single-checkbox-border: #bae6fd;
|
|
201
|
+
--single-checkbox-note: #0369a1;
|
|
202
|
+
|
|
203
|
+
--dropdown-bg: #ffffff;
|
|
204
|
+
--dropdown-border: #d1d5db;
|
|
205
|
+
--dropdown-item-hover: #f3f4f6;
|
|
206
|
+
--dropdown-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
207
|
+
|
|
208
|
+
--radius: 6px;
|
|
209
|
+
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* dark theme (host opt-in) */
|
|
213
|
+
:host([theme="dark"]),
|
|
214
|
+
:host([data-theme="dark"]) {
|
|
215
|
+
--form-label: #95979c;
|
|
216
|
+
--input-bg: #0b1220;
|
|
217
|
+
--input-border: #1f2937;
|
|
218
|
+
--input-border-focus: #60a5fa;
|
|
219
|
+
--input-focus-ring: rgba(96, 165, 250, 0.08);
|
|
220
|
+
--placeholder: #94a3b8;
|
|
221
|
+
|
|
222
|
+
--content-columns-bg: #121212;
|
|
223
|
+
--content-columns-border: #1f2937;
|
|
224
|
+
--content-item-bg: #0b1220;
|
|
225
|
+
|
|
226
|
+
--checkbox-label-color: #dddddd;
|
|
227
|
+
--checkbox-hover-bg: #000000;
|
|
228
|
+
|
|
229
|
+
--single-checkbox-bg: #06202b;
|
|
230
|
+
--single-checkbox-border: rgba(186, 230, 253, 0.04);
|
|
231
|
+
--single-checkbox-note: #7fc3ff;
|
|
232
|
+
|
|
233
|
+
--dropdown-bg: #0f1724;
|
|
234
|
+
--dropdown-border: #374151;
|
|
235
|
+
--dropdown-item-hover: #06202b;
|
|
236
|
+
--dropdown-shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
237
|
+
|
|
238
|
+
--shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* respect system preference when not using shadow DOM */
|
|
242
|
+
@media (prefers-color-scheme: dark) {
|
|
243
|
+
:host {
|
|
244
|
+
--form-label: #95979c;
|
|
245
|
+
--input-bg: #0b1220;
|
|
246
|
+
--input-border: #1f2937;
|
|
247
|
+
--input-border-focus: #60a5fa;
|
|
248
|
+
--input-focus-ring: rgba(96, 165, 250, 0.08);
|
|
249
|
+
--placeholder: #94a3b8;
|
|
250
|
+
|
|
251
|
+
--content-columns-bg: #121212;
|
|
252
|
+
--content-columns-border: #1f2937;
|
|
253
|
+
--content-item-bg: #0b1220;
|
|
254
|
+
|
|
255
|
+
--checkbox-label-color: #dddddd;
|
|
256
|
+
--checkbox-hover-bg: #000000;
|
|
257
|
+
|
|
258
|
+
--single-checkbox-bg: #06202b;
|
|
259
|
+
--single-checkbox-border: rgba(186, 230, 253, 0.04);
|
|
260
|
+
--single-checkbox-note: #7fc3ff;
|
|
261
|
+
|
|
262
|
+
--dropdown-bg: #0f1724;
|
|
263
|
+
--dropdown-border: #374151;
|
|
264
|
+
--dropdown-item-hover: #06202b;
|
|
265
|
+
--dropdown-shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
266
|
+
|
|
267
|
+
--shadow: 0 4px 6px rgba(2, 6, 23, 0.6);
|
|
268
|
+
}
|
|
102
269
|
}
|
|
103
|
-
|
|
270
|
+
|
|
104
271
|
.form-group {
|
|
105
272
|
display: flex;
|
|
106
273
|
flex-direction: column;
|
|
@@ -109,40 +276,43 @@
|
|
|
109
276
|
|
|
110
277
|
.form-group label {
|
|
111
278
|
font-weight: 500;
|
|
112
|
-
color:
|
|
279
|
+
color: var(--form-label);
|
|
113
280
|
margin-bottom: 8px;
|
|
114
|
-
font-size:
|
|
281
|
+
font-size: var(--form-label-size);
|
|
115
282
|
}
|
|
116
283
|
|
|
117
284
|
.form-group input,
|
|
118
285
|
.form-group textarea {
|
|
119
286
|
padding: 12px;
|
|
120
|
-
border: 1px solid
|
|
121
|
-
border-radius:
|
|
287
|
+
border: 1px solid var(--input-border);
|
|
288
|
+
border-radius: var(--input-radius);
|
|
122
289
|
font-size: 14px;
|
|
123
290
|
transition: border-color 0.2s ease;
|
|
291
|
+
background: var(--input-bg);
|
|
292
|
+
color: inherit;
|
|
124
293
|
}
|
|
125
294
|
|
|
126
295
|
.form-group input:focus,
|
|
127
296
|
.form-group textarea:focus {
|
|
128
297
|
outline: none;
|
|
129
|
-
border-color:
|
|
130
|
-
box-shadow: 0 0 0 3px
|
|
298
|
+
border-color: var(--input-border-focus);
|
|
299
|
+
box-shadow: 0 0 0 3px var(--input-focus-ring);
|
|
300
|
+
background: var(--input-bg);
|
|
131
301
|
}
|
|
132
302
|
|
|
133
303
|
.form-group input::placeholder,
|
|
134
304
|
.form-group textarea::placeholder {
|
|
135
|
-
color:
|
|
305
|
+
color: var(--placeholder);
|
|
136
306
|
}
|
|
137
307
|
|
|
138
308
|
/* Two Column Layout */
|
|
139
309
|
.content-columns {
|
|
140
|
-
background-color:
|
|
310
|
+
background-color: var(--content-columns-bg);
|
|
141
311
|
display: grid;
|
|
142
312
|
grid-template-columns: 2fr 3fr;
|
|
143
313
|
min-height: 500px;
|
|
144
314
|
gap: 1px;
|
|
145
|
-
border: 1px solid
|
|
315
|
+
border: 1px solid var(--content-columns-border);
|
|
146
316
|
overflow: hidden;
|
|
147
317
|
}
|
|
148
318
|
|
|
@@ -163,15 +333,15 @@
|
|
|
163
333
|
align-items: center;
|
|
164
334
|
gap: 8px;
|
|
165
335
|
font-size: 14px;
|
|
166
|
-
color:
|
|
336
|
+
color: var(--checkbox-label-color);
|
|
167
337
|
cursor: pointer;
|
|
168
338
|
padding: 8px;
|
|
169
|
-
border-radius:
|
|
339
|
+
border-radius: var(--radius);
|
|
170
340
|
transition: background-color 0.2s ease;
|
|
171
341
|
}
|
|
172
342
|
|
|
173
343
|
.checkbox-type-label:hover {
|
|
174
|
-
background-color:
|
|
344
|
+
background-color: var(--checkbox-hover-bg);
|
|
175
345
|
}
|
|
176
346
|
|
|
177
347
|
.checkbox-type-label input[type="radio"] {
|
|
@@ -180,8 +350,8 @@
|
|
|
180
350
|
}
|
|
181
351
|
|
|
182
352
|
.single-checkbox-info {
|
|
183
|
-
background-color:
|
|
184
|
-
border: 1px solid
|
|
353
|
+
background-color: var(--single-checkbox-bg);
|
|
354
|
+
border: 1px solid var(--single-checkbox-border);
|
|
185
355
|
border-radius: 6px;
|
|
186
356
|
padding: 12px;
|
|
187
357
|
margin-top: 8px;
|
|
@@ -190,7 +360,7 @@
|
|
|
190
360
|
.single-checkbox-info .config-note {
|
|
191
361
|
margin: 0;
|
|
192
362
|
font-size: 14px;
|
|
193
|
-
color:
|
|
363
|
+
color: var(--single-checkbox-note);
|
|
194
364
|
font-style: italic;
|
|
195
365
|
}
|
|
196
366
|
|
|
@@ -210,10 +380,10 @@
|
|
|
210
380
|
position: absolute;
|
|
211
381
|
top: 100%;
|
|
212
382
|
right: 0;
|
|
213
|
-
background:
|
|
214
|
-
border: 1px solid
|
|
383
|
+
background: var(--dropdown-bg);
|
|
384
|
+
border: 1px solid var(--dropdown-border);
|
|
215
385
|
border-radius: 6px;
|
|
216
|
-
box-shadow:
|
|
386
|
+
box-shadow: var(--dropdown-shadow);
|
|
217
387
|
z-index: 1000;
|
|
218
388
|
min-width: 120px;
|
|
219
389
|
display: none;
|
|
@@ -228,7 +398,8 @@
|
|
|
228
398
|
width: 100%;
|
|
229
399
|
padding: 8px 12px;
|
|
230
400
|
border: none;
|
|
231
|
-
background:
|
|
401
|
+
background: var(--dropdown-bg);
|
|
402
|
+
color: inherit;
|
|
232
403
|
text-align: left;
|
|
233
404
|
font-size: 14px;
|
|
234
405
|
cursor: pointer;
|
|
@@ -236,15 +407,15 @@
|
|
|
236
407
|
}
|
|
237
408
|
|
|
238
409
|
.content-options button:hover {
|
|
239
|
-
background-color:
|
|
410
|
+
background-color: var(--dropdown-item-hover);
|
|
240
411
|
}
|
|
241
412
|
|
|
242
413
|
.content-item {
|
|
243
|
-
border: 1px solid
|
|
414
|
+
border: 1px solid var(--content-columns-border);
|
|
244
415
|
border-radius: 6px;
|
|
245
416
|
padding: 16px;
|
|
246
417
|
margin-bottom: 12px;
|
|
247
|
-
background:
|
|
418
|
+
background: var(--content-item-bg);
|
|
248
419
|
}
|
|
249
420
|
|
|
250
421
|
.content-header {
|
|
@@ -258,7 +429,7 @@
|
|
|
258
429
|
margin: 0;
|
|
259
430
|
font-size: 16px;
|
|
260
431
|
font-weight: 600;
|
|
261
|
-
color:
|
|
432
|
+
color: var(--form-label);
|
|
262
433
|
}
|
|
263
434
|
|
|
264
435
|
.content-header-controls {
|
|
@@ -269,10 +440,11 @@
|
|
|
269
440
|
|
|
270
441
|
.content-type-select {
|
|
271
442
|
padding: 4px 8px;
|
|
272
|
-
border: 1px solid
|
|
443
|
+
border: 1px solid var(--input-border);
|
|
273
444
|
border-radius: 4px;
|
|
274
445
|
font-size: 12px;
|
|
275
|
-
background:
|
|
446
|
+
background: var(--dropdown-bg);
|
|
447
|
+
color: inherit;
|
|
276
448
|
}
|
|
277
449
|
|
|
278
450
|
.content-config-section {
|
|
@@ -283,23 +455,107 @@
|
|
|
283
455
|
width: 100%;
|
|
284
456
|
min-height: 80px;
|
|
285
457
|
padding: 8px;
|
|
286
|
-
border: 1px solid
|
|
458
|
+
border: 1px solid var(--input-border);
|
|
287
459
|
border-radius: 4px;
|
|
288
460
|
font-size: 14px;
|
|
289
461
|
font-family: inherit;
|
|
290
462
|
resize: vertical;
|
|
463
|
+
background: var(--input-bg);
|
|
464
|
+
color: inherit;
|
|
465
|
+
scrollbar-color: var(--input-border) transparent;
|
|
291
466
|
}
|
|
292
467
|
|
|
293
468
|
.config-textarea:focus {
|
|
294
469
|
outline: none;
|
|
295
|
-
border-color:
|
|
296
|
-
box-shadow: 0 0 0 3px
|
|
470
|
+
border-color: var(--input-border-focus);
|
|
471
|
+
box-shadow: 0 0 0 3px var(--input-focus-ring);
|
|
472
|
+
}
|
|
473
|
+
`,ut=L`
|
|
474
|
+
/* Theme tokens (defaults) */
|
|
475
|
+
:host {
|
|
476
|
+
--section-bg: #ffffff;
|
|
477
|
+
--section-text: #111827;
|
|
478
|
+
--section-muted: #6b7280;
|
|
479
|
+
--section-border: #e5e7eb;
|
|
480
|
+
|
|
481
|
+
--section-header-bg: #ffffff;
|
|
482
|
+
--section-header-text: #111827;
|
|
483
|
+
|
|
484
|
+
--primary: #3b82f6;
|
|
485
|
+
--primary-contrast: #ffffff;
|
|
486
|
+
--primary-focus-ring: rgba(59, 130, 246, 0.08);
|
|
487
|
+
|
|
488
|
+
--danger: #ef4444;
|
|
489
|
+
--danger-bg: #fee2e2;
|
|
490
|
+
|
|
491
|
+
--muted-bg: #f9fafb;
|
|
492
|
+
--muted-alt-bg: #f8fafc;
|
|
493
|
+
|
|
494
|
+
--card-bg: #ffffff;
|
|
495
|
+
|
|
496
|
+
--radius-md: 6px;
|
|
497
|
+
--radius-sm: 4px;
|
|
498
|
+
|
|
499
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* Dark theme support on the host */
|
|
503
|
+
:host([theme="dark"]),
|
|
504
|
+
:host([data-theme="dark"]) {
|
|
505
|
+
--section-bg: #0b1220;
|
|
506
|
+
--section-text: #f8fafc;
|
|
507
|
+
--section-muted: #94a3b8;
|
|
508
|
+
--section-border: #1f2937;
|
|
509
|
+
|
|
510
|
+
--section-header-bg: #0f1724;
|
|
511
|
+
--section-header-text: #f8fafc;
|
|
512
|
+
|
|
513
|
+
--primary: #60a5fa;
|
|
514
|
+
--primary-contrast: #0b1220;
|
|
515
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.08);
|
|
516
|
+
|
|
517
|
+
--danger: #f87171;
|
|
518
|
+
--danger-bg: #3b0b0b;
|
|
519
|
+
|
|
520
|
+
--muted-bg: transparent;
|
|
521
|
+
--muted-alt-bg: transparent;
|
|
522
|
+
|
|
523
|
+
--card-bg: #0b1220;
|
|
524
|
+
|
|
525
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* Also respect system preference when not in shadow DOM */
|
|
529
|
+
@media (prefers-color-scheme: dark) {
|
|
530
|
+
:host {
|
|
531
|
+
--section-bg: #0b1220;
|
|
532
|
+
--section-text: #f8fafc;
|
|
533
|
+
--section-muted: #94a3b8;
|
|
534
|
+
--section-border: #1f2937;
|
|
535
|
+
|
|
536
|
+
--section-header-bg: #0f1724;
|
|
537
|
+
--section-header-text: #f8fafc;
|
|
538
|
+
|
|
539
|
+
--primary: #60a5fa;
|
|
540
|
+
--primary-contrast: #0b1220;
|
|
541
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.08);
|
|
542
|
+
|
|
543
|
+
--danger: #f87171;
|
|
544
|
+
--danger-bg: #3b0b0b;
|
|
545
|
+
|
|
546
|
+
--muted-bg: transparent;
|
|
547
|
+
--muted-alt-bg: transparent;
|
|
548
|
+
|
|
549
|
+
--card-bg: #0b1220;
|
|
550
|
+
|
|
551
|
+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
552
|
+
}
|
|
297
553
|
}
|
|
298
|
-
|
|
554
|
+
|
|
299
555
|
/* Steps and Questions Sections */
|
|
300
556
|
.section {
|
|
301
557
|
padding: 16px;
|
|
302
|
-
background-color:
|
|
558
|
+
background-color: var(--section-bg);
|
|
303
559
|
}
|
|
304
560
|
|
|
305
561
|
.section-header {
|
|
@@ -313,15 +569,15 @@
|
|
|
313
569
|
margin: 0;
|
|
314
570
|
font-size: 18px;
|
|
315
571
|
font-weight: 600;
|
|
316
|
-
color:
|
|
572
|
+
color: var(--section-header-text);
|
|
317
573
|
}
|
|
318
574
|
|
|
319
575
|
.add-button {
|
|
320
|
-
background-color:
|
|
321
|
-
color:
|
|
322
|
-
border: 1px solid
|
|
576
|
+
background-color: var(--muted-bg); /* Gray background to match sections */
|
|
577
|
+
color: var(--primary);
|
|
578
|
+
border: 1px solid var(--primary);
|
|
323
579
|
padding: 6px 12px;
|
|
324
|
-
border-radius:
|
|
580
|
+
border-radius: var(--radius-md);
|
|
325
581
|
font-size: 14px;
|
|
326
582
|
font-weight: 500;
|
|
327
583
|
cursor: pointer;
|
|
@@ -332,7 +588,7 @@
|
|
|
332
588
|
}
|
|
333
589
|
|
|
334
590
|
.add-button:hover {
|
|
335
|
-
background-color:
|
|
591
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
336
592
|
}
|
|
337
593
|
|
|
338
594
|
.add-button::before {
|
|
@@ -355,26 +611,26 @@
|
|
|
355
611
|
margin: 0 0 8px 0;
|
|
356
612
|
font-size: 16px;
|
|
357
613
|
font-weight: 600;
|
|
358
|
-
color:
|
|
614
|
+
color: var(--section-muted); /* Gray text color */
|
|
359
615
|
}
|
|
360
616
|
|
|
361
617
|
.empty-state p {
|
|
362
618
|
margin: 0 0 24px 0;
|
|
363
|
-
color:
|
|
619
|
+
color: var(--section-muted);
|
|
364
620
|
font-size: 14px;
|
|
365
621
|
line-height: 1.5;
|
|
366
622
|
}
|
|
367
623
|
|
|
368
624
|
.empty-state .add-button {
|
|
369
|
-
background-color:
|
|
370
|
-
color:
|
|
371
|
-
border: 1px solid
|
|
625
|
+
background-color: var(--muted-bg); /* Lighter gray to match background */
|
|
626
|
+
color: var(--primary); /* Blue text to match header buttons */
|
|
627
|
+
border: 1px solid var(--primary); /* Blue border to match header buttons */
|
|
372
628
|
padding: 8px 16px;
|
|
373
629
|
margin: 0 auto; /* Center the button horizontally */
|
|
374
630
|
}
|
|
375
631
|
|
|
376
632
|
.empty-state .add-button:hover {
|
|
377
|
-
background-color:
|
|
633
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
378
634
|
}
|
|
379
635
|
|
|
380
636
|
/* Steps for Questions Section */
|
|
@@ -386,24 +642,24 @@
|
|
|
386
642
|
.steps-empty-state h3 {
|
|
387
643
|
text-align: center; /* Center the heading */
|
|
388
644
|
margin-bottom: 4px;
|
|
389
|
-
color:
|
|
645
|
+
color: var(--section-muted); /* Gray text color */
|
|
390
646
|
}
|
|
391
647
|
|
|
392
648
|
.steps-empty-state p {
|
|
393
649
|
text-align: center; /* Center the text */
|
|
394
650
|
margin-bottom: 16px;
|
|
395
|
-
color:
|
|
651
|
+
color: var(--section-muted);
|
|
396
652
|
}
|
|
397
653
|
|
|
398
654
|
.steps-empty-state .add-button {
|
|
399
|
-
background-color:
|
|
400
|
-
color:
|
|
401
|
-
border: 1px solid
|
|
655
|
+
background-color: var(--muted-bg); /* Lighter gray to match background */
|
|
656
|
+
color: var(--primary); /* Blue text to match header buttons */
|
|
657
|
+
border: 1px solid var(--primary); /* Blue border to match header buttons */
|
|
402
658
|
margin: 0 auto; /* Center the button horizontally */
|
|
403
659
|
}
|
|
404
660
|
|
|
405
661
|
.steps-empty-state .add-button:hover {
|
|
406
|
-
background-color:
|
|
662
|
+
background-color: var(--muted-alt-bg); /* Slightly darker gray on hover */
|
|
407
663
|
}
|
|
408
664
|
|
|
409
665
|
/* Disabled States */
|
|
@@ -427,12 +683,13 @@
|
|
|
427
683
|
|
|
428
684
|
.question-item {
|
|
429
685
|
padding: 16px;
|
|
430
|
-
border: 1px solid
|
|
686
|
+
border: 1px solid var(--section-border);
|
|
431
687
|
border-radius: 8px;
|
|
432
|
-
background-color:
|
|
688
|
+
background-color: var(--card-bg);
|
|
433
689
|
display: flex;
|
|
434
690
|
flex-direction: column;
|
|
435
691
|
gap: 8px;
|
|
692
|
+
box-shadow: var(--shadow-sm);
|
|
436
693
|
}
|
|
437
694
|
|
|
438
695
|
.question-header {
|
|
@@ -447,7 +704,7 @@
|
|
|
447
704
|
margin: 0;
|
|
448
705
|
font-size: 16px;
|
|
449
706
|
font-weight: 600;
|
|
450
|
-
color:
|
|
707
|
+
color: var(--section-text);
|
|
451
708
|
flex: 1;
|
|
452
709
|
}
|
|
453
710
|
|
|
@@ -459,52 +716,54 @@
|
|
|
459
716
|
|
|
460
717
|
.question-type-select {
|
|
461
718
|
padding: 6px 10px;
|
|
462
|
-
border: 1px solid
|
|
463
|
-
border-radius:
|
|
464
|
-
background-color:
|
|
719
|
+
border: 1px solid var(--section-border);
|
|
720
|
+
border-radius: var(--radius-md);
|
|
721
|
+
background-color: var(--card-bg);
|
|
465
722
|
font-size: 13px;
|
|
466
|
-
color:
|
|
723
|
+
color: var(--section-text);
|
|
467
724
|
min-width: 140px;
|
|
468
725
|
}
|
|
469
726
|
|
|
470
727
|
.question-type-select:focus {
|
|
471
728
|
outline: none;
|
|
472
|
-
border-color:
|
|
473
|
-
box-shadow: 0 0 0 3px
|
|
729
|
+
border-color: var(--primary);
|
|
730
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
474
731
|
}
|
|
475
732
|
|
|
476
733
|
.delete-question-button {
|
|
477
734
|
background: none;
|
|
478
735
|
border: none;
|
|
479
|
-
color:
|
|
736
|
+
color: var(--danger);
|
|
480
737
|
font-size: 16px;
|
|
481
738
|
cursor: pointer;
|
|
482
739
|
padding: 4px;
|
|
483
740
|
border-radius: 4px;
|
|
484
741
|
transition: all 0.2s ease;
|
|
742
|
+
line-height: 1;
|
|
485
743
|
}
|
|
486
744
|
|
|
487
745
|
.delete-question-button:hover {
|
|
488
|
-
background-color:
|
|
746
|
+
background-color: var(--danger-bg);
|
|
489
747
|
}
|
|
490
748
|
|
|
491
749
|
.question-label-input {
|
|
492
750
|
padding: 12px;
|
|
493
|
-
border: 1px solid
|
|
751
|
+
border: 1px solid var(--section-border);
|
|
494
752
|
border-radius: 6px;
|
|
495
753
|
font-size: 14px;
|
|
496
|
-
background-color:
|
|
754
|
+
background-color: var(--card-bg);
|
|
497
755
|
transition: border-color 0.2s ease;
|
|
756
|
+
color: var(--section-text);
|
|
498
757
|
}
|
|
499
758
|
|
|
500
759
|
.question-label-input:focus {
|
|
501
760
|
outline: none;
|
|
502
|
-
border-color:
|
|
503
|
-
box-shadow: 0 0 0 3px
|
|
761
|
+
border-color: var(--primary);
|
|
762
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
504
763
|
}
|
|
505
764
|
|
|
506
765
|
.question-label-input::placeholder {
|
|
507
|
-
color:
|
|
766
|
+
color: var(--section-muted);
|
|
508
767
|
}
|
|
509
768
|
|
|
510
769
|
.question-required-label {
|
|
@@ -512,7 +771,7 @@
|
|
|
512
771
|
align-items: center;
|
|
513
772
|
gap: 8px;
|
|
514
773
|
font-size: 14px;
|
|
515
|
-
color:
|
|
774
|
+
color: var(--section-text);
|
|
516
775
|
cursor: pointer;
|
|
517
776
|
}
|
|
518
777
|
|
|
@@ -522,9 +781,9 @@
|
|
|
522
781
|
}
|
|
523
782
|
|
|
524
783
|
.add-question-button {
|
|
525
|
-
background-color:
|
|
526
|
-
color:
|
|
527
|
-
border: 1px solid
|
|
784
|
+
background-color: var(--muted-bg);
|
|
785
|
+
color: var(--primary);
|
|
786
|
+
border: 1px solid var(--primary);
|
|
528
787
|
padding: 8px 16px;
|
|
529
788
|
border-radius: 6px;
|
|
530
789
|
font-size: 14px;
|
|
@@ -539,7 +798,7 @@
|
|
|
539
798
|
}
|
|
540
799
|
|
|
541
800
|
.add-question-button:hover {
|
|
542
|
-
background-color:
|
|
801
|
+
background-color: var(--muted-alt-bg);
|
|
543
802
|
}
|
|
544
803
|
|
|
545
804
|
.add-question-button::before {
|
|
@@ -553,7 +812,7 @@
|
|
|
553
812
|
.question-config-section {
|
|
554
813
|
margin-top: 8px;
|
|
555
814
|
padding-top: 8px;
|
|
556
|
-
border-top: 1px solid
|
|
815
|
+
border-top: 1px solid var(--section-border);
|
|
557
816
|
}
|
|
558
817
|
|
|
559
818
|
.options-label,
|
|
@@ -561,7 +820,7 @@
|
|
|
561
820
|
display: block;
|
|
562
821
|
font-size: 13px;
|
|
563
822
|
font-weight: 500;
|
|
564
|
-
color:
|
|
823
|
+
color: var(--section-text);
|
|
565
824
|
margin-bottom: 8px;
|
|
566
825
|
}
|
|
567
826
|
|
|
@@ -580,22 +839,23 @@
|
|
|
580
839
|
.option-input {
|
|
581
840
|
flex: 1;
|
|
582
841
|
padding: 8px 10px;
|
|
583
|
-
border: 1px solid
|
|
842
|
+
border: 1px solid var(--section-border);
|
|
584
843
|
border-radius: 4px;
|
|
585
844
|
font-size: 13px;
|
|
586
|
-
background-color:
|
|
845
|
+
background-color: var(--card-bg);
|
|
846
|
+
color: var(--section-text);
|
|
587
847
|
}
|
|
588
848
|
|
|
589
849
|
.option-input:focus {
|
|
590
850
|
outline: none;
|
|
591
|
-
border-color:
|
|
592
|
-
box-shadow: 0 0 0 2px
|
|
851
|
+
border-color: var(--primary);
|
|
852
|
+
box-shadow: 0 0 0 2px var(--primary-focus-ring);
|
|
593
853
|
}
|
|
594
854
|
|
|
595
855
|
.remove-option-button {
|
|
596
856
|
background: none;
|
|
597
857
|
border: none;
|
|
598
|
-
color:
|
|
858
|
+
color: var(--danger);
|
|
599
859
|
font-size: 16px;
|
|
600
860
|
cursor: pointer;
|
|
601
861
|
padding: 4px 6px;
|
|
@@ -605,13 +865,13 @@
|
|
|
605
865
|
}
|
|
606
866
|
|
|
607
867
|
.remove-option-button:hover {
|
|
608
|
-
background-color:
|
|
868
|
+
background-color: var(--danger-bg);
|
|
609
869
|
}
|
|
610
870
|
|
|
611
871
|
.add-option-button {
|
|
612
872
|
background: none;
|
|
613
|
-
border: 1px dashed
|
|
614
|
-
color:
|
|
873
|
+
border: 1px dashed var(--section-border);
|
|
874
|
+
color: var(--section-muted);
|
|
615
875
|
padding: 8px 12px;
|
|
616
876
|
border-radius: 4px;
|
|
617
877
|
font-size: 13px;
|
|
@@ -621,38 +881,135 @@
|
|
|
621
881
|
}
|
|
622
882
|
|
|
623
883
|
.add-option-button:hover {
|
|
624
|
-
border-color:
|
|
625
|
-
color:
|
|
626
|
-
background-color:
|
|
884
|
+
border-color: var(--primary);
|
|
885
|
+
color: var(--primary);
|
|
886
|
+
background-color: var(--muted-alt-bg);
|
|
627
887
|
}
|
|
628
888
|
|
|
629
889
|
.config-input {
|
|
630
890
|
width: 100%;
|
|
631
891
|
padding: 8px 10px;
|
|
632
|
-
border: 1px solid
|
|
892
|
+
border: 1px solid var(--section-border);
|
|
633
893
|
border-radius: 4px;
|
|
634
894
|
font-size: 13px;
|
|
635
|
-
background-color:
|
|
895
|
+
background-color: var(--card-bg);
|
|
636
896
|
margin-top: 4px;
|
|
897
|
+
color: var(--section-text);
|
|
637
898
|
}
|
|
638
899
|
|
|
639
900
|
.config-input:focus {
|
|
640
901
|
outline: none;
|
|
641
|
-
border-color:
|
|
642
|
-
box-shadow: 0 0 0 2px
|
|
902
|
+
border-color: var(--primary);
|
|
903
|
+
box-shadow: 0 0 0 2px var(--primary-focus-ring);
|
|
643
904
|
}
|
|
644
905
|
|
|
645
906
|
.config-note {
|
|
646
907
|
margin: 0;
|
|
647
908
|
font-size: 13px;
|
|
648
|
-
color:
|
|
909
|
+
color: var(--section-muted);
|
|
649
910
|
font-style: italic;
|
|
650
911
|
padding: 8px 12px;
|
|
651
|
-
background-color:
|
|
912
|
+
background-color: var(--muted-alt-bg);
|
|
652
913
|
border-radius: 4px;
|
|
653
|
-
border-left: 3px solid
|
|
914
|
+
border-left: 3px solid var(--section-border);
|
|
915
|
+
}
|
|
916
|
+
`,Ne=L`
|
|
917
|
+
/* Theme tokens (defaults) */
|
|
918
|
+
:host {
|
|
919
|
+
--bg: #f8fafc;
|
|
920
|
+
|
|
921
|
+
--panel-bg: #ffffff;
|
|
922
|
+
--card-bg: #ffffff;
|
|
923
|
+
--text: #111827;
|
|
924
|
+
--muted: #6b7280;
|
|
925
|
+
--muted-weak: #9ca3af;
|
|
926
|
+
--muted-surface: #f3f4f6;
|
|
927
|
+
--muted-border: #d1d5db
|
|
928
|
+
--border: #e5e7eb;
|
|
929
|
+
|
|
930
|
+
--primary: #3b82f6;
|
|
931
|
+
--primary-600: #2563eb;
|
|
932
|
+
--primary-600-border: #1d4ed8;
|
|
933
|
+
--primary-100-bg: #eff6ff;
|
|
934
|
+
--primary-badge-bg: #e0e7ff;
|
|
935
|
+
--primary-badge-text: #3730a3;
|
|
936
|
+
|
|
937
|
+
--danger: #ef4444;
|
|
938
|
+
--danger-100-bg: #fef2f2;
|
|
939
|
+
|
|
940
|
+
--success: #22c55e;
|
|
941
|
+
|
|
942
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
943
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
944
|
+
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
945
|
+
|
|
946
|
+
--radius-md: 6px;
|
|
947
|
+
--radius-lg: 12px;
|
|
948
|
+
|
|
949
|
+
--overlay-bg: rgba(0, 0, 0, 0.4);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/* Dark theme on host */
|
|
953
|
+
:host([theme="dark"]),
|
|
954
|
+
:host([data-theme="dark"]) {
|
|
955
|
+
--bg: #0b1220;
|
|
956
|
+
--panel-bg: #0f1724;
|
|
957
|
+
--card-bg: #0b1220;
|
|
958
|
+
--text: #f8fafc;
|
|
959
|
+
--muted: #94a3b8;
|
|
960
|
+
--muted-weak: #374151;
|
|
961
|
+
--muted-surface: #06202b;
|
|
962
|
+
--border: #1f2937;
|
|
963
|
+
|
|
964
|
+
--primary: #60a5fa;
|
|
965
|
+
--primary-600: #3b82f6;
|
|
966
|
+
--primary-100-bg: #0b2a4a;
|
|
967
|
+
--primary-badge-bg: #0b1b3b;
|
|
968
|
+
--primary-badge-text: #cfe7ff;
|
|
969
|
+
|
|
970
|
+
--danger: #f87171;
|
|
971
|
+
--danger-100-bg: rgba(248, 113, 113, 0.08);
|
|
972
|
+
|
|
973
|
+
--success: #22c55e;
|
|
974
|
+
|
|
975
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
976
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
977
|
+
--shadow-md: 0 2px 8px rgba(2, 6, 23, 0.6);
|
|
978
|
+
|
|
979
|
+
--overlay-bg: rgba(0, 0, 0, 0.6);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/* Respect system preference (non-shadow DOM usage) */
|
|
983
|
+
@media (prefers-color-scheme: dark) {
|
|
984
|
+
:host {
|
|
985
|
+
--bg: #0b1220;
|
|
986
|
+
--panel-bg: #0f1724;
|
|
987
|
+
--card-bg: #0b1220;
|
|
988
|
+
--text: #f8fafc;
|
|
989
|
+
--muted: #94a3b8;
|
|
990
|
+
--muted-weak: #374151;
|
|
991
|
+
--muted-surface: #06202b;
|
|
992
|
+
--border: #1f2937;
|
|
993
|
+
|
|
994
|
+
--primary: #60a5fa;
|
|
995
|
+
--primary-600: #3b82f6;
|
|
996
|
+
--primary-100-bg: #0b2a4a;
|
|
997
|
+
--primary-badge-bg: #0b1b3b;
|
|
998
|
+
--primary-badge-text: #cfe7ff;
|
|
999
|
+
|
|
1000
|
+
--danger: #f87171;
|
|
1001
|
+
--danger-100-bg: rgba(248, 113, 113, 0.08);
|
|
1002
|
+
|
|
1003
|
+
--success: #22c55e;
|
|
1004
|
+
|
|
1005
|
+
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
1006
|
+
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
|
|
1007
|
+
--shadow-md: 0 2px 8px rgba(2, 6, 23, 0.6);
|
|
1008
|
+
|
|
1009
|
+
--overlay-bg: rgba(0, 0, 0, 0.6);
|
|
1010
|
+
}
|
|
654
1011
|
}
|
|
655
|
-
|
|
1012
|
+
|
|
656
1013
|
/* Builder Step Styles */
|
|
657
1014
|
.steps-list {
|
|
658
1015
|
display: flex;
|
|
@@ -664,26 +1021,26 @@
|
|
|
664
1021
|
display: flex;
|
|
665
1022
|
align-items: center;
|
|
666
1023
|
padding: 12px;
|
|
667
|
-
border: 1px solid
|
|
668
|
-
border-radius:
|
|
669
|
-
background-color:
|
|
1024
|
+
border: 1px solid var(--border);
|
|
1025
|
+
border-radius: var(--radius-md);
|
|
1026
|
+
background-color: var(--card-bg);
|
|
670
1027
|
cursor: pointer;
|
|
671
1028
|
transition: all 0.2s ease;
|
|
672
1029
|
gap: 12px;
|
|
673
1030
|
}
|
|
674
1031
|
|
|
675
1032
|
.step-item:hover {
|
|
676
|
-
border-color:
|
|
677
|
-
background-color:
|
|
1033
|
+
border-color: var(--muted-border);
|
|
1034
|
+
background-color: var(--muted-surface);
|
|
678
1035
|
}
|
|
679
1036
|
|
|
680
1037
|
.step-item.selected {
|
|
681
|
-
border-color:
|
|
682
|
-
background-color:
|
|
1038
|
+
border-color: var(--primary);
|
|
1039
|
+
background-color: var(--primary-100-bg);
|
|
683
1040
|
}
|
|
684
1041
|
|
|
685
1042
|
.step-handle {
|
|
686
|
-
color:
|
|
1043
|
+
color: var(--muted);
|
|
687
1044
|
font-size: 14px;
|
|
688
1045
|
cursor: grab;
|
|
689
1046
|
user-select: none;
|
|
@@ -702,7 +1059,7 @@
|
|
|
702
1059
|
|
|
703
1060
|
.step-content strong {
|
|
704
1061
|
font-weight: 600;
|
|
705
|
-
color:
|
|
1062
|
+
color: var(--text);
|
|
706
1063
|
font-size: 14px;
|
|
707
1064
|
}
|
|
708
1065
|
|
|
@@ -715,7 +1072,7 @@
|
|
|
715
1072
|
.step-menu {
|
|
716
1073
|
background: none;
|
|
717
1074
|
border: none;
|
|
718
|
-
color:
|
|
1075
|
+
color: var(--muted-weak);
|
|
719
1076
|
font-size: 16px;
|
|
720
1077
|
cursor: pointer;
|
|
721
1078
|
padding: 4px;
|
|
@@ -724,8 +1081,8 @@
|
|
|
724
1081
|
}
|
|
725
1082
|
|
|
726
1083
|
.step-menu:hover {
|
|
727
|
-
background-color:
|
|
728
|
-
color:
|
|
1084
|
+
background-color: var(--muted-surface);
|
|
1085
|
+
color: var(--muted);
|
|
729
1086
|
}
|
|
730
1087
|
|
|
731
1088
|
.step-menu-container {
|
|
@@ -736,12 +1093,10 @@
|
|
|
736
1093
|
position: absolute;
|
|
737
1094
|
top: calc(100% + 4px);
|
|
738
1095
|
right: 0;
|
|
739
|
-
background:
|
|
740
|
-
border: 1px solid
|
|
741
|
-
border-radius:
|
|
742
|
-
box-shadow:
|
|
743
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
744
|
-
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
1096
|
+
background: var(--panel-bg);
|
|
1097
|
+
border: 1px solid var(--border);
|
|
1098
|
+
border-radius: var(--radius-lg);
|
|
1099
|
+
box-shadow: var(--shadow-md);
|
|
745
1100
|
min-width: 160px;
|
|
746
1101
|
z-index: 100;
|
|
747
1102
|
overflow: hidden;
|
|
@@ -758,21 +1113,21 @@
|
|
|
758
1113
|
text-align: left;
|
|
759
1114
|
cursor: pointer;
|
|
760
1115
|
font-size: 14px;
|
|
761
|
-
color:
|
|
1116
|
+
color: var(--text);
|
|
762
1117
|
transition: background 0.2s;
|
|
763
1118
|
font-family: inherit;
|
|
764
1119
|
}
|
|
765
1120
|
|
|
766
1121
|
.step-menu-item:hover {
|
|
767
|
-
background:
|
|
1122
|
+
background: var(--muted-surface);
|
|
768
1123
|
}
|
|
769
1124
|
|
|
770
1125
|
.step-menu-item.danger {
|
|
771
|
-
color:
|
|
1126
|
+
color: var(--danger);
|
|
772
1127
|
}
|
|
773
1128
|
|
|
774
1129
|
.step-menu-item.danger:hover {
|
|
775
|
-
background:
|
|
1130
|
+
background: var(--danger-100-bg);
|
|
776
1131
|
}
|
|
777
1132
|
|
|
778
1133
|
.step-menu-icon {
|
|
@@ -780,12 +1135,13 @@
|
|
|
780
1135
|
width: 20px;
|
|
781
1136
|
text-align: center;
|
|
782
1137
|
}
|
|
1138
|
+
|
|
783
1139
|
.runner-layout {
|
|
784
1140
|
display: flex;
|
|
785
1141
|
width: 100%;
|
|
786
1142
|
min-height: 100vh;
|
|
787
1143
|
box-sizing: border-box;
|
|
788
|
-
background:
|
|
1144
|
+
background: var(--bg);
|
|
789
1145
|
gap: 32px;
|
|
790
1146
|
overflow: hidden;
|
|
791
1147
|
position: relative;
|
|
@@ -798,7 +1154,7 @@
|
|
|
798
1154
|
left: 0;
|
|
799
1155
|
right: 0;
|
|
800
1156
|
bottom: 0;
|
|
801
|
-
background:
|
|
1157
|
+
background: var(--overlay-bg);
|
|
802
1158
|
display: flex;
|
|
803
1159
|
align-items: flex-start;
|
|
804
1160
|
justify-content: center;
|
|
@@ -808,12 +1164,10 @@
|
|
|
808
1164
|
}
|
|
809
1165
|
|
|
810
1166
|
.runner-loading-box {
|
|
811
|
-
background:
|
|
1167
|
+
background: var(--panel-bg);
|
|
812
1168
|
border-radius: 8px;
|
|
813
1169
|
padding: 24px 48px;
|
|
814
|
-
box-shadow:
|
|
815
|
-
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
816
|
-
0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
|
1170
|
+
box-shadow: var(--shadow-sm);
|
|
817
1171
|
display: flex;
|
|
818
1172
|
flex-direction: row;
|
|
819
1173
|
align-items: center;
|
|
@@ -825,14 +1179,14 @@
|
|
|
825
1179
|
.runner-loading-spinner {
|
|
826
1180
|
width: 48px;
|
|
827
1181
|
height: 48px;
|
|
828
|
-
border: 4px solid
|
|
829
|
-
border-top: 4px solid
|
|
1182
|
+
border: 4px solid var(--border);
|
|
1183
|
+
border-top: 4px solid var(--primary);
|
|
830
1184
|
border-radius: 50%;
|
|
831
1185
|
animation: runner-spin 1s linear infinite;
|
|
832
1186
|
}
|
|
833
1187
|
|
|
834
1188
|
.runner-loading-text {
|
|
835
|
-
color:
|
|
1189
|
+
color: var(--muted);
|
|
836
1190
|
font-size: 16px;
|
|
837
1191
|
font-weight: 500;
|
|
838
1192
|
text-align: center;
|
|
@@ -850,8 +1204,8 @@
|
|
|
850
1204
|
.runner-sidebar {
|
|
851
1205
|
width: 380px;
|
|
852
1206
|
min-width: 320px;
|
|
853
|
-
background:
|
|
854
|
-
border-right: 1px solid
|
|
1207
|
+
background: var(--bg);
|
|
1208
|
+
border-right: 1px solid var(--border);
|
|
855
1209
|
padding: 40px 32px 40px 32px;
|
|
856
1210
|
display: flex;
|
|
857
1211
|
flex-direction: column;
|
|
@@ -862,7 +1216,7 @@
|
|
|
862
1216
|
.runner-sidebar-header {
|
|
863
1217
|
font-size: 1.15rem;
|
|
864
1218
|
font-weight: 700;
|
|
865
|
-
color:
|
|
1219
|
+
color: var(--text);
|
|
866
1220
|
margin-bottom: 24px;
|
|
867
1221
|
letter-spacing: 0.01em;
|
|
868
1222
|
text-align: left;
|
|
@@ -883,8 +1237,8 @@
|
|
|
883
1237
|
justify-content: space-between;
|
|
884
1238
|
padding: 18px 18px 18px 20px;
|
|
885
1239
|
border-radius: 12px;
|
|
886
|
-
background:
|
|
887
|
-
box-shadow:
|
|
1240
|
+
background: var(--card-bg);
|
|
1241
|
+
box-shadow: var(--shadow-xs);
|
|
888
1242
|
margin-bottom: 0;
|
|
889
1243
|
cursor: pointer;
|
|
890
1244
|
border: 2px solid transparent;
|
|
@@ -893,26 +1247,30 @@
|
|
|
893
1247
|
box-shadow 0.2s;
|
|
894
1248
|
gap: 12px;
|
|
895
1249
|
}
|
|
1250
|
+
|
|
896
1251
|
.runner-step-item.active {
|
|
897
|
-
border: 2px solid
|
|
898
|
-
background:
|
|
1252
|
+
border: 2px solid var(--primary);
|
|
1253
|
+
background: var(--card-bg);
|
|
899
1254
|
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
|
|
900
1255
|
}
|
|
1256
|
+
|
|
901
1257
|
.runner-step-title {
|
|
902
1258
|
font-weight: 500;
|
|
903
|
-
color:
|
|
1259
|
+
color: var(--text);
|
|
904
1260
|
font-size: 0.97rem;
|
|
905
1261
|
flex: 1;
|
|
906
1262
|
min-width: 0;
|
|
907
1263
|
line-height: 1.4;
|
|
908
1264
|
}
|
|
1265
|
+
|
|
909
1266
|
.runner-step-item.active .runner-step-title {
|
|
910
1267
|
font-weight: 700;
|
|
911
1268
|
font-size: 1.07rem;
|
|
912
1269
|
}
|
|
1270
|
+
|
|
913
1271
|
.runner-step-badge {
|
|
914
|
-
background:
|
|
915
|
-
color:
|
|
1272
|
+
background: var(--primary-badge-bg);
|
|
1273
|
+
color: var(--primary-badge-text);
|
|
916
1274
|
font-size: 12px;
|
|
917
1275
|
font-weight: 600;
|
|
918
1276
|
border-radius: 6px;
|
|
@@ -927,7 +1285,7 @@
|
|
|
927
1285
|
flex: 1;
|
|
928
1286
|
width: 100%;
|
|
929
1287
|
padding: 56px 64px 56px 64px;
|
|
930
|
-
background:
|
|
1288
|
+
background: var(--bg);
|
|
931
1289
|
min-width: 0;
|
|
932
1290
|
display: flex;
|
|
933
1291
|
flex-direction: column;
|
|
@@ -947,17 +1305,18 @@
|
|
|
947
1305
|
.runner-step-header h2.runner-step-title {
|
|
948
1306
|
font-size: 1.5rem;
|
|
949
1307
|
font-weight: 700;
|
|
950
|
-
color:
|
|
1308
|
+
color: var(--text);
|
|
951
1309
|
}
|
|
952
1310
|
|
|
953
1311
|
.runner-step-divider {
|
|
954
1312
|
border: none;
|
|
955
|
-
border-top: 1px solid
|
|
956
|
-
margin: 20px 0
|
|
1313
|
+
border-top: 1px solid var(--border);
|
|
1314
|
+
margin: 20px 0;
|
|
957
1315
|
width: 100%;
|
|
958
1316
|
}
|
|
1317
|
+
|
|
959
1318
|
.runner-step-desc {
|
|
960
|
-
color:
|
|
1319
|
+
color: var(--muted);
|
|
961
1320
|
font-size: 1rem;
|
|
962
1321
|
margin: 0;
|
|
963
1322
|
}
|
|
@@ -974,8 +1333,9 @@
|
|
|
974
1333
|
margin-top: 24px;
|
|
975
1334
|
padding-right: 0;
|
|
976
1335
|
}
|
|
1336
|
+
|
|
977
1337
|
.next-button {
|
|
978
|
-
background:
|
|
1338
|
+
background: var(--primary);
|
|
979
1339
|
color: #fff;
|
|
980
1340
|
border: none;
|
|
981
1341
|
border-radius: 6px;
|
|
@@ -989,16 +1349,17 @@
|
|
|
989
1349
|
box-sizing: border-box;
|
|
990
1350
|
align-self: flex-end;
|
|
991
1351
|
}
|
|
1352
|
+
|
|
992
1353
|
.next-button:hover {
|
|
993
|
-
background:
|
|
1354
|
+
background: var(--primary-600);
|
|
994
1355
|
}
|
|
995
1356
|
|
|
996
1357
|
:global(body) {
|
|
997
|
-
background:
|
|
1358
|
+
background: var(--bg);
|
|
998
1359
|
}
|
|
999
1360
|
|
|
1000
1361
|
.runner-card {
|
|
1001
|
-
background:
|
|
1362
|
+
background: var(--card-bg);
|
|
1002
1363
|
border-radius: 12px;
|
|
1003
1364
|
padding: 24px 24px 20px 24px;
|
|
1004
1365
|
margin-bottom: 0;
|
|
@@ -1010,20 +1371,20 @@
|
|
|
1010
1371
|
font-size: 1rem;
|
|
1011
1372
|
font-weight: 600;
|
|
1012
1373
|
margin-bottom: 8px;
|
|
1013
|
-
color:
|
|
1374
|
+
color: var(--text);
|
|
1014
1375
|
display: flex;
|
|
1015
1376
|
align-items: center;
|
|
1016
1377
|
}
|
|
1017
1378
|
|
|
1018
1379
|
.runner-question-required {
|
|
1019
|
-
color:
|
|
1380
|
+
color: var(--danger);
|
|
1020
1381
|
font-size: 1.1em;
|
|
1021
1382
|
margin-left: 4px;
|
|
1022
1383
|
}
|
|
1023
1384
|
|
|
1024
1385
|
.runner-question-divider {
|
|
1025
1386
|
border: none;
|
|
1026
|
-
border-top: 1.5px solid
|
|
1387
|
+
border-top: 1.5px solid var(--border);
|
|
1027
1388
|
margin: 12px 0 20px 0;
|
|
1028
1389
|
}
|
|
1029
1390
|
|
|
@@ -1036,11 +1397,11 @@
|
|
|
1036
1397
|
.runner-card select {
|
|
1037
1398
|
width: 100%;
|
|
1038
1399
|
padding: 12px 16px;
|
|
1039
|
-
border: 1px solid
|
|
1400
|
+
border: 1px solid var(--border);
|
|
1040
1401
|
border-radius: 12px;
|
|
1041
1402
|
font-size: 14px;
|
|
1042
|
-
background-color:
|
|
1043
|
-
color:
|
|
1403
|
+
background-color: var(--bg);
|
|
1404
|
+
color: var(--text);
|
|
1044
1405
|
transition: all 0.2s ease;
|
|
1045
1406
|
box-sizing: border-box;
|
|
1046
1407
|
}
|
|
@@ -1052,16 +1413,14 @@
|
|
|
1052
1413
|
.runner-card textarea:focus,
|
|
1053
1414
|
.runner-card select:focus {
|
|
1054
1415
|
outline: none;
|
|
1055
|
-
border-color:
|
|
1056
|
-
background-color:
|
|
1416
|
+
border-color: var(--primary);
|
|
1417
|
+
background-color: var(--card-bg);
|
|
1057
1418
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
1058
1419
|
}
|
|
1059
1420
|
|
|
1060
|
-
.runner-card input
|
|
1061
|
-
.runner-card input[type="email"]::placeholder,
|
|
1062
|
-
.runner-card input[type="number"]::placeholder,
|
|
1421
|
+
.runner-card input::placeholder,
|
|
1063
1422
|
.runner-card textarea::placeholder {
|
|
1064
|
-
color:
|
|
1423
|
+
color: var(--muted-weak);
|
|
1065
1424
|
}
|
|
1066
1425
|
|
|
1067
1426
|
.runner-card textarea {
|
|
@@ -1077,7 +1436,7 @@
|
|
|
1077
1436
|
}
|
|
1078
1437
|
|
|
1079
1438
|
.runner-card select.placeholder {
|
|
1080
|
-
color:
|
|
1439
|
+
color: var(--muted-weak);
|
|
1081
1440
|
}
|
|
1082
1441
|
|
|
1083
1442
|
/* Radio group styling */
|
|
@@ -1085,7 +1444,7 @@
|
|
|
1085
1444
|
display: flex;
|
|
1086
1445
|
flex-direction: column;
|
|
1087
1446
|
gap: 8px;
|
|
1088
|
-
background-color:
|
|
1447
|
+
background-color: var(--card-bg);
|
|
1089
1448
|
padding: 16px;
|
|
1090
1449
|
}
|
|
1091
1450
|
|
|
@@ -1107,18 +1466,18 @@
|
|
|
1107
1466
|
margin-right: 12px;
|
|
1108
1467
|
width: 18px;
|
|
1109
1468
|
height: 18px;
|
|
1110
|
-
accent-color:
|
|
1469
|
+
accent-color: var(--primary);
|
|
1111
1470
|
cursor: pointer;
|
|
1112
1471
|
}
|
|
1113
1472
|
|
|
1114
1473
|
.radio-option input[type="radio"]:checked + .radio-label {
|
|
1115
1474
|
font-weight: 600;
|
|
1116
|
-
color:
|
|
1475
|
+
color: var(--text);
|
|
1117
1476
|
}
|
|
1118
1477
|
|
|
1119
1478
|
.radio-label {
|
|
1120
1479
|
font-size: 16px;
|
|
1121
|
-
color:
|
|
1480
|
+
color: var(--muted-weak);
|
|
1122
1481
|
cursor: pointer;
|
|
1123
1482
|
flex: 1;
|
|
1124
1483
|
}
|
|
@@ -1129,12 +1488,12 @@
|
|
|
1129
1488
|
box-shadow: none;
|
|
1130
1489
|
}
|
|
1131
1490
|
|
|
1132
|
-
/* Checkbox group styling */
|
|
1491
|
+
/* Checkbox group styling (reuse tokens) */
|
|
1133
1492
|
.checkbox-group {
|
|
1134
1493
|
display: flex;
|
|
1135
1494
|
flex-direction: column;
|
|
1136
1495
|
gap: 8px;
|
|
1137
|
-
background-color:
|
|
1496
|
+
background-color: var(--card-bg);
|
|
1138
1497
|
padding: 16px;
|
|
1139
1498
|
}
|
|
1140
1499
|
|
|
@@ -1147,7 +1506,7 @@
|
|
|
1147
1506
|
background-color: transparent;
|
|
1148
1507
|
transition: all 0.2s ease;
|
|
1149
1508
|
}
|
|
1150
|
-
|
|
1509
|
+
|
|
1151
1510
|
.checkbox-option:hover {
|
|
1152
1511
|
background-color: transparent;
|
|
1153
1512
|
}
|
|
@@ -1156,18 +1515,18 @@
|
|
|
1156
1515
|
margin-right: 12px;
|
|
1157
1516
|
width: 18px;
|
|
1158
1517
|
height: 18px;
|
|
1159
|
-
accent-color:
|
|
1518
|
+
accent-color: var(--primary);
|
|
1160
1519
|
cursor: pointer;
|
|
1161
1520
|
}
|
|
1162
1521
|
|
|
1163
1522
|
.checkbox-option input[type="checkbox"]:checked + .checkbox-label {
|
|
1164
1523
|
font-weight: 600;
|
|
1165
|
-
color:
|
|
1524
|
+
color: var(--text);
|
|
1166
1525
|
}
|
|
1167
1526
|
|
|
1168
1527
|
.checkbox-label {
|
|
1169
1528
|
font-size: 16px;
|
|
1170
|
-
color:
|
|
1529
|
+
color: var(--muted);
|
|
1171
1530
|
cursor: pointer;
|
|
1172
1531
|
flex: 1;
|
|
1173
1532
|
}
|
|
@@ -1178,7 +1537,10 @@
|
|
|
1178
1537
|
box-shadow: none;
|
|
1179
1538
|
}
|
|
1180
1539
|
|
|
1181
|
-
/*
|
|
1540
|
+
/* Signature, file upload, error, print, mobile, etc. */
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
/* Single checkbox styling */
|
|
1182
1544
|
.checkbox-single {
|
|
1183
1545
|
display: flex;
|
|
1184
1546
|
align-items: center;
|
|
@@ -1198,13 +1560,13 @@
|
|
|
1198
1560
|
margin-right: 12px;
|
|
1199
1561
|
width: 18px;
|
|
1200
1562
|
height: 18px;
|
|
1201
|
-
accent-color:
|
|
1563
|
+
accent-color: var(--primary);
|
|
1202
1564
|
cursor: pointer;
|
|
1203
1565
|
}
|
|
1204
1566
|
|
|
1205
1567
|
.checkbox-single input[type="checkbox"]:checked + .checkbox-label {
|
|
1206
1568
|
font-weight: 600;
|
|
1207
|
-
color:
|
|
1569
|
+
color: var(--text);
|
|
1208
1570
|
}
|
|
1209
1571
|
|
|
1210
1572
|
.checkbox-single:has(input[type="checkbox"]:checked) {
|
|
@@ -1213,7 +1575,6 @@
|
|
|
1213
1575
|
box-shadow: none;
|
|
1214
1576
|
}
|
|
1215
1577
|
|
|
1216
|
-
/* Signature styling */
|
|
1217
1578
|
.signature-container {
|
|
1218
1579
|
display: flex;
|
|
1219
1580
|
flex-direction: column;
|
|
@@ -1223,9 +1584,9 @@
|
|
|
1223
1584
|
.signature-canvas {
|
|
1224
1585
|
width: 100%;
|
|
1225
1586
|
height: 200px;
|
|
1226
|
-
border: 1px solid
|
|
1587
|
+
border: 1px solid var(--border);
|
|
1227
1588
|
border-radius: 8px;
|
|
1228
|
-
background-color:
|
|
1589
|
+
background-color: var(--card-bg);
|
|
1229
1590
|
cursor: crosshair;
|
|
1230
1591
|
max-width: 700px;
|
|
1231
1592
|
}
|
|
@@ -1236,9 +1597,9 @@
|
|
|
1236
1597
|
}
|
|
1237
1598
|
|
|
1238
1599
|
.signature-clear-btn {
|
|
1239
|
-
background:
|
|
1240
|
-
color:
|
|
1241
|
-
border: 1px solid
|
|
1600
|
+
background: var(--muted-surface);
|
|
1601
|
+
color: var(--muted-weak);
|
|
1602
|
+
border: 1px solid var(--primary-600);
|
|
1242
1603
|
border-radius: 6px;
|
|
1243
1604
|
padding: 8px 16px;
|
|
1244
1605
|
font-size: 14px;
|
|
@@ -1248,14 +1609,15 @@
|
|
|
1248
1609
|
}
|
|
1249
1610
|
|
|
1250
1611
|
.signature-clear-btn:hover {
|
|
1251
|
-
background:
|
|
1252
|
-
border-color:
|
|
1612
|
+
background: var(--muted-weak);
|
|
1613
|
+
border-color: var(--muted-weak);
|
|
1253
1614
|
}
|
|
1254
1615
|
|
|
1255
|
-
.signature-save-btn
|
|
1256
|
-
|
|
1616
|
+
.signature-save-btn,
|
|
1617
|
+
.signature-replace-btn {
|
|
1618
|
+
background: var(--primary);
|
|
1257
1619
|
color: white;
|
|
1258
|
-
border: 1px solid
|
|
1620
|
+
border: 1px solid var(--primary-600, var(--primary-600));
|
|
1259
1621
|
border-radius: 6px;
|
|
1260
1622
|
padding: 8px 16px;
|
|
1261
1623
|
font-size: 14px;
|
|
@@ -1264,41 +1626,14 @@
|
|
|
1264
1626
|
transition: all 0.2s ease;
|
|
1265
1627
|
}
|
|
1266
1628
|
|
|
1267
|
-
.signature-save-btn:hover
|
|
1268
|
-
background: #2563eb;
|
|
1269
|
-
border-color: #1d4ed8;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
.signature-saved {
|
|
1273
|
-
color: #059669;
|
|
1274
|
-
font-size: 14px;
|
|
1275
|
-
font-weight: 500;
|
|
1276
|
-
display: flex;
|
|
1277
|
-
align-items: center;
|
|
1278
|
-
gap: 4px;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.signature-replace-btn {
|
|
1282
|
-
background: #3b82f6;
|
|
1283
|
-
color: white;
|
|
1284
|
-
border: none;
|
|
1285
|
-
padding: 8px 16px;
|
|
1286
|
-
border-radius: 4px;
|
|
1287
|
-
cursor: pointer;
|
|
1288
|
-
font-size: 0.875rem;
|
|
1289
|
-
font-weight: 500;
|
|
1290
|
-
transition: background-color 0.2s ease;
|
|
1291
|
-
display: inline-flex;
|
|
1292
|
-
align-items: center;
|
|
1293
|
-
gap: 6px;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1629
|
+
.signature-save-btn:hover,
|
|
1296
1630
|
.signature-replace-btn:hover {
|
|
1297
|
-
background:
|
|
1631
|
+
background: var(--primary-600),
|
|
1632
|
+
border-color: var(--primary-600-border);
|
|
1298
1633
|
}
|
|
1299
1634
|
|
|
1300
1635
|
.signature-cancel-btn {
|
|
1301
|
-
background:
|
|
1636
|
+
background: var(--muted);
|
|
1302
1637
|
color: white;
|
|
1303
1638
|
border: none;
|
|
1304
1639
|
padding: 8px 16px;
|
|
@@ -1310,42 +1645,31 @@
|
|
|
1310
1645
|
}
|
|
1311
1646
|
|
|
1312
1647
|
.signature-cancel-btn:hover {
|
|
1313
|
-
background:
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
/* File Upload Styles */
|
|
1317
|
-
.file-upload-container {
|
|
1318
|
-
display: flex;
|
|
1319
|
-
flex-direction: column;
|
|
1320
|
-
gap: 12px;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
.file-input {
|
|
1324
|
-
display: none;
|
|
1648
|
+
background: var(--muted-weak);
|
|
1325
1649
|
}
|
|
1326
1650
|
|
|
1327
1651
|
.file-placeholder {
|
|
1328
|
-
background:
|
|
1652
|
+
background: var(--muted-weak);
|
|
1329
1653
|
border: 2px dashed #d1d5db;
|
|
1330
1654
|
border-radius: 8px;
|
|
1331
1655
|
padding: 24px;
|
|
1332
1656
|
text-align: center;
|
|
1333
|
-
color:
|
|
1657
|
+
color: var(--muted);
|
|
1334
1658
|
cursor: pointer;
|
|
1335
1659
|
transition: all 0.2s ease;
|
|
1336
1660
|
}
|
|
1337
1661
|
|
|
1338
1662
|
.file-placeholder:hover {
|
|
1339
|
-
border-color:
|
|
1340
|
-
background:
|
|
1341
|
-
color:
|
|
1663
|
+
border-color: var(--primary);
|
|
1664
|
+
background: var(--primary-100-bg);
|
|
1665
|
+
color: var(--primary);
|
|
1342
1666
|
}
|
|
1343
1667
|
|
|
1344
1668
|
.file-info {
|
|
1345
1669
|
display: flex;
|
|
1346
1670
|
align-items: center;
|
|
1347
1671
|
gap: 12px;
|
|
1348
|
-
background:
|
|
1672
|
+
background: var(--primary-100-bg);
|
|
1349
1673
|
border: 1px solid #bae6fd;
|
|
1350
1674
|
border-radius: 8px;
|
|
1351
1675
|
padding: 12px 16px;
|
|
@@ -1353,17 +1677,15 @@
|
|
|
1353
1677
|
|
|
1354
1678
|
.file-name {
|
|
1355
1679
|
font-weight: 500;
|
|
1356
|
-
color:
|
|
1680
|
+
color: var(--primary);
|
|
1357
1681
|
flex: 1;
|
|
1358
1682
|
}
|
|
1359
|
-
|
|
1360
1683
|
.file-size {
|
|
1361
|
-
color:
|
|
1684
|
+
color:var(--primary);
|
|
1362
1685
|
font-size: 0.875rem;
|
|
1363
1686
|
}
|
|
1364
|
-
|
|
1365
1687
|
.file-remove-btn {
|
|
1366
|
-
background:
|
|
1688
|
+
background: var(--danger);
|
|
1367
1689
|
color: white;
|
|
1368
1690
|
border: none;
|
|
1369
1691
|
border-radius: 6px;
|
|
@@ -1374,13 +1696,8 @@
|
|
|
1374
1696
|
transition: background-color 0.2s ease;
|
|
1375
1697
|
}
|
|
1376
1698
|
|
|
1377
|
-
.file-remove-btn:hover {
|
|
1378
|
-
background: #b91c1c;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
/* Error message styling */
|
|
1382
1699
|
.error-message {
|
|
1383
|
-
color:
|
|
1700
|
+
color: var(--danger);
|
|
1384
1701
|
font-size: 0.875rem;
|
|
1385
1702
|
margin-top: 8px;
|
|
1386
1703
|
margin-bottom: 0;
|
|
@@ -1390,19 +1707,19 @@
|
|
|
1390
1707
|
.question.error input,
|
|
1391
1708
|
.question.error textarea,
|
|
1392
1709
|
.question.error select {
|
|
1393
|
-
border-color:
|
|
1394
|
-
background-color:
|
|
1710
|
+
border-color: var(--danger);
|
|
1711
|
+
background-color: var(--danger-100-bg);
|
|
1395
1712
|
}
|
|
1396
1713
|
|
|
1397
1714
|
.question.error input:focus,
|
|
1398
1715
|
.question.error textarea:focus,
|
|
1399
1716
|
.question.error select:focus {
|
|
1400
|
-
border-color:
|
|
1401
|
-
background-color:
|
|
1717
|
+
border-color: var(--danger);
|
|
1718
|
+
background-color: var(--card-bg);
|
|
1402
1719
|
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
|
|
1403
1720
|
}
|
|
1404
1721
|
|
|
1405
|
-
/*
|
|
1722
|
+
/* Many remaining structural styles reuse variables above for print/mobile */
|
|
1406
1723
|
.content-element {
|
|
1407
1724
|
margin-bottom: 16px;
|
|
1408
1725
|
}
|
|
@@ -1410,35 +1727,35 @@
|
|
|
1410
1727
|
.text-content p {
|
|
1411
1728
|
font-size: 1rem;
|
|
1412
1729
|
line-height: 1.6;
|
|
1413
|
-
color:
|
|
1730
|
+
color: var(--muted-weak);
|
|
1414
1731
|
margin: 0;
|
|
1415
1732
|
}
|
|
1416
1733
|
|
|
1417
1734
|
.markdown-content {
|
|
1418
1735
|
font-size: 1rem;
|
|
1419
1736
|
line-height: 1.6;
|
|
1420
|
-
color:
|
|
1737
|
+
color: var(--muted-weak);
|
|
1421
1738
|
}
|
|
1422
1739
|
|
|
1423
1740
|
.markdown-content h1 {
|
|
1424
1741
|
font-size: 1.5rem;
|
|
1425
1742
|
font-weight: 700;
|
|
1426
1743
|
margin: 24px 0 16px 0;
|
|
1427
|
-
color:
|
|
1744
|
+
color: var(--text);
|
|
1428
1745
|
}
|
|
1429
1746
|
|
|
1430
1747
|
.markdown-content h2 {
|
|
1431
1748
|
font-size: 1.25rem;
|
|
1432
1749
|
font-weight: 600;
|
|
1433
1750
|
margin: 20px 0 12px 0;
|
|
1434
|
-
color:
|
|
1751
|
+
color: var(--text);
|
|
1435
1752
|
}
|
|
1436
1753
|
|
|
1437
1754
|
.markdown-content h3 {
|
|
1438
1755
|
font-size: 1.125rem;
|
|
1439
1756
|
font-weight: 600;
|
|
1440
1757
|
margin: 16px 0 8px 0;
|
|
1441
|
-
color:
|
|
1758
|
+
color: var(--text);
|
|
1442
1759
|
}
|
|
1443
1760
|
|
|
1444
1761
|
.markdown-content strong {
|
|
@@ -1450,7 +1767,7 @@
|
|
|
1450
1767
|
}
|
|
1451
1768
|
|
|
1452
1769
|
.markdown-content code {
|
|
1453
|
-
background:
|
|
1770
|
+
background: var(--muted-surface);
|
|
1454
1771
|
padding: 2px 6px;
|
|
1455
1772
|
border-radius: 4px;
|
|
1456
1773
|
font-family: "Courier New", monospace;
|
|
@@ -1458,13 +1775,13 @@
|
|
|
1458
1775
|
}
|
|
1459
1776
|
|
|
1460
1777
|
.markdown-content blockquote {
|
|
1461
|
-
background:
|
|
1462
|
-
border-left: 4px solid
|
|
1778
|
+
background: var(--bg);
|
|
1779
|
+
border-left: 4px solid var(--primary);
|
|
1463
1780
|
padding: 12px 16px;
|
|
1464
1781
|
margin: 16px 0;
|
|
1465
1782
|
border-radius: 0 4px 4px 0;
|
|
1466
1783
|
font-style: italic;
|
|
1467
|
-
color:
|
|
1784
|
+
color: var(--muted);
|
|
1468
1785
|
}
|
|
1469
1786
|
|
|
1470
1787
|
.markdown-content ul {
|
|
@@ -1481,6 +1798,24 @@
|
|
|
1481
1798
|
margin: 4px 0;
|
|
1482
1799
|
}
|
|
1483
1800
|
|
|
1801
|
+
.divider-content .content-divider {
|
|
1802
|
+
border-top: 2px solid var(--border);
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
.markdown-content ul {
|
|
1806
|
+
margin: 12px 0;
|
|
1807
|
+
padding-left: 24px;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
.markdown-content ol {
|
|
1811
|
+
margin: 12px 0;
|
|
1812
|
+
padding-left: 24px;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
.markdown-content li {
|
|
1816
|
+
margin: 4px 0;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1484
1819
|
.divider-content {
|
|
1485
1820
|
text-align: center;
|
|
1486
1821
|
margin: 24px 0;
|
|
@@ -1528,14 +1863,15 @@
|
|
|
1528
1863
|
}
|
|
1529
1864
|
|
|
1530
1865
|
.unknown-element {
|
|
1531
|
-
background:
|
|
1866
|
+
background: var(--danger-100-bg);
|
|
1532
1867
|
border: 1px solid #fecaca;
|
|
1533
1868
|
border-radius: 8px;
|
|
1534
1869
|
padding: 16px;
|
|
1535
|
-
color:
|
|
1870
|
+
color: var(--danger);
|
|
1536
1871
|
text-align: center;
|
|
1537
1872
|
}
|
|
1538
1873
|
|
|
1874
|
+
|
|
1539
1875
|
.unknown-element p {
|
|
1540
1876
|
margin: 0;
|
|
1541
1877
|
font-weight: 500;
|
|
@@ -1557,7 +1893,7 @@
|
|
|
1557
1893
|
.submission-success-icon {
|
|
1558
1894
|
width: 48px;
|
|
1559
1895
|
height: 48px;
|
|
1560
|
-
color:
|
|
1896
|
+
color: var(--success);
|
|
1561
1897
|
margin-bottom: 32px;
|
|
1562
1898
|
display: flex;
|
|
1563
1899
|
align-items: center;
|
|
@@ -1948,8 +2284,8 @@
|
|
|
1948
2284
|
}
|
|
1949
2285
|
|
|
1950
2286
|
.runner-mobile-step-tab:hover:not(:disabled):not(.active) {
|
|
1951
|
-
background:
|
|
1952
|
-
border-color:
|
|
2287
|
+
background: var(--bg);
|
|
2288
|
+
border-color: var(--border);
|
|
1953
2289
|
}
|
|
1954
2290
|
|
|
1955
2291
|
.runner-mobile-step-tab:focus {
|
|
@@ -1957,13 +2293,13 @@
|
|
|
1957
2293
|
}
|
|
1958
2294
|
|
|
1959
2295
|
.runner-mobile-step-tab:focus:not(.active) {
|
|
1960
|
-
outline: 2px solid
|
|
2296
|
+
outline: 2px solid var(--primary);
|
|
1961
2297
|
outline-offset: 2px;
|
|
1962
2298
|
}
|
|
1963
2299
|
|
|
1964
2300
|
.runner-mobile-step-tab.active {
|
|
1965
|
-
background:
|
|
1966
|
-
border-color:
|
|
2301
|
+
background: var(--primary) !important;
|
|
2302
|
+
border-color: var(--primary) !important;
|
|
1967
2303
|
color: #fff !important;
|
|
1968
2304
|
}
|
|
1969
2305
|
|
|
@@ -2006,9 +2342,9 @@
|
|
|
2006
2342
|
|
|
2007
2343
|
/* Enhance mobile tab styling for completed/active states */
|
|
2008
2344
|
.runner-mobile-step-tab.completed:not(.active) {
|
|
2009
|
-
background:
|
|
2010
|
-
border-color:
|
|
2011
|
-
color:
|
|
2345
|
+
background: var(--success);
|
|
2346
|
+
border-color: var(--success);
|
|
2347
|
+
color: var(--text);
|
|
2012
2348
|
}
|
|
2013
2349
|
|
|
2014
2350
|
.runner-mobile-step-tab.completed .runner-mobile-step-badge {
|
|
@@ -2403,10 +2739,52 @@
|
|
|
2403
2739
|
width: 100%;
|
|
2404
2740
|
}
|
|
2405
2741
|
|
|
2742
|
+
/* Submission Error Icon */
|
|
2743
|
+
.submission-error-icon {
|
|
2744
|
+
color: #ef4444;
|
|
2745
|
+
margin-bottom: 16px;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
.submission-error-icon svg {
|
|
2749
|
+
stroke: #ef4444;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
/* Error badge in sidebar */
|
|
2753
|
+
.runner-step-badge.error {
|
|
2754
|
+
background: #fee2e2;
|
|
2755
|
+
color: #dc2626;
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
/* Retry Button */
|
|
2759
|
+
.retry-button {
|
|
2760
|
+
background: #3b82f6;
|
|
2761
|
+
color: white;
|
|
2762
|
+
border: none;
|
|
2763
|
+
border-radius: 8px;
|
|
2764
|
+
padding: 12px 24px;
|
|
2765
|
+
font-size: 16px;
|
|
2766
|
+
font-weight: 500;
|
|
2767
|
+
cursor: pointer;
|
|
2768
|
+
transition: background 0.2s ease;
|
|
2769
|
+
margin-top: 24px;
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
.retry-button:hover {
|
|
2773
|
+
background: #2563eb;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
.retry-button:active {
|
|
2777
|
+
background: #1d4ed8;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2406
2780
|
/* Clean styling for checkbox lists in print */
|
|
2407
2781
|
.print-response-value.checkbox-response div {
|
|
2408
2782
|
margin: 2px 0;
|
|
2409
2783
|
line-height: 1.4;
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
|
|
2410
2788
|
}
|
|
2411
2789
|
|
|
2412
2790
|
.step-edit-btn {
|
|
@@ -2453,18 +2831,89 @@
|
|
|
2453
2831
|
border-color: #3b82f6;
|
|
2454
2832
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
2455
2833
|
}
|
|
2456
|
-
`,ht=
|
|
2834
|
+
`,ht=L`
|
|
2835
|
+
/* Theme variables (defaults) */
|
|
2836
|
+
:host {
|
|
2837
|
+
--modal-overlay-bg: rgba(0, 0, 0, 0.5);
|
|
2838
|
+
--modal-backdrop-blur: 2px;
|
|
2839
|
+
|
|
2840
|
+
--modal-bg: #ffffff;
|
|
2841
|
+
--modal-text: #111827;
|
|
2842
|
+
--muted-text: #6b7280;
|
|
2843
|
+
--muted-alt: #9ca3af;
|
|
2844
|
+
--border-color: #e5e7eb;
|
|
2845
|
+
|
|
2846
|
+
--primary: #3b82f6;
|
|
2847
|
+
--primary-focus-ring: rgba(59, 130, 246, 0.1);
|
|
2848
|
+
|
|
2849
|
+
--card-border: #e5e7eb;
|
|
2850
|
+
--card-hover-bg: #f0f9ff;
|
|
2851
|
+
--card-selected-bg: #eff6ff;
|
|
2852
|
+
|
|
2853
|
+
--close-color: #9ca3af;
|
|
2854
|
+
|
|
2855
|
+
--footer-bg: transparent;
|
|
2856
|
+
--save-bg: #111827;
|
|
2857
|
+
--save-hover: #1f2937;
|
|
2858
|
+
--cancel-bg: #ffffff;
|
|
2859
|
+
|
|
2860
|
+
--scrollbar-track: #f1f5f9;
|
|
2861
|
+
--scrollbar-thumb: #cbd5e1;
|
|
2862
|
+
--scrollbar-thumb-hover: #94a3b8;
|
|
2863
|
+
|
|
2864
|
+
--modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
2865
|
+
|
|
2866
|
+
--radius-lg: 12px;
|
|
2867
|
+
--radius-md: 8px;
|
|
2868
|
+
|
|
2869
|
+
--anim-fade: 0.2s;
|
|
2870
|
+
--anim-slide: 0.3s;
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
/* Dark mode (host attribute or data attribute) */
|
|
2874
|
+
:host([theme="dark"]),
|
|
2875
|
+
:host([data-theme="dark"]) {
|
|
2876
|
+
--modal-overlay-bg: rgba(0, 0, 0, 0.7);
|
|
2877
|
+
--modal-backdrop-blur: 4px;
|
|
2878
|
+
|
|
2879
|
+
--modal-bg: #0b1220;
|
|
2880
|
+
--modal-text: #f8fafc;
|
|
2881
|
+
--muted-text: #94a3b8;
|
|
2882
|
+
--muted-alt: #9aa4b2;
|
|
2883
|
+
--border-color: #1f2937;
|
|
2884
|
+
|
|
2885
|
+
--primary: #60a5fa;
|
|
2886
|
+
--primary-focus-ring: rgba(96, 165, 250, 0.12);
|
|
2887
|
+
|
|
2888
|
+
--card-border: #111827;
|
|
2889
|
+
--card-hover-bg: #06202b;
|
|
2890
|
+
--card-selected-bg: #0b2a4a;
|
|
2891
|
+
|
|
2892
|
+
--close-color: #94a3b8;
|
|
2893
|
+
|
|
2894
|
+
--footer-bg: transparent;
|
|
2895
|
+
--save-bg: #111827;
|
|
2896
|
+
--save-hover: #0b1220;
|
|
2897
|
+
--cancel-bg: #0b1220;
|
|
2898
|
+
|
|
2899
|
+
--scrollbar-track: #031024;
|
|
2900
|
+
--scrollbar-thumb: #1f2937;
|
|
2901
|
+
--scrollbar-thumb-hover: #374151;
|
|
2902
|
+
|
|
2903
|
+
--modal-shadow: 0 20px 25px -5px rgba(2, 6, 23, 0.6);
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2457
2906
|
/* Modal Overlay */
|
|
2458
2907
|
.modal-overlay {
|
|
2459
2908
|
position: fixed;
|
|
2460
2909
|
inset: 0;
|
|
2461
|
-
background:
|
|
2462
|
-
backdrop-filter: blur(
|
|
2910
|
+
background: var(--modal-overlay-bg);
|
|
2911
|
+
backdrop-filter: blur(var(--modal-backdrop-blur));
|
|
2463
2912
|
display: flex;
|
|
2464
2913
|
align-items: center;
|
|
2465
2914
|
justify-content: center;
|
|
2466
2915
|
z-index: 1000;
|
|
2467
|
-
animation: fadeIn
|
|
2916
|
+
animation: fadeIn var(--anim-fade) ease-out;
|
|
2468
2917
|
}
|
|
2469
2918
|
|
|
2470
2919
|
@keyframes fadeIn {
|
|
@@ -2478,16 +2927,17 @@
|
|
|
2478
2927
|
|
|
2479
2928
|
/* Modal Container */
|
|
2480
2929
|
.modal-content {
|
|
2481
|
-
background:
|
|
2482
|
-
|
|
2483
|
-
|
|
2930
|
+
background: var(--modal-bg);
|
|
2931
|
+
color: var(--modal-text);
|
|
2932
|
+
border-radius: var(--radius-lg);
|
|
2933
|
+
box-shadow: var(--modal-shadow);
|
|
2484
2934
|
width: 90%;
|
|
2485
2935
|
max-width: 750px;
|
|
2486
2936
|
max-height: 90vh;
|
|
2487
2937
|
display: flex;
|
|
2488
2938
|
flex-direction: column;
|
|
2489
2939
|
overflow: hidden;
|
|
2490
|
-
animation: slideUp
|
|
2940
|
+
animation: slideUp var(--anim-slide) ease-out;
|
|
2491
2941
|
}
|
|
2492
2942
|
|
|
2493
2943
|
@keyframes slideUp {
|
|
@@ -2507,14 +2957,14 @@
|
|
|
2507
2957
|
align-items: center;
|
|
2508
2958
|
justify-content: space-between;
|
|
2509
2959
|
padding: 24px 32px;
|
|
2510
|
-
border-bottom: 1px solid
|
|
2960
|
+
border-bottom: 1px solid var(--border-color);
|
|
2511
2961
|
}
|
|
2512
2962
|
|
|
2513
2963
|
.modal-header h2 {
|
|
2514
2964
|
margin: 0;
|
|
2515
2965
|
font-size: 20px;
|
|
2516
2966
|
font-weight: 600;
|
|
2517
|
-
color:
|
|
2967
|
+
color: var(--modal-text);
|
|
2518
2968
|
}
|
|
2519
2969
|
|
|
2520
2970
|
.modal-close {
|
|
@@ -2528,15 +2978,15 @@
|
|
|
2528
2978
|
border: none;
|
|
2529
2979
|
border-radius: 6px;
|
|
2530
2980
|
font-size: 20px;
|
|
2531
|
-
color:
|
|
2981
|
+
color: var(--close-color);
|
|
2532
2982
|
cursor: pointer;
|
|
2533
2983
|
transition: all 0.2s;
|
|
2534
2984
|
line-height: 1;
|
|
2535
2985
|
}
|
|
2536
2986
|
|
|
2537
2987
|
.modal-close:hover {
|
|
2538
|
-
background:
|
|
2539
|
-
color:
|
|
2988
|
+
background: var(--card-hover-bg);
|
|
2989
|
+
color: var(--muted-text);
|
|
2540
2990
|
}
|
|
2541
2991
|
|
|
2542
2992
|
/* Modal Body */
|
|
@@ -2561,7 +3011,7 @@
|
|
|
2561
3011
|
|
|
2562
3012
|
.modal-body label {
|
|
2563
3013
|
font-weight: 600;
|
|
2564
|
-
color:
|
|
3014
|
+
color: var(--modal-text);
|
|
2565
3015
|
font-size: 14px;
|
|
2566
3016
|
}
|
|
2567
3017
|
|
|
@@ -2572,33 +3022,33 @@
|
|
|
2572
3022
|
.assignment-select {
|
|
2573
3023
|
width: 100%;
|
|
2574
3024
|
padding: 12px 16px;
|
|
2575
|
-
border: 1px solid
|
|
2576
|
-
border-radius:
|
|
3025
|
+
border: 1px solid var(--border-color);
|
|
3026
|
+
border-radius: var(--radius-md);
|
|
2577
3027
|
font-size: 15px;
|
|
2578
3028
|
font-family: inherit;
|
|
2579
|
-
background:
|
|
2580
|
-
color:
|
|
3029
|
+
background: var(--modal-bg);
|
|
3030
|
+
color: var(--modal-text);
|
|
2581
3031
|
transition: all 0.2s;
|
|
2582
3032
|
box-sizing: border-box;
|
|
2583
3033
|
}
|
|
2584
3034
|
|
|
2585
3035
|
.modal-body input::placeholder,
|
|
2586
3036
|
.modal-body textarea::placeholder {
|
|
2587
|
-
color:
|
|
3037
|
+
color: var(--muted-alt);
|
|
2588
3038
|
}
|
|
2589
3039
|
|
|
2590
3040
|
.modal-body input:hover,
|
|
2591
3041
|
.modal-body textarea:hover,
|
|
2592
3042
|
.assignment-select:hover {
|
|
2593
|
-
border-color:
|
|
3043
|
+
border-color: var(--muted-alt);
|
|
2594
3044
|
}
|
|
2595
3045
|
|
|
2596
3046
|
.modal-body input:focus,
|
|
2597
3047
|
.modal-body textarea:focus,
|
|
2598
3048
|
.assignment-select:focus {
|
|
2599
3049
|
outline: none;
|
|
2600
|
-
border-color:
|
|
2601
|
-
box-shadow: 0 0 0 3px
|
|
3050
|
+
border-color: var(--primary);
|
|
3051
|
+
box-shadow: 0 0 0 3px var(--primary-focus-ring);
|
|
2602
3052
|
}
|
|
2603
3053
|
|
|
2604
3054
|
.modal-body textarea {
|
|
@@ -2621,7 +3071,7 @@
|
|
|
2621
3071
|
|
|
2622
3072
|
.assignment-section > label {
|
|
2623
3073
|
font-weight: 600;
|
|
2624
|
-
color:
|
|
3074
|
+
color: var(--modal-text);
|
|
2625
3075
|
font-size: 14px;
|
|
2626
3076
|
}
|
|
2627
3077
|
|
|
@@ -2636,22 +3086,23 @@
|
|
|
2636
3086
|
flex-direction: column;
|
|
2637
3087
|
flex: 1;
|
|
2638
3088
|
padding: 16px;
|
|
2639
|
-
border: 2px solid
|
|
2640
|
-
border-radius:
|
|
3089
|
+
border: 2px solid var(--card-border);
|
|
3090
|
+
border-radius: var(--radius-md);
|
|
2641
3091
|
cursor: pointer;
|
|
2642
3092
|
transition: all 0.2s;
|
|
2643
3093
|
position: relative;
|
|
2644
3094
|
min-height: 80px;
|
|
3095
|
+
background: transparent;
|
|
2645
3096
|
}
|
|
2646
3097
|
|
|
2647
3098
|
.assignment-card:hover {
|
|
2648
|
-
border-color:
|
|
2649
|
-
background:
|
|
3099
|
+
border-color: var(--primary);
|
|
3100
|
+
background: var(--card-hover-bg);
|
|
2650
3101
|
}
|
|
2651
3102
|
|
|
2652
3103
|
.assignment-card.selected {
|
|
2653
|
-
border-color:
|
|
2654
|
-
background:
|
|
3104
|
+
border-color: var(--primary);
|
|
3105
|
+
background: var(--card-selected-bg);
|
|
2655
3106
|
}
|
|
2656
3107
|
|
|
2657
3108
|
/* Custom Radio in Cards */
|
|
@@ -2661,14 +3112,14 @@
|
|
|
2661
3112
|
left: 16px;
|
|
2662
3113
|
width: 20px;
|
|
2663
3114
|
height: 20px;
|
|
2664
|
-
border: 2px solid
|
|
3115
|
+
border: 2px solid var(--border-color);
|
|
2665
3116
|
border-radius: 50%;
|
|
2666
3117
|
transition: all 0.2s;
|
|
2667
3118
|
}
|
|
2668
3119
|
|
|
2669
3120
|
.assignment-card.selected .assignment-card-radio {
|
|
2670
|
-
border-color:
|
|
2671
|
-
background:
|
|
3121
|
+
border-color: var(--primary);
|
|
3122
|
+
background: var(--modal-bg);
|
|
2672
3123
|
}
|
|
2673
3124
|
|
|
2674
3125
|
.assignment-card.selected .assignment-card-radio::after {
|
|
@@ -2680,7 +3131,7 @@
|
|
|
2680
3131
|
width: 10px;
|
|
2681
3132
|
height: 10px;
|
|
2682
3133
|
border-radius: 50%;
|
|
2683
|
-
background:
|
|
3134
|
+
background: var(--primary);
|
|
2684
3135
|
}
|
|
2685
3136
|
|
|
2686
3137
|
.assignment-card-content {
|
|
@@ -2692,12 +3143,12 @@
|
|
|
2692
3143
|
|
|
2693
3144
|
.assignment-card-title {
|
|
2694
3145
|
font-weight: 600;
|
|
2695
|
-
color:
|
|
3146
|
+
color: var(--modal-text);
|
|
2696
3147
|
font-size: 14px;
|
|
2697
3148
|
}
|
|
2698
3149
|
|
|
2699
3150
|
.assignment-card-description {
|
|
2700
|
-
color:
|
|
3151
|
+
color: var(--muted-text);
|
|
2701
3152
|
font-size: 13px;
|
|
2702
3153
|
line-height: 1.4;
|
|
2703
3154
|
}
|
|
@@ -2719,7 +3170,7 @@
|
|
|
2719
3170
|
}
|
|
2720
3171
|
|
|
2721
3172
|
.assignment-radio-option:hover {
|
|
2722
|
-
background:
|
|
3173
|
+
background: var(--card-hover-bg);
|
|
2723
3174
|
}
|
|
2724
3175
|
|
|
2725
3176
|
.assignment-radio-option input[type="radio"] {
|
|
@@ -2728,7 +3179,7 @@
|
|
|
2728
3179
|
width: 18px;
|
|
2729
3180
|
height: 18px;
|
|
2730
3181
|
cursor: pointer;
|
|
2731
|
-
accent-color:
|
|
3182
|
+
accent-color: var(--primary);
|
|
2732
3183
|
}
|
|
2733
3184
|
|
|
2734
3185
|
.assignment-radio-label {
|
|
@@ -2741,13 +3192,13 @@
|
|
|
2741
3192
|
|
|
2742
3193
|
.assignment-radio-title {
|
|
2743
3194
|
font-weight: 500;
|
|
2744
|
-
color:
|
|
3195
|
+
color: var(--modal-text);
|
|
2745
3196
|
font-size: 14px;
|
|
2746
3197
|
line-height: 1.3;
|
|
2747
3198
|
}
|
|
2748
3199
|
|
|
2749
3200
|
.assignment-radio-description {
|
|
2750
|
-
color:
|
|
3201
|
+
color: var(--muted-text);
|
|
2751
3202
|
font-size: 13px;
|
|
2752
3203
|
line-height: 1.4;
|
|
2753
3204
|
}
|
|
@@ -2758,13 +3209,14 @@
|
|
|
2758
3209
|
justify-content: flex-end;
|
|
2759
3210
|
gap: 12px;
|
|
2760
3211
|
padding: 20px 32px;
|
|
2761
|
-
border-top: 1px solid
|
|
3212
|
+
border-top: 1px solid var(--border-color);
|
|
3213
|
+
background: var(--footer-bg);
|
|
2762
3214
|
}
|
|
2763
3215
|
|
|
2764
3216
|
.modal-footer button {
|
|
2765
3217
|
padding: 10px 24px;
|
|
2766
3218
|
border: none;
|
|
2767
|
-
border-radius:
|
|
3219
|
+
border-radius: var(--radius-md);
|
|
2768
3220
|
font-size: 14px;
|
|
2769
3221
|
font-weight: 500;
|
|
2770
3222
|
font-family: inherit;
|
|
@@ -2773,27 +3225,27 @@
|
|
|
2773
3225
|
}
|
|
2774
3226
|
|
|
2775
3227
|
.modal-footer .cancel-button {
|
|
2776
|
-
background:
|
|
2777
|
-
color:
|
|
2778
|
-
border: 1px solid
|
|
3228
|
+
background: var(--cancel-bg);
|
|
3229
|
+
color: var(--modal-text);
|
|
3230
|
+
border: 1px solid var(--border-color) !important;
|
|
2779
3231
|
}
|
|
2780
3232
|
|
|
2781
3233
|
.modal-footer .cancel-button:hover {
|
|
2782
|
-
background:
|
|
2783
|
-
border-color:
|
|
3234
|
+
background: var(--card-hover-bg);
|
|
3235
|
+
border-color: var(--muted-alt) !important;
|
|
2784
3236
|
}
|
|
2785
3237
|
|
|
2786
3238
|
.modal-footer .save-button {
|
|
2787
|
-
background:
|
|
3239
|
+
background: var(--save-bg);
|
|
2788
3240
|
color: white;
|
|
2789
3241
|
}
|
|
2790
3242
|
|
|
2791
3243
|
.modal-footer .save-button:hover {
|
|
2792
|
-
background:
|
|
3244
|
+
background: var(--save-hover);
|
|
2793
3245
|
}
|
|
2794
3246
|
|
|
2795
3247
|
.modal-footer .save-button:disabled {
|
|
2796
|
-
background:
|
|
3248
|
+
background: var(--muted-alt);
|
|
2797
3249
|
cursor: not-allowed;
|
|
2798
3250
|
opacity: 0.6;
|
|
2799
3251
|
}
|
|
@@ -2804,17 +3256,17 @@
|
|
|
2804
3256
|
}
|
|
2805
3257
|
|
|
2806
3258
|
.modal-body::-webkit-scrollbar-track {
|
|
2807
|
-
background:
|
|
3259
|
+
background: var(--scrollbar-track);
|
|
2808
3260
|
border-radius: 4px;
|
|
2809
3261
|
}
|
|
2810
3262
|
|
|
2811
3263
|
.modal-body::-webkit-scrollbar-thumb {
|
|
2812
|
-
background:
|
|
3264
|
+
background: var(--scrollbar-thumb);
|
|
2813
3265
|
border-radius: 4px;
|
|
2814
3266
|
}
|
|
2815
3267
|
|
|
2816
3268
|
.modal-body::-webkit-scrollbar-thumb:hover {
|
|
2817
|
-
background:
|
|
3269
|
+
background: var(--scrollbar-thumb-hover);
|
|
2818
3270
|
}
|
|
2819
3271
|
|
|
2820
3272
|
/* Responsive */
|
|
@@ -2834,22 +3286,22 @@
|
|
|
2834
3286
|
flex-direction: column;
|
|
2835
3287
|
}
|
|
2836
3288
|
}
|
|
2837
|
-
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,
|
|
3289
|
+
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,k=(s,e,t,i)=>{for(var r=i>1?void 0:i?mt(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&>(e,t,r),r};let y=class extends V{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=[],this._editingStepId=null,this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName="",this._openMenuStepId=null}connectedCallback(){super.connectedCallback(),this.workflow?(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Builder loaded with existing workflow:",this.workflow.name)):this._templateData=this._getDefaultWorkflowData(),this._clickOutsideHandler=()=>this._closeStepMenu(),document.addEventListener("click",this._clickOutsideHandler)}disconnectedCallback(){super.disconnectedCallback(),this._clickOutsideHandler&&document.removeEventListener("click",this._clickOutsideHandler)}updated(s){s.has("workflow")&&this.workflow&&(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Workflow property changed, reloading template data"))}_getDefaultWorkflowData(){const s={id:E(),title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:E(),name:"",description:"",steps:[s]}}_handleTitleChange(s){const e=s.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(s){const e=s.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var s;console.log("🚫 Builder Widget: Cancel button clicked"),(s=this.onCancel)==null||s.call(this)}_handleSave(){var s,e,t;if((s=this._templateData.name)!=null&&s.trim()){const i={id:this._templateData.id||E(),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(i,null,2)),this.workflow?(console.log("Calling onWorkflowUpdated callback"),(e=this.onWorkflowUpdated)==null||e.call(this,i)):(console.log("Calling onWorkflowCreated callback"),(t=this.onWorkflowCreated)==null||t.call(this,i))}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._editingStepId=null,this._stepFormData={title:"",description:""},this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName=""}_handleStepFormInput(s){const e=s.target,{name:t,value:i}=e;this._stepFormData={...this._stepFormData,[t]:i}}_toggleStepMenu(s,e){s.stopPropagation(),this._openMenuStepId=this._openMenuStepId===e?null:e}_closeStepMenu(){this._openMenuStepId=null}_editStep(s){var t;const e=(t=this._templateData.steps)==null?void 0:t.find(i=>i.id===s);if(e){if(this._editingStepId=s,this._stepFormData={title:e.title,description:e.description},this._stepAssignmentCategory=e.assignment.category,this._stepAssignmentType=e.assignment.type,this._stepAssignmentTarget=e.assignment.email||e.assignment.targetId||"",this._stepAssignmentType==="specific_user"){const r=(e.assignment.targetName||"").split(" ");this._stepAssignmentFirstName=r[0]||"",this._stepAssignmentLastName=r.slice(1).join(" ")||""}else this._stepAssignmentFirstName="",this._stepAssignmentLastName="";this._showStepModal=!0,this._closeStepMenu(),console.log("Editing step:",s)}}_duplicateStep(s){var r,n;const e=(r=this._templateData.steps)==null?void 0:r.find(o=>o.id===s);if(!e)return;const t=this._templateData.steps||[],i={...e,id:E(),title:`${e.title} (Copy)`,order:t.length+1,elements:((n=e.elements)==null?void 0:n.map(o=>({...o,id:E()})))||[]};this._templateData={...this._templateData,steps:[...t,i]},this._closeStepMenu(),console.log("Step duplicated:",s)}_deleteStep(s){const e=(this._templateData.steps||[]).filter(t=>t.id!==s);e.forEach((t,i)=>{t.order=i+1}),this._templateData={...this._templateData,steps:e},this._selectedStepId===s&&(this._selectedStepId=e.length>0?e[0].id:null),this._closeStepMenu(),console.log("Step deleted:",s)}_createStep(){var t,i;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const s=this._templateData.steps||[],e={category:this._stepAssignmentCategory,type:this._stepAssignmentType};if(this._stepAssignmentType==="specific_user"&&this._stepAssignmentTarget?(e.email=this._stepAssignmentTarget,this._stepAssignmentFirstName||this._stepAssignmentLastName?e.targetName=`${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim():e.targetName=this._stepAssignmentTarget):this._stepAssignmentType==="instance_role_assignee_select"&&this._stepAssignmentTarget&&(e.targetId=this._stepAssignmentTarget),this._editingStepId){const r=s.map(n=>{var o;return n.id===this._editingStepId?{...n,title:this._stepFormData.title.trim(),description:((o=this._stepFormData.description)==null?void 0:o.trim())||"",assignment:e}:n});this._templateData={...this._templateData,steps:r},console.log("✅ Step updated:",this._editingStepId)}else{const r={id:E(),title:this._stepFormData.title.trim(),description:((i=this._stepFormData.description)==null?void 0:i.trim())||"",order:s.length+1,assignment:e,elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...s,r]},this._selectedStepId=r.id,console.log("✅ Step created and selected:",r)}this._closeStepModal()}_selectStep(s){this._selectedStepId=s,console.log("🎯 Step selected:",s)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(s=>s.id===this._selectedStepId)||null}_handleDragStart(s,e){this._draggedStepId=e,s.dataTransfer&&(s.dataTransfer.effectAllowed="move",s.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(s){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(s,e){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(s){const e=s.relatedTarget;s.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(s,e){if(s.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],i=t.findIndex(a=>a.id===this._draggedStepId),r=t.findIndex(a=>a.id===e);if(i===-1||r===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((a,d)=>`${d+1}: ${a.title}`));const n=[...t],[o]=n.splice(i,1);n.splice(r,0,o),n.forEach((a,d)=>{a.order=d+1}),console.log("🔄 After reorder:",n.map((a,d)=>`${d+1}: ${a.title}`)),this._templateData={...this._templateData,steps:n},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_addQuestion(s="text_input"){var i,r;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(s)){let n={id:E(),type:s,order:(((i=e.elements)==null?void 0:i.length)||0)+1};switch(s){case"text":n.content="Enter your text content here...";break;case"html":n.content="<p>Enter your HTML content here...</p>";break;case"divider":n.content="",n.caption="Section Divider";break;case"markdown":n.content=`## Enter your markdown content here...
|
|
2838
3290
|
|
|
2839
|
-
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],
|
|
3291
|
+
Use **bold** and *italic* text.`;break}const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],n]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Content element added to step:",this._selectedStepId)}else{const n={id:E(),type:s,label:this._getQuestionTypeDisplayName(s),order:(((r=e.elements)==null?void 0:r.length)||0)+1,required:!1};["select","radio","checkbox"].includes(s)&&(n.options=["Option 1","Option 2"]);const o=this._templateData.steps.map(a=>a.id===this._selectedStepId?{...a,elements:[...a.elements||[],n]}:a);this._templateData={...this._templateData,steps:o},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(s){var r;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:E(),type:s,order:(((r=e.elements)==null?void 0:r.length)||0)+1};switch(s){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...
|
|
2840
3292
|
|
|
2841
|
-
Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(
|
|
3293
|
+
Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(n=>n.id===this._selectedStepId?{...n,elements:[...n.elements||[],t]}:n);this._templateData={...this._templateData,steps:i},console.log("✅ Content element added to step:",this._selectedStepId)}_updateQuestion(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(r=>{var n;return r.id===this._selectedStepId?{...r,elements:((n=r.elements)==null?void 0:n.map(o=>o.id===s?{...o,...e}:o))||[]}:r});this._templateData={...this._templateData,steps:t}}_updateContentElement(s,e){var i;if(!this._selectedStepId)return;const t=(i=this._templateData.steps)==null?void 0:i.map(r=>{var n;return r.id===this._selectedStepId?{...r,elements:((n=r.elements)==null?void 0:n.map(o=>o.id===s?{...o,...e}:o))||[]}:r});this._templateData={...this._templateData,steps:t}}_deleteQuestion(s){var t;if(!this._selectedStepId)return;const e=(t=this._templateData.steps)==null?void 0:t.map(i=>{var r;return i.id===this._selectedStepId?{...i,elements:((r=i.elements)==null?void 0:r.filter(n=>n.id!==s))||[]}:i});this._templateData={...this._templateData,steps:e},console.log("🗑️ Question deleted:",s)}_renderQuestionTypeSpecificFields(s){switch(s.type){case"select":case"radio":return l`
|
|
2842
3294
|
<div class="question-options-section">
|
|
2843
3295
|
<label class="options-label">Options:</label>
|
|
2844
3296
|
<div class="options-list">
|
|
2845
|
-
${(s.options||[]).map((e,t)=>
|
|
3297
|
+
${(s.options||[]).map((e,t)=>l`
|
|
2846
3298
|
<div class="option-item">
|
|
2847
3299
|
<input
|
|
2848
3300
|
type="text"
|
|
2849
3301
|
class="option-input"
|
|
2850
3302
|
placeholder="Option ${t+1}"
|
|
2851
3303
|
.value=${e}
|
|
2852
|
-
@input=${i=>{const
|
|
3304
|
+
@input=${i=>{const r=i.target,n=[...s.options||[]];n[t]=r.value,this._updateQuestion(s.id,{options:n})}}
|
|
2853
3305
|
/>
|
|
2854
3306
|
<button
|
|
2855
3307
|
class="remove-option-button"
|
|
@@ -2883,7 +3335,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2883
3335
|
</button>
|
|
2884
3336
|
</div>
|
|
2885
3337
|
</div>
|
|
2886
|
-
`;case"checkbox":return
|
|
3338
|
+
`;case"checkbox":return l`
|
|
2887
3339
|
<div class="question-checkbox-config">
|
|
2888
3340
|
<div class="checkbox-type-selection">
|
|
2889
3341
|
<label class="checkbox-type-label">
|
|
@@ -2908,18 +3360,18 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2908
3360
|
</label>
|
|
2909
3361
|
</div>
|
|
2910
3362
|
|
|
2911
|
-
${s.options&&s.options.length>0?
|
|
3363
|
+
${s.options&&s.options.length>0?l`
|
|
2912
3364
|
<div class="question-options-section">
|
|
2913
3365
|
<label class="options-label">Checkbox Options:</label>
|
|
2914
3366
|
<div class="options-list">
|
|
2915
|
-
${(s.options||[]).map((e,t)=>
|
|
3367
|
+
${(s.options||[]).map((e,t)=>l`
|
|
2916
3368
|
<div class="option-item">
|
|
2917
3369
|
<input
|
|
2918
3370
|
type="text"
|
|
2919
3371
|
class="option-input"
|
|
2920
3372
|
placeholder="Option ${t+1}"
|
|
2921
3373
|
.value=${e}
|
|
2922
|
-
@input=${i=>{const
|
|
3374
|
+
@input=${i=>{const r=i.target,n=[...s.options||[]];n[t]=r.value,this._updateQuestion(s.id,{options:n})}}
|
|
2923
3375
|
/>
|
|
2924
3376
|
<button
|
|
2925
3377
|
class="remove-option-button"
|
|
@@ -2967,7 +3419,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2967
3419
|
</button>
|
|
2968
3420
|
</div>
|
|
2969
3421
|
</div>
|
|
2970
|
-
`:
|
|
3422
|
+
`:l`
|
|
2971
3423
|
<div class="single-checkbox-info">
|
|
2972
3424
|
<p class="config-note">
|
|
2973
3425
|
Single checkbox - users can check/uncheck for Yes/No response
|
|
@@ -2975,7 +3427,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2975
3427
|
</div>
|
|
2976
3428
|
`}
|
|
2977
3429
|
</div>
|
|
2978
|
-
`;case"textarea":return
|
|
3430
|
+
`;case"textarea":return l`
|
|
2979
3431
|
<div class="question-config-section">
|
|
2980
3432
|
<label class="config-label">
|
|
2981
3433
|
Placeholder:
|
|
@@ -2988,7 +3440,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
2988
3440
|
/>
|
|
2989
3441
|
</label>
|
|
2990
3442
|
</div>
|
|
2991
|
-
`;case"text_input":return
|
|
3443
|
+
`;case"text_input":return l`
|
|
2992
3444
|
<div class="question-config-section">
|
|
2993
3445
|
<label class="config-label">
|
|
2994
3446
|
Placeholder:
|
|
@@ -3001,7 +3453,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3001
3453
|
/>
|
|
3002
3454
|
</label>
|
|
3003
3455
|
</div>
|
|
3004
|
-
`;case"number":return
|
|
3456
|
+
`;case"number":return l`
|
|
3005
3457
|
<div class="question-config-section">
|
|
3006
3458
|
<label class="config-label">
|
|
3007
3459
|
Placeholder:
|
|
@@ -3014,19 +3466,19 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3014
3466
|
/>
|
|
3015
3467
|
</label>
|
|
3016
3468
|
</div>
|
|
3017
|
-
`;case"file_upload":return
|
|
3469
|
+
`;case"file_upload":return l`
|
|
3018
3470
|
<div class="question-config-section">
|
|
3019
3471
|
<p class="config-note">File upload field - users can upload files</p>
|
|
3020
3472
|
</div>
|
|
3021
|
-
`;case"signature":return
|
|
3473
|
+
`;case"signature":return l`
|
|
3022
3474
|
<div class="question-config-section">
|
|
3023
3475
|
<p class="config-note">Digital signature pad - users can sign with mouse/touch</p>
|
|
3024
3476
|
</div>
|
|
3025
|
-
`;case"date":return
|
|
3477
|
+
`;case"date":return l`
|
|
3026
3478
|
<div class="question-config-section">
|
|
3027
3479
|
<p class="config-note">Date picker field</p>
|
|
3028
3480
|
</div>
|
|
3029
|
-
`;default:return
|
|
3481
|
+
`;default:return l``}}_renderContentTypeSpecificFields(s){switch(s.type){case"text":return l`
|
|
3030
3482
|
<div class="content-config-section">
|
|
3031
3483
|
<label class="config-label">
|
|
3032
3484
|
Text Content:
|
|
@@ -3038,7 +3490,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3038
3490
|
></textarea>
|
|
3039
3491
|
</label>
|
|
3040
3492
|
</div>
|
|
3041
|
-
`;case"html":return
|
|
3493
|
+
`;case"html":return l`
|
|
3042
3494
|
<div class="content-config-section">
|
|
3043
3495
|
<label class="config-label">
|
|
3044
3496
|
HTML Content:
|
|
@@ -3050,7 +3502,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3050
3502
|
></textarea>
|
|
3051
3503
|
</label>
|
|
3052
3504
|
</div>
|
|
3053
|
-
`;case"image":return
|
|
3505
|
+
`;case"image":return l`
|
|
3054
3506
|
<div class="content-config-section">
|
|
3055
3507
|
<label class="config-label">
|
|
3056
3508
|
Image URL:
|
|
@@ -3083,7 +3535,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3083
3535
|
/>
|
|
3084
3536
|
</label>
|
|
3085
3537
|
</div>
|
|
3086
|
-
`;case"video":return
|
|
3538
|
+
`;case"video":return l`
|
|
3087
3539
|
<div class="content-config-section">
|
|
3088
3540
|
<label class="config-label">
|
|
3089
3541
|
Video URL:
|
|
@@ -3106,7 +3558,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3106
3558
|
/>
|
|
3107
3559
|
</label>
|
|
3108
3560
|
</div>
|
|
3109
|
-
`;case"file":return
|
|
3561
|
+
`;case"file":return l`
|
|
3110
3562
|
<div class="content-config-section">
|
|
3111
3563
|
<label class="config-label">
|
|
3112
3564
|
File URL:
|
|
@@ -3129,7 +3581,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3129
3581
|
/>
|
|
3130
3582
|
</label>
|
|
3131
3583
|
</div>
|
|
3132
|
-
`;case"divider":return
|
|
3584
|
+
`;case"divider":return l`
|
|
3133
3585
|
<div class="content-config-section">
|
|
3134
3586
|
<label class="config-label">
|
|
3135
3587
|
Caption:
|
|
@@ -3142,7 +3594,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3142
3594
|
/>
|
|
3143
3595
|
</label>
|
|
3144
3596
|
</div>
|
|
3145
|
-
`;case"markdown":return
|
|
3597
|
+
`;case"markdown":return l`
|
|
3146
3598
|
<div class="content-config-section">
|
|
3147
3599
|
<label class="config-label">
|
|
3148
3600
|
Markdown Content:
|
|
@@ -3154,7 +3606,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3154
3606
|
></textarea>
|
|
3155
3607
|
</label>
|
|
3156
3608
|
</div>
|
|
3157
|
-
`;default:return
|
|
3609
|
+
`;default:return l``}}_getQuestionTypeDisplayName(s){switch(s){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(s){switch(s){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(s){return s.options&&s.options.length>0?"Checkbox Group":"Single Checkbox"}_hasSteps(){const s=!!(this._templateData.steps&&this._templateData.steps.length>0);return s&&!this._selectedStepId&&this._templateData.steps&&(this._selectedStepId=this._templateData.steps[0].id,console.log("🎯 Auto-selected first step:",this._templateData.steps[0].title)),!s&&this._selectedStepId&&(this._selectedStepId=null),s}_getAssignmentDisplayText(s){switch(s.category){case"individual":switch(s.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 s.email?`Assigned to: ${s.email}`:"Assigned to: Specific user";default:return"Assigned to: Individual"}case"role":switch(s.type){case"instance_role_assignee_select":return s.targetId?`Assigned to: ${s.targetId} role`:"Assigned to: Role";default:return"Assigned to: Role"}default:return"Assignment not configured"}}render(){var e;const s=this._getSelectedStep();return l`
|
|
3158
3610
|
<div class="header">
|
|
3159
3611
|
<div class="header-inputs">
|
|
3160
3612
|
<div class="form-group">
|
|
@@ -3184,7 +3636,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3184
3636
|
</div>
|
|
3185
3637
|
|
|
3186
3638
|
<div class="main-content">
|
|
3187
|
-
${this._showStepModal?
|
|
3639
|
+
${this._showStepModal?l`
|
|
3188
3640
|
<div class="modal-overlay" @click=${this._closeStepModal}>
|
|
3189
3641
|
<div class="modal-content" @click=${t=>t.stopPropagation()}>
|
|
3190
3642
|
<div class="modal-header">
|
|
@@ -3245,7 +3697,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3245
3697
|
</div>
|
|
3246
3698
|
</div>
|
|
3247
3699
|
|
|
3248
|
-
${this._stepAssignmentCategory==="individual"?
|
|
3700
|
+
${this._stepAssignmentCategory==="individual"?l`
|
|
3249
3701
|
<div class="assignment-radio-group">
|
|
3250
3702
|
<label class="assignment-radio-option">
|
|
3251
3703
|
<input
|
|
@@ -3316,7 +3768,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3316
3768
|
</label>
|
|
3317
3769
|
</div>
|
|
3318
3770
|
|
|
3319
|
-
${this._stepAssignmentType==="specific_user"?
|
|
3771
|
+
${this._stepAssignmentType==="specific_user"?l`
|
|
3320
3772
|
<div class="assignment-name-fields">
|
|
3321
3773
|
<input
|
|
3322
3774
|
type="text"
|
|
@@ -3341,7 +3793,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3341
3793
|
@input=${t=>{const i=t.target;this._stepAssignmentTarget=i.value}}
|
|
3342
3794
|
/>
|
|
3343
3795
|
`:""}
|
|
3344
|
-
`:
|
|
3796
|
+
`:l`
|
|
3345
3797
|
<div class="assignment-radio-group">
|
|
3346
3798
|
<label class="assignment-radio-option">
|
|
3347
3799
|
<input
|
|
@@ -3385,11 +3837,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3385
3837
|
<div class="section">
|
|
3386
3838
|
<div class="section-header">
|
|
3387
3839
|
<h2>Steps</h2>
|
|
3388
|
-
<button class="add-button" @click=${this._addStep}>Add</button>
|
|
3840
|
+
<button class="add-button" @click=${this._addStep}>Add step</button>
|
|
3389
3841
|
</div>
|
|
3390
3842
|
|
|
3391
3843
|
<div class="steps-list">
|
|
3392
|
-
${((e=this._templateData.steps)==null?void 0:e.map(t=>
|
|
3844
|
+
${((e=this._templateData.steps)==null?void 0:e.map(t=>l`
|
|
3393
3845
|
<div
|
|
3394
3846
|
class="step-item ${this._selectedStepId===t.id?"selected":""} ${this._dragOverStepId===t.id?"drag-over":""}"
|
|
3395
3847
|
@click=${()=>this._selectStep(t.id)}
|
|
@@ -3455,7 +3907,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3455
3907
|
>
|
|
3456
3908
|
⋯
|
|
3457
3909
|
</button>
|
|
3458
|
-
${this._openMenuStepId===t.id?
|
|
3910
|
+
${this._openMenuStepId===t.id?l`
|
|
3459
3911
|
<div class="step-menu-dropdown">
|
|
3460
3912
|
<button
|
|
3461
3913
|
class="step-menu-item"
|
|
@@ -3544,24 +3996,23 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3544
3996
|
<!-- Questions Section -->
|
|
3545
3997
|
<div class="section">
|
|
3546
3998
|
<div class="section-header">
|
|
3547
|
-
<h2>
|
|
3548
|
-
<button class="add-button" @click=${()=>this._addQuestion()}>Add</button>
|
|
3999
|
+
<h2>Blocks</h2>
|
|
4000
|
+
<button class="add-button" @click=${()=>this._addQuestion()}>Add block</button>
|
|
3549
4001
|
</div>
|
|
3550
4002
|
|
|
3551
|
-
${s&&s.elements&&s.elements.length>0?
|
|
4003
|
+
${s&&s.elements&&s.elements.length>0?l`
|
|
3552
4004
|
<div class="elements-list">
|
|
3553
|
-
${s.elements.map(t=>{const i="label"in t&&"required"in t,
|
|
4005
|
+
${s.elements.map(t=>{const i="label"in t&&"required"in t,r="content"in t;if(i){const n=t;return l`
|
|
3554
4006
|
<div class="question-item">
|
|
3555
4007
|
<div class="question-header">
|
|
3556
4008
|
<h3 class="question-title">
|
|
3557
|
-
${
|
|
4009
|
+
${n.label||(n.type==="checkbox"?this._getCheckboxTypeDisplayName(n):this._getQuestionTypeDisplayName(n.type))}
|
|
3558
4010
|
</h3>
|
|
3559
4011
|
<div class="question-header-controls">
|
|
3560
4012
|
<select
|
|
3561
4013
|
class="question-type-select"
|
|
3562
|
-
.value=${
|
|
3563
|
-
|
|
3564
|
-
@change=${o=>{const l=o.target.value;if(["text","html","divider","markdown"].includes(l)){this._addQuestion(l),this._deleteQuestion(r.id);return}const c={type:l};["select","radio","checkbox"].includes(l)&&!r.options&&(c.options=["Option 1","Option 2"]);const u=this._getQuestionTypeDisplayName(r.type);(!r.label||r.label===u)&&(c.label=this._getQuestionTypeDisplayName(l)),this._updateQuestion(r.id,c)}}
|
|
4014
|
+
.value=${n.type||"text_input"}
|
|
4015
|
+
@change=${o=>{const d=o.target.value;if(["text","html","divider","markdown"].includes(d)){this._addQuestion(d),this._deleteQuestion(n.id);return}const c={type:d};["select","radio","checkbox"].includes(d)&&!n.options&&(c.options=["Option 1","Option 2"]);const u=this._getQuestionTypeDisplayName(n.type);(!n.label||n.label===u)&&(c.label=this._getQuestionTypeDisplayName(d)),this._updateQuestion(n.id,c)}}
|
|
3565
4016
|
>
|
|
3566
4017
|
<optgroup label="Questions">
|
|
3567
4018
|
<option value="text_input">Text Input (short)</option>
|
|
@@ -3583,8 +4034,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3583
4034
|
</select>
|
|
3584
4035
|
<button
|
|
3585
4036
|
class="delete-question-button"
|
|
3586
|
-
@click=${()=>this._deleteQuestion(
|
|
3587
|
-
title="Delete question"
|
|
4037
|
+
@click=${()=>this._deleteQuestion(n.id)}
|
|
4038
|
+
title="Delete question block"
|
|
3588
4039
|
>
|
|
3589
4040
|
<svg
|
|
3590
4041
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -3612,33 +4063,32 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3612
4063
|
type="text"
|
|
3613
4064
|
class="question-label-input"
|
|
3614
4065
|
placeholder="Question label"
|
|
3615
|
-
.value=${
|
|
3616
|
-
@input=${o=>{const a=o.target;this._updateQuestion(
|
|
4066
|
+
.value=${n.label||""}
|
|
4067
|
+
@input=${o=>{const a=o.target;this._updateQuestion(n.id,{label:a.value})}}
|
|
3617
4068
|
/>
|
|
3618
4069
|
|
|
3619
|
-
${this._renderQuestionTypeSpecificFields(
|
|
4070
|
+
${this._renderQuestionTypeSpecificFields(n)}
|
|
3620
4071
|
|
|
3621
4072
|
<label class="question-required-label">
|
|
3622
4073
|
<input
|
|
3623
4074
|
type="checkbox"
|
|
3624
|
-
.checked=${
|
|
3625
|
-
@change=${o=>{const a=o.target;this._updateQuestion(
|
|
4075
|
+
.checked=${n.required||!1}
|
|
4076
|
+
@change=${o=>{const a=o.target;this._updateQuestion(n.id,{required:a.checked})}}
|
|
3626
4077
|
/>
|
|
3627
4078
|
Required
|
|
3628
4079
|
</label>
|
|
3629
4080
|
</div>
|
|
3630
|
-
`}else if(
|
|
4081
|
+
`}else if(r){const n=t;return l`
|
|
3631
4082
|
<div class="question-item">
|
|
3632
4083
|
<div class="question-header">
|
|
3633
4084
|
<h3 class="question-title">
|
|
3634
|
-
${this._getContentTypeDisplayName(
|
|
4085
|
+
${this._getContentTypeDisplayName(n.type)}
|
|
3635
4086
|
</h3>
|
|
3636
4087
|
<div class="question-header-controls">
|
|
3637
4088
|
<select
|
|
3638
4089
|
class="question-type-select"
|
|
3639
4090
|
.value=${t.type||"text"}
|
|
3640
|
-
|
|
3641
|
-
@change=${o=>{const l=o.target.value;if(!["text","html","divider","markdown"].includes(l)){this._addQuestion(l),this._deleteQuestion(t.id);return}this._addQuestion(l),this._deleteQuestion(t.id)}}
|
|
4091
|
+
@change=${o=>{const d=o.target.value;if(!["text","html","divider","markdown"].includes(d)){this._addQuestion(d),this._deleteQuestion(t.id);return}this._addQuestion(d),this._deleteQuestion(t.id)}}
|
|
3642
4092
|
>
|
|
3643
4093
|
<optgroup label="Questions">
|
|
3644
4094
|
<option value="text_input">Text Input (short)</option>
|
|
@@ -3661,7 +4111,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3661
4111
|
<button
|
|
3662
4112
|
class="delete-question-button"
|
|
3663
4113
|
@click=${()=>this._deleteQuestion(t.id)}
|
|
3664
|
-
title="Delete content"
|
|
4114
|
+
title="Delete content block"
|
|
3665
4115
|
>
|
|
3666
4116
|
<svg
|
|
3667
4117
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -3685,18 +4135,18 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3685
4135
|
</div>
|
|
3686
4136
|
</div>
|
|
3687
4137
|
<div class="question-content">
|
|
3688
|
-
${this._renderContentTypeSpecificFields(
|
|
4138
|
+
${this._renderContentTypeSpecificFields(n)}
|
|
3689
4139
|
</div>
|
|
3690
4140
|
</div>
|
|
3691
|
-
`}else{const
|
|
4141
|
+
`}else{const n=t;return l`
|
|
3692
4142
|
<div class="question-item">
|
|
3693
4143
|
<div class="question-header">
|
|
3694
4144
|
<h3 class="question-title">Unknown Element</h3>
|
|
3695
4145
|
<div class="question-header-controls">
|
|
3696
4146
|
<button
|
|
3697
4147
|
class="delete-question-button"
|
|
3698
|
-
@click=${()=>this._deleteQuestion(
|
|
3699
|
-
title="Delete
|
|
4148
|
+
@click=${()=>this._deleteQuestion(n.id)}
|
|
4149
|
+
title="Delete block"
|
|
3700
4150
|
>
|
|
3701
4151
|
✕
|
|
3702
4152
|
</button>
|
|
@@ -3705,125 +4155,127 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3705
4155
|
</div>
|
|
3706
4156
|
`}})}
|
|
3707
4157
|
</div>
|
|
3708
|
-
`:
|
|
4158
|
+
`:l`
|
|
3709
4159
|
<div class="empty-state">
|
|
3710
|
-
<h3>Add
|
|
4160
|
+
<h3>Add blocks</h3>
|
|
3711
4161
|
<p>Use the add button to start building your workflow</p>
|
|
3712
|
-
<button class="add-button" @click=${()=>this._addQuestion()}>
|
|
4162
|
+
<button class="add-button" @click=${()=>this._addQuestion()}>
|
|
4163
|
+
Add block
|
|
4164
|
+
</button>
|
|
3713
4165
|
</div>
|
|
3714
4166
|
`}
|
|
3715
4167
|
</div>
|
|
3716
4168
|
</div>
|
|
3717
4169
|
</div>
|
|
3718
|
-
`}};
|
|
4170
|
+
`}};y.styles=L`
|
|
3719
4171
|
${pt}
|
|
3720
4172
|
${ct}
|
|
3721
4173
|
${ut}
|
|
3722
|
-
${
|
|
4174
|
+
${Ne}
|
|
3723
4175
|
${ht}
|
|
3724
|
-
`,
|
|
4176
|
+
`,k([b()],y.prototype,"_templateData",2),k([b()],y.prototype,"_showStepModal",2),k([b()],y.prototype,"_stepFormData",2),k([b()],y.prototype,"_draggedStepId",2),k([b()],y.prototype,"_dragOverStepId",2),k([b()],y.prototype,"_selectedStepId",2),k([b()],y.prototype,"_questions",2),k([b()],y.prototype,"_editingStepId",2),k([b()],y.prototype,"_stepAssignmentCategory",2),k([b()],y.prototype,"_stepAssignmentType",2),k([b()],y.prototype,"_stepAssignmentTarget",2),k([b()],y.prototype,"_stepAssignmentFirstName",2),k([b()],y.prototype,"_stepAssignmentLastName",2),k([D({attribute:!1})],y.prototype,"onCancel",2),k([D({attribute:!1})],y.prototype,"workflow",2),k([b()],y.prototype,"_openMenuStepId",2),y=k([Ue("builder-widget")],y);class ft{constructor(e,t){this.signaturePads=e,this.savedSignatures=t}validateStep(e,t,i){if(i==="preview")return{isValid:!0,errors:{}};if(!e)return{isValid:!1,errors:{}};let r=!0;const n={};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&&(r=!1,n[a.id]=d.message)}}return{isValid:r,errors:n}}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 i=this.signaturePads.get(e.id);return!i||i.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 bt{getStorageKey(e){return`runner-form-data-${e||"default"}`}saveFormData(e,t,i,r,n,o){var c,u,h;const a=this.getStorageKey(e),d=o?{...o,currentStepId:(u=(c=o.steps)==null?void 0:c[i])==null?void 0:u.id,completedSteps:Array.from(n),steps:(h=o.steps)==null?void 0:h.map(m=>({...m,responses:m.responses||[]}))}:null,p={formData:t,timestamp:new Date().toISOString(),stepIndex:i,savedSignatures:Array.from(r),completedSteps:Array.from(n),instance:d};try{localStorage.setItem(a,JSON.stringify(p))}catch(m){console.warn("Failed to save form data to localStorage:",m)}}restoreFormData(e){const t=this.getStorageKey(e);try{const i=localStorage.getItem(t);if(!i)return null;const r=JSON.parse(i);return{formData:r.formData||{},stepIndex:r.stepIndex||0,savedSignatures:new Set(r.savedSignatures||[]),completedSteps:new Set(r.completedSteps||[]),savedInstance:r.instance||null}}catch(i){return console.warn("Failed to restore form data from localStorage:",i),null}}clearFormData(e,t="completed workflow"){const i=this.getStorageKey(e);try{localStorage.removeItem(i),console.log(`Cleared saved form data for ${t}`)}catch(r){console.warn("Failed to clear saved form data:",r)}}shouldRestoreData(e){return e==="default"}}/*!
|
|
3725
4177
|
* Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
|
|
3726
4178
|
* (c) 2025 Szymon Nowak | Released under the MIT license
|
|
3727
|
-
*/class Z{constructor(e,t,i,n){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=i||0,this.time=n||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 i=this.calculateControlPoints(e[0],e[1],e[2]).c2,n=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],i,n,e[2],t.start,t.end)}static calculateControlPoints(e,t,i){const n=e.x-t.x,r=e.y-t.y,o=t.x-i.x,a=t.y-i.y,l={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+i.x)/2,y:(t.y+i.y)/2},c=Math.sqrt(n*n+r*r),u=Math.sqrt(o*o+a*a),h=l.x-p.x,m=l.y-p.y,v=c+u==0?0:u/(c+u),D={x:p.x+h*v,y:p.y+m*v},se=t.x-D.x,ne=t.y-D.y;return{c1:new Z(l.x+se,l.y+ne),c2:new Z(p.x+se,p.y+ne)}}constructor(e,t,i,n,r,o){this.startPoint=e,this.control2=t,this.control1=i,this.endPoint=n,this.startWidth=r,this.endWidth=o}length(){let t=0,i,n;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),l=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const p=a-i,c=l-n;t+=Math.sqrt(p*p+c*c)}i=a,n=l}return t}point(e,t,i,n,r){return t*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*n*(1-e)*e*e+r*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,i){this._et.addEventListener(e,t,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,i){this._et.removeEventListener(e,t,i)}}function xt(s,e=250){let t=0,i=null,n,r,o;const a=()=>{t=Date.now(),i=null,n=s.apply(r,o),i||(r=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return r=this,o=p,u<=0||u>e?(i&&(clearTimeout(i),i=null),t=c,n=s.apply(r,o),i||(r=null,o=[])):i||(i=window.setTimeout(a,u)),n}}class ee extends vt{constructor(e,t={}){var i,n,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=(i=t.throttle)!==null&&i!==void 0?i:16,this.minDistance=(n=t.minDistance)!==null&&n!==void 0?n: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?xt(ee.prototype._strokeUpdate,this.throttle):ee.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((i,n)=>{const r=new Image,o=t.ratio||window.devicePixelRatio||1,a=t.width||this.canvas.width/o,l=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,l),i()},r.onerror=u=>{n(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:i}=this._getListenerFunctions();switch(e.event.type){case"mousedown":i("mousemove",this._handleMouseMove,{passive:!1}),i("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":i("touchmove",this._handleTouchMove,{passive:!1}),i("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":i("pointermove",this._handlePointerMove,{passive:!1}),i("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},n),{points:[]});this._data.push(r),this._reset(n),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),i=this._data[this._data.length-1],n=i.points,r=n.length>0&&n[n.length-1],o=r?t.distanceTo(r)<=this.minDistance:!1,a=this._getPointGroupOptions(i);if(!r||!(r&&o)){const l=this._addPoint(t,a);r?l&&this._drawCurve(l,a):this._drawDot(t,a),n.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,i){const n=this.canvas.getBoundingClientRect();return new Z(e-n.left,t-n.top,i,new Date().getTime())}_addPoint(e,t){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const n=this._calculateCurveWidths(i[1],i[2],t),r=ge.fromPoints(i,n);return i.shift(),r}return null}_calculateCurveWidths(e,t,i){const n=i.velocityFilterWeight*t.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,r=this._strokeWidth(n,i),o={end:r,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=r,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,i){const n=this._ctx;n.moveTo(e,t),n.arc(e,t,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const i=this._ctx,n=e.endWidth-e.startWidth,r=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=t.penColor;for(let o=0;o<r;o+=1){const a=o/r,l=a*a,p=l*a,c=1-a,u=c*c,h=u*c;let m=h*e.startPoint.x;m+=3*u*a*e.control1.x,m+=3*c*l*e.control2.x,m+=p*e.endPoint.x;let v=h*e.startPoint.y;v+=3*u*a*e.control1.y,v+=3*c*l*e.control2.y,v+=p*e.endPoint.y;const D=Math.min(e.startWidth+p*n,t.maxWidth);this._drawCurveSegment(m,v,D)}i.closePath(),i.fill()}_drawDot(e,t){const i=this._ctx,n=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,n),i.closePath(),i.fillStyle=t.penColor,i.fill()}_fromData(e,t,i){for(const n of e){const{points:r}=n,o=this._getPointGroupOptions(n);if(r.length>1)for(let a=0;a<r.length;a+=1){const l=r[a],p=new Z(l.x,l.y,l.pressure,l.time);a===0&&this._reset(o);const c=this._addPoint(p,o);c&&t(c,o)}else this._reset(o),i(r[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,r=0,o=this.canvas.width/i,a=this.canvas.height/i,l=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),l.setAttribute("viewBox",`${n} ${r} ${o} ${a}`),l.setAttribute("width",o.toString()),l.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),l.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"),l.appendChild(u)}},(p,{penColor:c,dotSize:u,minWidth:h,maxWidth:m})=>{const v=document.createElement("circle"),D=u>0?u:(h+m)/2;v.setAttribute("r",D.toString()),v.setAttribute("cx",p.x.toString()),v.setAttribute("cy",p.y.toString()),v.setAttribute("fill",c),l.appendChild(v)}),l.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const i=t==null?void 0:t.getElementById(`signature-${e}`);if(!i)return null;this.clearSignaturePad(e),this.resizeCanvas(i);const n=new ee(i,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,n),this.canvasElements.set(e,i),n.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),n}handleSignatureChange(e){var r;const t=this.signaturePads.get(e);if(!t)return;const i=!t.isEmpty(),n=i?t.toData():null;(r=this.onSignatureChange)==null||r.call(this,{questionId:e,hasSignature:i,signatureData:n})}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 i=t.toSVG(),n=t.toDataURL();return{questionId:e,svgData:i,dataURL:n}}restoreSignature(e,t){const i=this.signaturePads.get(e);if(!i||!t)return!1;try{return i.clear(),i.fromData(t),!0}catch(n){return console.warn(`Failed to restore signature for ${e}:`,n),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const i=this.canvasElements.get(t);if(i){this.resizeCanvas(i);const n=e.toData();e.clear(),e.fromData(n)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),i=window.getComputedStyle(e),n=parseFloat(i.width),r=parseFloat(i.height);e.width=n*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 yt{trackQuestionResponse(e,t,i){if(!e)return;e.responses||(e.responses=[]);const n=e.responses.findIndex(o=>o.elementId===t),r={elementId:t,value:i,answeredAt:new Date};n>=0?e.responses[n]=r:e.responses.push(r)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(n=>{if(this.isQuestionElement(n.type)){const r=t[n.id];if(r!==void 0&&i.responses){let o=i.responses.find(a=>a.elementId===n.id);o?(o.value=r,o.answeredAt=new Date):(o={elementId:n.id,value:r,answeredAt:new Date},i.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),t}hasChangedFromPrevious(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.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 i=e+1;i<t.steps.length;i++){const n=t.steps[i];if(this.isStepAssignedToUser(n))return i}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const i=t==null?void 0:t.steps;return e===((i==null?void 0:i.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,i,n,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=i.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=i.steps;if(!a||e<0||e>=a.length)return{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"};const l=a[e];if(this.isStepAssignedToUser(l)){const p=n.has(l.id),c=this.isStepWithinAllowedRange(e,i,n);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,i){if(!(t!=null&&t.steps))return!1;const r=this.getAssignedSteps(t).map(l=>t.steps.findIndex(p=>p.id===l.id)).sort((l,p)=>l-p);let o=-1;for(const l of r){const p=t.steps[l];i.has(p.id)&&(o=l)}let a=-1;for(const l of r)if(l>o){a=l;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const te=class te{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(i=>{i.responses&&i.responses.forEach(n=>{t[n.elementId]=n.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return te.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var i;const t={};return(i=e.elements)==null||i.forEach(n=>{if(this.isQuestionElement(n)){const r=n,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}};te.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let me=te;const ie=class ie{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,i){var p,c,u,h,m;const n=t.target,r=(p=n.files)==null?void 0:p[0];if(!r){this.clearFile(e),(c=i.onRequestUpdate)==null||c.call(i);return}const o=this.validateFileSize(r);if(o){this.handleFileValidationError(e,o,n),(u=i.onRequestUpdate)==null||u.call(i);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(r);this.formStateManager.setFormField(e,a);const l=this.hasFileChanged(e,a,i.savedInstance);l&&i.mode!=="preview"?this.executeFileUploadCallback(e,r,a,i):this.logSkippedCallback(e,i.mode,l),(h=i.onRequestUpdate)==null||h.call(i),i.mode!=="admin"&&((m=i.onFormDataSave)==null||m.call(i))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>ie.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,i){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),i.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,i){if(!(i!=null&&i.steps))return!0;for(const n of i.steps)if(n.responses){const r=n.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,i,n){var r,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!n.onFileUploaded),n.onFileUploaded&&n.onFileUploaded({instanceId:(r=n.instance)==null?void 0:r.id,stepId:(o=n.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:i.name,fileSize:i.size,fileType:i.type})}logSkippedCallback(e,t,i){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):i||console.log("File unchanged, skipping callback for:",e)}};ie.MAX_FILE_SIZE=5*1024*1024;let fe=ie;class k{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,i=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(2))+" "+i[n]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),i=t[t.length-1];return i&&i.includes(".")?i:"Uploaded File"}}static _guessFileTypeFromUrl(e){var r;const i=(r=k._extractFilenameFromUrl(e).split(".").pop())==null?void 0:r.toLowerCase();return i?{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"}[i]||`${i.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,i){return i.mode==="print"?d`<div class="print-response-value textarea-response">
|
|
3728
|
-
${t||
|
|
3729
|
-
</div>`:
|
|
4179
|
+
*/class Z{constructor(e,t,i,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=i||0,this.time=r||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 i=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new ge(e[1],i,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,i){const r=e.x-t.x,n=e.y-t.y,o=t.x-i.x,a=t.y-i.y,d={x:(e.x+t.x)/2,y:(e.y+t.y)/2},p={x:(t.x+i.x)/2,y:(t.y+i.y)/2},c=Math.sqrt(r*r+n*n),u=Math.sqrt(o*o+a*a),h=d.x-p.x,m=d.y-p.y,x=c+u==0?0:u/(c+u),w={x:p.x+h*x,y:p.y+m*x},se=t.x-w.x,re=t.y-w.y;return{c1:new Z(d.x+se,d.y+re),c2:new Z(p.x+se,p.y+re)}}constructor(e,t,i,r,n,o){this.startPoint=e,this.control2=t,this.control1=i,this.endPoint=r,this.startWidth=n,this.endWidth=o}length(){let t=0,i,r;for(let n=0;n<=10;n+=1){const o=n/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(n>0){const p=a-i,c=d-r;t+=Math.sqrt(p*p+c*c)}i=a,r=d}return t}point(e,t,i,r,n){return t*(1-e)*(1-e)*(1-e)+3*i*(1-e)*(1-e)*e+3*r*(1-e)*e*e+n*e*e*e}}class vt{constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,i){this._et.addEventListener(e,t,i)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,i){this._et.removeEventListener(e,t,i)}}function xt(s,e=250){let t=0,i=null,r,n,o;const a=()=>{t=Date.now(),i=null,r=s.apply(n,o),i||(n=null,o=[])};return function(...p){const c=Date.now(),u=e-(c-t);return n=this,o=p,u<=0||u>e?(i&&(clearTimeout(i),i=null),t=c,r=s.apply(n,o),i||(n=null,o=[])):i||(i=window.setTimeout(a,u)),r}}class ee extends vt{constructor(e,t={}){var i,r,n;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=(i=t.throttle)!==null&&i!==void 0?i:16,this.minDistance=(r=t.minDistance)!==null&&r!==void 0?r: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=(n=t.canvasContextOptions)!==null&&n!==void 0?n:{},this._strokeMoveUpdate=this.throttle?xt(ee.prototype._strokeUpdate,this.throttle):ee.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((i,r)=>{const n=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()),n.onload=()=>{this._ctx.drawImage(n,p,c,a,d),i()},n.onerror=u=>{r(u)},n.crossOrigin="anonymous",n.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:i}=this._getListenerFunctions();switch(e.event.type){case"mousedown":i("mousemove",this._handleMouseMove,{passive:!1}),i("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":i("touchmove",this._handleTouchMove,{passive:!1}),i("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":i("pointermove",this._handlePointerMove,{passive:!1}),i("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const r=this._getPointGroupOptions(),n=Object.assign(Object.assign({},r),{points:[]});this._data.push(n),this._reset(r),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),i=this._data[this._data.length-1],r=i.points,n=r.length>0&&r[r.length-1],o=n?t.distanceTo(n)<=this.minDistance:!1,a=this._getPointGroupOptions(i);if(!n||!(n&&o)){const d=this._addPoint(t,a);n?d&&this._drawCurve(d,a):this._drawDot(t,a),r.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,i){const r=this.canvas.getBoundingClientRect();return new Z(e-r.left,t-r.top,i,new Date().getTime())}_addPoint(e,t){const{_lastPoints:i}=this;if(i.push(e),i.length>2){i.length===3&&i.unshift(i[0]);const r=this._calculateCurveWidths(i[1],i[2],t),n=ge.fromPoints(i,r);return i.shift(),n}return null}_calculateCurveWidths(e,t,i){const r=i.velocityFilterWeight*t.velocityFrom(e)+(1-i.velocityFilterWeight)*this._lastVelocity,n=this._strokeWidth(r,i),o={end:n,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=n,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,i){const r=this._ctx;r.moveTo(e,t),r.arc(e,t,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const i=this._ctx,r=e.endWidth-e.startWidth,n=Math.ceil(e.length())*2;i.beginPath(),i.fillStyle=t.penColor;for(let o=0;o<n;o+=1){const a=o/n,d=a*a,p=d*a,c=1-a,u=c*c,h=u*c;let m=h*e.startPoint.x;m+=3*u*a*e.control1.x,m+=3*c*d*e.control2.x,m+=p*e.endPoint.x;let x=h*e.startPoint.y;x+=3*u*a*e.control1.y,x+=3*c*d*e.control2.y,x+=p*e.endPoint.y;const w=Math.min(e.startWidth+p*r,t.maxWidth);this._drawCurveSegment(m,x,w)}i.closePath(),i.fill()}_drawDot(e,t){const i=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;i.beginPath(),this._drawCurveSegment(e.x,e.y,r),i.closePath(),i.fillStyle=t.penColor,i.fill()}_fromData(e,t,i){for(const r of e){const{points:n}=r,o=this._getPointGroupOptions(r);if(n.length>1)for(let a=0;a<n.length;a+=1){const d=n[a],p=new Z(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),i(n[0],o)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,i=Math.max(window.devicePixelRatio||1,1),r=0,n=0,o=this.canvas.width/i,a=this.canvas.height/i,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",`${r} ${n} ${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:m})=>{const x=document.createElement("circle"),w=u>0?u:(h+m)/2;x.setAttribute("r",w.toString()),x.setAttribute("cx",p.x.toString()),x.setAttribute("cy",p.y.toString()),x.setAttribute("fill",c),d.appendChild(x)}),d.outerHTML}}class _t{constructor(e){this.signaturePads=new Map,this.canvasElements=new Map,this.onSignatureChange=e}initializeSignaturePad(e,t){const i=t==null?void 0:t.getElementById(`signature-${e}`);if(!i)return null;this.clearSignaturePad(e),this.resizeCanvas(i);const r=new ee(i,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)",minWidth:.5,maxWidth:2.5});return this.signaturePads.set(e,r),this.canvasElements.set(e,i),r.addEventListener("endStroke",()=>{this.handleSignatureChange(e)}),r}handleSignatureChange(e){var n;const t=this.signaturePads.get(e);if(!t)return;const i=!t.isEmpty(),r=i?t.toData():null;(n=this.onSignatureChange)==null||n.call(this,{questionId:e,hasSignature:i,signatureData:r})}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 i=t.toSVG(),r=t.toDataURL();return{questionId:e,svgData:i,dataURL:r}}restoreSignature(e,t){const i=this.signaturePads.get(e);if(!i||!t)return!1;try{return i.clear(),i.fromData(t),!0}catch(r){return console.warn(`Failed to restore signature for ${e}:`,r),!1}}handleResize(){this.signaturePads.forEach((e,t)=>{const i=this.canvasElements.get(t);if(i){this.resizeCanvas(i);const r=e.toData();e.clear(),e.fromData(r)}})}resizeCanvas(e){const t=Math.max(window.devicePixelRatio||1,1),i=window.getComputedStyle(e),r=parseFloat(i.width),n=parseFloat(i.height);e.width=r*t,e.height=n*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 yt{trackQuestionResponse(e,t,i){if(!e)return;e.responses||(e.responses=[]);const r=e.responses.findIndex(o=>o.elementId===t),n={elementId:t,value:i,answeredAt:new Date};r>=0?e.responses[r]=n:e.responses.push(n)}updateInstanceWithFormData(e,t){e!=null&&e.steps&&e.steps.forEach(i=>{i.responses||(i.responses=[]),i.elements.forEach(r=>{if(this.isQuestionElement(r.type)){const n=t[r.id];if(n!==void 0&&i.responses){let o=i.responses.find(a=>a.elementId===r.id);o?(o.value=n,o.answeredAt=new Date):(o={elementId:r.id,value:n,answeredAt:new Date},i.responses.push(o))}}})})}extractFormDataFromSteps(e){const t={};return e.forEach(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),t}hasChangedFromPrevious(e,t,i){if(!(i!=null&&i.steps))return!0;for(const r of i.steps)if(r.responses){const n=r.responses.find(o=>o.elementId===e);if(n)return n.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 i=e+1;i<t.steps.length;i++){const r=t.steps[i];if(this.isStepAssignedToUser(r))return i}return-1}isLastAssignedStep(e,t){if(this.mode==="preview"||this.mode==="admin"||this.mode==="view-only"||this.mode==="print"){const i=t==null?void 0:t.steps;return e===((i==null?void 0:i.length)||0)-1}return this.findNextAssignedStep(e,t)===-1}canNavigateToStep(e,t,i,r,n,o){if((n||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=i.steps;return!p||e<0||e>=p.length?{canNavigate:!1,newStepIndex:t,reason:"Invalid step index"}:{canNavigate:!0,newStepIndex:e}}const a=i.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=r.has(d.id),c=this.isStepWithinAllowedRange(e,i,r);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,i){if(!(t!=null&&t.steps))return!1;const n=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 n){const p=t.steps[d];i.has(p.id)&&(o=d)}let a=-1;for(const d of n)if(d>o){a=d;break}return a!==-1?e<=a&&this.isStepAssignedToUser(t.steps[e]):this.isStepAssignedToUser(t.steps[e])}}const te=class te{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(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),this.formData=t}reset(){this.formData={},this.validationErrors={}}isQuestionElement(e){return te.QUESTION_ELEMENT_TYPES.includes(e.type)}getStepFormData(e){var i;const t={};return(i=e.elements)==null||i.forEach(r=>{if(this.isQuestionElement(r)){const n=r,o=this.formData[n.id];o!==void 0&&(t[n.id]=o)}}),t}hasFormData(){return Object.keys(this.formData).length>0}getFormFieldIds(){return Object.keys(this.formData)}getValidationErrorCount(){return Object.keys(this.validationErrors).length}};te.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"];let me=te;const ie=class ie{constructor(e,t){this.formStateManager=e,this.responseTracker=t}handleFileUpload(e,t,i){var p,c,u,h,m;const r=t.target,n=(p=r.files)==null?void 0:p[0];if(!n){this.clearFile(e),(c=i.onRequestUpdate)==null||c.call(i);return}const o=this.validateFileSize(n);if(o){this.handleFileValidationError(e,o,r),(u=i.onRequestUpdate)==null||u.call(i);return}this.formStateManager.clearValidationError(e);const a=this.createFileInfo(n);this.formStateManager.setFormField(e,a);const d=this.hasFileChanged(e,a,i.savedInstance);d&&i.mode!=="preview"?this.executeFileUploadCallback(e,n,a,i):this.logSkippedCallback(e,i.mode,d),(h=i.onRequestUpdate)==null||h.call(i),i.mode!=="admin"&&((m=i.onFormDataSave)==null||m.call(i))}clearFile(e){this.formStateManager.setFormField(e,null),this.formStateManager.clearValidationError(e)}validateFileSize(e){return e.size>ie.MAX_FILE_SIZE?`File size must be less than 5MB. Current size: ${(e.size/1024/1024).toFixed(2)}MB`:null}handleFileValidationError(e,t,i){this.formStateManager.setValidationError(e,t),this.formStateManager.setFormField(e,null),i.value=""}createFileInfo(e){return{name:e.name,size:e.size,type:e.type,lastModified:e.lastModified}}hasFileChanged(e,t,i){if(!(i!=null&&i.steps))return!0;for(const r of i.steps)if(r.responses){const n=r.responses.find(o=>o.elementId===e);if(n&&n.value&&typeof n.value=="object"){const o=n.value;return o.name!==t.name||o.size!==t.size||o.type!==t.type||o.lastModified!==t.lastModified}}return!0}executeFileUploadCallback(e,t,i,r){var n,o;console.log("File changed, calling callback for:",e),console.log("Callback function exists:",!!r.onFileUploaded),r.onFileUploaded&&r.onFileUploaded({instanceId:(n=r.instance)==null?void 0:n.id,stepId:(o=r.currentStep)==null?void 0:o.id,questionId:e,file:t,fileName:i.name,fileSize:i.size,fileType:i.type})}logSkippedCallback(e,t,i){t==="preview"?console.log("Preview mode: skipping file upload callback for:",e):i||console.log("File unchanged, skipping callback for:",e)}};ie.MAX_FILE_SIZE=5*1024*1024;let fe=ie;class ${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,i=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+i[r]}static _extractFilenameFromUrl(e){try{return new URL(e).pathname.split("/").pop()||""||"Uploaded File"}catch{const t=e.split("/"),i=t[t.length-1];return i&&i.includes(".")?i:"Uploaded File"}}static _guessFileTypeFromUrl(e){var n;const i=(n=$._extractFilenameFromUrl(e).split(".").pop())==null?void 0:n.toLowerCase();return i?{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"}[i]||`${i.toUpperCase()} File`:"Unknown"}static renderTextArea(e,t,i){return i.mode==="print"?l`<div class="print-response-value textarea-response">
|
|
4180
|
+
${t||l`<span class="print-no-response">No response</span>`}
|
|
4181
|
+
</div>`:l`<textarea
|
|
3730
4182
|
id=${e.id}
|
|
3731
4183
|
.value=${t}
|
|
3732
4184
|
?required=${e.required}
|
|
3733
4185
|
?disabled=${this._isInputDisabled(i)}
|
|
3734
4186
|
placeholder=${e.placeholder?e.placeholder:"Your response"}
|
|
3735
|
-
@input=${
|
|
3736
|
-
></textarea>`}static renderSelect(e,t,i){var
|
|
3737
|
-
${t||
|
|
3738
|
-
</div>`:
|
|
4187
|
+
@input=${r=>i.handlers.handleInputChange(e.id,r)}
|
|
4188
|
+
></textarea>`}static renderSelect(e,t,i){var r;return i.mode==="print"?l`<div class="print-response-value select-response">
|
|
4189
|
+
${t||l`<span class="print-no-response">No selection made</span>`}
|
|
4190
|
+
</div>`:l`<select
|
|
3739
4191
|
id=${e.id}
|
|
3740
4192
|
.value=${t}
|
|
3741
4193
|
?required=${e.required}
|
|
3742
4194
|
?disabled=${this._isInputDisabled(i)}
|
|
3743
4195
|
class=${t===""?"placeholder":""}
|
|
3744
|
-
@change=${
|
|
4196
|
+
@change=${n=>i.handlers.handleInputChange(e.id,n)}
|
|
3745
4197
|
>
|
|
3746
4198
|
<option value="">Choose</option>
|
|
3747
|
-
${(
|
|
3748
|
-
</select>`}static renderRadio(e,t,i){var o;const
|
|
3749
|
-
${t||
|
|
3750
|
-
</div>`:
|
|
3751
|
-
${(o=e.options)==null?void 0:o.map(a=>
|
|
4199
|
+
${(r=e.options)==null?void 0:r.map(n=>l`<option value=${n}>${n}</option>`)}
|
|
4200
|
+
</select>`}static renderRadio(e,t,i){var o;const r=this._isInputDisabled(i),n=i.mode==="print";return n?l`<div class="print-response-value radio-response">
|
|
4201
|
+
${t||l`<span class="print-no-response">No selection made</span>`}
|
|
4202
|
+
</div>`:l`<div class="radio-group ${n?"print-mode":""}">
|
|
4203
|
+
${(o=e.options)==null?void 0:o.map(a=>l`
|
|
3752
4204
|
<label class="radio-option">
|
|
3753
4205
|
<input
|
|
3754
4206
|
type="radio"
|
|
3755
4207
|
name=${e.id}
|
|
3756
4208
|
value=${a}
|
|
3757
4209
|
.checked=${t===a}
|
|
3758
|
-
?disabled=${
|
|
3759
|
-
@change=${
|
|
4210
|
+
?disabled=${r}
|
|
4211
|
+
@change=${n?null:d=>i.handlers.handleInputChange(e.id,d)}
|
|
3760
4212
|
/>
|
|
3761
4213
|
<span class="radio-label">${a}</span>
|
|
3762
4214
|
</label>
|
|
3763
4215
|
`)}
|
|
3764
|
-
</div>`}static renderCheckbox(e,t,i){var o;const
|
|
3765
|
-
${a.length>0?a.map(l
|
|
3766
|
-
</div>`}return
|
|
3767
|
-
${(o=e.options)==null?void 0:o.map(a=>
|
|
4216
|
+
</div>`}static renderCheckbox(e,t,i){var o;const r=this._isInputDisabled(i),n=i.mode==="print";if(e.options&&e.options.length>0){if(n){const a=Array.isArray(t)?t:[];return l`<div class="print-response-value checkbox-response">
|
|
4217
|
+
${a.length>0?a.map(d=>l`<div>• ${d}</div>`):l`<span class="print-no-response">No selections made</span>`}
|
|
4218
|
+
</div>`}return l`<div class="checkbox-group ${n?"print-mode":""}">
|
|
4219
|
+
${(o=e.options)==null?void 0:o.map(a=>l`
|
|
3768
4220
|
<label class="checkbox-option">
|
|
3769
4221
|
<input
|
|
3770
4222
|
type="checkbox"
|
|
3771
4223
|
name=${e.id}
|
|
3772
4224
|
value=${a}
|
|
3773
4225
|
.checked=${Array.isArray(t)?t.includes(a):!1}
|
|
3774
|
-
?disabled=${
|
|
3775
|
-
@change=${
|
|
4226
|
+
?disabled=${r}
|
|
4227
|
+
@change=${n?null:d=>i.handlers.handleCheckboxGroupChange(e.id,a,d)}
|
|
3776
4228
|
/>
|
|
3777
4229
|
<span class="checkbox-label">${a}</span>
|
|
3778
4230
|
</label>
|
|
3779
4231
|
`)}
|
|
3780
|
-
</div>`}else return
|
|
4232
|
+
</div>`}else return n?l`<div class="print-response-value checkbox-response">
|
|
3781
4233
|
${t?"Yes":"No"}
|
|
3782
|
-
</div>`:
|
|
4234
|
+
</div>`:l`<label class="checkbox-single ${n?"print-mode":""}">
|
|
3783
4235
|
<input
|
|
3784
4236
|
type="checkbox"
|
|
3785
4237
|
id=${e.id}
|
|
3786
4238
|
.checked=${!!t}
|
|
3787
|
-
?disabled=${
|
|
3788
|
-
@change=${
|
|
4239
|
+
?disabled=${r}
|
|
4240
|
+
@change=${n?null:a=>i.handlers.handleCheckboxChange(e.id,a)}
|
|
3789
4241
|
/>
|
|
3790
4242
|
<span class="checkbox-label">${e.label}</span>
|
|
3791
|
-
</label>`}static renderSignature(e,t,i){const
|
|
4243
|
+
</label>`}static renderSignature(e,t,i){const r=i.formData[e.id],n=!!i.formData[e.id],o=i.savedSignatures.has(e.id),a=i.replacingSignatures.has(e.id);if(i.mode==="print")return r&&typeof r=="string"?l`
|
|
3792
4244
|
<div class="print-response-value signature-response">
|
|
3793
4245
|
<img
|
|
3794
|
-
src="${
|
|
4246
|
+
src="${r}"
|
|
3795
4247
|
alt="Digital Signature"
|
|
3796
4248
|
class="signature-image"
|
|
3797
|
-
@error=${
|
|
4249
|
+
@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")}}
|
|
3798
4250
|
/>
|
|
3799
4251
|
<div class="signature-fallback hidden">
|
|
3800
4252
|
<span class="signature-error">Unable to display signature</span>
|
|
3801
4253
|
</div>
|
|
3802
4254
|
</div>
|
|
3803
|
-
`:
|
|
4255
|
+
`:l`<div class="print-response-value signature-response">
|
|
3804
4256
|
<span class="print-no-response">No signature provided</span>
|
|
3805
|
-
</div>`;if(i.mode==="view-only")return
|
|
4257
|
+
</div>`;if(i.mode==="view-only")return r&&typeof r=="string"?l`
|
|
3806
4258
|
<div class="signature-view-only">
|
|
3807
4259
|
<img
|
|
3808
|
-
src="${
|
|
4260
|
+
src="${r}"
|
|
3809
4261
|
alt="Digital Signature"
|
|
3810
4262
|
class="signature-image"
|
|
3811
|
-
@error=${
|
|
4263
|
+
@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")}}
|
|
3812
4264
|
/>
|
|
3813
4265
|
<div class="signature-fallback hidden">
|
|
3814
4266
|
<span class="signature-error">Unable to display signature</span>
|
|
3815
4267
|
</div>
|
|
3816
4268
|
</div>
|
|
3817
|
-
`:
|
|
4269
|
+
`:l`
|
|
3818
4270
|
<div class="signature-view-only">
|
|
3819
4271
|
<span class="no-signature">No signature captured</span>
|
|
3820
4272
|
</div>
|
|
3821
|
-
`;if(i.mode==="admin"&&
|
|
4273
|
+
`;if(i.mode==="admin"&&r&&typeof r=="string"&&!a){const d=r.trim().startsWith("<svg");return l`
|
|
3822
4274
|
<div class="signature-admin-display">
|
|
3823
4275
|
<div class="signature-existing">
|
|
3824
|
-
${l
|
|
4276
|
+
${d?l` <div class="signature-svg-container" .innerHTML=${r}></div> `:l`
|
|
3825
4277
|
<img
|
|
3826
|
-
src="${
|
|
4278
|
+
src="${r}"
|
|
3827
4279
|
alt="Digital Signature"
|
|
3828
4280
|
class="signature-image"
|
|
3829
4281
|
@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")}}
|
|
@@ -3843,7 +4295,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3843
4295
|
</button>
|
|
3844
4296
|
</div>
|
|
3845
4297
|
</div>
|
|
3846
|
-
`}return
|
|
4298
|
+
`}return l`
|
|
3847
4299
|
<div class="signature-container ${this._isInputDisabled(i)?"disabled":""}">
|
|
3848
4300
|
<canvas id="signature-${e.id}" class="signature-canvas"></canvas>
|
|
3849
4301
|
<div class="signature-controls">
|
|
@@ -3855,7 +4307,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3855
4307
|
>
|
|
3856
4308
|
Clear
|
|
3857
4309
|
</button>
|
|
3858
|
-
${
|
|
4310
|
+
${n&&!o?l`
|
|
3859
4311
|
<button
|
|
3860
4312
|
type="button"
|
|
3861
4313
|
class="signature-save-btn"
|
|
@@ -3865,8 +4317,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3865
4317
|
Save
|
|
3866
4318
|
</button>
|
|
3867
4319
|
`:""}
|
|
3868
|
-
${o?
|
|
3869
|
-
${i.mode==="admin"&&a?
|
|
4320
|
+
${o?l` <span class="signature-saved">✓ Saved</span> `:""}
|
|
4321
|
+
${i.mode==="admin"&&a?l`
|
|
3870
4322
|
<button
|
|
3871
4323
|
type="button"
|
|
3872
4324
|
class="signature-cancel-btn"
|
|
@@ -3877,45 +4329,45 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3877
4329
|
`:""}
|
|
3878
4330
|
</div>
|
|
3879
4331
|
</div>
|
|
3880
|
-
`}static renderFileUpload(e,t,i){const
|
|
4332
|
+
`}static renderFileUpload(e,t,i){const r=i.formData[e.id];if(i.mode==="view-only"||i.mode==="print")if(r){const n=typeof r=="string",o=typeof r=="object"&&r.name;if(i.mode==="print"){if(o)return l`
|
|
3881
4333
|
<div class="print-response-value file-response">
|
|
3882
|
-
📎 ${
|
|
3883
|
-
${
|
|
3884
|
-
>(${
|
|
4334
|
+
📎 ${r.name}
|
|
4335
|
+
${r.size?l` <span class="file-size"
|
|
4336
|
+
>(${$._formatFileSize(r.size)})</span
|
|
3885
4337
|
>`:""}
|
|
3886
4338
|
</div>
|
|
3887
|
-
`;if(
|
|
4339
|
+
`;if(n){const a=$._extractFilenameFromUrl(r);return l` <div class="print-response-value file-response">📎 ${a}</div> `}else return l` <div class="print-response-value file-response">📎 ${r}</div> `}else{const a=n?r:"#",d=o?r.name:n?$._extractFilenameFromUrl(r):"View File";return l`
|
|
3888
4340
|
<div class="file-upload-view-only">
|
|
3889
|
-
<a href="${a}" target="_blank" class="file-link"> 📎 ${
|
|
3890
|
-
${o&&
|
|
4341
|
+
<a href="${a}" target="_blank" class="file-link"> 📎 ${d} </a>
|
|
4342
|
+
${o&&r.size?l`
|
|
3891
4343
|
<span class="file-size-info"
|
|
3892
|
-
>(${
|
|
4344
|
+
>(${$._formatFileSize(r.size)})</span
|
|
3893
4345
|
>
|
|
3894
4346
|
`:""}
|
|
3895
4347
|
</div>
|
|
3896
|
-
`}}else return i.mode==="print"?
|
|
4348
|
+
`}}else return i.mode==="print"?l`
|
|
3897
4349
|
<div class="print-response-value file-response">
|
|
3898
4350
|
<span class="print-no-response">No file uploaded</span>
|
|
3899
4351
|
</div>
|
|
3900
|
-
`:
|
|
4352
|
+
`:l`
|
|
3901
4353
|
<div class="file-upload-view-only">
|
|
3902
4354
|
<span class="no-file">No file uploaded</span>
|
|
3903
4355
|
</div>
|
|
3904
|
-
`;return
|
|
4356
|
+
`;return l`
|
|
3905
4357
|
<div class="file-upload-container">
|
|
3906
4358
|
<input
|
|
3907
4359
|
type="file"
|
|
3908
4360
|
id=${e.id}
|
|
3909
4361
|
?required=${e.required}
|
|
3910
4362
|
?disabled=${this._isInputDisabled(i)}
|
|
3911
|
-
@change=${
|
|
4363
|
+
@change=${n=>i.handlers.handleFileUpload(e.id,n)}
|
|
3912
4364
|
/>
|
|
3913
|
-
${
|
|
4365
|
+
${r?l`
|
|
3914
4366
|
<div class="file-preview">
|
|
3915
|
-
<span class="file-name">${
|
|
4367
|
+
<span class="file-name">${r.name||"File selected"}</span>
|
|
3916
4368
|
<button
|
|
3917
4369
|
type="button"
|
|
3918
|
-
class="file-
|
|
4370
|
+
class="file-remove-btn"
|
|
3919
4371
|
?disabled=${this._isInputDisabled(i)}
|
|
3920
4372
|
@click=${()=>{i.formData[e.id]=null,i.handlers.trackQuestionResponse(e.id,null)}}
|
|
3921
4373
|
>
|
|
@@ -3924,32 +4376,32 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3924
4376
|
</div>
|
|
3925
4377
|
`:""}
|
|
3926
4378
|
</div>
|
|
3927
|
-
`}static renderDefaultInput(e,t,i){if(i.mode==="print"){const
|
|
3928
|
-
${
|
|
3929
|
-
</div>`}const
|
|
3930
|
-
type=${
|
|
4379
|
+
`}static renderDefaultInput(e,t,i){if(i.mode==="print"){const n=e.type==="date"&&t?new Date(t).toLocaleDateString():t;return l`<div class="print-response-value input-response">
|
|
4380
|
+
${n||l`<span class="print-no-response">No response</span>`}
|
|
4381
|
+
</div>`}const r=e.type==="number"?"number":e.type==="date"?"date":"text";return l`<input
|
|
4382
|
+
type=${r}
|
|
3931
4383
|
id=${e.id}
|
|
3932
4384
|
.value=${t}
|
|
3933
4385
|
?required=${e.required}
|
|
3934
4386
|
?disabled=${this._isInputDisabled(i)}
|
|
3935
4387
|
placeholder=${e.placeholder?e.placeholder:"Your response"} // custom placeholder when not blank
|
|
3936
|
-
@input=${
|
|
3937
|
-
/>`}static render(e,t){const i=t.formData[e.id]??"",
|
|
4388
|
+
@input=${n=>i.handlers.handleInputChange(e.id,n)}
|
|
4389
|
+
/>`}static render(e,t){const i=t.formData[e.id]??"",r=t.validationErrors[e.id],n=()=>{switch(e.type){case"textarea":return $.renderTextArea(e,i,t);case"select":return $.renderSelect(e,i,t);case"radio":return $.renderRadio(e,i,t);case"checkbox":return $.renderCheckbox(e,i,t);case"signature":return $.renderSignature(e,i,t);case"file_upload":return $.renderFileUpload(e,i,t);default:return $.renderDefaultInput(e,i,t)}},o=e.type==="checkbox"&&(!e.options||e.options.length===0);return t.mode==="print"?l`
|
|
3938
4390
|
<div class="question-print">
|
|
3939
|
-
${o?"":
|
|
3940
|
-
${
|
|
4391
|
+
${o?"":l` <div class="print-question-title">${e.label}:</div> `}
|
|
4392
|
+
${n()}
|
|
3941
4393
|
<hr class="print-question-separator" />
|
|
3942
4394
|
</div>
|
|
3943
|
-
`:
|
|
3944
|
-
<div class="question ${
|
|
3945
|
-
${o?"":
|
|
4395
|
+
`:l`
|
|
4396
|
+
<div class="question ${r?"error":""}">
|
|
4397
|
+
${o?"":l`
|
|
3946
4398
|
<div class="runner-question-title">
|
|
3947
|
-
${e.label}${e.required?
|
|
4399
|
+
${e.label}${e.required?l`<span class="runner-question-required">*</span>`:""}
|
|
3948
4400
|
</div>
|
|
3949
4401
|
<hr class="runner-question-divider" />
|
|
3950
4402
|
`}
|
|
3951
|
-
${
|
|
3952
|
-
${
|
|
4403
|
+
${n()}
|
|
4404
|
+
${r?l`<div class="error-message">${r}</div>`:""}
|
|
3953
4405
|
</div>
|
|
3954
4406
|
`}}/**
|
|
3955
4407
|
* @license
|
|
@@ -3959,74 +4411,74 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
3959
4411
|
* @license
|
|
3960
4412
|
* Copyright 2017 Google LLC
|
|
3961
4413
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3962
|
-
*/class be extends $t{constructor(e){if(super(e),this.it=
|
|
4414
|
+
*/class be extends $t{constructor(e){if(super(e),this.it=_,e.type!==St.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===_||e==null)return this._t=void 0,this.it=e;if(e===U)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 Le=kt(be);class C{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`
|
|
3963
4415
|
<div class="content-element text-content">
|
|
3964
4416
|
<p>${e.content}</p>
|
|
3965
4417
|
</div>
|
|
3966
|
-
`}static renderMarkdownElement(e){return
|
|
4418
|
+
`}static renderMarkdownElement(e){return l`
|
|
3967
4419
|
<div class="content-element markdown-content">
|
|
3968
4420
|
<div class="markdown-text">
|
|
3969
|
-
${Le(
|
|
4421
|
+
${Le(C.renderMarkdown(e.content))}
|
|
3970
4422
|
</div>
|
|
3971
4423
|
</div>
|
|
3972
|
-
`}static renderDivider(e){return
|
|
4424
|
+
`}static renderDivider(e){return l`
|
|
3973
4425
|
<div class="content-element divider-content">
|
|
3974
4426
|
<hr class="content-divider" />
|
|
3975
|
-
${e.caption?
|
|
4427
|
+
${e.caption?l`<div class="divider-caption">${e.caption}</div>`:""}
|
|
3976
4428
|
</div>
|
|
3977
|
-
`}static renderHtml(e){return
|
|
4429
|
+
`}static renderHtml(e){return l`
|
|
3978
4430
|
<div class="content-element html-content">
|
|
3979
4431
|
<div class="html-content-wrapper">${Le(e.content)}</div>
|
|
3980
4432
|
</div>
|
|
3981
|
-
`}static renderImage(e){return
|
|
4433
|
+
`}static renderImage(e){return l`
|
|
3982
4434
|
<div class="content-element image-content">
|
|
3983
4435
|
<div class="image-placeholder">
|
|
3984
4436
|
<p>📷 Image: ${e.caption||e.alt||"Image content"}</p>
|
|
3985
4437
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
3986
4438
|
</div>
|
|
3987
4439
|
</div>
|
|
3988
|
-
`}static renderVideo(e){return
|
|
4440
|
+
`}static renderVideo(e){return l`
|
|
3989
4441
|
<div class="content-element video-content">
|
|
3990
4442
|
<div class="video-placeholder">
|
|
3991
4443
|
<p>🎥 Video: ${e.caption||"Video content"}</p>
|
|
3992
4444
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
3993
4445
|
</div>
|
|
3994
4446
|
</div>
|
|
3995
|
-
`}static renderFile(e){return
|
|
4447
|
+
`}static renderFile(e){return l`
|
|
3996
4448
|
<div class="content-element file-content">
|
|
3997
4449
|
<div class="file-placeholder">
|
|
3998
4450
|
<p>📄 File: ${e.caption||"File content"}</p>
|
|
3999
4451
|
<small>URL: ${e.url||"No URL provided"}</small>
|
|
4000
4452
|
</div>
|
|
4001
4453
|
</div>
|
|
4002
|
-
`}static renderUnknown(e){return
|
|
4454
|
+
`}static renderUnknown(e){return l`
|
|
4003
4455
|
<div class="content-element unknown-content">
|
|
4004
4456
|
<p>⚠️ Unknown content type: ${e.type}</p>
|
|
4005
4457
|
</div>
|
|
4006
|
-
`}static render(e,t){const i=()=>{switch(e.type){case"text":return
|
|
4458
|
+
`}static render(e,t){const i=()=>{switch(e.type){case"text":return C.renderText(e);case"markdown":return C.renderMarkdownElement(e);case"divider":return C.renderDivider(e);case"html":return C.renderHtml(e);case"image":return C.renderImage(e);case"video":return C.renderVideo(e);case"file":return C.renderFile(e);default:return C.renderUnknown(e)}};return(t==null?void 0:t.mode)==="print"?l`
|
|
4007
4459
|
<div class="content-print">
|
|
4008
4460
|
${i()}
|
|
4009
|
-
${e.type!=="divider"?
|
|
4461
|
+
${e.type!=="divider"?l`<hr class="print-question-separator" />`:""}
|
|
4010
4462
|
</div>
|
|
4011
|
-
`:i()}}class
|
|
4463
|
+
`:i()}}class ve{static renderMobileStepsForStatus(e){const{steps:t,disabled:i=!1}=e;return l`
|
|
4012
4464
|
<div class="runner-mobile-steps">
|
|
4013
4465
|
<nav aria-label="Workflow steps">
|
|
4014
4466
|
<div class="runner-mobile-steps-container">
|
|
4015
|
-
${t==null?void 0:t.map(
|
|
4467
|
+
${t==null?void 0:t.map(r=>{const n=e.isStepAssignedToUser(r),o=e.completedSteps.has(r.id);return l`
|
|
4016
4468
|
<div
|
|
4017
|
-
class="runner-mobile-step-tab ${o?"completed":""} ${
|
|
4018
|
-
style="cursor: not-allowed; opacity: ${i?"0.6":
|
|
4469
|
+
class="runner-mobile-step-tab ${o?"completed":""} ${n?"":"unassigned"} ${i?"disabled":""}"
|
|
4470
|
+
style="cursor: not-allowed; opacity: ${i?"0.6":n?"1":"0.6"};"
|
|
4019
4471
|
>
|
|
4020
|
-
<span class="runner-mobile-step-title">${
|
|
4472
|
+
<span class="runner-mobile-step-title">${r.title}</span>
|
|
4021
4473
|
<span class="runner-mobile-step-badge">
|
|
4022
|
-
${o?"Completed":
|
|
4474
|
+
${o?"Completed":n?"Your Step":"Other User"}
|
|
4023
4475
|
</span>
|
|
4024
4476
|
</div>
|
|
4025
4477
|
`})}
|
|
4026
4478
|
</div>
|
|
4027
4479
|
</nav>
|
|
4028
4480
|
</div>
|
|
4029
|
-
`}static renderNotAssignedView(){return
|
|
4481
|
+
`}static renderNotAssignedView(){return l`
|
|
4030
4482
|
<div class="runner-content not-assigned-view">
|
|
4031
4483
|
<div class="not-assigned-container">
|
|
4032
4484
|
<div class="not-assigned-icon">
|
|
@@ -4049,7 +4501,59 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4049
4501
|
</p>
|
|
4050
4502
|
</div>
|
|
4051
4503
|
</div>
|
|
4052
|
-
`}static
|
|
4504
|
+
`}static renderSubmissionErrorView(e){var r,n,o;const{submissionError:t,onRetry:i}=e;return l`
|
|
4505
|
+
<div class="runner-layout">
|
|
4506
|
+
<!-- Mobile Steps Navigation (visible only on mobile) -->
|
|
4507
|
+
${this.renderMobileStepsForStatus({steps:(r=e.instance)==null?void 0:r.steps,isStepAssignedToUser:e.isStepAssignedToUser,completedSteps:e.completedSteps,disabled:!0})}
|
|
4508
|
+
|
|
4509
|
+
<!-- Sidebar: Steps List (read-only, hidden on mobile) -->
|
|
4510
|
+
<aside class="runner-sidebar">
|
|
4511
|
+
<div class="runner-sidebar-header">Steps</div>
|
|
4512
|
+
<nav aria-label="Workflow steps">
|
|
4513
|
+
<ul class="runner-steps-list">
|
|
4514
|
+
${(o=(n=e.instance)==null?void 0:n.steps)==null?void 0:o.map(a=>{const d=e.isStepAssignedToUser(a),p=e.completedSteps.has(a.id);return l`
|
|
4515
|
+
<li
|
|
4516
|
+
class="runner-step-item ${p?"completed":""} ${d?"":"unassigned"}"
|
|
4517
|
+
style="opacity: ${d?"1":"0.6"}; cursor: not-allowed;"
|
|
4518
|
+
>
|
|
4519
|
+
<span class="runner-step-title">${a.title}</span>
|
|
4520
|
+
<span class="runner-step-badge ${!p&&d?"error":""}">
|
|
4521
|
+
${p?"Submitted":d?"Failed":"Other User"}
|
|
4522
|
+
</span>
|
|
4523
|
+
</li>
|
|
4524
|
+
`})}
|
|
4525
|
+
</ul>
|
|
4526
|
+
</nav>
|
|
4527
|
+
</aside>
|
|
4528
|
+
|
|
4529
|
+
<!-- Main Content: Error View -->
|
|
4530
|
+
<main class="runner-main-content">
|
|
4531
|
+
<div class="submission-container">
|
|
4532
|
+
<div class="submission-error-icon">
|
|
4533
|
+
<svg
|
|
4534
|
+
width="64"
|
|
4535
|
+
height="64"
|
|
4536
|
+
viewBox="0 0 24 24"
|
|
4537
|
+
fill="none"
|
|
4538
|
+
stroke="currentColor"
|
|
4539
|
+
stroke-width="2"
|
|
4540
|
+
stroke-linecap="round"
|
|
4541
|
+
stroke-linejoin="round"
|
|
4542
|
+
>
|
|
4543
|
+
<circle cx="12" cy="12" r="10" />
|
|
4544
|
+
<path d="M12 8v4" />
|
|
4545
|
+
<circle cx="12" cy="16" r="1" fill="currentColor" />
|
|
4546
|
+
</svg>
|
|
4547
|
+
</div>
|
|
4548
|
+
<h2 class="submission-title">Submission Failed</h2>
|
|
4549
|
+
<p class="submission-message">
|
|
4550
|
+
${t||"Unable to save your response. Please try again."}
|
|
4551
|
+
</p>
|
|
4552
|
+
${i?l` <button class="retry-button" @click=${i}>Try Again</button> `:""}
|
|
4553
|
+
</div>
|
|
4554
|
+
</main>
|
|
4555
|
+
</div>
|
|
4556
|
+
`}static renderUnifiedSubmissionView(e){var t,i,r;return l`
|
|
4053
4557
|
<div class="runner-layout">
|
|
4054
4558
|
<!-- Mobile Steps Navigation (visible only on mobile) -->
|
|
4055
4559
|
${this.renderMobileStepsForStatus({steps:(t=e.instance)==null?void 0:t.steps,isStepAssignedToUser:e.isStepAssignedToUser,completedSteps:e.completedSteps,disabled:!0})}
|
|
@@ -4059,12 +4563,12 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4059
4563
|
<div class="runner-sidebar-header">Steps</div>
|
|
4060
4564
|
<nav aria-label="Workflow steps">
|
|
4061
4565
|
<ul class="runner-steps-list">
|
|
4062
|
-
${(
|
|
4566
|
+
${(r=(i=e.instance)==null?void 0:i.steps)==null?void 0:r.map(n=>{const o=e.isStepAssignedToUser(n),a=e.completedSteps.has(n.id);return l`
|
|
4063
4567
|
<li
|
|
4064
4568
|
class="runner-step-item ${a?"completed":""} ${o?"":"unassigned"}"
|
|
4065
4569
|
style="opacity: ${o?"1":"0.6"}; cursor: not-allowed;"
|
|
4066
4570
|
>
|
|
4067
|
-
<span class="runner-step-title">${
|
|
4571
|
+
<span class="runner-step-title">${n.title}</span>
|
|
4068
4572
|
<span class="runner-step-badge">
|
|
4069
4573
|
${a?"Submitted":o?"Your Step":"Other User"}
|
|
4070
4574
|
</span>
|
|
@@ -4098,59 +4602,59 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4098
4602
|
</div>
|
|
4099
4603
|
</main>
|
|
4100
4604
|
</div>
|
|
4101
|
-
`}}class q{static isStepCompleted(e,t,i){return!!(t.completedSteps.has(e.id)||(t.isSubmitted||t.userStepsSubmitted)&&i)}static renderSidebar(e){const{steps:t}=e;return
|
|
4605
|
+
`}}class q{static isStepCompleted(e,t,i){return!!(t.completedSteps.has(e.id)||(t.isSubmitted||t.userStepsSubmitted)&&i)}static renderSidebar(e){const{steps:t}=e;return l`
|
|
4102
4606
|
<aside class="runner-sidebar">
|
|
4103
4607
|
<div class="runner-sidebar-header">Steps</div>
|
|
4104
4608
|
<nav aria-label="Workflow steps">
|
|
4105
4609
|
<ul class="runner-steps-list">
|
|
4106
|
-
${t==null?void 0:t.map((i,
|
|
4610
|
+
${t==null?void 0:t.map((i,r)=>{const n=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(i),o=r===e.currentStepIndex,a=this.isStepCompleted(i,e,n),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print",p=e.isLoading;return l`
|
|
4107
4611
|
<li
|
|
4108
|
-
class="runner-step-item ${o?"active":""} ${a?"completed":""} ${
|
|
4109
|
-
@click=${()=>!p&&e.goToStep(
|
|
4110
|
-
style="${
|
|
4612
|
+
class="runner-step-item ${o?"active":""} ${a?"completed":""} ${n?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
|
|
4613
|
+
@click=${()=>!p&&e.goToStep(r)}
|
|
4614
|
+
style="${d?"opacity: 0.5; cursor: not-allowed;":""}"
|
|
4111
4615
|
>
|
|
4112
4616
|
<span class="runner-step-title">${i.title}</span>
|
|
4113
4617
|
<span class="runner-step-badge">
|
|
4114
|
-
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":
|
|
4618
|
+
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":n?"Assigned":"Not Assigned"}
|
|
4115
4619
|
</span>
|
|
4116
4620
|
</li>
|
|
4117
4621
|
`})}
|
|
4118
4622
|
</ul>
|
|
4119
4623
|
</nav>
|
|
4120
4624
|
</aside>
|
|
4121
|
-
`}static renderMobileSteps(e){const{steps:t}=e;return
|
|
4625
|
+
`}static renderMobileSteps(e){const{steps:t}=e;return l`
|
|
4122
4626
|
<div class="runner-mobile-steps">
|
|
4123
4627
|
<nav aria-label="Workflow steps">
|
|
4124
4628
|
<div class="runner-mobile-steps-container">
|
|
4125
|
-
${t==null?void 0:t.map((i,
|
|
4629
|
+
${t==null?void 0:t.map((i,r)=>{const n=e.mode==="preview"||e.mode==="admin"||e.mode==="view-only"||e.mode==="print"||e.isStepAssignedToUser(i),o=r===e.currentStepIndex,a=this.isStepCompleted(i,e,n),d=(e.isSubmitted||e.userStepsSubmitted)&&e.mode!=="preview"&&e.mode!=="admin"&&e.mode!=="view-only"&&e.mode!=="print",p=e.isLoading;return l`
|
|
4126
4630
|
<button
|
|
4127
|
-
class="runner-mobile-step-tab ${o?"active":""} ${a?"completed":""} ${
|
|
4128
|
-
@click=${()=>!p&&e.goToStep(
|
|
4129
|
-
?disabled=${
|
|
4631
|
+
class="runner-mobile-step-tab ${o?"active":""} ${a?"completed":""} ${n?"":"unassigned"} ${d?"disabled":""} ${p?"loading-disabled":""}"
|
|
4632
|
+
@click=${()=>!p&&e.goToStep(r)}
|
|
4633
|
+
?disabled=${d||p}
|
|
4130
4634
|
aria-current=${o?"step":"false"}
|
|
4131
4635
|
>
|
|
4132
4636
|
<span class="runner-mobile-step-title">${i.title}</span>
|
|
4133
4637
|
<span class="runner-mobile-step-badge">
|
|
4134
|
-
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":
|
|
4638
|
+
${e.mode==="preview"?"Preview":e.mode==="admin"?"Admin":e.mode==="view-only"?"View Only":e.mode==="print"?"Print":d?"Submitted":a?"Completed":n?"Assigned":"Not Assigned"}
|
|
4135
4639
|
</span>
|
|
4136
4640
|
</button>
|
|
4137
4641
|
`})}
|
|
4138
4642
|
</div>
|
|
4139
4643
|
</nav>
|
|
4140
4644
|
</div>
|
|
4141
|
-
`}static renderStepHeader(e){const{step:t,mode:i}=e;return i==="print"?
|
|
4645
|
+
`}static renderStepHeader(e){const{step:t,mode:i}=e;return i==="print"?l`
|
|
4142
4646
|
<div class="step-print-header">
|
|
4143
4647
|
<div class="print-step-title">${t.title}</div>
|
|
4144
|
-
${t.description?
|
|
4648
|
+
${t.description?l`<div class="print-step-description">${t.description}</div>`:""}
|
|
4145
4649
|
<hr class="print-question-separator" />
|
|
4146
4650
|
</div>
|
|
4147
|
-
`:
|
|
4651
|
+
`:l`
|
|
4148
4652
|
<section class="runner-step-header">
|
|
4149
4653
|
<h2 class="runner-step-title">${t.title}</h2>
|
|
4150
4654
|
<hr class="runner-step-divider" />
|
|
4151
|
-
${t.description?
|
|
4655
|
+
${t.description?l`<p class="runner-step-desc">${t.description}</p>`:""}
|
|
4152
4656
|
</section>
|
|
4153
|
-
`}}class Dt{static renderFormActions(e){return e.mode==="preview"||e.mode==="view-only"||e.mode==="print"||!e.isCurrentStepAssigned?
|
|
4657
|
+
`}}class Dt{static renderFormActions(e){return e.mode==="preview"||e.mode==="view-only"||e.mode==="print"||!e.isCurrentStepAssigned?l``:l`
|
|
4154
4658
|
<div class="runner-form-actions">
|
|
4155
4659
|
<button
|
|
4156
4660
|
class="next-button ${e.mode==="admin"&&e.justSaved?"saved-state":""}"
|
|
@@ -4160,13 +4664,13 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4160
4664
|
${e.mode==="admin"?e.justSaved?"✓ Saved!":"Save":e.isLastStep?"Submit":"Next"}
|
|
4161
4665
|
</button>
|
|
4162
4666
|
</div>
|
|
4163
|
-
`}}class ve{static handleInputChange(e,t,i,n,r,o){const a=t.target;let l;a.type==="radio"?l=a.value:a.type==="checkbox"?l=a.checked:l=a.value;const p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxChange(e,t,i,n,r,o){const l=t.target.checked,p={...i,[e]:l};n(p),o!=="preview"&&r(e,l)}static handleCheckboxGroupChange(e,t,i,n,r,o,a){const l=i.target,p=n[e];let c=Array.isArray(p)?[...p]:[];l.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...n,[e]:c};r(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,At=Object.getOwnPropertyDescriptor,y=(s,e,t,i)=>{for(var n=i>1?void 0:i?At(e,t):e,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Ct(e,t,n),n};let b=class extends H{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(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.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(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.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 i=this._getAssignedSteps(),n=i.filter(r=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(r.id)});this._userStepsSubmitted=i.length>0&&n.length===i.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 s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.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 s;!((s=this.instance)!=null&&s.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 s;!((s=this.instance)!=null&&s.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 s;!((s=this.instance)!=null&&s.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(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return Ne.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){ve.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){ve.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){ve.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,n,r;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(r=this.onSignatureCaptured)==null||r.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(n=this._currentStep)==null?void 0:n.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var n;(n=this.instance)!=null&&n.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,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[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return k.render(s,this._getRenderContext())}_renderContentElement(s){return $.render(s,this._getRenderContext())}_isQuestionElement(s){return b.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return b.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):d`<div class="unknown-element">
|
|
4667
|
+
`}}class xe{static handleInputChange(e,t,i,r,n,o){const a=t.target;let d;a.type==="radio"?d=a.value:a.type==="checkbox"?d=a.checked:d=a.value;const p={...i,[e]:d};r(p),o!=="preview"&&n(e,d)}static handleCheckboxChange(e,t,i,r,n,o){const d=t.target.checked,p={...i,[e]:d};r(p),o!=="preview"&&n(e,d)}static handleCheckboxGroupChange(e,t,i,r,n,o,a){const d=i.target,p=r[e];let c=Array.isArray(p)?[...p]:[];d.checked?c.includes(t)||c.push(t):c=c.filter(h=>h!==t);const u={...r,[e]:c};n(u),a!=="preview"&&o(e,c)}}var Ct=Object.defineProperty,At=Object.getOwnPropertyDescriptor,v=(s,e,t,i)=>{for(var r=i>1?void 0:i?At(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Ct(e,t,r),r};let f=class extends V{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,this._submissionError=null}willUpdate(s){(s.has("mode")||s.has("currentUser"))&&this._updateNavigationService(),(s.has("instance")||s.has("workflow")||s.has("mode"))&&(this._initializeState(),this._updateValidationService())}connectedCallback(){super.connectedCallback(),this._initializeServices(),this._initializeState(),window.addEventListener("resize",this._handleResize.bind(this)),this._restoreFormData()}disconnectedCallback(){var s;super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize.bind(this)),(s=this.signatureManager)==null||s.destroy()}_initializeServices(){this.persistenceManager=new bt,this.responseTracker=new yt,this.formStateManager=new me,this.signatureManager=new _t(s=>this._handleSignatureChange(s)),this.fileUploadManager=new fe(this.formStateManager,this.responseTracker),this._updateNavigationService(),this._updateValidationService()}_updateNavigationService(){this.navigationService=new wt(this.mode||"default",this.currentUser)}_updateValidationService(){var s;this.validationService=new ft(((s=this.signatureManager)==null?void 0:s.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(s){this.formStateManager.setFormField(s.questionId,s.hasSignature),this.formStateManager.setFormField(`${s.questionId}_signatureData`,s.signatureData),this._formData=this.formStateManager.getFormData(),this._savedSignatures.has(s.questionId)&&(this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s.questionId))),this._clearValidationError(s.questionId),this.mode!=="admin"&&this._saveFormDataToHistory()}_clearValidationError(s){this.formStateManager.clearValidationError(s),this._validationErrors=this.formStateManager.getValidationErrors()}_updateFormData(s){this.formStateManager.updateFormData(s),this._formData=this.formStateManager.getFormData(),this.mode!=="admin"&&this._saveFormDataToHistory()}_handleFormDataUpdate(s){this._clearValidationError(s)}_initializeState(){var s,e,t;if((s=this.formStateManager)==null||s.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 i=this._getAssignedSteps(),r=i.filter(n=>{var o;return(o=this.instance.completedSteps)==null?void 0:o.includes(n.id)});this._userStepsSubmitted=i.length>0&&r.length===i.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 s;if(console.log("Initializing preview mode..."),!((s=this.workflow)!=null&&s.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 s;!((s=this.instance)!=null&&s.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 s;!((s=this.instance)!=null&&s.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 s;!((s=this.instance)!=null&&s.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(s){return this.navigationService.isStepAssignedToUser(s)}_getAssignedSteps(){return this.instance?this.navigationService.getAssignedSteps(this.instance):[]}_isCurrentStepAssigned(){const s=this._currentStep;return!s||this.mode!=="default"?!0:this._isStepAssignedToUser(s)}_renderNotAssignedView(){return ve.renderNotAssignedView()}get _currentStep(){var s,e,t;return this.mode==="preview"&&this.workflow?(s=this.workflow.steps)==null?void 0:s[this._currentStepIndex]:(t=(e=this.instance)==null?void 0:e.steps)==null?void 0:t[this._currentStepIndex]}_validateStep(){const s=this._currentStep;if(!s)return!1;const e=this.validationService.validateStep(s,this._formData,this.mode||"default");return this.formStateManager.setValidationErrors(e.errors),this._validationErrors=this.formStateManager.getValidationErrors(),e.isValid}_handleInputChange(s,e){xe.handleInputChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxChange(s,e){xe.handleCheckboxChange(s,e,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_handleCheckboxGroupChange(s,e,t){xe.handleCheckboxGroupChange(s,e,t,this._formData,this._updateFormData.bind(this),this._trackQuestionResponse.bind(this),this.mode),this._handleFormDataUpdate(s)}_initializeSignaturePad(s){this.signatureManager.initializeSignaturePad(s,this.shadowRoot)&&this._updateValidationService()}_handleResize(){this.signatureManager.handleResize()}_clearSignature(s){this.signatureManager.clearSignature(s)}_startReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures,s]),this.formStateManager.setFormField(s,!1),this.formStateManager.setFormField(`${s}_signatureData`,null),this._formData=this.formStateManager.getFormData(),this._savedSignatures=new Set([...this._savedSignatures].filter(e=>e!==s)),this.requestUpdate()}_cancelReplaceSignature(s){this._replacingSignatures=new Set([...this._replacingSignatures].filter(e=>e!==s))}_saveSignature(s){var i,r,n;const e=this.signatureManager.saveSignature(s);if(!e)return;const t=this._hasSignatureChanged(s,e.svgData);this._savedSignatures=new Set([...this._savedSignatures,s]),this._replacingSignatures.has(s)&&(this._replacingSignatures=new Set([...this._replacingSignatures].filter(o=>o!==s))),this._trackQuestionResponse(s,e.svgData),t&&this.mode!=="preview"?(console.log("Signature changed, calling callback for:",s),console.log("Callback function exists:",!!this.onSignatureCaptured),(n=this.onSignatureCaptured)==null||n.call(this,{instanceId:(i=this.instance)==null?void 0:i.id,stepId:(r=this._currentStep)==null?void 0:r.id,questionId:s,svgData:e.svgData,dataURL:e.dataURL})):this.mode==="preview"?console.log("Preview mode: skipping signature callback for:",s):console.log("Signature unchanged, skipping callback for:",s),this._clearValidationError(s),this.mode!=="admin"&&this._saveFormDataToHistory()}_hasSignatureChanged(s,e){return this.responseTracker.hasChangedFromPrevious(s,e,this._savedInstance)}_restoreInstanceResponses(){var s,e;!((s=this._savedInstance)!=null&&s.steps)||!((e=this.instance)!=null&&e.steps)||this._savedInstance.steps.forEach((t,i)=>{var r;(r=this.instance)!=null&&r.steps&&this.instance.steps[i]&&(this.instance.steps[i].responses=t.responses||[])})}_handleFileUpload(s,e){this.fileUploadManager.handleFileUpload(s,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[s];t&&this._trackQuestionResponse(s,t),this.requestUpdate()}})}_captureSignaturesFromStep(s){console.log("Capturing signatures from step:",s.id)}_trackQuestionResponse(s,e){this.responseTracker.trackQuestionResponse(this._currentStep,s,e)}_renderQuestion(s){return $.render(s,this._getRenderContext())}_renderContentElement(s){return C.render(s,this._getRenderContext())}_isQuestionElement(s){return f.QUESTION_ELEMENT_TYPES.includes(s.type)}_isContentElement(s){return f.CONTENT_ELEMENT_TYPES.includes(s.type)}_renderStepElement(s){return this.mode==="print"?this._isQuestionElement(s)?this._renderQuestion(s):this._isContentElement(s)?this._renderContentElement(s):l`<div class="unknown-element">
|
|
4164
4668
|
<p>⚠️ Unknown element type: ${s.type}</p>
|
|
4165
|
-
</div>`:this._isQuestionElement(s)?
|
|
4669
|
+
</div>`:this._isQuestionElement(s)?l`<div class="runner-card">${this._renderQuestion(s)}</div>`:this._isContentElement(s)?l`<div class="runner-card">${this._renderContentElement(s)}</div>`:l`<div class="runner-card">
|
|
4166
4670
|
<div class="unknown-element">
|
|
4167
4671
|
<p>⚠️ Unknown element type: ${s.type}</p>
|
|
4168
4672
|
</div>
|
|
4169
|
-
</div>`}_renderStepWithElements(s){return
|
|
4673
|
+
</div>`}_renderStepWithElements(s){return l`
|
|
4170
4674
|
<div class="print-step">
|
|
4171
4675
|
<!-- Step Header -->
|
|
4172
4676
|
${q.renderStepHeader({step:s,mode:"print"})}
|
|
@@ -4174,9 +4678,9 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4174
4678
|
<!-- Step Elements -->
|
|
4175
4679
|
${s.elements.map(e=>this._renderStepElement(e))}
|
|
4176
4680
|
</div>
|
|
4177
|
-
`}_renderAllStepsForPrint(){var s;return!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0?
|
|
4681
|
+
`}_renderAllStepsForPrint(){var s;return!((s=this.instance)!=null&&s.steps)||this.instance.steps.length===0?l`<div class="runner-content">
|
|
4178
4682
|
No workflow instance loaded or instance has no steps.
|
|
4179
|
-
</div>`:
|
|
4683
|
+
</div>`:l`
|
|
4180
4684
|
<div class="print-layout">
|
|
4181
4685
|
<!-- Instance Title at top -->
|
|
4182
4686
|
<div class="print-instance-title">${this.instance.name||"Untitled Form"}</div>
|
|
@@ -4184,9 +4688,9 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4184
4688
|
|
|
4185
4689
|
${this.instance.steps.map(e=>this._renderStepWithElements(e))}
|
|
4186
4690
|
</div>
|
|
4187
|
-
`}_nextStep(){var t,i,n,r;if(!this._validateStep())return;const s=this._currentStep;s&&this._captureSignaturesFromStep(s);const e=this._findNextAssignedStep(this._currentStepIndex);if(e!==-1){const o=(t=this._currentStep)==null?void 0:t.id;if(this._currentStepIndex=e,o&&((i=this.instance)!=null&&i.steps)){const l=this.instance.steps.find(p=>p.id===o);l&&(l.status="completed")}const a=(r=(n=this.instance)==null?void 0:n.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(s){return this.instance?this.navigationService.findNextAssignedStep(s,this.instance):-1}_isLastAssignedStep(){return this.navigationService.isLastAssignedStep(this._currentStepIndex,this.instance)}_isLastStepInWorkflow(){var e;const s=(e=this.instance)==null?void 0:e.steps;return s?this._currentStepIndex===s.length-1:!1}_goToStep(s){var i;console.log(`🎯 _goToStep called: stepIndex=${s}, mode=${this.mode}, currentStep=${this._currentStepIndex}`);const e=this.mode==="preview"?this.workflow:this.instance;if(console.log("📊 Data source:",e?`${((i=e.steps)==null?void 0:i.length)||0} steps`:"null"),!e){console.log("❌ No data source available");return}const t=this.navigationService.canNavigateToStep(s,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 s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!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 s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!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.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 s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!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 i=this.instance.steps.find(n=>n.id===e);i&&(i.status="completed")}this._updateInstanceData(e,"admin_save",{stepId:e,adminMode:!0}),this._justSaved=!0,this.requestUpdate(),setTimeout(()=>{this._justSaved=!1,this.requestUpdate()},2e3)}_clearSavedFormData(s){var e;this.persistenceManager.clearFormData((e=this.instance)==null?void 0:e.id,s)}_scrollToTop(){requestAnimationFrame(()=>{var t,i;this.scrollIntoView({behavior:"smooth",block:"start"});const s=(t=this.shadowRoot)==null?void 0:t.querySelector(".runner-layout");s&&s.scrollTo({top:0,behavior:"smooth"});const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-main-content");e&&e.scrollTo({top:0,behavior:"smooth"})})}_updateInstanceData(s,e,t){var l,p,c,u,h,m,v;s&&this._internalCompletedSteps.add(s);let i=(p=(l=this.instance)==null?void 0:l.steps)==null?void 0:p.find(D=>D.id===s);if(!i&&this._internalCompletedSteps.size>0){const D=Array.from(this._internalCompletedSteps),se=D[D.length-1];i=(u=(c=this.instance)==null?void 0:c.steps)==null?void 0:u.find(ne=>ne.id===se)}const n=e==="submission",r=((h=this.instance)==null?void 0:h.steps)&&this._internalCompletedSteps.size>=this.instance.steps.length,o=n||r?null:this._currentStep?{id:this._currentStep.id,title:this._currentStep.title}:null,a={instanceId:(m=this.instance)==null?void 0:m.id,workflowId:(v=this.instance)==null?void 0:v.workflowId,completedStepId:s||(i?i.id:null),completedStepData:i?{id:i.id,title:i.title,responses:i.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 s=this.persistenceManager.restoreFormData((e=this.instance)==null?void 0:e.id);s?(this.formStateManager.updateFormData(s.formData),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=s.stepIndex,this._savedSignatures=s.savedSignatures,this._internalCompletedSteps=s.completedSteps,this._savedInstance=s.savedInstance||void 0):this._updateCompletedStepsFromCurrentIndex()}_updateCompletedStepsFromCurrentIndex(){var s;if((s=this.instance)!=null&&s.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(([i,n])=>{var o;if(i.endsWith("_signatureData"))return;const r=(o=this.shadowRoot)==null?void 0:o.getElementById(i);if(r){if(r.type==="checkbox"){const a=r;typeof n=="boolean"?a.checked=n:Array.isArray(n)&&(a.checked=n.includes(a.value))}else if(r.type==="radio"){const a=r;a.checked=a.value===n}else if(r.type==="file"){const a=r;a.value=""}else r.value=String(n||"");console.log(`Restored value for ${i}:`,n)}}),this._restoreSignatures(),console.log("Form values restored to DOM elements"),this._updateInstanceWithFormData(!0),(t=this._savedInstance)!=null&&t.steps&&this._restoreInstanceResponses())})}_updateInstanceWithFormData(s=!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 i=t,n=this._formData[i.id];if(n!==void 0&&e.responses){let r=e.responses.find(o=>o.elementId===i.id);r?(r.value=n,r.answeredAt=new Date):(r={elementId:i.id,value:n,answeredAt:new Date},e.responses.push(r))}}})})}_restoreSignatures(){Object.entries(this._formData).forEach(([s,e])=>{if(s.endsWith("_signatureData")&&e){const t=s.replace("_signatureData",""),i=this.signatureManager.getSignaturePad(t);if(i&&e)try{i.clear(),i.fromData(e)}catch{}}})}_saveFormDataToHistory(){var s;this.persistenceManager.saveFormData((s=this.instance)==null?void 0:s.id,this._formData,this._currentStepIndex,this._savedSignatures,this._internalCompletedSteps,this.instance||null)}_extractFormDataFromDOM(){var i;const s={},e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-step-form");if(!e)return s;const t=e.elements;for(let n=0;n<t.length;n++){const r=t[n];if(r.name||r.id){const o=r.id||r.name;if(r.type==="checkbox"){const a=r;a.name&&a.name===o?(s[o]||(s[o]=[]),a.checked&&s[o].push(a.value)):s[o]=a.checked}else if(r.type==="radio"){const a=r;a.checked&&(s[o]=a.value)}else s[o]=r.value}}return s}_updateInstanceFromFormData(s=!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(i=>{i.responses||(i.responses=[]),i.elements.forEach(n=>{if(n.type==="text_input"||n.type==="textarea"||n.type==="select"||n.type==="number"||n.type==="radio"||n.type==="checkbox"||n.type==="date"||n.type==="file_upload"||n.type==="signature"){const r=n,o=this._formData[r.id];if(o!==void 0&&i.responses){let a=i.responses.find(l=>l.elementId===r.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:r.id,value:o,answeredAt:new Date},i.responses.push(a))}}})}),console.log("Instance updated from form data:",this.instance),s&&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(s=!1){this._updateInstanceFromFormData(s)}getFormData(){return this.formStateManager.getFormData()}restoreFormData(){this._restoreFormDataFromDOM()}clearSavedFormData(s){this._clearSavedFormData(s)}_renderUnifiedSubmissionView(){const s={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this)};return Ne.renderUnifiedSubmissionView(s)}_isInstanceCompleted(){var s;return((s=this.instance)==null?void 0:s.status)==="completed"}_areUserStepsCompleted(){var e;if(!((e=this.instance)!=null&&e.steps))return!1;const s=this._getAssignedSteps();return s.length===0?!1:s.every(t=>t.status==="completed")}_isCurrentStepCompleted(){const s=this._currentStep;return!s||!this._isCurrentStepAssigned()?!1:this._internalCompletedSteps.has(s.id)}_shouldShowCompletionView(){var s;return this.mode!=="default"?!1:!!(this._isCurrentStepCompleted()||this._isInstanceCompleted()||((s=this.instance)==null?void 0:s.status)==="active"&&this._areUserStepsCompleted())}_renderModeBasedContent(){var e,t;if(this._shouldShowCompletionView())return this._renderUnifiedSubmissionView();if(this.mode==="print")return this._renderAllStepsForPrint();const s=this.mode==="preview"?(e=this.workflow)==null?void 0:e.steps:(t=this.instance)==null?void 0:t.steps;return!s||s.length===0?d`<div class="runner-content">
|
|
4691
|
+
`}async _nextStep(){var t,i,r,n;if(!this._validateStep())return;const s=this._currentStep;s&&this._captureSignaturesFromStep(s);const e=this._findNextAssignedStep(this._currentStepIndex);if(e!==-1){const o=(t=this._currentStep)==null?void 0:t.id;if(this._currentStepIndex=e,(await this._updateInstanceData(o,"step_navigation",{direction:"next",fromStepIndex:this._currentStepIndex-1,toStepIndex:this._currentStepIndex,completedStepId:o})).success&&o&&(i=this.instance)!=null&&i.steps){const p=this.instance.steps.find(c=>c.id===o);p&&(p.status="completed")}const d=(n=(r=this.instance)==null?void 0:r.steps)==null?void 0:n[this._currentStepIndex];d&&(d.status="active"),this.mode!=="admin"&&this._saveFormDataToHistory(),this._scrollToTop()}}_findNextAssignedStep(s){return this.instance?this.navigationService.findNextAssignedStep(s,this.instance):-1}_isLastAssignedStep(){return this.navigationService.isLastAssignedStep(this._currentStepIndex,this.instance)}_isLastStepInWorkflow(){var e;const s=(e=this.instance)==null?void 0:e.steps;return s?this._currentStepIndex===s.length-1:!1}_goToStep(s){var i;console.log(`🎯 _goToStep called: stepIndex=${s}, mode=${this.mode}, currentStep=${this._currentStepIndex}`);const e=this.mode==="preview"?this.workflow:this.instance;if(console.log("📊 Data source:",e?`${((i=e.steps)==null?void 0:i.length)||0} steps`:"null"),!e){console.log("❌ No data source available");return}const t=this.navigationService.canNavigateToStep(s,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)}async _submitUserSteps(){var i;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(i=this._currentStep)==null?void 0:i.id;e&&this._internalCompletedSteps.add(e),(await this._updateInstanceData(e,"user_steps_submission")).success&&e&&this._internalCompletedSteps.add(e),this._userStepsSubmitted=!0,this._clearSavedFormData("user steps submission"),this._scrollToTop()}async _submit(){var i;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot submit, instance data is missing.");return}const e=(i=this._currentStep)==null?void 0:i.id;console.log("Submitting entire workflow:",this.instance.id),console.log("Final form data:",this._formData),(await this._updateInstanceData(e,"submission")).success&&(e&&this._internalCompletedSteps.add(e),this.instance&&(this.instance.status="completed",this.instance.currentStepId=void 0,this.instance.completedSteps=Array.from(this._internalCompletedSteps)),this._isSubmitted=!0,this._clearSavedFormData("full workflow submission"),this._scrollToTop())}async _saveStep(){var i;if(!this._validateStep())return;const s=this._currentStep;if(s&&this._captureSignaturesFromStep(s),!this.instance){console.error("Cannot save, instance data is missing.");return}const e=(i=this._currentStep)==null?void 0:i.id;if((await this._updateInstanceData(e,"admin_save",{stepId:e,adminMode:!0})).success){if(e&&(this._internalCompletedSteps.add(e),this.instance.steps)){const r=this.instance.steps.find(n=>n.id===e);r&&(r.status="completed")}this._justSaved=!0,this.requestUpdate(),setTimeout(()=>{this._justSaved=!1,this.requestUpdate()},2e3)}}_clearSavedFormData(s){var e;this.persistenceManager.clearFormData((e=this.instance)==null?void 0:e.id,s)}_scrollToTop(){requestAnimationFrame(()=>{var t,i;this.scrollIntoView({behavior:"smooth",block:"start"});const s=(t=this.shadowRoot)==null?void 0:t.querySelector(".runner-layout");s&&s.scrollTo({top:0,behavior:"smooth"});const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-main-content");e&&e.scrollTo({top:0,behavior:"smooth"})})}async _updateInstanceData(s,e,t){var d,p,c,u,h,m,x;s&&this._internalCompletedSteps.add(s);let i=(p=(d=this.instance)==null?void 0:d.steps)==null?void 0:p.find(w=>w.id===s);if(!i&&this._internalCompletedSteps.size>0){const w=Array.from(this._internalCompletedSteps),se=w[w.length-1];i=(u=(c=this.instance)==null?void 0:c.steps)==null?void 0:u.find(re=>re.id===se)}const r=e==="submission",n=((h=this.instance)==null?void 0:h.steps)&&this._internalCompletedSteps.size>=this.instance.steps.length,o=r||n?null:this._currentStep?{id:this._currentStep.id,title:this._currentStep.title}:null,a={instanceId:(m=this.instance)==null?void 0:m.id,workflowId:(x=this.instance)==null?void 0:x.workflowId,completedStepId:s||(i?i.id:void 0),completedStepData:i?{id:i.id,title:i.title,responses:i.responses||[]}:void 0,completedSteps:Array.from(this._internalCompletedSteps),currentStep:o,mode:this.mode};if(this.onInstanceUpdated)try{this._submissionError=null,this.requestUpdate();const w=await this.onInstanceUpdated(a);return w.success?this._submissionError=null:(this._submissionError=w.error||"Unable to save response. Please try again.",s&&this._internalCompletedSteps.delete(s)),this.requestUpdate(),w}catch(w){return this._submissionError=w instanceof Error?w.message:"Unable to save response. Please try again.",s&&this._internalCompletedSteps.delete(s),this.requestUpdate(),{success:!1,error:this._submissionError}}return{success:!0}}_restoreFormData(){var e;if(!this.persistenceManager.shouldRestoreData(this.mode||"default")){console.log("Skipping form data restoration - showing official instance data");return}const s=this.persistenceManager.restoreFormData((e=this.instance)==null?void 0:e.id);s?(this.formStateManager.updateFormData(s.formData),this._formData=this.formStateManager.getFormData(),this._currentStepIndex=s.stepIndex,this._savedSignatures=s.savedSignatures,this._internalCompletedSteps=s.completedSteps,this._savedInstance=s.savedInstance||void 0):this._updateCompletedStepsFromCurrentIndex()}_updateCompletedStepsFromCurrentIndex(){var s;if((s=this.instance)!=null&&s.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(([i,r])=>{var o;if(i.endsWith("_signatureData"))return;const n=(o=this.shadowRoot)==null?void 0:o.getElementById(i);if(n){if(n.type==="checkbox"){const a=n;typeof r=="boolean"?a.checked=r:Array.isArray(r)&&(a.checked=r.includes(a.value))}else if(n.type==="radio"){const a=n;a.checked=a.value===r}else if(n.type==="file"){const a=n;a.value=""}else n.value=String(r||"");console.log(`Restored value for ${i}:`,r)}}),this._restoreSignatures(),console.log("Form values restored to DOM elements"),this._updateInstanceWithFormData(!0),(t=this._savedInstance)!=null&&t.steps&&this._restoreInstanceResponses())})}_updateInstanceWithFormData(s=!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 i=t,r=this._formData[i.id];if(r!==void 0&&e.responses){let n=e.responses.find(o=>o.elementId===i.id);n?(n.value=r,n.answeredAt=new Date):(n={elementId:i.id,value:r,answeredAt:new Date},e.responses.push(n))}}})})}_restoreSignatures(){Object.entries(this._formData).forEach(([s,e])=>{if(s.endsWith("_signatureData")&&e){const t=s.replace("_signatureData",""),i=this.signatureManager.getSignaturePad(t);if(i&&e)try{i.clear(),i.fromData(e)}catch{}}})}_saveFormDataToHistory(){var s;this.persistenceManager.saveFormData((s=this.instance)==null?void 0:s.id,this._formData,this._currentStepIndex,this._savedSignatures,this._internalCompletedSteps,this.instance||null)}_extractFormDataFromDOM(){var i;const s={},e=(i=this.shadowRoot)==null?void 0:i.querySelector(".runner-step-form");if(!e)return s;const t=e.elements;for(let r=0;r<t.length;r++){const n=t[r];if(n.name||n.id){const o=n.id||n.name;if(n.type==="checkbox"){const a=n;a.name&&a.name===o?(s[o]||(s[o]=[]),a.checked&&s[o].push(a.value)):s[o]=a.checked}else if(n.type==="radio"){const a=n;a.checked&&(s[o]=a.value)}else s[o]=n.value}}return s}_updateInstanceFromFormData(s=!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(i=>{i.responses||(i.responses=[]),i.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 n=r,o=this._formData[n.id];if(o!==void 0&&i.responses){let a=i.responses.find(d=>d.elementId===n.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:n.id,value:o,answeredAt:new Date},i.responses.push(a))}}})}),console.log("Instance updated from form data:",this.instance),s&&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(s=!1){this._updateInstanceFromFormData(s)}getFormData(){return this.formStateManager.getFormData()}restoreFormData(){this._restoreFormDataFromDOM()}clearSavedFormData(s){this._clearSavedFormData(s)}_renderUnifiedSubmissionView(){const s={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this)};return ve.renderUnifiedSubmissionView(s)}_isInstanceCompleted(){var s;return((s=this.instance)==null?void 0:s.status)==="completed"}_areUserStepsCompleted(){var e;if(!((e=this.instance)!=null&&e.steps))return!1;const s=this._getAssignedSteps();return s.length===0?!1:s.every(t=>t.status==="completed")}_isCurrentStepCompleted(){const s=this._currentStep;return!s||!this._isCurrentStepAssigned()?!1:this._internalCompletedSteps.has(s.id)}_shouldShowCompletionView(){var s;return this.mode!=="default"?!1:!!(this._isCurrentStepCompleted()||this._isInstanceCompleted()||((s=this.instance)==null?void 0:s.status)==="active"&&this._areUserStepsCompleted())}_renderSubmissionErrorView(){const s={instance:this.instance,assignedSteps:this._getAssignedSteps(),completedSteps:this._internalCompletedSteps,isStepAssignedToUser:this._isStepAssignedToUser.bind(this),submissionError:this._submissionError,onRetry:()=>{this._submissionError=null,this._isSubmitted=!1,this._userStepsSubmitted=!1,this.requestUpdate()}};return ve.renderSubmissionErrorView(s)}_renderModeBasedContent(){var e,t;if(this._submissionError)return this._renderSubmissionErrorView();if(this._shouldShowCompletionView())return this._renderUnifiedSubmissionView();if(this.mode==="print")return this._renderAllStepsForPrint();const s=this.mode==="preview"?(e=this.workflow)==null?void 0:e.steps:(t=this.instance)==null?void 0:t.steps;return!s||s.length===0?l`<div class="runner-content">
|
|
4188
4692
|
${this.mode==="preview"?"No workflow loaded or workflow has no steps.":"No workflow instance loaded or instance has no steps."}
|
|
4189
|
-
</div>`:this.mode==="default"&&this._getAssignedSteps().length===0?this._renderNotAssignedView():null}_validateCurrentStep(){return this._currentStep}_initializeStepAssets(s){this.updateComplete.then(()=>{s.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(s){var n
|
|
4693
|
+
</div>`:this.mode==="default"&&this._getAssignedSteps().length===0?this._renderNotAssignedView():null}_validateCurrentStep(){return this._currentStep}_initializeStepAssets(s){this.updateComplete.then(()=>{s.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(s){var r,n;const e=this._isLastAssignedStep(),t=this._isLastStepInWorkflow(),i=this.mode==="preview"?(r=this.workflow)==null?void 0:r.steps:(n=this.instance)==null?void 0:n.steps;return l`
|
|
4190
4694
|
<!-- Mobile Steps Navigation (visible only on mobile) -->
|
|
4191
4695
|
${q.renderMobileSteps({steps:i,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)})}
|
|
4192
4696
|
|
|
@@ -4195,20 +4699,20 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4195
4699
|
|
|
4196
4700
|
<!-- Main Content: Step Details and Questions -->
|
|
4197
4701
|
<main class="runner-main-content">
|
|
4198
|
-
${this.mode==="print"?q.renderStepHeader({step:s,mode:this.mode}):
|
|
4702
|
+
${this.mode==="print"?q.renderStepHeader({step:s,mode:this.mode}):l`<div class="runner-card">
|
|
4199
4703
|
${q.renderStepHeader({step:s,mode:this.mode})}
|
|
4200
4704
|
</div>`}
|
|
4201
4705
|
<form class="runner-step-form" @submit=${o=>o.preventDefault()}>
|
|
4202
4706
|
${s.elements.map(o=>this._renderStepElement(o))}
|
|
4203
|
-
${Dt.renderFormActions({mode:this.mode||"default",isLastStep:e,isLastStepInWorkflow:t,justSaved:this._justSaved,isCurrentStepAssigned:this._isCurrentStepAssigned(),handlers:{saveStep:this._saveStep
|
|
4707
|
+
${Dt.renderFormActions({mode:this.mode||"default",isLastStep:e,isLastStepInWorkflow:t,justSaved:this._justSaved,isCurrentStepAssigned:this._isCurrentStepAssigned(),handlers:{saveStep:()=>{this._saveStep()},nextStep:()=>{this._nextStep()},submitUserSteps:()=>{this._submitUserSteps()},submit:()=>{this._submit()}}})}
|
|
4204
4708
|
</form>
|
|
4205
4709
|
</main>
|
|
4206
|
-
`}_renderMainContent(){const s=this._renderModeBasedContent();if(s)return s;const e=this._validateCurrentStep();return e?(this._initializeStepAssets(e),this._renderCurrentStepLayout(e)):
|
|
4710
|
+
`}_renderMainContent(){const s=this._renderModeBasedContent();if(s)return s;const e=this._validateCurrentStep();return e?(this._initializeStepAssets(e),this._renderCurrentStepLayout(e)):l`<div class="runner-content">Invalid current step.</div>`}render(){return l`
|
|
4207
4711
|
<div class="runner-layout">
|
|
4208
4712
|
${this._renderMainContent()}
|
|
4209
4713
|
|
|
4210
4714
|
<!-- Loading overlay with white box (conditionally rendered) -->
|
|
4211
|
-
${this.isLoading?
|
|
4715
|
+
${this.isLoading?l`
|
|
4212
4716
|
<div class="runner-loading-overlay">
|
|
4213
4717
|
<div class="runner-loading-box">
|
|
4214
4718
|
<div class="runner-loading-spinner"></div>
|
|
@@ -4217,14 +4721,14 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4217
4721
|
</div>
|
|
4218
4722
|
`:""}
|
|
4219
4723
|
</div>
|
|
4220
|
-
`}};
|
|
4724
|
+
`}};f.styles=[Ne],f.QUESTION_ELEMENT_TYPES=["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"],f.CONTENT_ELEMENT_TYPES=["text","html","image","video","file","divider","markdown"],v([D({type:Object})],f.prototype,"instance",2),v([D({type:Object})],f.prototype,"workflow",2),v([D({type:String})],f.prototype,"mode",2),v([D({type:Boolean})],f.prototype,"isLoading",2),v([D({type:Object})],f.prototype,"currentUser",2),v([D({type:Function})],f.prototype,"onSignatureCaptured",2),v([D({type:Function})],f.prototype,"onFileUploaded",2),v([D({type:Function})],f.prototype,"onInstanceUpdated",2),v([b()],f.prototype,"_currentStepIndex",2),v([b()],f.prototype,"_formData",2),v([b()],f.prototype,"_validationErrors",2),v([b()],f.prototype,"_internalCompletedSteps",2),v([b()],f.prototype,"_formRestorationComplete",2),v([b()],f.prototype,"_savedSignatures",2),v([b()],f.prototype,"_replacingSignatures",2),v([b()],f.prototype,"_savedInstance",2),v([b()],f.prototype,"_isSubmitted",2),v([b()],f.prototype,"_userStepsSubmitted",2),v([b()],f.prototype,"_justSaved",2),v([b()],f.prototype,"_submissionError",2),f=v([Ue("runner-widget")],f);function Et(s,e={}){const{title:t=s.name||"Workflow Instance",includeStyles:i=!0,customCSS:r="",showTimestamps:n=!1}=e,o=new Date;if(!(s!=null&&s.steps)||s.steps.length===0)throw new Error("Instance must have at least one step to generate HTML");return{html:`<!DOCTYPE html>
|
|
4221
4725
|
<html lang="en">
|
|
4222
4726
|
<head>
|
|
4223
4727
|
<meta charset="UTF-8">
|
|
4224
4728
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4225
4729
|
<title>${g(t)}</title>
|
|
4226
4730
|
${i?`<style>${Yt()}</style>`:""}
|
|
4227
|
-
${
|
|
4731
|
+
${r?`<style>${r}</style>`:""}
|
|
4228
4732
|
</head>
|
|
4229
4733
|
<body>
|
|
4230
4734
|
<div class="print-layout">
|
|
@@ -4234,8 +4738,8 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4234
4738
|
</div>
|
|
4235
4739
|
<hr class="print-question-separator" />
|
|
4236
4740
|
|
|
4237
|
-
${
|
|
4238
|
-
${s.steps.map(
|
|
4741
|
+
${n?jt(s,o):""}
|
|
4742
|
+
${s.steps.map(d=>Mt(d)).join(`
|
|
4239
4743
|
`)}
|
|
4240
4744
|
</div>
|
|
4241
4745
|
</body>
|
|
@@ -4254,11 +4758,11 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4254
4758
|
${s.description?`<div class="print-step-description">${g(s.description)}</div>`:""}
|
|
4255
4759
|
<hr class="print-question-separator" />
|
|
4256
4760
|
</div>
|
|
4257
|
-
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=
|
|
4761
|
+
`}function Ft(s,e){return Wt(s)?zt(s,e):It(s)}function zt(s,e){const t=Ht(s.id,e.responses),i=t==null?void 0:t.value,n=s.type==="checkbox"&&(!s.options||s.options.length===0)?"":`
|
|
4258
4762
|
<div class="print-question-title">
|
|
4259
4763
|
${g(s.label)}:
|
|
4260
4764
|
</div>
|
|
4261
|
-
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return
|
|
4765
|
+
`,o='<hr class="print-question-separator" />';switch(s.type){case"text_input":case"number":case"date":return n+Ut(s,i)+o;case"textarea":return n+Pt(s,i)+o;case"select":return n+Nt(s,i)+o;case"radio":return n+Lt(s,i)+o;case"checkbox":return n+Ot(s,i)+o;case"file_upload":return n+Rt(s,i)+o;case"signature":return n+Vt(s,i)+o;default:return n+`
|
|
4262
4766
|
<div class="unknown-element">
|
|
4263
4767
|
<p>⚠️ Unknown question type: ${g(s.type)}</p>
|
|
4264
4768
|
</div>
|
|
@@ -4337,19 +4841,19 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4337
4841
|
</div>
|
|
4338
4842
|
${e}
|
|
4339
4843
|
</div>
|
|
4340
|
-
`}}function
|
|
4844
|
+
`}}function Ut(s,e){const t=e!=null?g(String(e)):"";return`
|
|
4341
4845
|
<div class="print-response-value input-response">
|
|
4342
4846
|
${(s.type==="date"&&e?new Date(e).toLocaleDateString():t)||'<span class="print-no-response">No response</span>'}
|
|
4343
4847
|
</div>
|
|
4344
|
-
`}function
|
|
4848
|
+
`}function Pt(s,e){return`
|
|
4345
4849
|
<div class="print-response-value textarea-response">
|
|
4346
4850
|
${(e!=null?g(String(e)):"")||'<span class="print-no-response">No response</span>'}
|
|
4347
4851
|
</div>
|
|
4348
|
-
`}function
|
|
4852
|
+
`}function Nt(s,e){const t=e!=null?String(e):"";return`
|
|
4349
4853
|
<div class="print-response-value select-response">
|
|
4350
4854
|
${t?g(t):'<span class="print-no-response">No selection made</span>'}
|
|
4351
4855
|
</div>
|
|
4352
|
-
`}function
|
|
4856
|
+
`}function Lt(s,e){const t=e!=null?String(e):"";return`
|
|
4353
4857
|
<div class="print-response-value radio-response">
|
|
4354
4858
|
${t?g(t):'<span class="print-no-response">No selection made</span>'}
|
|
4355
4859
|
</div>
|
|
@@ -4359,22 +4863,22 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4359
4863
|
</div>
|
|
4360
4864
|
`;{const i=Array.isArray(e)?e.map(String):[];return`
|
|
4361
4865
|
<div class="print-response-value checkbox-response">
|
|
4362
|
-
${i.length>0?i.map(
|
|
4866
|
+
${i.length>0?i.map(r=>`<div>• ${g(r)}</div>`).join(""):'<span class="print-no-response">No selections made</span>'}
|
|
4363
4867
|
</div>
|
|
4364
4868
|
`}}function Rt(s,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`
|
|
4365
4869
|
<div class="print-response-value file-response">
|
|
4366
4870
|
📎 ${g(e.name)}
|
|
4367
4871
|
${e.size?` <span class="file-size">(${Bt(e.size)})</span>`:""}
|
|
4368
4872
|
</div>
|
|
4369
|
-
`;if(t){const
|
|
4873
|
+
`;if(t){const r=Qt(e);return`
|
|
4370
4874
|
<div class="print-response-value file-response">
|
|
4371
|
-
📎 ${g(
|
|
4875
|
+
📎 ${g(r)}
|
|
4372
4876
|
</div>
|
|
4373
4877
|
`}else return`
|
|
4374
4878
|
<div class="print-response-value file-response">
|
|
4375
4879
|
📎 ${g(String(e))}
|
|
4376
4880
|
</div>
|
|
4377
|
-
`}function
|
|
4881
|
+
`}function Vt(s,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?`
|
|
4378
4882
|
<div class="print-response-value signature-response">
|
|
4379
4883
|
<img
|
|
4380
4884
|
src="${g(t)}"
|
|
@@ -4386,7 +4890,7 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4386
4890
|
<div class="signature-fallback">
|
|
4387
4891
|
<div class="signature-error">Unable to display signature</div>
|
|
4388
4892
|
</div>
|
|
4389
|
-
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function
|
|
4893
|
+
`}function Wt(s){return["text_input","textarea","select","number","radio","checkbox","date","file_upload","signature"].includes(s.type)}function Ht(s,e){return e==null?void 0:e.find(t=>t.elementId===s)}function jt(s,e){return`
|
|
4390
4894
|
<div class="runner-card" style="margin-bottom: 40px; border-left: 4px solid #3b82f6;">
|
|
4391
4895
|
<div style="display: flex; justify-content: between; align-items: center; gap: 20px;">
|
|
4392
4896
|
<div>
|
|
@@ -4909,4 +5413,4 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(r=>r
|
|
|
4909
5413
|
margin: 2px 0;
|
|
4910
5414
|
line-height: 1.4;
|
|
4911
5415
|
}
|
|
4912
|
-
`}function qt(s,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(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,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(s);if(!t)return console.error(`Error: Target element with ID '${s}' 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 i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&i.
|
|
5416
|
+
`}function qt(s,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(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,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(s);if(!t)return console.error(`Error: Target element with ID '${s}' 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 i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&(i.onInstanceUpdated=e.onInstanceUpdated),t.appendChild(i),console.log(`Drill Runner mounted on #${s}`),i}function Jt(s,e){const t=s.getFormData(),i=JSON.parse(JSON.stringify(e));return i.steps&&i.steps.forEach(r=>{r.responses||(r.responses=[]),r.elements.forEach(n=>{if(n.type==="text_input"||n.type==="textarea"||n.type==="select"||n.type==="number"||n.type==="radio"||n.type==="checkbox"||n.type==="date"||n.type==="file_upload"||n.type==="signature"){const o=t[n.id];if(o!==void 0){let a=r.responses.find(d=>d.elementId===n.id);a?(a.value=o,a.answeredAt=new Date):(a={elementId:n.id,value:o,answeredAt:new Date},r.responses.push(a))}}})}),i}function Xt(s,e){const t={};e.steps&&e.steps.forEach(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),s.restoreFormData(),console.log("Form data restored to runner widget:",t)}A.createBuilder=qt,A.createRunner=Kt,A.generateInstanceHTML=Et,A.restoreFormDataToRunner=Xt,A.updateInstanceFromRunnerForm=Jt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|