@nyaruka/temba-components 0.159.4 → 0.159.5

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,14 @@ 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.159.5](https://github.com/nyaruka/temba-components/compare/v0.159.4...v0.159.5)
8
+
9
+ - Refine flow list: inline type icons, drop status column, sparkline fixtures [`#1030`](https://github.com/nyaruka/temba-components/pull/1030)
10
+
7
11
  #### [v0.159.4](https://github.com/nyaruka/temba-components/compare/v0.159.3...v0.159.4)
8
12
 
13
+ > 9 June 2026
14
+
9
15
  - Refine content list components for the contact list rollout [`#1027`](https://github.com/nyaruka/temba-components/pull/1027)
10
16
 
11
17
  #### [v0.159.3](https://github.com/nyaruka/temba-components/compare/v0.159.2...v0.159.3)
@@ -9329,14 +9329,12 @@ const{I:sh}=lt,rh=t=>t,ah=()=>document.createComment(""),lh=(t,e,i)=>{const o=t.
9329
9329
  color: var(--accent-700);
9330
9330
  }
9331
9331
 
9332
- /* Leading entity-type icon — a small icon shared by every row
9333
- (contact silhouette, flow type icon, etc.). It rides inside the
9332
+ /* Leading entity-type icon — a small icon flagging a row (contact
9333
+ silhouette, voice/background flow, etc.). It rides inside the
9334
9334
  first column's cell rather than in its own column, so the column
9335
- header aligns with the icon (the row's leading content) rather
9336
- than the value beside it and the alignment reads the same
9337
- whether or not the list has a leading icon. Subclasses override
9338
- {@link getRowIcon}; when it returns null for every row no space
9339
- is reserved (see {@link reservesIcon}). */
9335
+ header aligns with the row's leading content. Subclasses
9336
+ override {@link getRowIcon}; a row whose icon is null renders
9337
+ its value flush at the column edge with no reserved gutter. */
9340
9338
  .lead-wrap {
9341
9339
  display: flex;
9342
9340
  align-items: center;
@@ -9345,12 +9343,12 @@ const{I:sh}=lt,rh=t=>t,ah=()=>document.createComment(""),lh=(t,e,i)=>{const o=t.
9345
9343
  .lead-wrap .cell-inner {
9346
9344
  min-width: 0;
9347
9345
  }
9348
- /* Reserve the icon's 1em footprint plus a snug 5px gap to the
9349
- value whether or not this row has an icon, so values stay
9350
- aligned down the column. The fixed box also keeps the column's
9351
- intrinsic width stable while <temba-icon> upgrades without it
9352
- the column briefly measures narrow and downstream pinned columns
9353
- jump, which races with whatever moment we snapshot. */
9346
+ /* The icon's 1em footprint plus a snug 5px gap to the value.
9347
+ The fixed box keeps the column's intrinsic width stable while
9348
+ <temba-icon> upgrades without it the column briefly measures
9349
+ narrow and downstream pinned columns jump, which races with
9350
+ whatever moment we snapshot. Rows without an icon don't render
9351
+ this box at all their value sits flush at the column edge. */
9354
9352
  .lead-icon {
9355
9353
  flex: 0 0 auto;
9356
9354
  display: flex;
@@ -9600,7 +9598,7 @@ const{I:sh}=lt,rh=t=>t,ah=()=>document.createComment(""),lh=(t,e,i)=>{const o=t.
9600
9598
  ></temba-checkbox>
9601
9599
  <span class="lbl-name">${t.name}</span>
9602
9600
  </div>
9603
- `}async handleLabelDropdownOpened(t){var e;if(!this.labelsByActionKey[t.key]&&t.labelsEndpoint)try{const i=((null===(e=(await ge(t.labelsEndpoint)).json)||void 0===e?void 0:e.results)||[]).slice().sort((t,e)=>String(t.name||"").localeCompare(String(e.name||"")));this.labelsByActionKey={...this.labelsByActionKey,[t.key]:i}}catch(t){console.error("failed to fetch labels",t)}}computeLabelState(t,e="labels"){const i=this.items.filter(t=>this.selectedIds.has(this.rowId(t)));if(0===i.length)return"none";const o=i.filter(i=>(i[e]||[]).some(e=>e.uuid===t));return 0===o.length?"none":o.length===i.length?"all":"some"}async toggleLabel(t,e){if(null!==this.pendingLabel)return;const i="all"!==e,o=Array.from(this.selectedIds);this.pendingLabel=t.uuid;try{if(this.actionEndpoint){const e=new URLSearchParams;e.append("action","label"),e.append("label",t.uuid),i||e.append("add","false"),o.forEach(t=>e.append("objects",t));try{await we(this.actionEndpoint,e),await this.fetchPage(this.currentUrl||void 0),this.recheckSelection(o),this.fireCustomEvent(jo.BulkAction,{action:"label",ids:o,label:t.uuid,add:i})}catch(t){console.error("label toggle POST failed",t)}}else this.fireCustomEvent(jo.BulkAction,{action:"label",ids:o,label:t.uuid,add:i})}finally{this.pendingLabel=null}}recheckSelection(t){const e=new Set(this.items.map(t=>this.rowId(t)));this.selectedIds=new Set(t.filter(t=>e.has(t)))}toggleSearch(){this.searchOpen=!this.searchOpen,this.searchOpen?(this.searchDraft=this.search,this.updateComplete.then(()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".searchbar input");null==e||e.focus()})):this.search?this.clearSearch():this.searchDraft=""}clearSearch(){this.searchDraft="",this.search&&(this.search="",this.page=1,this.searching=!1,this.fetchPage(),this.writeUrlState())}renderStatusPill(t,e){return Z`<span class="status-pill status-${t}">${e}</span>`}getRowIcon(t){return null}isLeftPinned(t){return!0===t.pinned||"left"===t.pinned}isRightPinned(t){return"right"===t.pinned}computePinLayout(){this.reservesIcon=this.items.length>0&&null!==this.getRowIcon(this.items[0]),this.pinIndexByColumn=new Map,this.rightPinIndexByColumn=new Map,this.checkPinIndex=-1,this.lastPinIndex=-1,this.firstRightPinIndex=-1,this.spacerAfterIndex=-1;let t=0;for(let e=this.columns.length-1;e>=0&&this.isRightPinned(this.columns[e]);e--)this.rightPinIndexByColumn.set(this.columns[e],t++);this.firstRightPinIndex=t-1;const e=this.columns.filter(t=>this.isLeftPinned(t)).length;if(0===e)return;let i=0;this.hasCheckboxes&&(this.checkPinIndex=i++),this.columns.forEach(t=>{this.isLeftPinned(t)&&this.pinIndexByColumn.set(t,i++)}),this.lastPinIndex=i-1,this.spacerAfterIndex=this.columns.some(t=>t.grow)?-1:e-1}pinClass(t){return t<0?"":t===this.lastPinIndex?"pinned pin-last":"pinned"}pinStyle(t){return t<0?"":`left: var(--cl-pin-${t}, 0px);`}columnPinClass(t){const e=this.pinIndexByColumn.get(t);if(null!=e)return this.pinClass(e);const i=this.rightPinIndexByColumn.get(t);return null!=i?i===this.firstRightPinIndex?"pinned pin-right pin-first":"pinned pin-right":""}columnPinStyle(t){const e=this.pinIndexByColumn.get(t);if(null!=e)return`left: var(--cl-pin-${e}, 0px);`;const i=this.rightPinIndexByColumn.get(t);return null!=i?`right: var(--cl-rpin-${i}, 0px);`:""}cellWidthStyle(t){if(this.fixedLayout)return"";if(t.width)return`width: ${t.width};`;const e=[];return t.minWidth&&e.push(`min-width: ${t.minWidth};`),t.grow||e.push(`max-width: ${t.maxWidth||"320px"};`),e.join(" ")}measurePinOffsets(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("tr.header");if(!e)return;const i=Array.from(e.children);let o=0,n=0;for(const t of i){if(!t.classList.contains("pinned"))break;if(t.classList.contains("pin-right"))break;this.style.setProperty(`--cl-pin-${n}`,`${o}px`),o+=t.offsetWidth,n++}let s=0,r=0;for(let t=i.length-1;t>=0&&i[t].classList.contains("pin-right");t--)this.style.setProperty(`--cl-rpin-${r}`,`${s}px`),s+=i[t].offsetWidth,r++;this.style.setProperty("--cl-rpin-total",`${s}px`)}syncScrollAffordance(){var t,e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".table-frame"),o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".table-scroll");if(!i||!o)return;const n=o.scrollWidth-o.clientWidth;i.classList.toggle("overflowing",n>1),i.classList.toggle("scrolled",o.scrollLeft>1),i.classList.toggle("can-scroll-right",o.scrollLeft<n-1),i.classList.toggle("scrolled-down",o.scrollTop>1),this.style.setProperty("--cl-scrollbar-w",o.offsetWidth-o.clientWidth+"px");const s=o.querySelector("table"),r=s?Math.min(o.clientHeight,s.offsetHeight):o.clientHeight;this.style.setProperty("--cl-rows-height",`${r}px`);const a=o.querySelector("tr.header");a&&this.style.setProperty("--cl-header-height",`${a.offsetHeight}px`);const l=i.getBoundingClientRect(),d=o.querySelector("tr.row td.lead-cell .lead-icon")||o.querySelector("tr.row td.cell .cell-inner")||o.querySelector("tr.header th.head-cell .head-inner");d&&this.style.setProperty("--cl-firstcol-left",d.getBoundingClientRect().left-l.left+"px")}renderHeader(){const t=this.items.map(t=>this.rowId(t)),e=t.length>0&&t.every(t=>this.selectedIds.has(t)),i=!e&&this.selectedIds.size>0;return Z`
9601
+ `}async handleLabelDropdownOpened(t){var e;if(!this.labelsByActionKey[t.key]&&t.labelsEndpoint)try{const i=((null===(e=(await ge(t.labelsEndpoint)).json)||void 0===e?void 0:e.results)||[]).slice().sort((t,e)=>String(t.name||"").localeCompare(String(e.name||"")));this.labelsByActionKey={...this.labelsByActionKey,[t.key]:i}}catch(t){console.error("failed to fetch labels",t)}}computeLabelState(t,e="labels"){const i=this.items.filter(t=>this.selectedIds.has(this.rowId(t)));if(0===i.length)return"none";const o=i.filter(i=>(i[e]||[]).some(e=>e.uuid===t));return 0===o.length?"none":o.length===i.length?"all":"some"}async toggleLabel(t,e){if(null!==this.pendingLabel)return;const i="all"!==e,o=Array.from(this.selectedIds);this.pendingLabel=t.uuid;try{if(this.actionEndpoint){const e=new URLSearchParams;e.append("action","label"),e.append("label",t.uuid),i||e.append("add","false"),o.forEach(t=>e.append("objects",t));try{await we(this.actionEndpoint,e),await this.fetchPage(this.currentUrl||void 0),this.recheckSelection(o),this.fireCustomEvent(jo.BulkAction,{action:"label",ids:o,label:t.uuid,add:i})}catch(t){console.error("label toggle POST failed",t)}}else this.fireCustomEvent(jo.BulkAction,{action:"label",ids:o,label:t.uuid,add:i})}finally{this.pendingLabel=null}}recheckSelection(t){const e=new Set(this.items.map(t=>this.rowId(t)));this.selectedIds=new Set(t.filter(t=>e.has(t)))}toggleSearch(){this.searchOpen=!this.searchOpen,this.searchOpen?(this.searchDraft=this.search,this.updateComplete.then(()=>{var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".searchbar input");null==e||e.focus()})):this.search?this.clearSearch():this.searchDraft=""}clearSearch(){this.searchDraft="",this.search&&(this.search="",this.page=1,this.searching=!1,this.fetchPage(),this.writeUrlState())}renderStatusPill(t,e){return Z`<span class="status-pill status-${t}">${e}</span>`}getRowIcon(t){return null}isLeftPinned(t){return!0===t.pinned||"left"===t.pinned}isRightPinned(t){return"right"===t.pinned}computePinLayout(){this.reservesIcon=this.items.some(t=>null!==this.getRowIcon(t)),this.pinIndexByColumn=new Map,this.rightPinIndexByColumn=new Map,this.checkPinIndex=-1,this.lastPinIndex=-1,this.firstRightPinIndex=-1,this.spacerAfterIndex=-1;let t=0;for(let e=this.columns.length-1;e>=0&&this.isRightPinned(this.columns[e]);e--)this.rightPinIndexByColumn.set(this.columns[e],t++);this.firstRightPinIndex=t-1;const e=this.columns.filter(t=>this.isLeftPinned(t)).length;if(0===e)return;let i=0;this.hasCheckboxes&&(this.checkPinIndex=i++),this.columns.forEach(t=>{this.isLeftPinned(t)&&this.pinIndexByColumn.set(t,i++)}),this.lastPinIndex=i-1,this.spacerAfterIndex=this.columns.some(t=>t.grow)?-1:e-1}pinClass(t){return t<0?"":t===this.lastPinIndex?"pinned pin-last":"pinned"}pinStyle(t){return t<0?"":`left: var(--cl-pin-${t}, 0px);`}columnPinClass(t){const e=this.pinIndexByColumn.get(t);if(null!=e)return this.pinClass(e);const i=this.rightPinIndexByColumn.get(t);return null!=i?i===this.firstRightPinIndex?"pinned pin-right pin-first":"pinned pin-right":""}columnPinStyle(t){const e=this.pinIndexByColumn.get(t);if(null!=e)return`left: var(--cl-pin-${e}, 0px);`;const i=this.rightPinIndexByColumn.get(t);return null!=i?`right: var(--cl-rpin-${i}, 0px);`:""}cellWidthStyle(t){if(this.fixedLayout)return"";if(t.width)return`width: ${t.width};`;const e=[];return t.minWidth&&e.push(`min-width: ${t.minWidth};`),t.grow||e.push(`max-width: ${t.maxWidth||"320px"};`),e.join(" ")}measurePinOffsets(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("tr.header");if(!e)return;const i=Array.from(e.children);let o=0,n=0;for(const t of i){if(!t.classList.contains("pinned"))break;if(t.classList.contains("pin-right"))break;this.style.setProperty(`--cl-pin-${n}`,`${o}px`),o+=t.offsetWidth,n++}let s=0,r=0;for(let t=i.length-1;t>=0&&i[t].classList.contains("pin-right");t--)this.style.setProperty(`--cl-rpin-${r}`,`${s}px`),s+=i[t].offsetWidth,r++;this.style.setProperty("--cl-rpin-total",`${s}px`)}syncScrollAffordance(){var t,e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".table-frame"),o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".table-scroll");if(!i||!o)return;const n=o.scrollWidth-o.clientWidth;i.classList.toggle("overflowing",n>1),i.classList.toggle("scrolled",o.scrollLeft>1),i.classList.toggle("can-scroll-right",o.scrollLeft<n-1),i.classList.toggle("scrolled-down",o.scrollTop>1),this.style.setProperty("--cl-scrollbar-w",o.offsetWidth-o.clientWidth+"px");const s=o.querySelector("table"),r=s?Math.min(o.clientHeight,s.offsetHeight):o.clientHeight;this.style.setProperty("--cl-rows-height",`${r}px`);const a=o.querySelector("tr.header");a&&this.style.setProperty("--cl-header-height",`${a.offsetHeight}px`);const l=i.getBoundingClientRect(),d=o.querySelector("tr.row td.lead-cell .lead-icon")||o.querySelector("tr.row td.cell .cell-inner")||o.querySelector("tr.header th.head-cell .head-inner");d&&this.style.setProperty("--cl-firstcol-left",d.getBoundingClientRect().left-l.left+"px")}renderHeader(){const t=this.items.map(t=>this.rowId(t)),e=t.length>0&&t.every(t=>this.selectedIds.has(t)),i=!e&&this.selectedIds.size>0;return Z`
9604
9602
  <thead>
9605
9603
  <tr class="header">
9606
9604
  ${this.hasCheckboxes?Z`
@@ -9671,9 +9669,9 @@ const{I:sh}=lt,rh=t=>t,ah=()=>document.createComment(""),lh=(t,e,i)=>{const o=t.
9671
9669
  class="cell ${n?"lead-cell":""} ${e.align||""} ${e.grow?"grow":""} ${this.columnPinClass(e)}"
9672
9670
  style=${this.columnPinStyle(e)}
9673
9671
  >
9674
- ${n?Z`<div class="lead-wrap">
9672
+ ${s?Z`<div class="lead-wrap">
9675
9673
  <span class="lead-icon"
9676
- >${s?Z`<temba-icon name=${s} size="1"></temba-icon>`:null}</span
9674
+ ><temba-icon name=${s} size="1"></temba-icon></span
9677
9675
  >${o}
9678
9676
  </div>`:o}
9679
9677
  </td>
@@ -11093,7 +11091,7 @@ background: #ccc;
11093
11091
  ${this.renderUploader()}
11094
11092
  </div>
11095
11093
  </div>
11096
- </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.4"}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
11094
+ </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.5"}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
11097
11095
  style="display: -webkit-box; -webkit-line-clamp: ${i}; -webkit-box-orient: vertical; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto;"
11098
11096
  title="${e}"
11099
11097
  >
@@ -18654,7 +18652,7 @@ function(t){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.
18654
18652
  fill: var(--accent-100);
18655
18653
  opacity: 0.7;
18656
18654
  }
18657
- `}constructor(){super(),this.valueKey="uuid",this.emptyMessage="No flows",this.searchPlaceholder="Search flows",this.columns=[{key:"name",label:"Name",sortable:!0,width:"280px",pinned:!0},{key:"status",label:"Status",width:"110px"},{key:"runs",label:"Runs",sortable:!0,width:"90px",align:"right"},{key:"ongoing",label:"Ongoing",sortable:!0,width:"90px",align:"right"},{key:"completion",label:"Completion",width:"130px",align:"right"},{key:"activity",label:"Activity",width:"120px",align:"right"}],this.bulkActions=[{key:"label",label:"Label",icon:Io.label,labelsEndpoint:"/api/v2/flow-labels.json"},{key:"export",label:"Export results",icon:Io.export},{key:"archive",label:"Archive",icon:Io.archive}]}getRowIcon(t){switch(null==t?void 0:t.type){case"voice":case"ivr":return Io.flow_ivr;case"background":return Io.flow_background;case"survey":return Io.flow_surveyor;default:return Io.flow_message}}getRowHref(t){return(null==t?void 0:t.uuid)?`/flow/editor/${t.uuid}/`:null}renderCell(t,e){var i,o;switch(e.key){case"name":{const e=t.labels||[];return Z`<span class="flow-name"
18655
+ `}constructor(){super(),this.valueKey="uuid",this.emptyMessage="No flows",this.searchPlaceholder="Search flows",this.columns=[{key:"name",label:"Name",sortable:!0,width:"280px",pinned:!0},{key:"runs",label:"Runs",sortable:!0,width:"90px",align:"right"},{key:"ongoing",label:"Ongoing",sortable:!0,width:"90px",align:"right"},{key:"completion",label:"Completion",width:"130px",align:"right"},{key:"activity",label:"Activity",width:"120px",align:"right"}],this.bulkActions=[{key:"label",label:"Label",icon:Io.label,labelsEndpoint:"/api/v2/flow-labels.json"},{key:"export",label:"Export results",icon:Io.export},{key:"archive",label:"Archive",icon:Io.archive}]}getRowIcon(t){switch(null==t?void 0:t.type){case"voice":case"ivr":return Io.flow_ivr;case"background":return Io.flow_background;case"survey":return Io.flow_surveyor;default:return null}}getRowHref(t){return(null==t?void 0:t.uuid)?`/flow/editor/${t.uuid}/`:null}renderCell(t,e){var i,o;switch(e.key){case"name":{const e=t.labels||[];return Z`<span class="flow-name"
18658
18656
  >${t.name||""}
18659
18657
  ${t.has_issues?Z`<temba-icon
18660
18658
  class="issue-icon"
@@ -18668,7 +18666,7 @@ function(t){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.
18668
18666
  </span>`:null}
18669
18667
  </span>`}case"runs":return Z`<span class="num"
18670
18668
  >${(null!==(i=t.runs)&&void 0!==i?i:0).toLocaleString()}</span
18671
- >`;case"ongoing":return Z`<span class="num">${null!==(o=t.ongoing)&&void 0!==o?o:0}</span>`;case"completion":return this.renderCompletion(t);case"activity":return this.renderSparkline(t.activity||[]);case"status":return this.renderFlowStatus(t);default:return super.renderCell(t,e)}}renderCompletion(t){const e="number"==typeof t.completion?t.completion:0,i=Math.round(100*e);return Z`
18669
+ >`;case"ongoing":return Z`<span class="num">${null!==(o=t.ongoing)&&void 0!==o?o:0}</span>`;case"completion":return this.renderCompletion(t);case"activity":return this.renderSparkline(t.activity||[]);default:return super.renderCell(t,e)}}renderCompletion(t){const e="number"==typeof t.completion?t.completion:0,i=Math.round(100*e);return Z`
18672
18670
  <div class="completion-bar">
18673
18671
  <div class="bar">
18674
18672
  <div class="fill" style="width: ${i}%"></div>
@@ -18686,7 +18684,7 @@ function(t){return(e,i,o)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.
18686
18684
  <path class="area" d=${`${r} L90,22 L0,22 Z`}></path>
18687
18685
  <polyline class="line" points=${s}></polyline>
18688
18686
  </svg>
18689
- `}renderFlowStatus(t){const e=(t.status||"active").toString().toLowerCase(),i="archived"===e?"archived":"active",o="archived"===e?"Archived":"Active";return this.renderStatusPill(i,o)}}),VC("temba-list",Ph),VC("temba-sortable-list",Hd),VC("temba-run-list",hu),VC("temba-flow-details",uu),VC("temba-label",Jh),VC("temba-menu",Yh),VC("temba-contact-search",qh),VC("temba-icon",Uh),VC("temba-dropdown",Gh),VC("temba-tabs",Xh),VC("temba-tab",Qh),VC("temba-contact-badges",ru),VC("temba-contact-timeline",lu),VC("temba-slider",du),VC("temba-content-menu",xu),VC("temba-compose",ku),VC("temba-color-picker",Su),VC("temba-resizer",$u),VC("temba-thumbnail",Du),VC("temba-webchat",Bu),VC("temba-image-picker",qu),VC("temba-mask",Uu),VC("temba-user",Ol),VC("temba-template-editor",ju),VC("temba-toast",Hu),VC("temba-chat",xh),VC("temba-media-picker",Vu),VC("temba-flow-editor",Dg),VC("temba-editor-toolbar",hg),VC("temba-message-table",WC),VC("temba-node-editor",uC),VC("temba-flow-node",Cg),VC("temba-sticky-note",Mg),VC("temba-canvas-menu",zg),VC("temba-node-type-selector",Ig),VC("temba-contact-notepad",Lg),VC("temba-progress",Og),VC("temba-start-progress",Pg),VC("temba-shortcuts",Rg),VC("temba-popup-select",Ng),VC("temba-user-select",Bg),VC("temba-workspace-select",Fg),VC("temba-chart",Jk),VC("temba-key-value-editor",mC),VC("temba-array-editor",gC),VC("temba-message-editor",fC),VC("temba-rich-edit",vC),VC("temba-accordion",xC),VC("temba-accordion-section",wC),VC("temba-expression-highlight",bC),VC("temba-floating-tab",$g),VC("temba-floating-window",yC),VC("temba-simulator",AC),VC("temba-flow-search",OC),VC("temba-issues-window",PC),VC("temba-revisions-window",UC),VC("temba-auto-translate",HC);class ZC extends ht{static get styles(){return d`
18687
+ `}}),VC("temba-list",Ph),VC("temba-sortable-list",Hd),VC("temba-run-list",hu),VC("temba-flow-details",uu),VC("temba-label",Jh),VC("temba-menu",Yh),VC("temba-contact-search",qh),VC("temba-icon",Uh),VC("temba-dropdown",Gh),VC("temba-tabs",Xh),VC("temba-tab",Qh),VC("temba-contact-badges",ru),VC("temba-contact-timeline",lu),VC("temba-slider",du),VC("temba-content-menu",xu),VC("temba-compose",ku),VC("temba-color-picker",Su),VC("temba-resizer",$u),VC("temba-thumbnail",Du),VC("temba-webchat",Bu),VC("temba-image-picker",qu),VC("temba-mask",Uu),VC("temba-user",Ol),VC("temba-template-editor",ju),VC("temba-toast",Hu),VC("temba-chat",xh),VC("temba-media-picker",Vu),VC("temba-flow-editor",Dg),VC("temba-editor-toolbar",hg),VC("temba-message-table",WC),VC("temba-node-editor",uC),VC("temba-flow-node",Cg),VC("temba-sticky-note",Mg),VC("temba-canvas-menu",zg),VC("temba-node-type-selector",Ig),VC("temba-contact-notepad",Lg),VC("temba-progress",Og),VC("temba-start-progress",Pg),VC("temba-shortcuts",Rg),VC("temba-popup-select",Ng),VC("temba-user-select",Bg),VC("temba-workspace-select",Fg),VC("temba-chart",Jk),VC("temba-key-value-editor",mC),VC("temba-array-editor",gC),VC("temba-message-editor",fC),VC("temba-rich-edit",vC),VC("temba-accordion",xC),VC("temba-accordion-section",wC),VC("temba-expression-highlight",bC),VC("temba-floating-tab",$g),VC("temba-floating-window",yC),VC("temba-simulator",AC),VC("temba-flow-search",OC),VC("temba-issues-window",PC),VC("temba-revisions-window",UC),VC("temba-auto-translate",HC);class ZC extends ht{static get styles(){return d`
18690
18688
  :host {
18691
18689
  line-height: normal;
18692
18690
  }