@nyaruka/temba-components 0.54.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/{9e03337b.js → b6e68477.js} +19 -14
- package/dist/index.js +19 -14
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/templates/components-body.html +1 -1
- package/dist/templates/components-head.html +1 -1
- package/out-tsc/src/RapidElement.js +2 -2
- package/out-tsc/src/RapidElement.js.map +1 -1
- package/out-tsc/src/contactsearch/ContactSearch.js +1 -0
- package/out-tsc/src/contactsearch/ContactSearch.js.map +1 -1
- package/out-tsc/src/remote/Remote.js +0 -1
- package/out-tsc/src/remote/Remote.js.map +1 -1
- package/out-tsc/src/select/Select.js +33 -25
- package/out-tsc/src/select/Select.js.map +1 -1
- package/package.json +1 -1
- package/src/RapidElement.ts +2 -2
- package/src/contactsearch/ContactSearch.ts +1 -1
- package/src/remote/Remote.ts +0 -1
- package/src/select/Select.ts +32 -28
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,i,r):o(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r}const e=window,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),o=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(i,t,n)},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,n))(e)})(t):t;var l;const h=window,c=h.trustedTypes,d=c?c.emptyScript:"",u=h.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:m};class g extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const n=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{i?t.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((i=>{const n=document.createElement("style"),o=e.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=i.cssText,t.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=f){var n;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:p).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,o=n._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=n.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:p;this._$El=o,this[o]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var v;g.finalized=!0,g.elementProperties=new Map,g.elementStyles=[],g.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:g}),(null!==(l=h.reactiveElementVersions)&&void 0!==l?l:h.reactiveElementVersions=[]).push("1.5.0");const y=window,b=y.trustedTypes,_=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,x=`lit$${(Math.random()+"").slice(9)}$`,w="?"+x,k=`<${w}>`,S=document,E=(t="")=>S.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,A=/-->/g,M=/>/g,O=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),z=/'/g,P=/"/g,I=/^(?:script|style|textarea|title)$/i,D=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),N=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),B=new WeakMap,q=S.createTreeWalker(S,129,null,!1),U=(t,e)=>{const i=t.length-1,n=[];let o,s=2===e?"<svg>":"",r=T;for(let e=0;e<i;e++){const i=t[e];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===T?"!--"===l[1]?r=A:void 0!==l[1]?r=M:void 0!==l[2]?(I.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=O):void 0!==l[3]&&(r=O):r===O?">"===l[0]?(r=null!=o?o:T,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?O:'"'===l[3]?P:z):r===P||r===z?r=O:r===A||r===M?r=T:(r=O,o=void 0);const d=r===O&&t[e+1].startsWith("/>")?" ":"";s+=r===T?i+k:h>=0?(n.push(a),i.slice(0,h)+"$lit$"+i.slice(h)+x+d):i+x+(-2===h?(n.push(void 0),e):d)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==_?_.createHTML(a):a,n]};class Z{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let o=0,s=0;const r=t.length-1,a=this.parts,[l,h]=U(t,e);if(this.el=Z.createElement(l,i),q.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=q.nextNode())&&a.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(x)){const i=h[s++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+"$lit$").split(x),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?W:"?"===e[1]?K:"@"===e[1]?Y:H})}else a.push({type:6,index:o})}for(const e of t)n.removeAttribute(e)}if(I.test(n.tagName)){const t=n.textContent.split(x),e=t.length-1;if(e>0){n.textContent=b?b.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],E()),q.nextNode(),a.push({type:2,index:++o});n.append(t[e],E())}}}else if(8===n.nodeType)if(n.data===w)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=n.data.indexOf(x,t+1));)a.push({type:7,index:o}),t+=x.length-1}o++}}static createElement(t,e){const i=S.createElement("template");return i.innerHTML=t,i}}function F(t,e,i=t,n){var o,s,r,a;if(e===N)return e;let l=void 0!==n?null===(o=i._$Co)||void 0===o?void 0:o[n]:i._$Cl;const h=C(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,n)),void 0!==n?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=F(t,l._$AS(t,e.values),l,n)),e}class j{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:n}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:S).importNode(i,!0);q.currentNode=o;let s=q.nextNode(),r=0,a=0,l=n[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new V(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new J(s,this,t)),this.u.push(e),l=n[++a]}r!==(null==l?void 0:l.index)&&(s=q.nextNode(),r++)}return o}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class V{constructor(t,e,i,n){var o;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cm=null===(o=null==n?void 0:n.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=F(this,t,e),C(t)?t===R||null==t||""===t?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==N&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>$(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==R&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(S.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:n}=t,o="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Z.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.p(i);else{const t=new j(o,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new Z(t)),e}k(t){$(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const o of t)n===e.length?e.push(i=new V(this.O(E()),this.O(E()),this,this.options)):i=e[n],i._$AI(o),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class H{constructor(t,e,i,n,o){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const o=this.strings;let s=!1;if(void 0===o)t=F(this,t,e,0),s=!C(t)||t!==this._$AH&&t!==N,s&&(this._$AH=t);else{const n=t;let r,a;for(t=o[0],r=0;r<o.length-1;r++)a=F(this,n[i+r],e,r),a===N&&(a=this._$AH[r]),s||(s=!C(a)||a!==this._$AH[r]),a===R?t=R:t!==R&&(t+=(null!=a?a:"")+o[r+1]),this._$AH[r]=a}s&&!n&&this.j(t)}j(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===R?void 0:t}}const G=b?b.emptyScript:"";class K extends H{constructor(){super(...arguments),this.type=4}j(t){t&&t!==R?this.element.setAttribute(this.name,G):this.element.removeAttribute(this.name)}}class Y extends H{constructor(t,e,i,n,o){super(t,e,i,n,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=F(this,t,e,0))&&void 0!==i?i:R)===N)return;const n=this._$AH,o=t===R&&n!==R||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==R&&(n===R||o);o&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const X=y.litHtmlPolyfillSupport;null==X||X(Z,V),(null!==(v=y.litHtmlVersions)&&void 0!==v?v:y.litHtmlVersions=[]).push("2.5.0");var Q,tt;class et extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var n,o;const s=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let r=s._$litPart$;if(void 0===r){const t=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;s._$litPart$=r=new V(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return N}}et.finalized=!0,et._$litElement$=!0,null===(Q=globalThis.litElementHydrateSupport)||void 0===Q||Q.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;var nt;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.2"),function(t){t[t.YELLOW=33]="YELLOW",t[t.PURPLE=35]="PURPLE",t[t.WHITE=37]="WHITE",t[t.BLUE=34]="BLUE",t[t.RED=31]="RED",t[t.CYAN=36]="CYAN",t[t.GREEN=32]="GREEN",t[t.BLACK=30]="BLACK"}(nt||(nt={}));const ot=(t,e)=>`[${e}m${t}[0m`,st=t=>ot(t.tagName.padEnd(30),nt.PURPLE),rt=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){console.log(st(t),i?ot("<updated>",nt.YELLOW):ot("<first-updated>",nt.BLACK));for(const[i,n]of e.entries())console.log(" "+String(i).padEnd(30),n,ot("=>",nt.WHITE),t[i])}},at=(t,e,i)=>{(t.DEBUG_EVENTS||t.DEBUG)&&console.log(st(t),void 0!==i?ot("<custom-event>",nt.RED):ot("<event> ",nt.CYAN),ot(e,nt.BLUE),void 0!==i?i:"")};class lt extends et{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),rt(this,t,!0)}updated(t){super.updated(t),rt(this,t,!1)}fireEvent(t){return at(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&at(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const n=i.closest(t);return n||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}}const ht=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function ct(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):ht(t,e)}var dt;null===(dt=window.HTMLSlotElement)||void 0===dt||dt.prototype.assignedElements;class ut extends lt{constructor(){super(),this.name="",this.value=null,this.inputRoot=this,this.disabled=!1,this.internals=this.attachInternals()}updated(t){super.updated(t),t.has("value")&&this.internals.setFormValue(this.value)}get form(){return this.internals.form}get type(){return this.localName}serializeValue(t){return JSON.stringify(t)}}ut.formAssociated=!0,t([ct({type:String})],ut.prototype,"name",void 0),t([ct({type:String,attribute:"help_text"})],ut.prototype,"helpText",void 0),t([ct({type:Boolean,attribute:"help_always"})],ut.prototype,"helpAlways",void 0),t([ct({type:Boolean,attribute:"widget_only"})],ut.prototype,"widgetOnly",void 0),t([ct({type:Boolean,attribute:"hide_label"})],ut.prototype,"hideLabel",void 0),t([ct({type:String})],ut.prototype,"label",void 0),t([ct({type:Array})],ut.prototype,"errors",void 0),t([ct({type:String})],ut.prototype,"value",void 0),t([ct({attribute:!1})],ut.prototype,"inputRoot",void 0),t([ct({type:Boolean})],ut.prototype,"disabled",void 0);var pt;!function(t){t.alert_warning="alert-square",t.account="user-01",t.active="play",t.add_note="file-02",t.airtime="bank-note-01",t.analytics="bar-chart-01",t.archive="archive",t.arrow_up="chevron-up",t.arrow_down="chevron-down",t.arrow_left="chevron-left",t.arrow_right="chevron-right",t.attachment="paperclip",t.attachment_audio="volume-min",t.attachment_document="file-06",t.attachment_image="image-01",t.attachment_location="marker-pin-01",t.attachment_video="video-recorder",t.broadcast="announcement-01",t.call="phone-call-01",t.call_missed="phone-call-02",t.campaign="clock-refresh",t.campaign_active="play",t.campaign_archived="archive",t.campaigns="clock-refresh",t.channel="zap",t.channel_a="channel-android",t.channel_ct="channel-clickatell",t.channel_d3="channel-whatsapp",t.channel_ds="channel-discord",t.channel_ex="zap",t.channel_fb="channel-facebook",t.channel_fba="channel-facebook",t.channel_fc="channel-freshchat",t.channel_fcm="channel-firebase",t.channel_ig="channel-instagram",t.channel_jc="channel-jiochat",t.channel_jn="channel-junebug",t.channel_kn="channel-kannel",t.channel_kwa="channel-whatsapp",t.channel_ln="channel-line",t.channel_mg="channel-mtarget",t.channel_pl="channel-plivo",t.channel_rc="channel-rocketchat",t.channel_sl="channel-slack",t.channel_sw="channel-signalwire",t.channel_tq="channel-thinq",t.channel_tg="channel-telegram",t.channel_t="channel-twilio",t.channel_twt="channel-twitter",t.channel_twa="channel-whatsapp",t.channel_vp="channel-viber",t.channel_vk="channel-vk",t.channel_nx="channel-vonage",t.channel_wc="channel-wechat",t.channel_wa="channel-whatsapp",t.channel_wac="channel-whatsapp",t.channel_zvw="channel-whatsapp",t.children="git-branch-01",t.check="check",t.checkbox="square",t.checkbox_checked="check-square",t.checkbox_partial="stop-square",t.classifier_wit="classifier-wit",t.classifier_luis="classifier-luis",t.classifier_bothub="classifier-bothub",t.compose="send-01",t.colors="palette",t.contact="user-01",t.contact_archived="archive",t.contact_blocked="message-x-square",t.contact_stopped="slash-octagon",t.contact_updated="user-edit",t.contacts="user-01",t.conversation="message-chat-square",t.copy="copy-04",t.dashboard="pie-chart-01",t.delete="trash-03",t.delete_small="x",t.down="chevron-down",t.download="download-01",t.email="mail-01",t.error="alert-circle",t.event="zap",t.fields="user-edit",t.filter="filter-funnel-01",t.flow="flow",t.flow_background="layers-two-01",t.flow_interrupted="x-close",t.flow_ivr="phone",t.flow_message="message-square-02",t.flow_surveyor="tablet-01",t.flow_user="hard-drive",t.flows="flow",t.global="at-sign",t.group="users-01",t.group_smart="atom-01",t.help="help-circle",t.home="settings-02",t.image="image-01",t.inbox="inbox-01",t.incoming_call="phone-incoming-01",t.info="user-square",t.label="tag-01",t.language="translate-01",t.link="link-external-01",t.location="marker-pin-01",t.log="file-02",t.logout="log-out-04",t.menu="menu-01",t.menu_collapse="chevron-left-double",t.message="message-square-02",t.messages="message-square-02",t.missing="maximize-02",t.missed_call="phone-x",t.new="plus",t.next_schedule="alarm-clock",t.notification="bell-01",t.org_active="credit-card-02",t.org_anonymous="glasses-01",t.org_bulk="credit-card-plus",t.org_flagged="flag-01",t.org_new="stars-02",t.org_suspended="slash-circle-01",t.org_verified="check-verified-02",t.overview="pie-chart-01",t.prometheus="prometheus",t.progress_spinner="refresh-cw-04",t.featured="star-01",t.referral="user-right-01",t.resend="refresh-cw-05",t.resthooks="share-07",t.restore="play",t.retry="refresh-cw-05",t.rocketchat="rocketchat",t.runs="rows-03",t.schedule="calendar",t.search="search-refraction",t.select_open="chevron-down",t.select_clear="x",t.service="magic-wand-01",t.service_end="log-out-04",t.settings="settings-02",t.sort="chevron-selector-vertical",t.sort_down="sort-arrow-down",t.sort_up="sort-arrow-up",t.staff="hard-drive",t.tickets="agent",t.tickets_all="archive",t.tickets_closed="check",t.tickets_mine="coffee",t.tickets_open="inbox-01",t.tickets_unassigned="inbox-01",t.topic="message-text-circle-02",t.two_factor_enabled="shield-02",t.two_factor_disabled="shield-01",t.trigger="signal-01",t.trigger_active="play",t.trigger_archived="archive",t.trigger_new="plus",t.triggers="signal-01",t.updated="edit-02",t.up="chevron-up",t.upload="upload-cloud-01",t.usages="link-04",t.user="users-01",t.users="users-01",t.user_beta="shield-zap",t.webhook="link-external-01",t.wit="wit",t.workspace="folder",t.zapier="zapier",t.zendesk="zendesk",t.ext="lightning-01",t.fcm="lightning-01",t.bothub="bothub",t.chatbase="chatbase",t.dtone="dtone",t.default="list",t.datepicker="calendar",t.slider="sliders-02",t.select="browser",t.input="edit-05"}(pt||(pt={}));class mt extends ut{constructor(){super(...arguments),this.name="",this.disabled=!1,this.size=1.2,this.animateChange="pulse"}static get styles(){return r`
|
|
1
|
+
function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,i,r):o(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r}const e=window,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),o=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new s(i,t,n)},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,n))(e)})(t):t;var l;const h=window,c=h.trustedTypes,d=c?c.emptyScript:"",u=h.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:m};class g extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const n=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,n)=>{i?t.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((i=>{const n=document.createElement("style"),o=e.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=i.cssText,t.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=f){var n;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:p).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,o=n._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=n.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:p;this._$El=o,this[o]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var v;g.finalized=!0,g.elementProperties=new Map,g.elementStyles=[],g.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:g}),(null!==(l=h.reactiveElementVersions)&&void 0!==l?l:h.reactiveElementVersions=[]).push("1.5.0");const y=window,b=y.trustedTypes,_=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,x=`lit$${(Math.random()+"").slice(9)}$`,w="?"+x,k=`<${w}>`,S=document,E=(t="")=>S.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,A=/-->/g,M=/>/g,O=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),z=/'/g,P=/"/g,I=/^(?:script|style|textarea|title)$/i,D=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),N=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),B=new WeakMap,q=S.createTreeWalker(S,129,null,!1),U=(t,e)=>{const i=t.length-1,n=[];let o,s=2===e?"<svg>":"",r=T;for(let e=0;e<i;e++){const i=t[e];let a,l,h=-1,c=0;for(;c<i.length&&(r.lastIndex=c,l=r.exec(i),null!==l);)c=r.lastIndex,r===T?"!--"===l[1]?r=A:void 0!==l[1]?r=M:void 0!==l[2]?(I.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=O):void 0!==l[3]&&(r=O):r===O?">"===l[0]?(r=null!=o?o:T,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?O:'"'===l[3]?P:z):r===P||r===z?r=O:r===A||r===M?r=T:(r=O,o=void 0);const d=r===O&&t[e+1].startsWith("/>")?" ":"";s+=r===T?i+k:h>=0?(n.push(a),i.slice(0,h)+"$lit$"+i.slice(h)+x+d):i+x+(-2===h?(n.push(void 0),e):d)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==_?_.createHTML(a):a,n]};class Z{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let o=0,s=0;const r=t.length-1,a=this.parts,[l,h]=U(t,e);if(this.el=Z.createElement(l,i),q.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=q.nextNode())&&a.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(x)){const i=h[s++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+"$lit$").split(x),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?W:"?"===e[1]?K:"@"===e[1]?Y:H})}else a.push({type:6,index:o})}for(const e of t)n.removeAttribute(e)}if(I.test(n.tagName)){const t=n.textContent.split(x),e=t.length-1;if(e>0){n.textContent=b?b.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],E()),q.nextNode(),a.push({type:2,index:++o});n.append(t[e],E())}}}else if(8===n.nodeType)if(n.data===w)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=n.data.indexOf(x,t+1));)a.push({type:7,index:o}),t+=x.length-1}o++}}static createElement(t,e){const i=S.createElement("template");return i.innerHTML=t,i}}function F(t,e,i=t,n){var o,s,r,a;if(e===N)return e;let l=void 0!==n?null===(o=i._$Co)||void 0===o?void 0:o[n]:i._$Cl;const h=C(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,i,n)),void 0!==n?(null!==(r=(a=i)._$Co)&&void 0!==r?r:a._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=F(t,l._$AS(t,e.values),l,n)),e}class j{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:n}=this._$AD,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:S).importNode(i,!0);q.currentNode=o;let s=q.nextNode(),r=0,a=0,l=n[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new V(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new J(s,this,t)),this.u.push(e),l=n[++a]}r!==(null==l?void 0:l.index)&&(s=q.nextNode(),r++)}return o}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class V{constructor(t,e,i,n){var o;this.type=2,this._$AH=R,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cm=null===(o=null==n?void 0:n.isConnected)||void 0===o||o}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=F(this,t,e),C(t)?t===R||null==t||""===t?(this._$AH!==R&&this._$AR(),this._$AH=R):t!==this._$AH&&t!==N&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>$(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==R&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(S.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:n}=t,o="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Z.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===o)this._$AH.p(i);else{const t=new j(o,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new Z(t)),e}k(t){$(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const o of t)n===e.length?e.push(i=new V(this.O(E()),this.O(E()),this,this.options)):i=e[n],i._$AI(o),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class H{constructor(t,e,i,n,o){this.type=1,this._$AH=R,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=R}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const o=this.strings;let s=!1;if(void 0===o)t=F(this,t,e,0),s=!C(t)||t!==this._$AH&&t!==N,s&&(this._$AH=t);else{const n=t;let r,a;for(t=o[0],r=0;r<o.length-1;r++)a=F(this,n[i+r],e,r),a===N&&(a=this._$AH[r]),s||(s=!C(a)||a!==this._$AH[r]),a===R?t=R:t!==R&&(t+=(null!=a?a:"")+o[r+1]),this._$AH[r]=a}s&&!n&&this.j(t)}j(t){t===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class W extends H{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===R?void 0:t}}const G=b?b.emptyScript:"";class K extends H{constructor(){super(...arguments),this.type=4}j(t){t&&t!==R?this.element.setAttribute(this.name,G):this.element.removeAttribute(this.name)}}class Y extends H{constructor(t,e,i,n,o){super(t,e,i,n,o),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=F(this,t,e,0))&&void 0!==i?i:R)===N)return;const n=this._$AH,o=t===R&&n!==R||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==R&&(n===R||o);o&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const X=y.litHtmlPolyfillSupport;null==X||X(Z,V),(null!==(v=y.litHtmlVersions)&&void 0!==v?v:y.litHtmlVersions=[]).push("2.5.0");var Q,tt;class et extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var n,o;const s=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let r=s._$litPart$;if(void 0===r){const t=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;s._$litPart$=r=new V(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return N}}et.finalized=!0,et._$litElement$=!0,null===(Q=globalThis.litElementHydrateSupport)||void 0===Q||Q.call(globalThis,{LitElement:et});const it=globalThis.litElementPolyfillSupport;var nt;null==it||it({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.2"),function(t){t[t.YELLOW=33]="YELLOW",t[t.PURPLE=35]="PURPLE",t[t.WHITE=37]="WHITE",t[t.BLUE=34]="BLUE",t[t.RED=31]="RED",t[t.CYAN=36]="CYAN",t[t.GREEN=32]="GREEN",t[t.BLACK=30]="BLACK"}(nt||(nt={}));const ot=(t,e)=>`[${e}m${t}[0m`,st=t=>ot(t.tagName.padEnd(30),nt.PURPLE),rt=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){console.log(st(t),i?ot("<first-updated>",nt.BLACK):ot("<updated>",nt.YELLOW));for(const[i,n]of e.entries())console.log(" "+String(i).padEnd(30),n,ot("=>",nt.WHITE),t[i])}},at=(t,e,i)=>{(t.DEBUG_EVENTS||t.DEBUG)&&console.log(st(t),void 0!==i?ot("<custom-event>",nt.RED):ot("<event> ",nt.CYAN),ot(e,nt.BLUE),void 0!==i?i:"")};class lt extends et{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),rt(this,t,!0)}updated(t){super.updated(t),rt(this,t,!1)}fireEvent(t){return at(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&at(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const n=i.closest(t);return n||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}}const ht=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function ct(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):ht(t,e)}var dt;null===(dt=window.HTMLSlotElement)||void 0===dt||dt.prototype.assignedElements;class ut extends lt{constructor(){super(),this.name="",this.value=null,this.inputRoot=this,this.disabled=!1,this.internals=this.attachInternals()}updated(t){super.updated(t),t.has("value")&&this.internals.setFormValue(this.value)}get form(){return this.internals.form}get type(){return this.localName}serializeValue(t){return JSON.stringify(t)}}ut.formAssociated=!0,t([ct({type:String})],ut.prototype,"name",void 0),t([ct({type:String,attribute:"help_text"})],ut.prototype,"helpText",void 0),t([ct({type:Boolean,attribute:"help_always"})],ut.prototype,"helpAlways",void 0),t([ct({type:Boolean,attribute:"widget_only"})],ut.prototype,"widgetOnly",void 0),t([ct({type:Boolean,attribute:"hide_label"})],ut.prototype,"hideLabel",void 0),t([ct({type:String})],ut.prototype,"label",void 0),t([ct({type:Array})],ut.prototype,"errors",void 0),t([ct({type:String})],ut.prototype,"value",void 0),t([ct({attribute:!1})],ut.prototype,"inputRoot",void 0),t([ct({type:Boolean})],ut.prototype,"disabled",void 0);var pt;!function(t){t.alert_warning="alert-square",t.account="user-01",t.active="play",t.add_note="file-02",t.airtime="bank-note-01",t.analytics="bar-chart-01",t.archive="archive",t.arrow_up="chevron-up",t.arrow_down="chevron-down",t.arrow_left="chevron-left",t.arrow_right="chevron-right",t.attachment="paperclip",t.attachment_audio="volume-min",t.attachment_document="file-06",t.attachment_image="image-01",t.attachment_location="marker-pin-01",t.attachment_video="video-recorder",t.broadcast="announcement-01",t.call="phone-call-01",t.call_missed="phone-call-02",t.campaign="clock-refresh",t.campaign_active="play",t.campaign_archived="archive",t.campaigns="clock-refresh",t.channel="zap",t.channel_a="channel-android",t.channel_ct="channel-clickatell",t.channel_d3="channel-whatsapp",t.channel_ds="channel-discord",t.channel_ex="zap",t.channel_fb="channel-facebook",t.channel_fba="channel-facebook",t.channel_fc="channel-freshchat",t.channel_fcm="channel-firebase",t.channel_ig="channel-instagram",t.channel_jc="channel-jiochat",t.channel_jn="channel-junebug",t.channel_kn="channel-kannel",t.channel_kwa="channel-whatsapp",t.channel_ln="channel-line",t.channel_mg="channel-mtarget",t.channel_pl="channel-plivo",t.channel_rc="channel-rocketchat",t.channel_sl="channel-slack",t.channel_sw="channel-signalwire",t.channel_tq="channel-thinq",t.channel_tg="channel-telegram",t.channel_t="channel-twilio",t.channel_twt="channel-twitter",t.channel_twa="channel-whatsapp",t.channel_vp="channel-viber",t.channel_vk="channel-vk",t.channel_nx="channel-vonage",t.channel_wc="channel-wechat",t.channel_wa="channel-whatsapp",t.channel_wac="channel-whatsapp",t.channel_zvw="channel-whatsapp",t.children="git-branch-01",t.check="check",t.checkbox="square",t.checkbox_checked="check-square",t.checkbox_partial="stop-square",t.classifier_wit="classifier-wit",t.classifier_luis="classifier-luis",t.classifier_bothub="classifier-bothub",t.compose="send-01",t.colors="palette",t.contact="user-01",t.contact_archived="archive",t.contact_blocked="message-x-square",t.contact_stopped="slash-octagon",t.contact_updated="user-edit",t.contacts="user-01",t.conversation="message-chat-square",t.copy="copy-04",t.dashboard="pie-chart-01",t.delete="trash-03",t.delete_small="x",t.down="chevron-down",t.download="download-01",t.email="mail-01",t.error="alert-circle",t.event="zap",t.fields="user-edit",t.filter="filter-funnel-01",t.flow="flow",t.flow_background="layers-two-01",t.flow_interrupted="x-close",t.flow_ivr="phone",t.flow_message="message-square-02",t.flow_surveyor="tablet-01",t.flow_user="hard-drive",t.flows="flow",t.global="at-sign",t.group="users-01",t.group_smart="atom-01",t.help="help-circle",t.home="settings-02",t.image="image-01",t.inbox="inbox-01",t.incoming_call="phone-incoming-01",t.info="user-square",t.label="tag-01",t.language="translate-01",t.link="link-external-01",t.location="marker-pin-01",t.log="file-02",t.logout="log-out-04",t.menu="menu-01",t.menu_collapse="chevron-left-double",t.message="message-square-02",t.messages="message-square-02",t.missing="maximize-02",t.missed_call="phone-x",t.new="plus",t.next_schedule="alarm-clock",t.notification="bell-01",t.org_active="credit-card-02",t.org_anonymous="glasses-01",t.org_bulk="credit-card-plus",t.org_flagged="flag-01",t.org_new="stars-02",t.org_suspended="slash-circle-01",t.org_verified="check-verified-02",t.overview="pie-chart-01",t.prometheus="prometheus",t.progress_spinner="refresh-cw-04",t.featured="star-01",t.referral="user-right-01",t.resend="refresh-cw-05",t.resthooks="share-07",t.restore="play",t.retry="refresh-cw-05",t.rocketchat="rocketchat",t.runs="rows-03",t.schedule="calendar",t.search="search-refraction",t.select_open="chevron-down",t.select_clear="x",t.service="magic-wand-01",t.service_end="log-out-04",t.settings="settings-02",t.sort="chevron-selector-vertical",t.sort_down="sort-arrow-down",t.sort_up="sort-arrow-up",t.staff="hard-drive",t.tickets="agent",t.tickets_all="archive",t.tickets_closed="check",t.tickets_mine="coffee",t.tickets_open="inbox-01",t.tickets_unassigned="inbox-01",t.topic="message-text-circle-02",t.two_factor_enabled="shield-02",t.two_factor_disabled="shield-01",t.trigger="signal-01",t.trigger_active="play",t.trigger_archived="archive",t.trigger_new="plus",t.triggers="signal-01",t.updated="edit-02",t.up="chevron-up",t.upload="upload-cloud-01",t.usages="link-04",t.user="users-01",t.users="users-01",t.user_beta="shield-zap",t.webhook="link-external-01",t.wit="wit",t.workspace="folder",t.zapier="zapier",t.zendesk="zendesk",t.ext="lightning-01",t.fcm="lightning-01",t.bothub="bothub",t.chatbase="chatbase",t.dtone="dtone",t.default="list",t.datepicker="calendar",t.slider="sliders-02",t.select="browser",t.input="edit-05"}(pt||(pt={}));class mt extends ut{constructor(){super(...arguments),this.name="",this.disabled=!1,this.size=1.2,this.animateChange="pulse"}static get styles(){return r`
|
|
2
2
|
:host {
|
|
3
3
|
color: var(--color-text);
|
|
4
4
|
display: inline-block;
|
|
@@ -754,6 +754,12 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
754
754
|
cursor: text;
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
+
.wrapper-bg {
|
|
758
|
+
background: #f3f3f3;
|
|
759
|
+
box-shadow: inset 0px 0px 4px rgb(0 0 0 / 10%);
|
|
760
|
+
border-radius: var(--curvature-widget);
|
|
761
|
+
}
|
|
762
|
+
|
|
757
763
|
.select-container {
|
|
758
764
|
display: flex;
|
|
759
765
|
flex-direction: row;
|
|
@@ -987,16 +993,13 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
987
993
|
|
|
988
994
|
.info-text {
|
|
989
995
|
opacity: 1;
|
|
990
|
-
transition:
|
|
996
|
+
transition: padding-top var(--transition-speed) ease-in-out,
|
|
997
|
+
padding-bottom var(--transition-speed) ease-in-out;
|
|
991
998
|
margin-bottom: 16px;
|
|
992
|
-
margin-top: -1em;
|
|
993
999
|
padding: 0.5em 1em;
|
|
994
|
-
background: #f3f3f3;
|
|
995
|
-
padding-top: 1.5em;
|
|
996
1000
|
border-radius: var(--curvature);
|
|
997
1001
|
font-size: 0.9em;
|
|
998
1002
|
color: rgba(0, 0, 0, 0.5);
|
|
999
|
-
box-shadow: inset 0px 0px 4px rgb(0 0 0 / 10%);
|
|
1000
1003
|
position: relative;
|
|
1001
1004
|
}
|
|
1002
1005
|
|
|
@@ -1008,17 +1011,17 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1008
1011
|
opacity: 0;
|
|
1009
1012
|
max-height: 0;
|
|
1010
1013
|
margin-bottom: 0px;
|
|
1011
|
-
margin-top: -2em;
|
|
1012
1014
|
pointer-events: none;
|
|
1015
|
+
padding: 0px;
|
|
1013
1016
|
}
|
|
1014
|
-
`}updated(t){if(super.updated(t),t.has("values")&&this.updateInputs(),t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Et.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&this.fetchOptions(this.query,this.page+1),t.has("value")&&this.value&&!this.values.length){const t=this.staticOptions.find((t=>this.getValue(t)===this.value));t&&this.setValues([t])}0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)}))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1
|
|
1017
|
+
`}updated(t){if(super.updated(t),t.has("values")&&(this.updateInputs(),(this.multi||1===this.values.length)&&this.fireEvent("change")),t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Et.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&this.fetchOptions(this.query,this.page+1),t.has("value")&&this.value&&!this.values.length){const t=this.staticOptions.find((t=>this.getValue(t)===this.value));t&&this.setValues([t])}0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.multi||1!==this.values.length?this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0])))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){const e=t.detail.selected;e.post&&this.endpoint?ue(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=Le(20,6e4)):this.blur()})):this.setSelectedOption(e)}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,n=this.shadowRoot.querySelector(".searchbox");Ra(this.query,n,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){this.removeValue(t),this.visibleOptions=[]}createArbitraryOptionDefault(){return null}open(){this.requestUpdate("input")}isOpen(){return this.visibleOptions.length>0}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.multi?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(Et.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const e=this.shadowRoot.querySelector(".searchbox"),i=Ba(e,t,"session"===this.expressions);return this.query=i.query,this.completionOptions=i.options,this.visibleOptions=[],this.anchorPosition=i.anchorPosition,void this.fireCustomEvent(Et.FetchComplete)}}fetchOptions(t,e=0){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const i=[...this.staticOptions],n=(t||"").trim().toLowerCase();if(this.tags&&n&&(i.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===n))||i.splice(0,0,{name:t,value:t})),this.endpoint){let o=this.endpoint;t&&this.queryParam&&(o.indexOf("?")>-1?o+="&":o+="?",o+=this.queryParam+"="+encodeURIComponent(t)),e&&(o.indexOf("?")>-1?o+="&":o+="?",o+="page="+e),this.next&&(o=this.next);const s=this.lruCache.get(o);if(this.cache&&!this.tags&&s)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...s.options]):(this.cursorIndex=0,this.setVisibleOptions([...i,...s.options])),this.complete=s.complete,this.next=s.next,void(this.fetching=!1);this.searchable&&!this.queryParam?le(o).then((t=>{this.cache&&!this.tags&&(this.lruCache.set(o,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...i,...t]),this.fetching=!1)})):se(o).then((s=>{const r=this.getOptions(s).filter((t=>this.isMatch(t,n))),a=s.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,s)):(this.cursorIndex=0,this.setVisibleOptions([...i,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,s)),this.cache&&!this.tags&&this.lruCache.set(o,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(i)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0,this.searchOnFocus&&!this.removingSelection&&this.requestUpdate("input"))}handleBlur(){this.focused=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0)}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.multi?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.multi||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1&&this.addInputAsValue(),("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length)this.requestUpdate("input");else if(this.multi&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[]}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(this.focused=!0,"INPUT"!==t.target.tagName){const e=this.shadowRoot.querySelector("input");if(e)return e.click(),void e.focus();this.visibleOptions.length>0?(this.visibleOptions=[],t.preventDefault(),t.stopPropagation()):this.requestUpdate("input")}}getEventHandlers(){return[{event:Et.Canceled,method:this.handleCancel},{event:Et.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),window.setTimeout((()=>{for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;this.staticOptions.push(e),null===t.getAttribute("selected")&&this.getValue(e)!=this.value||(null!==this.getAttribute("multi")?this.addValue(e):this.setValues([e]))}0!==this.values.length||this.placeholder||(0==this.staticOptions.length&&this.endpoint?le(this.endpoint).then((t=>{t.length>0&&this.setValues([t[0]])})):null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.setValues([this.staticOptions[0]])),this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}),0)}handleArrowClick(t){this.visibleOptions.length>0&&(this.visibleOptions=[],t.preventDefault(),t.stopPropagation())}renderSelectedItemDefault(t){return t?D`
|
|
1015
1018
|
<div class="option-name" style="display:flex">
|
|
1016
1019
|
${t.icon?D`<temba-icon
|
|
1017
1020
|
name="${t.icon}"
|
|
1018
1021
|
style="margin-right:0.5em;"
|
|
1019
1022
|
></temba-icon>`:null}<span>${this.getName(t)}</span>
|
|
1020
1023
|
</div>
|
|
1021
|
-
`:null}serializeValue(t){return!this.jsonValue&&(this.staticOptions.length>0||this.tags)?t.value:super.serializeValue(t)}setSelection(t){for(const e of this.staticOptions)if(e.value===t)return void(0!==this.values.length&&this.values[0].value===""+t||
|
|
1024
|
+
`:null}serializeValue(t){return!this.jsonValue&&(this.staticOptions.length>0||this.tags)?t.value:super.serializeValue(t)}setSelection(t){for(const e of this.staticOptions)if(e.value===t)return void(0!==this.values.length&&this.values[0].value===""+t||this.setValues([e]))}handleClear(t){t.preventDefault(),t.stopPropagation(),this.setValues([])}setValues(t){this.values=t,this.requestUpdate("values")}addValue(t){this.values.push(t),this.requestUpdate("values")}removeValue(t){this.values=this.values.filter((e=>e!==t)),this.requestUpdate("values")}popValue(){this.values.pop(),this.requestUpdate("values")}clear(){this.values=[],this.requestUpdate("values")}render(){const t=0===this.values.length?this.placeholder:"",e=D`
|
|
1022
1025
|
<div class="placeholder">${t}</div>
|
|
1023
1026
|
`,i=this.clearable&&this.values.length>0&&!this.multi?D`<temba-icon
|
|
1024
1027
|
name="${pt.select_clear}"
|
|
@@ -1050,6 +1053,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1050
1053
|
>
|
|
1051
1054
|
|
|
1052
1055
|
|
|
1056
|
+
<div class="wrapper-bg">
|
|
1053
1057
|
<div
|
|
1054
1058
|
tabindex="0"
|
|
1055
1059
|
class="select-container ${n}"
|
|
@@ -1095,8 +1099,9 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1095
1099
|
</div>`}
|
|
1096
1100
|
</div>
|
|
1097
1101
|
|
|
1098
|
-
|
|
1099
|
-
<div class="info-text ${this.infoText?"":"hide"} ${this.focused?"focused":""}">${this.infoText}</div>
|
|
1102
|
+
|
|
1103
|
+
<div class="info-text ${this.infoText?"":"hide"} ${this.focused?"focused":""}">${this.infoText}</div></div></div>
|
|
1104
|
+
|
|
1100
1105
|
|
|
1101
1106
|
<temba-options
|
|
1102
1107
|
@temba-selection=${this.handleOptionSelection}
|
|
@@ -1134,7 +1139,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
1134
1139
|
|
|
1135
1140
|
</temba-field>
|
|
1136
1141
|
|
|
1137
|
-
`}}t([ct({type:Boolean})],qa.prototype,"multi",void 0),t([ct({type:Boolean})],qa.prototype,"searchOnFocus",void 0),t([ct({type:String})],qa.prototype,"placeholder",void 0),t([ct()],qa.prototype,"name",void 0),t([ct()],qa.prototype,"endpoint",void 0),t([ct({type:String})],qa.prototype,"nameKey",void 0),t([ct({type:String})],qa.prototype,"valueKey",void 0),t([ct({attribute:!1})],qa.prototype,"currentFunction",void 0),t([ct({type:String})],qa.prototype,"queryParam",void 0),t([ct({type:String})],qa.prototype,"input",void 0),t([ct({type:Array})],qa.prototype,"visibleOptions",void 0),t([ct({type:Array})],qa.prototype,"completionOptions",void 0),t([ct({type:Number})],qa.prototype,"quietMillis",void 0),t([ct({type:Boolean})],qa.prototype,"fetching",void 0),t([ct({type:Boolean})],qa.prototype,"searchable",void 0),t([ct({type:String})],qa.prototype,"expressions",void 0),t([ct({type:Boolean})],qa.prototype,"cache",void 0),t([ct({type:String})],qa.prototype,"cacheKey",void 0),t([ct({type:Boolean})],qa.prototype,"focused",void 0),t([ct({type:Boolean})],qa.prototype,"disabled",void 0),t([ct({attribute:!1})],qa.prototype,"selectedIndex",void 0),t([ct({type:Number})],qa.prototype,"cursorIndex",void 0),t([ct({attribute:!1})],qa.prototype,"anchorElement",void 0),t([ct({attribute:!1})],qa.prototype,"anchorExpressions",void 0),t([ct({type:Object})],qa.prototype,"anchorPosition",void 0),t([ct({type:Boolean})],qa.prototype,"tags",void 0),t([ct({type:Boolean,attribute:"space_select"})],qa.prototype,"spaceSelect",void 0),t([ct({type:Boolean})],qa.prototype,"jsonValue",void 0),t([ct({type:Boolean})],qa.prototype,"hideErrors",void 0),t([ct({type:Boolean})],qa.prototype,"clearable",void 0),t([ct({type:String})],qa.prototype,"flavor",void 0),t([ct({type:String,attribute:"info_text"})],qa.prototype,"infoText",void 0),t([ct({type:Array})],qa.prototype,"values",void 0),t([ct({attribute:!1})],qa.prototype,"getName",void 0),t([ct({attribute:!1})],qa.prototype,"isMatch",void 0),t([ct({attribute:!1})],qa.prototype,"getValue",void 0),t([ct({type:Number,attribute:"option-width"})],qa.prototype,"optionWidth",void 0),t([ct({type:Boolean,attribute:"anchor-right"})],qa.prototype,"anchorRight",void 0),t([ct({attribute:!1})],qa.prototype,"shouldExclude",void 0),t([ct({attribute:!1})],qa.prototype,"sortFunction",void 0),t([ct({attribute:!1})],qa.prototype,"renderOption",void 0),t([ct({attribute:!1})],qa.prototype,"renderOptionName",void 0),t([ct({attribute:!1})],qa.prototype,"renderOptionDetail",void 0),t([ct({attribute:!1})],qa.prototype,"renderSelectedItem",void 0),t([ct({attribute:!1})],qa.prototype,"createArbitraryOption",void 0),t([ct({attribute:!1})],qa.prototype,"getOptions",void 0),t([ct({attribute:!1})],qa.prototype,"isComplete",void 0),t([ct({type:Array,attribute:"options"})],qa.prototype,"staticOptions",void 0);class Ua extends ut{constructor(){super(...arguments),this.submitOnEnter=!1,this.anchorPosition={left:0,top:0},this.placeholder="",this.options=[],this.name="",this.value="",this.autogrow=!1}static get styles(){return r`
|
|
1142
|
+
`}}t([ct({type:Boolean})],qa.prototype,"multi",void 0),t([ct({type:Boolean})],qa.prototype,"searchOnFocus",void 0),t([ct({type:String})],qa.prototype,"placeholder",void 0),t([ct()],qa.prototype,"name",void 0),t([ct()],qa.prototype,"endpoint",void 0),t([ct({type:String})],qa.prototype,"nameKey",void 0),t([ct({type:String})],qa.prototype,"valueKey",void 0),t([ct({attribute:!1})],qa.prototype,"currentFunction",void 0),t([ct({type:String})],qa.prototype,"queryParam",void 0),t([ct({type:String})],qa.prototype,"input",void 0),t([ct({type:Array})],qa.prototype,"visibleOptions",void 0),t([ct({type:Array})],qa.prototype,"completionOptions",void 0),t([ct({type:Number})],qa.prototype,"quietMillis",void 0),t([ct({type:Boolean})],qa.prototype,"fetching",void 0),t([ct({type:Boolean})],qa.prototype,"searchable",void 0),t([ct({type:String})],qa.prototype,"expressions",void 0),t([ct({type:Boolean})],qa.prototype,"cache",void 0),t([ct({type:String})],qa.prototype,"cacheKey",void 0),t([ct({type:Boolean})],qa.prototype,"focused",void 0),t([ct({type:Boolean})],qa.prototype,"disabled",void 0),t([ct({attribute:!1})],qa.prototype,"selectedIndex",void 0),t([ct({type:Number})],qa.prototype,"cursorIndex",void 0),t([ct({attribute:!1})],qa.prototype,"anchorElement",void 0),t([ct({attribute:!1})],qa.prototype,"anchorExpressions",void 0),t([ct({type:Object})],qa.prototype,"anchorPosition",void 0),t([ct({type:Boolean})],qa.prototype,"tags",void 0),t([ct({type:Boolean,attribute:"space_select"})],qa.prototype,"spaceSelect",void 0),t([ct({type:Boolean})],qa.prototype,"jsonValue",void 0),t([ct({type:Boolean})],qa.prototype,"hideErrors",void 0),t([ct({type:Boolean})],qa.prototype,"clearable",void 0),t([ct({type:String})],qa.prototype,"flavor",void 0),t([ct({type:String,attribute:"info_text"})],qa.prototype,"infoText",void 0),t([ct({type:Array})],qa.prototype,"values",void 0),t([ct({type:Object})],qa.prototype,"selection",void 0),t([ct({attribute:!1})],qa.prototype,"getName",void 0),t([ct({attribute:!1})],qa.prototype,"isMatch",void 0),t([ct({attribute:!1})],qa.prototype,"getValue",void 0),t([ct({type:Number,attribute:"option-width"})],qa.prototype,"optionWidth",void 0),t([ct({type:Boolean,attribute:"anchor-right"})],qa.prototype,"anchorRight",void 0),t([ct({attribute:!1})],qa.prototype,"shouldExclude",void 0),t([ct({attribute:!1})],qa.prototype,"sortFunction",void 0),t([ct({attribute:!1})],qa.prototype,"renderOption",void 0),t([ct({attribute:!1})],qa.prototype,"renderOptionName",void 0),t([ct({attribute:!1})],qa.prototype,"renderOptionDetail",void 0),t([ct({attribute:!1})],qa.prototype,"renderSelectedItem",void 0),t([ct({attribute:!1})],qa.prototype,"createArbitraryOption",void 0),t([ct({attribute:!1})],qa.prototype,"getOptions",void 0),t([ct({attribute:!1})],qa.prototype,"isComplete",void 0),t([ct({type:Array,attribute:"options"})],qa.prototype,"staticOptions",void 0);class Ua extends ut{constructor(){super(...arguments),this.submitOnEnter=!1,this.anchorPosition={left:0,top:0},this.placeholder="",this.options=[],this.name="",this.value="",this.autogrow=!1}static get styles(){return r`
|
|
1138
1143
|
:host {
|
|
1139
1144
|
display: block;
|
|
1140
1145
|
}
|
|
@@ -3108,7 +3113,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
3108
3113
|
margin-top: 0.5em;
|
|
3109
3114
|
margin-left: 0.6em;
|
|
3110
3115
|
}
|
|
3111
|
-
`}updated(t){super.updated(t),(t.has("query")||t.has("endpoint"))&&(this.fetching=!!this.query&&!!this.endpoint,this.fetching&&(this.initialized=!0,this.summary=null,this.lastQuery&&window.clearTimeout(this.lastQuery),this.query.trim().length>0&&(this.lastQuery=window.setTimeout((()=>{this.fetchSummary(this.query)}),1e3))))}fetchSummary(t){this.endpoint&&ue(this.endpoint,{include:{query:t},exclude:this.exclusions}).then((t=>{this.fetching=!1,200===t.status?(this.summary=t.json,this.summary.error?this.errors=[this.summary.error]:this.errors=[],this.requestUpdate("errors"),this.fireCustomEvent(Et.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Et.ContentChanged,this.summary))}))}handleQueryChange(t){const e=t.target;this.query=e.inputElement.value}handleSlotChanged(t){if("TEMBA-CHECKBOX"===t.target.tagName){const e=t.target;let i=e.checked;i?("not_seen_since_days"===e.name&&(i=90),this.exclusions[e.name]=i):delete this.exclusions[e.name]}this.requestUpdate("query")}render(){let t;if(this.summary){const e=Object.keys(this.summary.fields||[]).map((t=>({uuid:t,...this.summary.fields[t]})));if(!this.summary.error){const i=this.summary.total,n=this.summary.query.indexOf("last_seen_on")>-1;t=D`
|
|
3116
|
+
`}updated(t){super.updated(t),(t.has("query")||t.has("endpoint"))&&(this.fetching=!!this.query&&!!this.endpoint,this.fetching&&(this.initialized=!0,this.summary=null,this.lastQuery&&window.clearTimeout(this.lastQuery),this.query.trim().length>0&&(this.lastQuery=window.setTimeout((()=>{this.fetchSummary(this.query)}),1e3))))}fetchSummary(t){this.endpoint&&ue(this.endpoint,{include:{query:t},exclude:this.exclusions}).then((t=>{this.fetching=!1,200===t.status?(this.summary=t.json,this.value=this.summary.query,this.summary.error?this.errors=[this.summary.error]:this.errors=[],this.requestUpdate("errors"),this.fireCustomEvent(Et.ContentChanged,this.summary)):(this.summary=t.json,this.summary.error&&(this.errors=[this.summary.error]),this.requestUpdate("errors"),this.fireCustomEvent(Et.ContentChanged,this.summary))}))}handleQueryChange(t){const e=t.target;this.query=e.inputElement.value}handleSlotChanged(t){if("TEMBA-CHECKBOX"===t.target.tagName){const e=t.target;let i=e.checked;i?("not_seen_since_days"===e.name&&(i=90),this.exclusions[e.name]=i):delete this.exclusions[e.name]}this.requestUpdate("query")}render(){let t;if(this.summary){const e=Object.keys(this.summary.fields||[]).map((t=>({uuid:t,...this.summary.fields[t]})));if(!this.summary.error){const i=this.summary.total,n=this.summary.query.indexOf("last_seen_on")>-1;t=D`
|
|
3112
3117
|
<table cellspacing="0" cellpadding="0">
|
|
3113
3118
|
<tr class="header">
|
|
3114
3119
|
<td colspan="2">
|
|
@@ -5920,7 +5925,7 @@ function t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPro
|
|
|
5920
5925
|
title="${this.datetime.toLocaleString(rh.datetime)}"
|
|
5921
5926
|
>
|
|
5922
5927
|
${t}
|
|
5923
|
-
</div>`}}}t([ct({type:String})],ah.prototype,"value",void 0),t([ct({type:String})],ah.prototype,"display",void 0),t([ct({type:Object,attribute:!1})],ah.prototype,"datetime",void 0);let lh=class extends lt{constructor(){super(...arguments),this.body=D`<temba-loading></temba-loading>`}static get styles(){return r``}updated(t){super.updated(t),t.has("endpoint")&&se(this.endpoint).then((t=>{
|
|
5928
|
+
</div>`}}}t([ct({type:String})],ah.prototype,"value",void 0),t([ct({type:String})],ah.prototype,"display",void 0),t([ct({type:Object,attribute:!1})],ah.prototype,"datetime",void 0);let lh=class extends lt{constructor(){super(...arguments),this.body=D`<temba-loading></temba-loading>`}static get styles(){return r``}updated(t){super.updated(t),t.has("endpoint")&&se(this.endpoint).then((t=>{this.body=tr(t.body)}))}render(){return D`${this.body}`}};t([ct({type:String})],lh.prototype,"endpoint",void 0),t([ct({attribute:!1})],lh.prototype,"body",void 0),lh=t([(t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e))("temba-remote")],lh);var hh=lh;class ch extends lt{constructor(){super(...arguments),this.animationTime=300,this.show=!1,this.zoom=!1,this.zoomPct=.9,this.scale=1,this.xTrans="0px",this.yTrans="0px"}static get styles(){return r`
|
|
5924
5929
|
:host {
|
|
5925
5930
|
position: absolute;
|
|
5926
5931
|
}
|
package/dist/sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),
|
|
1
|
+
if(!self.define){let e,t={};const o=(o,n)=>(o=new URL(o+".js",n).href,t[o]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=o,e.onload=t,document.head.appendChild(e)}else e=o,importScripts(o),t()})).then((()=>{let e=t[o];if(!e)throw new Error(`Module ${o} didn’t register its module`);return e})));self.define=(n,s)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(t[i])return;let r={};const l=e=>o(e,i),d={module:{uri:i},exports:r,require:l};t[i]=Promise.all(n.map((e=>d[e]||l(e)))).then((e=>(s(...e),r)))}}define(["./workbox-919adfb7"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"b6e68477.js",revision:"8906865832f357dfae203b4e08872e53"},{url:"templates/components-body.html",revision:"230688f8c5652a1f71b1957c5f5bdc39"},{url:"templates/components-head.html",revision:"7408755815d3d33f3d748d318487073c"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw.js","sources":["../../../../../tmp/
|
|
1
|
+
{"version":3,"file":"sw.js","sources":["../../../../../tmp/69ce9f168830fc1298794ac86fbd842f/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/runner/work/temba-components/temba-components/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"b6e68477.js\",\n \"revision\": \"8906865832f357dfae203b4e08872e53\"\n },\n {\n \"url\": \"templates/components-body.html\",\n \"revision\": \"230688f8c5652a1f71b1957c5f5bdc39\"\n },\n {\n \"url\": \"templates/components-head.html\",\n \"revision\": \"7408755815d3d33f3d748d318487073c\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,oCAEd,CACED,IAAO,iCACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<script type="module" src="{{STATIC_URL}}@nyaruka/temba-components/dist/b6e68477.js"></script><script>window.TEMBA_COMPONENTS_VERSION="0.54.1"</script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/
|
|
1
|
+
<link rel="modulepreload" href="{{STATIC_URL}}@nyaruka/temba-components/dist/b6e68477.js" crossorigin="anonymous">
|
|
@@ -20,8 +20,8 @@ const showUpdates = (ele, changes, firstUpdated = false) => {
|
|
|
20
20
|
if (ele['DEBUG_UPDATES'] || ele['DEBUG']) {
|
|
21
21
|
if (changes.size > 0) {
|
|
22
22
|
console.log(tag(ele), firstUpdated
|
|
23
|
-
? colorize('<updated>', Color.
|
|
24
|
-
: colorize('<
|
|
23
|
+
? colorize('<first-updated>', Color.BLACK)
|
|
24
|
+
: colorize('<updated>', Color.YELLOW));
|
|
25
25
|
for (const [key, value] of changes.entries()) {
|
|
26
26
|
console.log(' ' + String(key).padEnd(30), value, colorize('=>', Color.WHITE), ele[key]);
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RapidElement.js","sourceRoot":"","sources":["../../src/RapidElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,KAAK,CAAC;AAGnD,IAAK,KASJ;AATD,WAAK,KAAK;IACR,sCAAW,CAAA;IACX,sCAAW,CAAA;IACX,oCAAU,CAAA;IACV,kCAAS,CAAA;IACT,gCAAQ,CAAA;IACR,kCAAS,CAAA;IACT,oCAAU,CAAA;IACV,oCAAU,CAAA;AACZ,CAAC,EATI,KAAK,KAAL,KAAK,QAST;AAED,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAY,EAAE,EAAE;IAC9C,OAAO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QAAgB,EAAE,OAAgB,IAAI;QAC1D,SAAS,aAAa,CAAC,EAA+B;YACpD,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzD,IAAK,EAAU,CAAC,YAAY;gBAAE,EAAE,GAAI,EAAU,CAAC,YAAY,CAAC;YAC5D,MAAM,KAAK,GAAI,EAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChD,OAAO,KAAK;gBACV,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,aAAa,CAAG,EAAc,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAEM,MAAM,CAAC,QAAgB;QAC5B,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,IAAI,GAAG,EAAE;YACP,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;SAC3B;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["import { LitElement, PropertyValueMap } from 'lit';\nimport { CustomEventType } from './interfaces';\n\nenum Color {\n YELLOW = 33,\n PURPLE = 35,\n WHITE = 37,\n BLUE = 34,\n RED = 31,\n CYAN = 36,\n GREEN = 32,\n BLACK = 30,\n}\n\nconst colorize = (text: string, color: Color) => {\n return `\\x1b[${color}m${text}\\x1b[0m`;\n};\n\nconst tag = (ele: HTMLElement) => {\n return colorize(ele.tagName.padEnd(30), Color.PURPLE);\n};\n\nconst showUpdates = (\n ele: HTMLElement,\n changes: Map<PropertyKey, unknown>,\n firstUpdated = false\n) => {\n if (ele['DEBUG_UPDATES'] || ele['DEBUG']) {\n if (changes.size > 0) {\n console.log(\n tag(ele),\n firstUpdated\n ? colorize('<first-updated>', Color.BLACK)\n : colorize('<updated>', Color.YELLOW)\n );\n for (const [key, value] of changes.entries()) {\n console.log(\n ' ' + String(key).padEnd(30),\n value,\n colorize('=>', Color.WHITE),\n ele[key]\n );\n }\n }\n }\n};\n\nconst showEvent = (ele: HTMLElement, type: string, details = undefined) => {\n if (ele['DEBUG_EVENTS'] || ele['DEBUG']) {\n console.log(\n tag(ele),\n details !== undefined\n ? colorize('<custom-event>', Color.RED)\n : colorize('<event> ', Color.CYAN),\n colorize(type, Color.BLUE),\n details !== undefined ? details : ''\n );\n }\n};\n\nexport interface EventHandler {\n event: string;\n method: EventListener;\n isDocument?: boolean;\n}\n\nexport class RapidElement extends LitElement {\n DEBUG = false;\n DEBUG_UPDATES = false;\n DEBUG_EVENTS = false;\n\n private eles: { [selector: string]: HTMLDivElement } = {};\n public getEventHandlers(): EventHandler[] {\n return [];\n }\n\n connectedCallback() {\n super.connectedCallback();\n\n for (const handler of this.getEventHandlers()) {\n if (handler.isDocument) {\n document.addEventListener(handler.event, handler.method.bind(this));\n } else {\n this.addEventListener(handler.event, handler.method.bind(this));\n }\n }\n }\n\n disconnectedCallback() {\n for (const handler of this.getEventHandlers()) {\n if (handler.isDocument) {\n document.removeEventListener(handler.event, handler.method);\n } else {\n this.removeEventListener(handler.event, handler.method);\n }\n }\n super.disconnectedCallback();\n }\n\n protected firstUpdated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.firstUpdated(changes);\n showUpdates(this, changes, true);\n }\n\n protected updated(\n changes: PropertyValueMap<any> | Map<PropertyKey, unknown>\n ): void {\n super.updated(changes);\n showUpdates(this, changes, false);\n }\n\n public fireEvent(type: string): any {\n showEvent(this, type);\n\n return this.dispatchEvent(\n new Event(type, {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n public fireCustomEvent(type: CustomEventType, detail: any = {}): any {\n if (this['DEBUG_EVENTS']) {\n showEvent(this, type, detail);\n }\n\n const event = new CustomEvent(type, {\n detail,\n bubbles: true,\n composed: true,\n });\n\n return this.dispatchEvent(event);\n }\n\n public dispatchEvent(event: any): any {\n super.dispatchEvent(event);\n const ele = event.target;\n if (ele) {\n // lookup events with - prefix and try to invoke them\n const eventFire = (ele as any)['-' + event.type];\n if (eventFire) {\n return eventFire(event);\n } else {\n const func = new Function(\n 'event',\n `\n with(document) {\n with(this) {\n let handler = ${ele.getAttribute('-' + event.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `\n );\n return func.call(ele, event);\n }\n }\n }\n\n public closestElement(selector: string, base: Element = this) {\n function __closestFrom(el: Element | Window | Document): Element {\n if (!el || el === document || el === window) return null;\n if ((el as any).assignedSlot) el = (el as any).assignedSlot;\n const found = (el as Element).closest(selector);\n return found\n ? found\n : __closestFrom(((el as Element).getRootNode() as ShadowRoot).host);\n }\n return __closestFrom(base);\n }\n\n public getDiv(selector: string) {\n let ele = this.eles[selector];\n if (ele) {\n return ele;\n }\n\n ele = this.shadowRoot.querySelector(selector);\n if (ele) {\n this.eles[selector] = ele;\n }\n return ele;\n }\n}\n"]}
|
|
@@ -179,6 +179,7 @@ export class ContactSearch extends FormElement {
|
|
|
179
179
|
this.fetching = false;
|
|
180
180
|
if (response.status === 200) {
|
|
181
181
|
this.summary = response.json;
|
|
182
|
+
this.value = this.summary.query;
|
|
182
183
|
if (this.summary.error) {
|
|
183
184
|
this.errors = [this.summary.error];
|
|
184
185
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;A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IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACnC","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\n\nconst QUEIT_MILLIS = 1000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n `;\n }\n\n // private cancelToken: CancelTokenSource;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n private lastQuery: number;\n private initialized = false;\n\n private exclusions = {};\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('query') || changedProperties.has('endpoint')) {\n this.fetching = !!this.query && !!this.endpoint;\n\n if (this.fetching) {\n this.initialized = true;\n // clear our summary on any change\n this.summary = null;\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n }\n\n if (this.query.trim().length > 0) {\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary(this.query);\n }, QUEIT_MILLIS);\n }\n }\n }\n }\n\n public fetchSummary(query: string): any {\n if (this.endpoint) {\n postJSON(this.endpoint, {\n include: { query },\n exclude: this.exclusions,\n }).then((response: WebResponse) => {\n this.fetching = false;\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleSlotChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n if (checkbox.name === 'not_seen_since_days') {\n value = 90;\n }\n\n this.exclusions[checkbox.name] = value;\n }\n }\n\n this.requestUpdate('query');\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n const fields = Object.keys(this.summary.fields || []).map(\n (uuid: string) => {\n return { uuid, ...this.summary.fields[uuid] };\n }\n );\n\n if (!this.summary.error) {\n const count = this.summary.total;\n const lastSeenOn = this.summary.query.indexOf('last_seen_on') > -1;\n\n summary = html`\n <table cellspacing=\"0\" cellpadding=\"0\">\n <tr class=\"header\">\n <td colspan=\"2\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(\n this.summary.query\n )}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </td>\n ${fields.map(\n field => html` <td class=\"field-header\">${field.label}</td> `\n )}\n <td></td>\n <td class=\"field-header date\">\n ${lastSeenOn ? 'Last Seen' : 'Created'}\n </td>\n </tr>\n\n ${this.summary.sample.map(\n (contact: Contact) => html`\n <tr class=\"contact\">\n <td class=\"urn\">${(contact as any).primary_urn_formatted}</td>\n <td class=\"name\">${contact.name}</td>\n ${fields.map(\n field => html`\n <td class=\"field\">\n ${((contact as any).fields[field.uuid] || { text: '' })\n .text}\n </td>\n `\n )}\n <td></td>\n <td class=\"date\">\n ${lastSeenOn\n ? contact.last_seen_on || '--'\n : contact.created_on}\n </td>\n </tr>\n `\n )}\n ${this.summary.total > this.summary.sample.length\n ? html`<tr class=\"table-footer\">\n <td class=\"query-details\" colspan=${fields.length + 3}></td>\n <td class=\"more\">\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(\n this.summary.query\n )}\"\n >more</a\n >\n </td>\n </tr>`\n : null}\n </table>\n `;\n }\n }\n\n return html`\n <div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>\n\n <slot @change=${this.handleSlotChanged}></slot>\n\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ContactSearch.js","sourceRoot":"","sources":["../../../src/contactsearch/ContactSearch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAW,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,YAAY,GAAG,IAAI,CAAC;AAU1B,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QAoJE,gBAAW,GAAG,EAAE,CAAC;QAGjB,SAAI,GAAG,EAAE,CAAC;QAGV,UAAK,GAAG,EAAE,CAAC;QAGX,sBAAiB,GAAG,IAA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I,CAAC,KAAK;;;;;;;sBAOP,IAAI,CAAC,iBAAiB;;;yBAGnB,UAAU,CAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ;SAC/C,CAAC;;;8BAGoB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO;;KAEpE,CAAC;IACJ,CAAC;CACF;AA7NC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACV;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAChB;AAGX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDACF;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACT;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACpB;AAGzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CACnC","sourcesContent":["import { TemplateResult, html, css } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { getClasses, postJSON, WebResponse } from '../utils';\nimport { TextInput } from '../textinput/TextInput';\nimport '../alert/Alert';\nimport { Contact, CustomEventType } from '../interfaces';\nimport { FormElement } from '../FormElement';\nimport { Checkbox } from '../checkbox/Checkbox';\n\nconst QUEIT_MILLIS = 1000;\n\ninterface SummaryResponse {\n total: number;\n sample: Contact[];\n query: string;\n fields: { [uuid: string]: { label: string; type: string } };\n error?: string;\n}\n\nexport class ContactSearch extends FormElement {\n static get styles() {\n return css`\n :host {\n color: var(--color-text);\n }\n\n .urn {\n width: 120px;\n }\n\n .name {\n width: 160px;\n }\n\n .date {\n text-align: right;\n }\n\n .field-header {\n font-size: 80%;\n color: var(--color-text-dark);\n }\n\n .field-header.date {\n text-align: right;\n }\n\n .more {\n font-size: 90%;\n padding-top: 5px;\n padding-right: 3px;\n text-align: right;\n width: 100px;\n vertical-align: top;\n }\n\n table {\n width: 100%;\n }\n\n .contact td {\n border-bottom: 1px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .table-footer td {\n padding: 10px 3px;\n }\n\n .query-replaced,\n .count-replaced {\n display: inline-block;\n background: var(--color-primary-light);\n color: var(--color-text-dark);\n padding: 3px 6px;\n border-radius: var(--curvature);\n font-size: 85%;\n margin: 0px 3px;\n }\n\n temba-loading {\n transform: scale(0);\n max-width: 0;\n opacity: 0;\n transition: transform 200ms ease-in-out;\n }\n\n .fetching temba-loading {\n transform: scale(1);\n max-width: 500px;\n opacity: 1;\n display: block;\n }\n\n .error {\n margin-top: 10px;\n }\n\n .match-count {\n padding: 4px;\n margin-top: 6px;\n }\n\n .linked {\n color: var(--color-link-primary);\n text-decoration: none;\n cursor: pointer;\n }\n\n .header td {\n border-bottom: 0px solid var(--color-borders);\n padding: 5px 3px;\n }\n\n .expanded .header td {\n border-bottom: 2px solid var(--color-borders);\n }\n\n td.field-header,\n tr.table-footer,\n tr.contact {\n display: none;\n }\n\n .expanded td.field-header {\n display: table-cell;\n }\n\n .expanded tr.contact,\n .expanded tr.table-footer {\n display: table-row;\n }\n\n .query {\n display: var(--contact-search-query-display);\n margin-bottom: 10px;\n }\n\n .results {\n display: none;\n }\n\n .summary {\n min-height: 2.2em;\n }\n\n .results.initialized {\n display: flex;\n align-items: center;\n margin-top: 0.5em;\n margin-left: 0.6em;\n }\n `;\n }\n\n // private cancelToken: CancelTokenSource;\n\n @property({ type: Boolean })\n fetching: boolean;\n\n @property({ type: Boolean })\n expanded: boolean;\n\n @property({ type: String })\n endpoint: string;\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: String })\n query = '';\n\n @property({ type: Number })\n inactiveThreshold = 1000;\n\n @property({ type: Number })\n inactiveDays = 90;\n\n @property({ type: Object, attribute: false })\n summary: SummaryResponse;\n\n @property({ type: Object, attribute: false })\n flow: any;\n\n private lastQuery: number;\n private initialized = false;\n\n private exclusions = {};\n\n public updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('query') || changedProperties.has('endpoint')) {\n this.fetching = !!this.query && !!this.endpoint;\n\n if (this.fetching) {\n this.initialized = true;\n // clear our summary on any change\n this.summary = null;\n if (this.lastQuery) {\n window.clearTimeout(this.lastQuery);\n }\n\n if (this.query.trim().length > 0) {\n this.lastQuery = window.setTimeout(() => {\n this.fetchSummary(this.query);\n }, QUEIT_MILLIS);\n }\n }\n }\n }\n\n public fetchSummary(query: string): any {\n if (this.endpoint) {\n postJSON(this.endpoint, {\n include: { query },\n exclude: this.exclusions,\n }).then((response: WebResponse) => {\n this.fetching = false;\n if (response.status === 200) {\n this.summary = response.json as SummaryResponse;\n this.value = this.summary.query;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n } else {\n this.errors = [];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n } else {\n this.summary = response.json as SummaryResponse;\n if (this.summary.error) {\n this.errors = [this.summary.error];\n }\n this.requestUpdate('errors');\n this.fireCustomEvent(CustomEventType.ContentChanged, this.summary);\n }\n });\n }\n }\n\n private handleQueryChange(evt: KeyboardEvent) {\n const input = evt.target as TextInput;\n this.query = input.inputElement.value;\n }\n\n private handleSlotChanged(evt: any) {\n if (evt.target.tagName === 'TEMBA-CHECKBOX') {\n const checkbox = evt.target as Checkbox;\n let value = checkbox.checked as any;\n\n if (!value) {\n delete this.exclusions[checkbox.name];\n } else {\n if (checkbox.name === 'not_seen_since_days') {\n value = 90;\n }\n\n this.exclusions[checkbox.name] = value;\n }\n }\n\n this.requestUpdate('query');\n }\n\n public render(): TemplateResult {\n let summary: TemplateResult;\n if (this.summary) {\n const fields = Object.keys(this.summary.fields || []).map(\n (uuid: string) => {\n return { uuid, ...this.summary.fields[uuid] };\n }\n );\n\n if (!this.summary.error) {\n const count = this.summary.total;\n const lastSeenOn = this.summary.query.indexOf('last_seen_on') > -1;\n\n summary = html`\n <table cellspacing=\"0\" cellpadding=\"0\">\n <tr class=\"header\">\n <td colspan=\"2\">\n Found\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(\n this.summary.query\n )}\"\n >\n ${count.toLocaleString()}\n </a>\n contact${count !== 1 ? 's' : ''}\n </td>\n ${fields.map(\n field => html` <td class=\"field-header\">${field.label}</td> `\n )}\n <td></td>\n <td class=\"field-header date\">\n ${lastSeenOn ? 'Last Seen' : 'Created'}\n </td>\n </tr>\n\n ${this.summary.sample.map(\n (contact: Contact) => html`\n <tr class=\"contact\">\n <td class=\"urn\">${(contact as any).primary_urn_formatted}</td>\n <td class=\"name\">${contact.name}</td>\n ${fields.map(\n field => html`\n <td class=\"field\">\n ${((contact as any).fields[field.uuid] || { text: '' })\n .text}\n </td>\n `\n )}\n <td></td>\n <td class=\"date\">\n ${lastSeenOn\n ? contact.last_seen_on || '--'\n : contact.created_on}\n </td>\n </tr>\n `\n )}\n ${this.summary.total > this.summary.sample.length\n ? html`<tr class=\"table-footer\">\n <td class=\"query-details\" colspan=${fields.length + 3}></td>\n <td class=\"more\">\n <a\n class=\"linked\"\n target=\"_\"\n href=\"/contact/?search=${encodeURIComponent(\n this.summary.query\n )}\"\n >more</a\n >\n </td>\n </tr>`\n : null}\n </table>\n `;\n }\n }\n\n return html`\n <div class=\"query\">\n <temba-textinput\n .label=${this.label}\n .helpText=${this.helpText}\n .widgetOnly=${this.widgetOnly}\n .errors=${this.errors}\n name=${this.name}\n .inputRoot=${this}\n @input=${this.handleQueryChange}\n placeholder=${this.placeholder}\n .value=${this.query}\n textarea\n autogrow\n >\n </temba-textinput>\n </div>\n\n <slot @change=${this.handleSlotChanged}></slot>\n\n <div\n class=\"results ${getClasses({\n fetching: this.fetching,\n initialized: this.initialized || this.fetching,\n })}\"\n >\n <temba-loading units=\"6\" size=\"8\"></temba-loading>\n <div class=\"summary ${this.expanded ? 'expanded' : ''}\">${summary}</div>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Remote.js","sourceRoot":"","sources":["../../../src/remote/Remote.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGjD,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,YAAY;IAAjC;;QAKb,SAAI,GAAQ,IAAI,CAAA,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"Remote.js","sourceRoot":"","sources":["../../../src/remote/Remote.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGjD,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,YAAY;IAAjC;;QAKb,SAAI,GAAQ,IAAI,CAAA,iCAAiC,CAAC;IAmBpD,CAAC;IAjBC,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA,EAAE,CAAC;IACf,CAAC;IAEM,OAAO,CAAC,OAAyB;QACtC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEvB,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC3B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACpC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;CACF,CAAA;AAtBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACV;AAGjB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oCACmB;AAL/B,MAAM;IAD1B,aAAa,CAAC,cAAc,CAAC;GACT,MAAM,CAwB1B;eAxBoB,MAAM","sourcesContent":["import { css, html, TemplateResult } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\nimport { RapidElement } from '../RapidElement';\nimport { getUrl } from '../utils';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\n\n@customElement('temba-remote')\nexport default class Remote extends RapidElement {\n @property({ type: String })\n endpoint: string;\n\n @property({ attribute: false })\n body: any = html`<temba-loading></temba-loading>`;\n\n static get styles() {\n return css``;\n }\n\n public updated(changes: Map<string, any>) {\n super.updated(changes);\n\n if (changes.has('endpoint')) {\n getUrl(this.endpoint).then(response => {\n this.body = unsafeHTML(response.body);\n });\n }\n }\n\n public render(): TemplateResult {\n return html`${this.body}`;\n }\n}\n"]}
|