@nyaruka/temba-components 0.159.6 → 0.160.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 CHANGED
@@ -4,8 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.160.1](https://github.com/nyaruka/temba-components/compare/v0.160.0...v0.160.1)
8
+
9
+ - Seed word-list category names from only the first word [`#1034`](https://github.com/nyaruka/temba-components/pull/1034)
10
+
11
+ #### [v0.160.0](https://github.com/nyaruka/temba-components/compare/v0.159.6...v0.160.0)
12
+
13
+ > 25 June 2026
14
+
7
15
  #### [v0.159.6](https://github.com/nyaruka/temba-components/compare/v0.159.5...v0.159.6)
8
16
 
17
+ > 25 June 2026
18
+
9
19
  - Promote a fully-translated language to a flow's default [`#1033`](https://github.com/nyaruka/temba-components/pull/1033)
10
20
  - Add label-create affordance to ContentList label dropdown [`#1031`](https://github.com/nyaruka/temba-components/pull/1031)
11
21
  - Fix empty contact fields tab from definition/data load race [`#1032`](https://github.com/nyaruka/temba-components/pull/1032)
@@ -41,7 +41,7 @@ const pt=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}
41
41
  * @license
42
42
  * Copyright 2017 Google LLC
43
43
  * SPDX-License-Identifier: BSD-3-Clause
44
- */var bt,yt,xt,wt,_t,kt,Ct,St,$t,At,Et,Tt,Dt,Mt,zt,It,Lt,Ot,Pt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Rt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Nt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},Bt="0123456789abcdef".split(""),Ft=[-2147483648,8388608,32768,128],qt=[24,16,8,0],Ut=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],jt=[];class Ht{constructor(t=!1,e=!1){bt.set(this,void 0),yt.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),_t.set(this,void 0),kt.set(this,void 0),Ct.set(this,void 0),St.set(this,void 0),$t.set(this,void 0),At.set(this,void 0),Et.set(this,void 0),Tt.set(this,void 0),Dt.set(this,void 0),Mt.set(this,void 0),zt.set(this,void 0),It.set(this,void 0),Lt.set(this,0),Ot.set(this,void 0),this.init(t,e)}init(t,e){e?(jt[0]=jt[16]=jt[1]=jt[2]=jt[3]=jt[4]=jt[5]=jt[6]=jt[7]=jt[8]=jt[9]=jt[10]=jt[11]=jt[12]=jt[13]=jt[14]=jt[15]=0,Pt(this,yt,jt)):Pt(this,yt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Pt(this,kt,3238371032),Pt(this,Ct,914150663),Pt(this,St,812702999),Pt(this,$t,4144912697),Pt(this,At,4290775857),Pt(this,Et,1750603025),Pt(this,Tt,1694076839),Pt(this,Dt,3204075428)):(Pt(this,kt,1779033703),Pt(this,Ct,3144134277),Pt(this,St,1013904242),Pt(this,$t,2773480762),Pt(this,At,1359893119),Pt(this,Et,2600822924),Pt(this,Tt,528734635),Pt(this,Dt,1541459225)),Pt(this,bt,Pt(this,Ot,Pt(this,xt,Pt(this,zt,0)))),Pt(this,wt,Pt(this,Mt,!1)),Pt(this,_t,!0),Pt(this,It,t)}update(t){if(Rt(this,wt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=Rt(this,yt);for(;i<o;){let t;if(Rt(this,Mt)&&(Pt(this,Mt,!1),n[0]=Rt(this,bt),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=Rt(this,Ot);i<o&&t<64;++i)n[t>>2]|=e[i]<<qt[3&t++];else for(t=Rt(this,Ot);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<qt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<qt[3&t++],n[t>>2]|=(128|o>>6&63)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<qt[3&t++],n[t>>2]|=(128|o>>12&63)<<qt[3&t++],n[t>>2]|=(128|o>>6&63)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++])}Pt(this,Lt,t),Pt(this,xt,Rt(this,xt)+(t-Rt(this,Ot))),t>=64?(Pt(this,bt,n[16]),Pt(this,Ot,t-64),this.hash(),Pt(this,Mt,!0)):Pt(this,Ot,t)}return Rt(this,xt)>4294967295&&(Pt(this,zt,Rt(this,zt)+(Rt(this,xt)/4294967296|0)),Pt(this,xt,Rt(this,xt)%4294967296)),this}finalize(){if(Rt(this,wt))return;Pt(this,wt,!0);const t=Rt(this,yt),e=Rt(this,Lt);t[16]=Rt(this,bt),t[e>>2]|=Ft[3&e],Pt(this,bt,t[16]),e>=56&&(Rt(this,Mt)||this.hash(),t[0]=Rt(this,bt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Rt(this,zt)<<3|Rt(this,xt)>>>29,t[15]=Rt(this,xt)<<3,this.hash()}hash(){let t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt);const l=Rt(this,yt);let d,c,h,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],d=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+d+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)Rt(this,_t)?(Rt(this,It)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Pt(this,_t,!1)):(d=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,h=g^t&i^b,m=n&s^~n&r,u=a+c+m+Ut[y]+l[y],p=d+h,a=o+u|0,o=u+p|0),d=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,h=f^o&e^g,m=a&n^~a&s,u=r+c+m+Ut[y+1]+l[y+1],p=d+h,r=i+u|0,i=u+p|0,d=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,h=v^i&t^f,m=r&a^~r&n,u=s+c+m+Ut[y+2]+l[y+2],p=d+h,s=e+u|0,e=u+p|0,d=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=e&i,h=b^e&o^v,m=s&r^~s&a,u=n+c+m+Ut[y+3]+l[y+3],p=d+h,n=t+u|0,t=u+p|0;Pt(this,kt,Rt(this,kt)+t|0),Pt(this,Ct,Rt(this,Ct)+e|0),Pt(this,St,Rt(this,St)+i|0),Pt(this,$t,Rt(this,$t)+o|0),Pt(this,At,Rt(this,At)+n|0),Pt(this,Et,Rt(this,Et)+s|0),Pt(this,Tt,Rt(this,Tt)+r|0),Pt(this,Dt,Rt(this,Dt)+a|0)}hex(){this.finalize();const t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt);let l=Bt[t>>28&15]+Bt[t>>24&15]+Bt[t>>20&15]+Bt[t>>16&15]+Bt[t>>12&15]+Bt[t>>8&15]+Bt[t>>4&15]+Bt[15&t]+Bt[e>>28&15]+Bt[e>>24&15]+Bt[e>>20&15]+Bt[e>>16&15]+Bt[e>>12&15]+Bt[e>>8&15]+Bt[e>>4&15]+Bt[15&e]+Bt[i>>28&15]+Bt[i>>24&15]+Bt[i>>20&15]+Bt[i>>16&15]+Bt[i>>12&15]+Bt[i>>8&15]+Bt[i>>4&15]+Bt[15&i]+Bt[o>>28&15]+Bt[o>>24&15]+Bt[o>>20&15]+Bt[o>>16&15]+Bt[o>>12&15]+Bt[o>>8&15]+Bt[o>>4&15]+Bt[15&o]+Bt[n>>28&15]+Bt[n>>24&15]+Bt[n>>20&15]+Bt[n>>16&15]+Bt[n>>12&15]+Bt[n>>8&15]+Bt[n>>4&15]+Bt[15&n]+Bt[s>>28&15]+Bt[s>>24&15]+Bt[s>>20&15]+Bt[s>>16&15]+Bt[s>>12&15]+Bt[s>>8&15]+Bt[s>>4&15]+Bt[15&s]+Bt[r>>28&15]+Bt[r>>24&15]+Bt[r>>20&15]+Bt[r>>16&15]+Bt[r>>12&15]+Bt[r>>8&15]+Bt[r>>4&15]+Bt[15&r];return Rt(this,It)||(l+=Bt[a>>28&15]+Bt[a>>24&15]+Bt[a>>20&15]+Bt[a>>16&15]+Bt[a>>12&15]+Bt[a>>8&15]+Bt[a>>4&15]+Bt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Rt(this,It)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Rt(this,It)?28:32),e=new DataView(t);return e.setUint32(0,Rt(this,kt)),e.setUint32(4,Rt(this,Ct)),e.setUint32(8,Rt(this,St)),e.setUint32(12,Rt(this,$t)),e.setUint32(16,Rt(this,At)),e.setUint32(20,Rt(this,Et)),e.setUint32(24,Rt(this,Tt)),Rt(this,It)||e.setUint32(28,Rt(this,Dt)),t}}function Wt(t){const e=new Ht;return e.update(t),parseInt(e.hex().substring(0,8),16)}bt=new WeakMap,yt=new WeakMap,xt=new WeakMap,wt=new WeakMap,_t=new WeakMap,kt=new WeakMap,Ct=new WeakMap,St=new WeakMap,$t=new WeakMap,At=new WeakMap,Et=new WeakMap,Tt=new WeakMap,Dt=new WeakMap,Mt=new WeakMap,zt=new WeakMap,It=new WeakMap,Lt=new WeakMap,Ot=new WeakMap;const Vt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)})};const Zt=[];for(let t=0;t<256;++t)Zt.push((t+256).toString(16).slice(1));function Yt(t,e=0){return(Zt[t[e+0]]+Zt[t[e+1]]+Zt[t[e+2]]+Zt[t[e+3]]+"-"+Zt[t[e+4]]+Zt[t[e+5]]+"-"+Zt[t[e+6]]+Zt[t[e+7]]+"-"+Zt[t[e+8]]+Zt[t[e+9]]+"-"+Zt[t[e+10]]+Zt[t[e+11]]+Zt[t[e+12]]+Zt[t[e+13]]+Zt[t[e+14]]+Zt[t[e+15]]).toLowerCase()}const Kt=new Uint8Array(16);function Gt(){return crypto.getRandomValues(Kt)}function Xt(t,e,i){return crypto.randomUUID?crypto.randomUUID():function(t){t=t||{};const e=t.random??t.rng?.()??Gt();if(e.length<16)throw new Error("Random bytes length must be >= 16");return e[6]=15&e[6]|64,e[8]=63&e[8]|128,Yt(e)}(t)}const Qt={};function Jt(t,e,i){let o;{const t=Date.now(),n=Gt();!function(t,e,i){t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=i[6]<<23|i[7]<<16|i[8]<<8|i[9],t.msecs=e):(t.seq=t.seq+1|0,0===t.seq&&t.msecs++)}(Qt,t,n),o=function(t,e,i,o,n=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(o){if(n<0||n+16>o.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else o=new Uint8Array(16),n=0;return e??=Date.now(),i??=127*t[6]<<24|t[7]<<16|t[8]<<8|t[9],o[n++]=e/1099511627776&255,o[n++]=e/4294967296&255,o[n++]=e/16777216&255,o[n++]=e/65536&255,o[n++]=e/256&255,o[n++]=255&e,o[n++]=112|i>>>28&15,o[n++]=i>>>20&255,o[n++]=128|i>>>14&63,o[n++]=i>>>6&255,o[n++]=i<<2&255|3&t[10],o[n++]=t[11],o[n++]=t[12],o[n++]=t[13],o[n++]=t[14],o[n++]=t[15],o}(n,Qt.msecs,Qt.seq,e,i)}return Yt(o)}const te=new Set(["Other","No Response"]),ee=new Set(["Other","All Responses","No Response","Failure","Success","Timeout"].map(t=>t.toLowerCase())),ie=new Set(["Other","All Responses","No Response","Timeout"].map(t=>t.toLowerCase())),oe=t=>(t||"").trim().toLowerCase(),ne=t=>ee.has(oe(t)),se=t=>ie.has(oe(t)),re=(t,e)=>oe(t)===oe(e),ae=(t,e)=>{const i=oe(e);return t.find(t=>oe(t.name)===i)},le=t=>{const e=new Set,i=[];for(const o of t){const t=(o||"").trim();if(!t)continue;if(!ne(t))continue;const n=t.toLowerCase();e.has(n)||(e.add(n),i.push(t))}return i},de=[{fieldName:"categories",getName:t=>null==t?void 0:t.name},{fieldName:"groups",getName:t=>null==t?void 0:t.name},{fieldName:"rules",getName:t=>null==t?void 0:t.category}],ce="/api/v2/media.json",he=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map(function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]});this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map(function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}}),this.hash=Wt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Nt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Vt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e}(this.rgb(t))}};var ue;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(ue||(ue={}));const pe=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},me=(t={})=>{var e;let i=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken");if(!i){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(i=t.value)}const o=i?{"X-CSRFToken":i}:{},n=null===(e=window.workspace)||void 0===e?void 0:e.uuid;return n&&(o["X-Temba-Workspace"]=n),o["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach(e=>{"X-Temba-Service-Org"===e&&delete o["X-Temba-Workspace"],o[e]=t[e]}),o},ge=(t,e=null,i={})=>new Promise((o,n)=>{const s={method:"GET",headers:me(i)};e&&(s.signal=e.signal),fetch(t,s).then(t=>{t.status<200||t.status>=300?n(t):t.text().then(i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})})}).catch(t=>{n(t)})}),fe=t=>{const e=[];Object.keys(t).forEach(i=>{t[i]&&e.push(i)});let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},ve=(t,e=null,i={})=>new Promise((o,n)=>{ge(t,e,i).then(t=>{o({results:t.json.results,next:t.json.next})}).catch(t=>n(t))}),be=async(t,e={})=>{if(!t)return new Promise(t=>t([]));let i=[],o=t;for(;o;){const t=await ve(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},ye=t=>new Promise((e,i)=>{ge(t).then(t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)}).catch(t=>i(t))}),xe=async t=>{if(!t)return new Promise(t=>t([]));let e=[],i=t;for(;i;){const t=await ye(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},we=(t,e,i={},o=null)=>{const n=me(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return new Promise((e,i)=>{fetch(t,s).then(async t=>{if(t.status>=500)return void i(t);const o=t.headers.get("X-Temba-Toasts");if(o){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(o))}t.text().then(i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})})}).catch(t=>{i(t)})})},_e=(t,e)=>we(t,JSON.stringify(e),!1,"application/json"),ke=(t,e,i={})=>new Promise((o,n)=>{we(t,e,i).then(e=>{e.status>=200&&e.status<400?o(e):n(t===ce?e:"Server failure")}).catch(t=>{n(t)})}),Ce=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:Ce(e):null}return null},Se=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout(function(){o=null,i||t.apply(s,n)},e),r&&t.apply(s,n)}},$e=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout(()=>{i=!0},e))}},Ae=(t,e,i="and")=>((t,e="and")=>{if(0===t.length)return"";if(1===t.length)return t[0];if(2===t.length)return"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" ");if("object"==typeof t[0])return t.map((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`);const i=t.slice(0,-1),o=t[t.length-1];return i.join(", ")+", "+e+" "+o})(t.map(e),i),Ee=(t,e,i="/")=>{const o=new Date;o.setTime(o.getTime()+2592e6),document.cookie=`${t}=${e};expires=${o.toUTCString()};path=${i}`},Te=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let o=0;o<i.length;o++){const n=i[o].trim();if(n.substring(0,t.length+1)==t+"="){e=decodeURIComponent(n.substring(t.length+1));break}}}return e},De=new WeakMap;function Me(t,e){let i=De.get(t);i||(i=new Map,De.set(t,i));let o=i.get(e);return o||(o=[],i.set(e,o)),o}function ze(t,e){return(void 0===e.defaultValue||typeof t==typeof e.defaultValue)&&(!("number"==typeof t&&!Number.isFinite(t))&&!(e.validate&&!e.validate(t)))}function Ie(t,e,i){return(o,n)=>{const s=String(n),r=null==i?void 0:i.validate;ft({type:"boolean"==typeof e?Boolean:"number"==typeof e?Number:String})(o,s);Me(o,t).push({propertyName:s,defaultValue:e,validate:r});const a=`__cookieHooked_${t}`;if(o[a])return;o[a]=!0;const l=o.connectedCallback;o.connectedCallback=function(){const e=Me(Object.getPrototypeOf(this),t);let i={};const o=Te(t);if(o)try{i=JSON.parse(o)}catch(t){}for(const t of e){const e=i[t.propertyName];void 0!==e&&ze(e,t)?this[t.propertyName]=e:void 0!==t.defaultValue&&(this[t.propertyName]=t.defaultValue)}l&&l.call(this)};const d=o.updated;o.updated=function(e){d&&d.call(this,e);const i=Me(Object.getPrototypeOf(this),t),o=i.some(t=>e.has(t.propertyName));if(!o)return;const n={};for(const t of i)n[t.propertyName]=this[t.propertyName];Ee(t,JSON.stringify(n))}}}var Le;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(Le||(Le={}));const Oe=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),Pe=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map(t=>t.substring(0,1)),o=i.filter((t,e)=>t==t.toUpperCase()||0==e);return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},Re=(t,e)=>{const i=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([0-9.]+))?\)/);if(i){let[t,o,n,s]=i.slice(1).map((t,e)=>e<3?parseInt(t):parseFloat(t));return t=Math.max(0,Math.floor(t*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),n=Math.max(0,Math.floor(n*(1-e))),void 0!==i[4]?`rgba(${t},${o},${n},${s})`:`rgb(${t},${o},${n})`}if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map(t=>t+t).join(""));const o=parseInt(i,16);let n=o>>16&255,s=o>>8&255,r=255&o;return n=Math.max(0,Math.floor(n*(1-e))),s=Math.max(0,Math.floor(s*(1-e))),r=Math.max(0,Math.floor(r*(1-e))),`rgb(${n},${s},${r})`}return t},Ne=(t,e)=>t.left+t.width/2-e.width/2,Be=(t,e)=>t.top+t.height/2-e.height/2,Fe=t=>{const{name:e,existingCategories:i,existingExits:o,existingCases:n,caseConfig:s}=t,r=ae(i,e),a=r?o.find(t=>t.uuid===r.exit_uuid):null,l=r&&n?n.find(t=>t.category_uuid===r.uuid):null,d=(null==r?void 0:r.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt(),u={category:{uuid:d,name:e,exit_uuid:c},exit:{uuid:c,destination_uuid:(null==a?void 0:a.destination_uuid)||null}};return s&&(u.case={uuid:h,type:s.type,arguments:s.arguments,category_uuid:d}),u},qe=(t,e,i=[],o=[],n=[])=>{const s=Fe({name:"Success",existingCategories:i,existingExits:o,existingCases:n,caseConfig:e}),r=Fe({name:"Failure",existingCategories:i,existingExits:o});return{router:{type:"switch",categories:[s.category,r.category],default_category_uuid:r.category.uuid,operand:t,cases:s.case?[s.case]:[]},exits:[s.exit,r.exit]}},Ue=(t,e)=>{const i=e.find(e=>e.uuid===t);return!!i&&se(i.name)},je=(t,e,i,o)=>{const n=e(t);if(!n)return"";if(0===n.operands)return n.categoryName||"";const s=(i||"").trim(),r=(o||"").trim(),a=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";switch(t){case"has_any_word":case"has_all_words":case"has_phrase":case"has_only_phrase":case"has_beginning":default:return s?a(s):"";case"has_pattern":return s;case"has_number_eq":return s?`= ${s}`:"";case"has_number_lt":return s?`< ${s}`:"";case"has_number_lte":return s?`≤ ${s}`:"";case"has_number_gt":return s?`> ${s}`:"";case"has_number_gte":return s?`≥ ${s}`:"";case"has_number_between":return s&&r?`${s} - ${r}`:"";case"has_date_lt":case"has_date_lte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`Before ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`Before ${s}`}return"";case"has_date_gt":case"has_date_gte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`After ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`After ${s}`}return"";case"has_date_eq":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`${e} ${i} ${o} ${"1"===o?"day":"days"}`}return s}return""}},He=(t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[],d=o.filter(t=>!se(t.name)),c=new Map;e.forEach((t,e)=>{const h=t.category.trim().toLowerCase(),u=t.category.trim();let p=c.get(h);if(!p){let t=d.find(t=>t.name.toLowerCase()===h);const e=Array.from(c.keys()).length;if(!t&&e<d.length){const i=d[e];i&&!Ue(i.uuid,o)&&(t=i)}const i=t?n.find(e=>e.uuid===t.exit_uuid):null;let s=(null==i?void 0:i.uuid)||Xt(),l=(null==t?void 0:t.uuid)||Xt();Ue(l,o)&&(l=Xt(),s=Xt()),p={uuid:l,name:u,exit_uuid:s},c.set(h,p),r.push({uuid:l,name:u,exit_uuid:s}),a.push({uuid:s,destination_uuid:(null==i?void 0:i.destination_uuid)||null})}let m=s[e];!m&&s.length>0&&(m=s.find(e=>{const i=o.find(t=>t.uuid===e.category_uuid);return e.type===t.operator&&(null==i?void 0:i.name.toLowerCase())===h}));const g=(null==m?void 0:m.uuid)||Xt(),f=i(t.operator);let v=[];v=f?0===f.operands?[]:2===f.operands?(t=>["string"==typeof(null==t?void 0:t.value1)?t.value1.trim():"","string"==typeof(null==t?void 0:t.value2)?t.value2.trim():""].filter(t=>""!==t))(t):t.value&&t.value.trim()?[t.value.trim()]:[]:t.value&&t.value.trim()?[t.value.trim()]:[],l.push({uuid:g,type:t.operator,arguments:v,category_uuid:p.uuid})});const h=e.length>0?"Other":"All Responses";let u=ae(o,h);if(!u){const t=e.length>0?"All Responses":"Other";u=ae(o,t)}const p=u?n.find(t=>t.uuid===u.exit_uuid):null,m=(null==p?void 0:p.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt();r.push({uuid:g,name:h,exit_uuid:m}),a.push({uuid:m,destination_uuid:(null==p?void 0:p.destination_uuid)||null});const f=r.find(t=>re(t.name,"Other")||re(t.name,"All Responses"));return{router:{type:"switch",categories:r,default_category_uuid:null==f?void 0:f.uuid,operand:t,cases:l},exits:a}},We=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Ve=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];pe(t.tagName,ue.PURPLE,[i?"<first-updated>":"<updated>",o])}},Ze=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&pe(t.tagName,ue.GREEN,void 0!==i?[e,i]:[e])};class Ye extends ht{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)):t.isWindow?window.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):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),Ve(this,t,!0)}updated(t){super.updated(t),Ve(this,t,!1)}getHeaders(){return this.service?{"X-Temba-Service-Org":this.service}:{}}fireEvent(t){return Ze(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&Ze(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 o=i.closest(t);return o||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)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}i([ft({type:String})],Ye.prototype,"service",void 0);
44
+ */var bt,yt,xt,wt,_t,kt,Ct,St,$t,At,Et,Tt,Dt,Mt,zt,It,Lt,Ot,Pt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Rt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Nt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},Bt="0123456789abcdef".split(""),Ft=[-2147483648,8388608,32768,128],qt=[24,16,8,0],Ut=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],jt=[];class Ht{constructor(t=!1,e=!1){bt.set(this,void 0),yt.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),_t.set(this,void 0),kt.set(this,void 0),Ct.set(this,void 0),St.set(this,void 0),$t.set(this,void 0),At.set(this,void 0),Et.set(this,void 0),Tt.set(this,void 0),Dt.set(this,void 0),Mt.set(this,void 0),zt.set(this,void 0),It.set(this,void 0),Lt.set(this,0),Ot.set(this,void 0),this.init(t,e)}init(t,e){e?(jt[0]=jt[16]=jt[1]=jt[2]=jt[3]=jt[4]=jt[5]=jt[6]=jt[7]=jt[8]=jt[9]=jt[10]=jt[11]=jt[12]=jt[13]=jt[14]=jt[15]=0,Pt(this,yt,jt)):Pt(this,yt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Pt(this,kt,3238371032),Pt(this,Ct,914150663),Pt(this,St,812702999),Pt(this,$t,4144912697),Pt(this,At,4290775857),Pt(this,Et,1750603025),Pt(this,Tt,1694076839),Pt(this,Dt,3204075428)):(Pt(this,kt,1779033703),Pt(this,Ct,3144134277),Pt(this,St,1013904242),Pt(this,$t,2773480762),Pt(this,At,1359893119),Pt(this,Et,2600822924),Pt(this,Tt,528734635),Pt(this,Dt,1541459225)),Pt(this,bt,Pt(this,Ot,Pt(this,xt,Pt(this,zt,0)))),Pt(this,wt,Pt(this,Mt,!1)),Pt(this,_t,!0),Pt(this,It,t)}update(t){if(Rt(this,wt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=Rt(this,yt);for(;i<o;){let t;if(Rt(this,Mt)&&(Pt(this,Mt,!1),n[0]=Rt(this,bt),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=Rt(this,Ot);i<o&&t<64;++i)n[t>>2]|=e[i]<<qt[3&t++];else for(t=Rt(this,Ot);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<qt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<qt[3&t++],n[t>>2]|=(128|o>>6&63)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<qt[3&t++],n[t>>2]|=(128|o>>12&63)<<qt[3&t++],n[t>>2]|=(128|o>>6&63)<<qt[3&t++],n[t>>2]|=(128|63&o)<<qt[3&t++])}Pt(this,Lt,t),Pt(this,xt,Rt(this,xt)+(t-Rt(this,Ot))),t>=64?(Pt(this,bt,n[16]),Pt(this,Ot,t-64),this.hash(),Pt(this,Mt,!0)):Pt(this,Ot,t)}return Rt(this,xt)>4294967295&&(Pt(this,zt,Rt(this,zt)+(Rt(this,xt)/4294967296|0)),Pt(this,xt,Rt(this,xt)%4294967296)),this}finalize(){if(Rt(this,wt))return;Pt(this,wt,!0);const t=Rt(this,yt),e=Rt(this,Lt);t[16]=Rt(this,bt),t[e>>2]|=Ft[3&e],Pt(this,bt,t[16]),e>=56&&(Rt(this,Mt)||this.hash(),t[0]=Rt(this,bt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Rt(this,zt)<<3|Rt(this,xt)>>>29,t[15]=Rt(this,xt)<<3,this.hash()}hash(){let t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt);const l=Rt(this,yt);let d,c,h,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],d=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+d+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)Rt(this,_t)?(Rt(this,It)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Pt(this,_t,!1)):(d=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,h=g^t&i^b,m=n&s^~n&r,u=a+c+m+Ut[y]+l[y],p=d+h,a=o+u|0,o=u+p|0),d=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,h=f^o&e^g,m=a&n^~a&s,u=r+c+m+Ut[y+1]+l[y+1],p=d+h,r=i+u|0,i=u+p|0,d=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,h=v^i&t^f,m=r&a^~r&n,u=s+c+m+Ut[y+2]+l[y+2],p=d+h,s=e+u|0,e=u+p|0,d=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=e&i,h=b^e&o^v,m=s&r^~s&a,u=n+c+m+Ut[y+3]+l[y+3],p=d+h,n=t+u|0,t=u+p|0;Pt(this,kt,Rt(this,kt)+t|0),Pt(this,Ct,Rt(this,Ct)+e|0),Pt(this,St,Rt(this,St)+i|0),Pt(this,$t,Rt(this,$t)+o|0),Pt(this,At,Rt(this,At)+n|0),Pt(this,Et,Rt(this,Et)+s|0),Pt(this,Tt,Rt(this,Tt)+r|0),Pt(this,Dt,Rt(this,Dt)+a|0)}hex(){this.finalize();const t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt);let l=Bt[t>>28&15]+Bt[t>>24&15]+Bt[t>>20&15]+Bt[t>>16&15]+Bt[t>>12&15]+Bt[t>>8&15]+Bt[t>>4&15]+Bt[15&t]+Bt[e>>28&15]+Bt[e>>24&15]+Bt[e>>20&15]+Bt[e>>16&15]+Bt[e>>12&15]+Bt[e>>8&15]+Bt[e>>4&15]+Bt[15&e]+Bt[i>>28&15]+Bt[i>>24&15]+Bt[i>>20&15]+Bt[i>>16&15]+Bt[i>>12&15]+Bt[i>>8&15]+Bt[i>>4&15]+Bt[15&i]+Bt[o>>28&15]+Bt[o>>24&15]+Bt[o>>20&15]+Bt[o>>16&15]+Bt[o>>12&15]+Bt[o>>8&15]+Bt[o>>4&15]+Bt[15&o]+Bt[n>>28&15]+Bt[n>>24&15]+Bt[n>>20&15]+Bt[n>>16&15]+Bt[n>>12&15]+Bt[n>>8&15]+Bt[n>>4&15]+Bt[15&n]+Bt[s>>28&15]+Bt[s>>24&15]+Bt[s>>20&15]+Bt[s>>16&15]+Bt[s>>12&15]+Bt[s>>8&15]+Bt[s>>4&15]+Bt[15&s]+Bt[r>>28&15]+Bt[r>>24&15]+Bt[r>>20&15]+Bt[r>>16&15]+Bt[r>>12&15]+Bt[r>>8&15]+Bt[r>>4&15]+Bt[15&r];return Rt(this,It)||(l+=Bt[a>>28&15]+Bt[a>>24&15]+Bt[a>>20&15]+Bt[a>>16&15]+Bt[a>>12&15]+Bt[a>>8&15]+Bt[a>>4&15]+Bt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Rt(this,kt),e=Rt(this,Ct),i=Rt(this,St),o=Rt(this,$t),n=Rt(this,At),s=Rt(this,Et),r=Rt(this,Tt),a=Rt(this,Dt),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Rt(this,It)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Rt(this,It)?28:32),e=new DataView(t);return e.setUint32(0,Rt(this,kt)),e.setUint32(4,Rt(this,Ct)),e.setUint32(8,Rt(this,St)),e.setUint32(12,Rt(this,$t)),e.setUint32(16,Rt(this,At)),e.setUint32(20,Rt(this,Et)),e.setUint32(24,Rt(this,Tt)),Rt(this,It)||e.setUint32(28,Rt(this,Dt)),t}}function Wt(t){const e=new Ht;return e.update(t),parseInt(e.hex().substring(0,8),16)}bt=new WeakMap,yt=new WeakMap,xt=new WeakMap,wt=new WeakMap,_t=new WeakMap,kt=new WeakMap,Ct=new WeakMap,St=new WeakMap,$t=new WeakMap,At=new WeakMap,Et=new WeakMap,Tt=new WeakMap,Dt=new WeakMap,Mt=new WeakMap,zt=new WeakMap,It=new WeakMap,Lt=new WeakMap,Ot=new WeakMap;const Vt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)})};const Zt=[];for(let t=0;t<256;++t)Zt.push((t+256).toString(16).slice(1));function Yt(t,e=0){return(Zt[t[e+0]]+Zt[t[e+1]]+Zt[t[e+2]]+Zt[t[e+3]]+"-"+Zt[t[e+4]]+Zt[t[e+5]]+"-"+Zt[t[e+6]]+Zt[t[e+7]]+"-"+Zt[t[e+8]]+Zt[t[e+9]]+"-"+Zt[t[e+10]]+Zt[t[e+11]]+Zt[t[e+12]]+Zt[t[e+13]]+Zt[t[e+14]]+Zt[t[e+15]]).toLowerCase()}const Kt=new Uint8Array(16);function Gt(){return crypto.getRandomValues(Kt)}function Xt(t,e,i){return crypto.randomUUID?crypto.randomUUID():function(t){t=t||{};const e=t.random??t.rng?.()??Gt();if(e.length<16)throw new Error("Random bytes length must be >= 16");return e[6]=15&e[6]|64,e[8]=63&e[8]|128,Yt(e)}(t)}const Qt={};function Jt(t,e,i){let o;{const t=Date.now(),n=Gt();!function(t,e,i){t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=i[6]<<23|i[7]<<16|i[8]<<8|i[9],t.msecs=e):(t.seq=t.seq+1|0,0===t.seq&&t.msecs++)}(Qt,t,n),o=function(t,e,i,o,n=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(o){if(n<0||n+16>o.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else o=new Uint8Array(16),n=0;return e??=Date.now(),i??=127*t[6]<<24|t[7]<<16|t[8]<<8|t[9],o[n++]=e/1099511627776&255,o[n++]=e/4294967296&255,o[n++]=e/16777216&255,o[n++]=e/65536&255,o[n++]=e/256&255,o[n++]=255&e,o[n++]=112|i>>>28&15,o[n++]=i>>>20&255,o[n++]=128|i>>>14&63,o[n++]=i>>>6&255,o[n++]=i<<2&255|3&t[10],o[n++]=t[11],o[n++]=t[12],o[n++]=t[13],o[n++]=t[14],o[n++]=t[15],o}(n,Qt.msecs,Qt.seq,e,i)}return Yt(o)}const te=new Set(["Other","No Response"]),ee=new Set(["Other","All Responses","No Response","Failure","Success","Timeout"].map(t=>t.toLowerCase())),ie=new Set(["Other","All Responses","No Response","Timeout"].map(t=>t.toLowerCase())),oe=t=>(t||"").trim().toLowerCase(),ne=t=>ee.has(oe(t)),se=t=>ie.has(oe(t)),re=(t,e)=>oe(t)===oe(e),ae=(t,e)=>{const i=oe(e);return t.find(t=>oe(t.name)===i)},le=t=>{const e=new Set,i=[];for(const o of t){const t=(o||"").trim();if(!t)continue;if(!ne(t))continue;const n=t.toLowerCase();e.has(n)||(e.add(n),i.push(t))}return i},de=[{fieldName:"categories",getName:t=>null==t?void 0:t.name},{fieldName:"groups",getName:t=>null==t?void 0:t.name},{fieldName:"rules",getName:t=>null==t?void 0:t.category}],ce="/api/v2/media.json",he=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map(function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]});this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map(function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}}),this.hash=Wt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Nt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Vt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e}(this.rgb(t))}};var ue;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(ue||(ue={}));const pe=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},me=(t={})=>{var e;let i=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken");if(!i){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(i=t.value)}const o=i?{"X-CSRFToken":i}:{},n=null===(e=window.workspace)||void 0===e?void 0:e.uuid;return n&&(o["X-Temba-Workspace"]=n),o["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach(e=>{"X-Temba-Service-Org"===e&&delete o["X-Temba-Workspace"],o[e]=t[e]}),o},ge=(t,e=null,i={})=>new Promise((o,n)=>{const s={method:"GET",headers:me(i)};e&&(s.signal=e.signal),fetch(t,s).then(t=>{t.status<200||t.status>=300?n(t):t.text().then(i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})})}).catch(t=>{n(t)})}),fe=t=>{const e=[];Object.keys(t).forEach(i=>{t[i]&&e.push(i)});let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},ve=(t,e=null,i={})=>new Promise((o,n)=>{ge(t,e,i).then(t=>{o({results:t.json.results,next:t.json.next})}).catch(t=>n(t))}),be=async(t,e={})=>{if(!t)return new Promise(t=>t([]));let i=[],o=t;for(;o;){const t=await ve(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},ye=t=>new Promise((e,i)=>{ge(t).then(t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)}).catch(t=>i(t))}),xe=async t=>{if(!t)return new Promise(t=>t([]));let e=[],i=t;for(;i;){const t=await ye(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},we=(t,e,i={},o=null)=>{const n=me(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return new Promise((e,i)=>{fetch(t,s).then(async t=>{if(t.status>=500)return void i(t);const o=t.headers.get("X-Temba-Toasts");if(o){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(o))}t.text().then(i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})})}).catch(t=>{i(t)})})},_e=(t,e)=>we(t,JSON.stringify(e),!1,"application/json"),ke=(t,e,i={})=>new Promise((o,n)=>{we(t,e,i).then(e=>{e.status>=200&&e.status<400?o(e):n(t===ce?e:"Server failure")}).catch(t=>{n(t)})}),Ce=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:Ce(e):null}return null},Se=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout(function(){o=null,i||t.apply(s,n)},e),r&&t.apply(s,n)}},$e=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout(()=>{i=!0},e))}},Ae=(t,e,i="and")=>((t,e="and")=>{if(0===t.length)return"";if(1===t.length)return t[0];if(2===t.length)return"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" ");if("object"==typeof t[0])return t.map((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`);const i=t.slice(0,-1),o=t[t.length-1];return i.join(", ")+", "+e+" "+o})(t.map(e),i),Ee=(t,e,i="/")=>{const o=new Date;o.setTime(o.getTime()+2592e6),document.cookie=`${t}=${e};expires=${o.toUTCString()};path=${i}`},Te=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let o=0;o<i.length;o++){const n=i[o].trim();if(n.substring(0,t.length+1)==t+"="){e=decodeURIComponent(n.substring(t.length+1));break}}}return e},De=new WeakMap;function Me(t,e){let i=De.get(t);i||(i=new Map,De.set(t,i));let o=i.get(e);return o||(o=[],i.set(e,o)),o}function ze(t,e){return(void 0===e.defaultValue||typeof t==typeof e.defaultValue)&&(!("number"==typeof t&&!Number.isFinite(t))&&!(e.validate&&!e.validate(t)))}function Ie(t,e,i){return(o,n)=>{const s=String(n),r=null==i?void 0:i.validate;ft({type:"boolean"==typeof e?Boolean:"number"==typeof e?Number:String})(o,s);Me(o,t).push({propertyName:s,defaultValue:e,validate:r});const a=`__cookieHooked_${t}`;if(o[a])return;o[a]=!0;const l=o.connectedCallback;o.connectedCallback=function(){const e=Me(Object.getPrototypeOf(this),t);let i={};const o=Te(t);if(o)try{i=JSON.parse(o)}catch(t){}for(const t of e){const e=i[t.propertyName];void 0!==e&&ze(e,t)?this[t.propertyName]=e:void 0!==t.defaultValue&&(this[t.propertyName]=t.defaultValue)}l&&l.call(this)};const d=o.updated;o.updated=function(e){d&&d.call(this,e);const i=Me(Object.getPrototypeOf(this),t),o=i.some(t=>e.has(t.propertyName));if(!o)return;const n={};for(const t of i)n[t.propertyName]=this[t.propertyName];Ee(t,JSON.stringify(n))}}}var Le;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(Le||(Le={}));const Oe=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),Pe=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map(t=>t.substring(0,1)),o=i.filter((t,e)=>t==t.toUpperCase()||0==e);return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},Re=(t,e)=>{const i=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([0-9.]+))?\)/);if(i){let[t,o,n,s]=i.slice(1).map((t,e)=>e<3?parseInt(t):parseFloat(t));return t=Math.max(0,Math.floor(t*(1-e))),o=Math.max(0,Math.floor(o*(1-e))),n=Math.max(0,Math.floor(n*(1-e))),void 0!==i[4]?`rgba(${t},${o},${n},${s})`:`rgb(${t},${o},${n})`}if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map(t=>t+t).join(""));const o=parseInt(i,16);let n=o>>16&255,s=o>>8&255,r=255&o;return n=Math.max(0,Math.floor(n*(1-e))),s=Math.max(0,Math.floor(s*(1-e))),r=Math.max(0,Math.floor(r*(1-e))),`rgb(${n},${s},${r})`}return t},Ne=(t,e)=>t.left+t.width/2-e.width/2,Be=(t,e)=>t.top+t.height/2-e.height/2,Fe=t=>{const{name:e,existingCategories:i,existingExits:o,existingCases:n,caseConfig:s}=t,r=ae(i,e),a=r?o.find(t=>t.uuid===r.exit_uuid):null,l=r&&n?n.find(t=>t.category_uuid===r.uuid):null,d=(null==r?void 0:r.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt(),h=(null==l?void 0:l.uuid)||Xt(),u={category:{uuid:d,name:e,exit_uuid:c},exit:{uuid:c,destination_uuid:(null==a?void 0:a.destination_uuid)||null}};return s&&(u.case={uuid:h,type:s.type,arguments:s.arguments,category_uuid:d}),u},qe=(t,e,i=[],o=[],n=[])=>{const s=Fe({name:"Success",existingCategories:i,existingExits:o,existingCases:n,caseConfig:e}),r=Fe({name:"Failure",existingCategories:i,existingExits:o});return{router:{type:"switch",categories:[s.category,r.category],default_category_uuid:r.category.uuid,operand:t,cases:s.case?[s.case]:[]},exits:[s.exit,r.exit]}},Ue=(t,e)=>{const i=e.find(e=>e.uuid===t);return!!i&&se(i.name)},je=(t,e,i,o)=>{const n=e(t);if(!n)return"";if(0===n.operands)return n.categoryName||"";const s=(i||"").trim(),r=(o||"").trim(),a=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"";switch(t){case"has_any_word":case"has_all_words":{const t=s.split(/\s+/)[0].replace(/[^\p{L}\p{N}]+$/u,"");return t?a(t):""}case"has_phrase":case"has_only_phrase":case"has_beginning":default:return s?a(s):"";case"has_pattern":return s;case"has_number_eq":return s?`= ${s}`:"";case"has_number_lt":return s?`< ${s}`:"";case"has_number_lte":return s?`≤ ${s}`:"";case"has_number_gt":return s?`> ${s}`:"";case"has_number_gte":return s?`≥ ${s}`:"";case"has_number_between":return s&&r?`${s} - ${r}`:"";case"has_date_lt":case"has_date_lte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`Before ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`Before ${s}`}return"";case"has_date_gt":case"has_date_gte":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`After ${e} ${i} ${o} ${"1"===o?"day":"days"}`}return`After ${s}`}return"";case"has_date_eq":if(s){const t=s.match(/^(today)\s*([+-])\s*(\d+)$/i);if(t){const[,e,i,o]=t;return`${e} ${i} ${o} ${"1"===o?"day":"days"}`}return s}return""}},He=(t,e,i,o=[],n=[],s=[])=>{const r=[],a=[],l=[],d=o.filter(t=>!se(t.name)),c=new Map;e.forEach((t,e)=>{const h=t.category.trim().toLowerCase(),u=t.category.trim();let p=c.get(h);if(!p){let t=d.find(t=>t.name.toLowerCase()===h);const e=Array.from(c.keys()).length;if(!t&&e<d.length){const i=d[e];i&&!Ue(i.uuid,o)&&(t=i)}const i=t?n.find(e=>e.uuid===t.exit_uuid):null;let s=(null==i?void 0:i.uuid)||Xt(),l=(null==t?void 0:t.uuid)||Xt();Ue(l,o)&&(l=Xt(),s=Xt()),p={uuid:l,name:u,exit_uuid:s},c.set(h,p),r.push({uuid:l,name:u,exit_uuid:s}),a.push({uuid:s,destination_uuid:(null==i?void 0:i.destination_uuid)||null})}let m=s[e];!m&&s.length>0&&(m=s.find(e=>{const i=o.find(t=>t.uuid===e.category_uuid);return e.type===t.operator&&(null==i?void 0:i.name.toLowerCase())===h}));const g=(null==m?void 0:m.uuid)||Xt(),f=i(t.operator);let v=[];v=f?0===f.operands?[]:2===f.operands?(t=>["string"==typeof(null==t?void 0:t.value1)?t.value1.trim():"","string"==typeof(null==t?void 0:t.value2)?t.value2.trim():""].filter(t=>""!==t))(t):t.value&&t.value.trim()?[t.value.trim()]:[]:t.value&&t.value.trim()?[t.value.trim()]:[],l.push({uuid:g,type:t.operator,arguments:v,category_uuid:p.uuid})});const h=e.length>0?"Other":"All Responses";let u=ae(o,h);if(!u){const t=e.length>0?"All Responses":"Other";u=ae(o,t)}const p=u?n.find(t=>t.uuid===u.exit_uuid):null,m=(null==p?void 0:p.uuid)||Xt(),g=(null==u?void 0:u.uuid)||Xt();r.push({uuid:g,name:h,exit_uuid:m}),a.push({uuid:m,destination_uuid:(null==p?void 0:p.destination_uuid)||null});const f=r.find(t=>re(t.name,"Other")||re(t.name,"All Responses"));return{router:{type:"switch",categories:r,default_category_uuid:null==f?void 0:f.uuid,operand:t,cases:l},exits:a}},We=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Ve=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];pe(t.tagName,ue.PURPLE,[i?"<first-updated>":"<updated>",o])}},Ze=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&pe(t.tagName,ue.GREEN,void 0!==i?[e,i]:[e])};class Ye extends ht{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)):t.isWindow?window.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):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),Ve(this,t,!0)}updated(t){super.updated(t),Ve(this,t,!1)}getHeaders(){return this.service?{"X-Temba-Service-Org":this.service}:{}}fireEvent(t){return Ze(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&Ze(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 o=i.closest(t);return o||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)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}i([ft({type:String})],Ye.prototype,"service",void 0);
45
45
  /**
46
46
  * @license
47
47
  * Copyright 2017 Google LLC
@@ -11124,7 +11124,7 @@ background: #ccc;
11124
11124
  ${this.renderUploader()}
11125
11125
  </div>
11126
11126
  </div>
11127
- </div>`}}i([ft({type:String,attribute:!1})],Vu.prototype,"endpoint",void 0),i([ft({type:Boolean})],Vu.prototype,"pendingDrop",void 0),i([ft({type:Boolean})],Vu.prototype,"ignoreDrops",void 0),i([ft({type:String})],Vu.prototype,"icon",void 0),i([ft({type:String})],Vu.prototype,"accept",void 0),i([ft({type:Number})],Vu.prototype,"max",void 0),i([ft({type:Array})],Vu.prototype,"attachments",void 0),i([ft({type:Boolean,attribute:!1})],Vu.prototype,"uploading",void 0);let Zu="dev";try{Zu="0.159.6"}catch(t){}const Yu=Zu,Ku=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"locations"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"locations"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"locations"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"},{type:"has_pattern",name:"matches regex",operands:1}],Gu=t=>Ku.filter(e=>"hidden"!==e.visibility&&(!e.filter||!!t&&t.includes(e.filter))),Xu=new Set(["has_beginning","has_number","has_number_between","has_number_lt","has_number_lte","has_number_eq","has_number_gte","has_number_gt","has_pattern"]),Qu=t=>Ku.find(e=>e.type===t),Ju=t=>t.map(t=>({value:t.type,name:t.name})),tp={type:"text",required:!1,maxLength:64,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"},ep={type:"checkbox",label:"Require rules to be localized",helpText:"Each language must specify its own rules for this node"},ip={type:"checkbox",label:"Require categories to be localized",helpText:t=>{var e;const i=null===(e=t.result_name)||void 0===e?void 0:e.trim();if(i){return`Only enable if you plan to use @results.${i.toLowerCase().replace(/\s+/g,"_")}.category_localized`}return"Only enable if you plan to use category_localized in your expressions for this result"},conditions:{visible:t=>!!t.result_name}},op={label:"Save Result",localizable:!1,items:["result_name"],collapsed:t=>!(t._isNew&&t.result_name),getValueCount:t=>!!t.result_name},np={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeRules","localizeCategories"],collapsed:!0,getValueCount:t=>!(!t.localizeRules&&!t.localizeCategories)}]},sp={type:"accordion",multi:!0,sections:[op]},rp={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeCategories"],collapsed:!0,getValueCount:t=>!!t.localizeCategories}]};function ap(t,e){var i,o;const n=(null===(i=t.router)||void 0===i?void 0:i.categories)||[],s={};n.forEach(t=>{const i=t.uuid,o=e[i];s[i]={originalName:t.name,localizedName:o&&o.name?Array.isArray(o.name)?o.name[0]||"":o.name:""}});const r=(null===(o=t.router)||void 0===o?void 0:o.cases)||[],a={};return r.forEach(t=>{var i,o;if(!(null===(i=t.arguments)||void 0===i?void 0:i.length)||!t.arguments.some(t=>t))return;const n=e[t.uuid],s=(null===(o=Qu(t.type))||void 0===o?void 0:o.name)||t.type;a[t.uuid]={operatorName:s,originalArguments:[...t.arguments],localizedArguments:(null==n?void 0:n.arguments)?[...n.arguments]:t.arguments.map(()=>"")}}),{categories:s,rules:a}}function lp(t,e){const i={};return t.categories&&Object.keys(t.categories).forEach(e=>{var o,n;const s=t.categories[e],r=(null===(o=s.localizedName)||void 0===o?void 0:o.trim())||"",a=(null===(n=s.originalName)||void 0===n?void 0:n.trim())||"";r&&r!==a&&(i[e]={name:[r]})}),t.rules&&Object.keys(t.rules).forEach(e=>{const o=t.rules[e],n=o.localizedArguments||[],s=o.originalArguments||[],r=n.some((t,e)=>(null==t?void 0:t.trim())&&t.trim()!==(s[e]||""));r&&(i[e]={arguments:n.map(t=>(null==t?void 0:t.trim())||"")})}),i}function dp(t,e,i,o=[]){const n=[],s=[],r=[];return t.forEach(t=>{const a=ae(e,t.name),l=a?i.find(t=>t.uuid===a.exit_uuid):null,d=(null==l?void 0:l.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt();if(n.push({uuid:c,name:t.name,exit_uuid:d}),s.push({uuid:d,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),t.case){const e=t.case.arguments[0],i=o.find(t=>{var i;return(null===(i=t.arguments)||void 0===i?void 0:i[0])===e});r.push({uuid:(null==i?void 0:i.uuid)||Xt(),type:t.case.type,arguments:t.case.arguments,category_uuid:c})}}),{categories:n,exits:s,cases:r}}function cp(t,e,i,o,n){const s=n.some(t=>re(t,"Other"))?null:ae(i,"Other"),r=s?o.find(t=>t.uuid===s.exit_uuid):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();return t.push({uuid:l,name:"Other",exit_uuid:a}),e.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null}),l}function hp(t){return e=>{const i={};return t(e,i),{valid:0===Object.keys(i).length,errors:i}}}function up(t){return t.toLocalizationFormData?t.toLocalizationFormData:"categories"===t.localizable?ap:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={uuid:t.uuid};return e.forEach(t=>{const e=i[t];o[t]=Array.isArray(e)&&e[0]||""}),o}):void 0;var e}function pp(t){return t.fromLocalizationFormData?t.fromLocalizationFormData:"categories"===t.localizable?lp:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={};return e.forEach(e=>{const n=t[e];n&&""!==n.trim()&&n!==i[e]&&(o[e]=[n])}),o}):void 0;var e}const mp="undefined"!=typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);function gp(t){return 0!==t.button||!(!mp||!t.ctrlKey)}function fp(t){if(t.dependency){const e=t.dependency.name||t.dependency.key;return`Cannot find a ${t.dependency.type} for ${e}`}return t.description}function vp(t){const e=20*Math.round(t/20);return Math.max(e,0)}const bp="font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;font-size:0.95em",yp={[sc.ExpressionPrefix]:`color:${Sc.expression};font-weight:600;${bp}`,[sc.Identifier]:`color:${Sc.expression};${bp}`,[sc.FunctionName]:`color:${Sc.fn};font-weight:900;${bp}`,[sc.StringLiteral]:`color:${Sc.string};${bp}`,[sc.NumberLiteral]:`color:${Sc.number};${bp}`,[sc.Keyword]:`color:${Sc.keyword};${bp}`,[sc.Operator]:`color:${Sc.operator};${bp}`,[sc.ContextRef]:`color:${Sc.expression};${bp}`,[sc.Separator]:`color:${Sc.operator};${bp}`,[sc.Arrow]:`color:${Sc.operator};${bp}`,[sc.Bracket]:`color:${Sc.operator};${bp}`,[sc.Paren]:`color:${Sc.paren};${bp}`,[sc.Whitespace]:bp},xp=[[/claude|anthropic/i,"anthropic"],[/gpt|openai|o1|o3|o4/i,"openai"],[/gemini|google/i,"gemini"],[/azure|microsoft/i,"azure"],[/deepseek/i,"deepseek"]],wp=(t,e=!1)=>{const i=hc(t||"",e?Xd:Gd),o=[];for(const t of i){const e=!!yp[t.type],i=o[o.length-1];i&&i.isExpr===e?i.tokens.push(t):o.push({isExpr:e,tokens:[t]})}const n=t=>{const e=yp[t.type];if(!e){const e=t.text.split("\n");return Z`${e.map((t,e)=>Z`${e>0?Z`<br />`:null}${t}`)}`}const i=t.text.split("\n");return Z`${i.map((t,i)=>Z`${i>0?Z`<br />`:null}${t?Z`<span style="${e}">${t}</span>`:null}`)}`};return Z`${o.map(t=>{const e=Z`${t.tokens.map(n)}`;return t.isExpr?Z`<span style="hyphens:none">${e}</span>`:e})}`},_p=(t,e,i=3)=>Z`<div
11127
+ </div>`}}i([ft({type:String,attribute:!1})],Vu.prototype,"endpoint",void 0),i([ft({type:Boolean})],Vu.prototype,"pendingDrop",void 0),i([ft({type:Boolean})],Vu.prototype,"ignoreDrops",void 0),i([ft({type:String})],Vu.prototype,"icon",void 0),i([ft({type:String})],Vu.prototype,"accept",void 0),i([ft({type:Number})],Vu.prototype,"max",void 0),i([ft({type:Array})],Vu.prototype,"attachments",void 0),i([ft({type:Boolean,attribute:!1})],Vu.prototype,"uploading",void 0);let Zu="dev";try{Zu="0.160.1"}catch(t){}const Yu=Zu,Ku=[{type:"has_any_word",name:"has any of the words",operands:1},{type:"has_all_words",name:"has all of the words",operands:1},{type:"has_phrase",name:"has the phrase",operands:1},{type:"has_only_phrase",name:"has only the phrase",operands:1},{type:"has_beginning",name:"starts with",operands:1},{type:"has_text",name:"has some text",operands:0,categoryName:"Has Text"},{type:"has_number",name:"has a number",operands:0,categoryName:"Has Number"},{type:"has_number_between",name:"has a number between",operands:2},{type:"has_number_lt",name:"has a number below",operands:1},{type:"has_number_lte",name:"has a number at or below",operands:1},{type:"has_number_eq",name:"has a number equal to",operands:1},{type:"has_number_gte",name:"has a number at or above",operands:1},{type:"has_number_gt",name:"has a number above",operands:1},{type:"has_date",name:"has a date",operands:0,categoryName:"Has Date"},{type:"has_date_lt",name:"has a date before",operands:1},{type:"has_date_eq",name:"has a date equal to",operands:1},{type:"has_date_gt",name:"has a date after",operands:1},{type:"has_time",name:"has a time",operands:0,categoryName:"Has Time"},{type:"has_phone",name:"has a phone number",operands:0,categoryName:"Has Phone"},{type:"has_email",name:"has an email",operands:0,categoryName:"Has Email"},{type:"has_state",name:"has state",operands:0,categoryName:"Has State",filter:"locations"},{type:"has_district",name:"has district",operands:1,categoryName:"Has District",filter:"locations"},{type:"has_ward",name:"has ward",operands:2,categoryName:"Has Ward",filter:"locations"},{type:"has_group",name:"is in the group",operands:1,visibility:"hidden"},{type:"has_category",name:"has the category",operands:0,visibility:"hidden"},{type:"has_error",name:"has an error",operands:0,categoryName:"Has Error",visibility:"hidden"},{type:"has_value",name:"is not empty",operands:0,categoryName:"Not Empty",visibility:"hidden"},{type:"has_pattern",name:"matches regex",operands:1}],Gu=t=>Ku.filter(e=>"hidden"!==e.visibility&&(!e.filter||!!t&&t.includes(e.filter))),Xu=new Set(["has_beginning","has_number","has_number_between","has_number_lt","has_number_lte","has_number_eq","has_number_gte","has_number_gt","has_pattern"]),Qu=t=>Ku.find(e=>e.type===t),Ju=t=>t.map(t=>({value:t.type,name:t.name})),tp={type:"text",required:!1,maxLength:64,placeholder:"(optional)",helpText:"The name to use to reference this result in the flow"},ep={type:"checkbox",label:"Require rules to be localized",helpText:"Each language must specify its own rules for this node"},ip={type:"checkbox",label:"Require categories to be localized",helpText:t=>{var e;const i=null===(e=t.result_name)||void 0===e?void 0:e.trim();if(i){return`Only enable if you plan to use @results.${i.toLowerCase().replace(/\s+/g,"_")}.category_localized`}return"Only enable if you plan to use category_localized in your expressions for this result"},conditions:{visible:t=>!!t.result_name}},op={label:"Save Result",localizable:!1,items:["result_name"],collapsed:t=>!(t._isNew&&t.result_name),getValueCount:t=>!!t.result_name},np={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeRules","localizeCategories"],collapsed:!0,getValueCount:t=>!(!t.localizeRules&&!t.localizeCategories)}]},sp={type:"accordion",multi:!0,sections:[op]},rp={type:"accordion",multi:!0,sections:[op,{label:"Localization",localizable:!1,items:["localizeCategories"],collapsed:!0,getValueCount:t=>!!t.localizeCategories}]};function ap(t,e){var i,o;const n=(null===(i=t.router)||void 0===i?void 0:i.categories)||[],s={};n.forEach(t=>{const i=t.uuid,o=e[i];s[i]={originalName:t.name,localizedName:o&&o.name?Array.isArray(o.name)?o.name[0]||"":o.name:""}});const r=(null===(o=t.router)||void 0===o?void 0:o.cases)||[],a={};return r.forEach(t=>{var i,o;if(!(null===(i=t.arguments)||void 0===i?void 0:i.length)||!t.arguments.some(t=>t))return;const n=e[t.uuid],s=(null===(o=Qu(t.type))||void 0===o?void 0:o.name)||t.type;a[t.uuid]={operatorName:s,originalArguments:[...t.arguments],localizedArguments:(null==n?void 0:n.arguments)?[...n.arguments]:t.arguments.map(()=>"")}}),{categories:s,rules:a}}function lp(t,e){const i={};return t.categories&&Object.keys(t.categories).forEach(e=>{var o,n;const s=t.categories[e],r=(null===(o=s.localizedName)||void 0===o?void 0:o.trim())||"",a=(null===(n=s.originalName)||void 0===n?void 0:n.trim())||"";r&&r!==a&&(i[e]={name:[r]})}),t.rules&&Object.keys(t.rules).forEach(e=>{const o=t.rules[e],n=o.localizedArguments||[],s=o.originalArguments||[],r=n.some((t,e)=>(null==t?void 0:t.trim())&&t.trim()!==(s[e]||""));r&&(i[e]={arguments:n.map(t=>(null==t?void 0:t.trim())||"")})}),i}function dp(t,e,i,o=[]){const n=[],s=[],r=[];return t.forEach(t=>{const a=ae(e,t.name),l=a?i.find(t=>t.uuid===a.exit_uuid):null,d=(null==l?void 0:l.uuid)||Xt(),c=(null==a?void 0:a.uuid)||Xt();if(n.push({uuid:c,name:t.name,exit_uuid:d}),s.push({uuid:d,destination_uuid:(null==l?void 0:l.destination_uuid)||null}),t.case){const e=t.case.arguments[0],i=o.find(t=>{var i;return(null===(i=t.arguments)||void 0===i?void 0:i[0])===e});r.push({uuid:(null==i?void 0:i.uuid)||Xt(),type:t.case.type,arguments:t.case.arguments,category_uuid:c})}}),{categories:n,exits:s,cases:r}}function cp(t,e,i,o,n){const s=n.some(t=>re(t,"Other"))?null:ae(i,"Other"),r=s?o.find(t=>t.uuid===s.exit_uuid):null,a=(null==r?void 0:r.uuid)||Xt(),l=(null==s?void 0:s.uuid)||Xt();return t.push({uuid:l,name:"Other",exit_uuid:a}),e.push({uuid:a,destination_uuid:(null==r?void 0:r.destination_uuid)||null}),l}function hp(t){return e=>{const i={};return t(e,i),{valid:0===Object.keys(i).length,errors:i}}}function up(t){return t.toLocalizationFormData?t.toLocalizationFormData:"categories"===t.localizable?ap:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={uuid:t.uuid};return e.forEach(t=>{const e=i[t];o[t]=Array.isArray(e)&&e[0]||""}),o}):void 0;var e}function pp(t){return t.fromLocalizationFormData?t.fromLocalizationFormData:"categories"===t.localizable?lp:Array.isArray(t.localizable)?(e=t.localizable,(t,i)=>{const o={};return e.forEach(e=>{const n=t[e];n&&""!==n.trim()&&n!==i[e]&&(o[e]=[n])}),o}):void 0;var e}const mp="undefined"!=typeof navigator&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);function gp(t){return 0!==t.button||!(!mp||!t.ctrlKey)}function fp(t){if(t.dependency){const e=t.dependency.name||t.dependency.key;return`Cannot find a ${t.dependency.type} for ${e}`}return t.description}function vp(t){const e=20*Math.round(t/20);return Math.max(e,0)}const bp="font-family:SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;font-size:0.95em",yp={[sc.ExpressionPrefix]:`color:${Sc.expression};font-weight:600;${bp}`,[sc.Identifier]:`color:${Sc.expression};${bp}`,[sc.FunctionName]:`color:${Sc.fn};font-weight:900;${bp}`,[sc.StringLiteral]:`color:${Sc.string};${bp}`,[sc.NumberLiteral]:`color:${Sc.number};${bp}`,[sc.Keyword]:`color:${Sc.keyword};${bp}`,[sc.Operator]:`color:${Sc.operator};${bp}`,[sc.ContextRef]:`color:${Sc.expression};${bp}`,[sc.Separator]:`color:${Sc.operator};${bp}`,[sc.Arrow]:`color:${Sc.operator};${bp}`,[sc.Bracket]:`color:${Sc.operator};${bp}`,[sc.Paren]:`color:${Sc.paren};${bp}`,[sc.Whitespace]:bp},xp=[[/claude|anthropic/i,"anthropic"],[/gpt|openai|o1|o3|o4/i,"openai"],[/gemini|google/i,"gemini"],[/azure|microsoft/i,"azure"],[/deepseek/i,"deepseek"]],wp=(t,e=!1)=>{const i=hc(t||"",e?Xd:Gd),o=[];for(const t of i){const e=!!yp[t.type],i=o[o.length-1];i&&i.isExpr===e?i.tokens.push(t):o.push({isExpr:e,tokens:[t]})}const n=t=>{const e=yp[t.type];if(!e){const e=t.text.split("\n");return Z`${e.map((t,e)=>Z`${e>0?Z`<br />`:null}${t}`)}`}const i=t.text.split("\n");return Z`${i.map((t,i)=>Z`${i>0?Z`<br />`:null}${t?Z`<span style="${e}">${t}</span>`:null}`)}`};return Z`${o.map(t=>{const e=Z`${t.tokens.map(n)}`;return t.isExpr?Z`<span style="hyphens:none">${e}</span>`:e})}`},_p=(t,e,i=3)=>Z`<div
11128
11128
  style="display: -webkit-box; -webkit-line-clamp: ${i}; -webkit-box-orient: vertical; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
11129
11129
  title="${e}"
11130
11130
  >