@nyaruka/temba-components 0.121.0 → 0.121.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/dist/temba-components.js +2 -2
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/store/AppState.js +4 -1
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/store/Store.js +1 -0
- package/out-tsc/src/store/Store.js.map +1 -1
- package/package.json +1 -1
- package/src/store/AppState.ts +4 -1
- package/src/store/Store.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,16 +4,33 @@ 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.121.2](https://github.com/nyaruka/temba-components/compare/v0.121.1...v0.121.2)
|
|
8
|
+
|
|
9
|
+
- Fallback to keyed assets for completion [`051adf9`](https://github.com/nyaruka/temba-components/commit/051adf9d8b98d2be362a6ce4b206ed2807284d8d)
|
|
10
|
+
|
|
11
|
+
#### [v0.121.1](https://github.com/nyaruka/temba-components/compare/v0.121.0...v0.121.1)
|
|
12
|
+
|
|
13
|
+
> 5 May 2025
|
|
14
|
+
|
|
15
|
+
- Don't update positions if they don't exist yet [`4278e31`](https://github.com/nyaruka/temba-components/commit/4278e31bc97faa361b19c40895fd819b00712e94)
|
|
16
|
+
|
|
7
17
|
#### [v0.121.0](https://github.com/nyaruka/temba-components/compare/v0.120.8...v0.121.0)
|
|
8
18
|
|
|
19
|
+
> 3 May 2025
|
|
20
|
+
|
|
9
21
|
- Add AppState using zustand and immer [`#496`](https://github.com/nyaruka/temba-components/pull/496)
|
|
10
22
|
- Add immer [`48ed498`](https://github.com/nyaruka/temba-components/commit/48ed498de5acf1a3d20b724b75c09e8a1fad5d58)
|
|
11
23
|
|
|
12
|
-
#### [v0.120.8](https://github.com/nyaruka/temba-components/compare/v0.120.
|
|
24
|
+
#### [v0.120.8](https://github.com/nyaruka/temba-components/compare/v0.120.7...v0.120.8)
|
|
13
25
|
|
|
14
26
|
> 30 April 2025
|
|
15
27
|
|
|
16
28
|
- Add locals to completion [`#495`](https://github.com/nyaruka/temba-components/pull/495)
|
|
29
|
+
|
|
30
|
+
#### [v0.120.7](https://github.com/nyaruka/temba-components/compare/v0.120.6...v0.120.7)
|
|
31
|
+
|
|
32
|
+
> 30 April 2025
|
|
33
|
+
|
|
17
34
|
- Add new icon for Microsoft AI and remove some unused ones [`#494`](https://github.com/nyaruka/temba-components/pull/494)
|
|
18
35
|
|
|
19
36
|
#### [v0.120.6](https://github.com/nyaruka/temba-components/compare/v0.120.5...v0.120.6)
|
package/dist/temba-components.js
CHANGED
|
@@ -386,7 +386,7 @@ let fr=Ks,vr=!1;const yr=["es","fr","pt"],br="data:image/png;base64,iVBORw0KGgoA
|
|
|
386
386
|
-webkit-box-orient: vertical;
|
|
387
387
|
overflow: hidden;
|
|
388
388
|
}
|
|
389
|
-
`,t([ce({type:Number})],xr.prototype,"scale",void 0),t([ce({type:Boolean})],xr.prototype,"showName",void 0),t([ce({type:Boolean})],xr.prototype,"system",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"bgimage",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"bgcolor",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"initials",void 0),t([ce({type:String})],xr.prototype,"name",void 0),t([ce({type:String})],xr.prototype,"email",void 0),t([ce({type:String})],xr.prototype,"avatar",void 0);const wr=t=>{let e;const i=new Set,o=(t,o)=>{const n="function"==typeof t?t(e):t;if(!Object.is(n,e)){const t=e;e=(null!=o?o:"object"!=typeof n||null===n)?n:Object.assign({},e,n),i.forEach((i=>i(e,t)))}},n=()=>e,s={setState:o,getState:n,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(o,n,s);return s};var kr=Symbol.for("immer-nothing"),Ar=Symbol.for("immer-draftable"),Sr=Symbol.for("immer-state"),Cr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Tr(t,...e){{const i=Cr[t],o="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${o}`)}}var Er=Object.getPrototypeOf;function $r(t){return!!t&&!!t[Sr]}function Or(t){return!!t&&(Lr(t)||Array.isArray(t)||!!t[Ar]||!!t.constructor?.[Ar]||Nr(t)||Br(t))}var zr=Object.prototype.constructor.toString();function Lr(t){if(!t||"object"!=typeof t)return!1;const e=Er(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===zr}function Mr(t,e){0===Ir(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,o)=>e(o,i,t)))}function Ir(t){const e=t[Sr];return e?e.type_:Array.isArray(t)?1:Nr(t)?2:Br(t)?3:0}function Pr(t,e){return 2===Ir(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Dr(t,e,i){const o=Ir(t);2===o?t.set(e,i):3===o?t.add(i):t[e]=i}function Nr(t){return t instanceof Map}function Br(t){return t instanceof Set}function Rr(t){return t.copy_||t.base_}function qr(t,e){if(Nr(t))return new Map(t);if(Br(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Lr(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Sr];let i=Reflect.ownKeys(e);for(let o=0;o<i.length;o++){const n=i[o],s=e[n];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[n]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[n]})}return Object.create(Er(t),e)}{const e=Er(t);if(null!==e&&i)return{...t};const o=Object.create(e);return Object.assign(o,t)}}function Fr(t,e=!1){return jr(t)||$r(t)||!Or(t)||(Ir(t)>1&&(t.set=t.add=t.clear=t.delete=Ur),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Fr(e,!0)))),t}function Ur(){Tr(2)}function jr(t){return Object.isFrozen(t)}var Vr,Zr={};function Hr(t){const e=Zr[t];return e||Tr(0,t),e}function Wr(){return Vr}function Gr(t,e){e&&(Hr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kr(t){Yr(t),t.drafts_.forEach(Jr),t.drafts_=null}function Yr(t){t===Vr&&(Vr=t.parent_)}function Qr(t){return Vr={drafts_:[],parent_:Vr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jr(t){const e=t[Sr];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Xr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Sr].modified_&&(Kr(e),Tr(4)),Or(t)&&(t=ta(e,t),e.parent_||ia(e,t)),e.patches_&&Hr("Patches").generateReplacementPatches_(i[Sr].base_,t,e.patches_,e.inversePatches_)):t=ta(e,i,[]),Kr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==kr?t:void 0}function ta(t,e,i){if(jr(e))return e;const o=e[Sr];if(!o)return Mr(e,((n,s)=>ea(t,o,e,n,s,i))),e;if(o.scope_!==t)return e;if(!o.modified_)return ia(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const e=o.copy_;let n=e,s=!1;3===o.type_&&(n=new Set(e),e.clear(),s=!0),Mr(n,((n,r)=>ea(t,o,e,n,r,i,s))),ia(t,e,!1),i&&t.patches_&&Hr("Patches").generatePatches_(o,i,t.patches_,t.inversePatches_)}return o.copy_}function ea(t,e,i,o,n,s,r){if(n===i&&Tr(5),$r(n)){const r=ta(t,n,s&&e&&3!==e.type_&&!Pr(e.assigned_,o)?s.concat(o):void 0);if(Dr(i,o,r),!$r(r))return;t.canAutoFreeze_=!1}else r&&i.add(n);if(Or(n)&&!jr(n)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ta(t,n),e&&e.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(i,o)||ia(t,n)}}function ia(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Fr(e,i)}var oa={get(t,e){if(e===Sr)return t;const i=Rr(t);if(!Pr(i,e))return function(t,e,i){const o=ra(e,i);return o?"value"in o?o.value:o.get?.call(t.draft_):void 0}(t,i,e);const o=i[e];return t.finalized_||!Or(o)?o:o===sa(t.base_,e)?(la(t),t.copy_[e]=ha(o,t)):o},has:(t,e)=>e in Rr(t),ownKeys:t=>Reflect.ownKeys(Rr(t)),set(t,e,i){const o=ra(Rr(t),e);if(o?.set)return o.set.call(t.draft_,i),!0;if(!t.modified_){const o=sa(Rr(t),e),n=o?.[Sr];if(n&&n.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,o)&&(void 0!==i||Pr(t.base_,e)))return!0;la(t),aa(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==sa(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,la(t),aa(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Rr(t),o=Reflect.getOwnPropertyDescriptor(i,e);return o?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:o.enumerable,value:i[e]}:o},defineProperty(){Tr(11)},getPrototypeOf:t=>Er(t.base_),setPrototypeOf(){Tr(12)}},na={};function sa(t,e){const i=t[Sr];return(i?Rr(i):t)[e]}function ra(t,e){if(!(e in t))return;let i=Er(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Er(i)}}function aa(t){t.modified_||(t.modified_=!0,t.parent_&&aa(t.parent_))}function la(t){t.copy_||(t.copy_=qr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Mr(oa,((t,e)=>{na[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),na.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Tr(13),na.set.call(this,t,e,void 0)},na.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Tr(14),oa.set.call(this,t[0],e,i,t[0])};function ha(t,e){const i=Nr(t)?Hr("MapSet").proxyMap_(t,e):Br(t)?Hr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),o={type_:i?1:0,scope_:e?e.scope_:Wr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,s=oa;i&&(n=[o],s=na);const{revoke:r,proxy:a}=Proxy.revocable(n,s);return o.draft_=a,o.revoke_=r,a}(t,e);return(e?e.scope_:Wr()).drafts_.push(i),i}function ca(t){if(!Or(t)||jr(t))return t;const e=t[Sr];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=qr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=qr(t,!0);return Mr(i,((t,e)=>{Dr(i,t,ca(e))})),e&&(e.finalized_=!1),i}var da=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const o=this;return function(t=i,...n){return o.produce(t,(t=>e.call(this,t,...n)))}}let o;if("function"!=typeof e&&Tr(6),void 0!==i&&"function"!=typeof i&&Tr(7),Or(t)){const n=Qr(this),s=ha(t,void 0);let r=!0;try{o=e(s),r=!1}finally{r?Kr(n):Yr(n)}return Gr(n,i),Xr(o,n)}if(!t||"object"!=typeof t){if(o=e(t),void 0===o&&(o=t),o===kr&&(o=void 0),this.autoFreeze_&&Fr(o,!0),i){const e=[],n=[];Hr("Patches").generateReplacementPatches_(t,o,e,n),i(e,n)}return o}Tr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,o;const n=this.produce(t,e,((t,e)=>{i=t,o=e}));return[n,i,o]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Or(t)||Tr(8),$r(t)&&(t=function(t){$r(t)||Tr(10,t);return ca(t)}(t));const e=Qr(this),i=ha(t,void 0);return i[Sr].isManual_=!0,Yr(e),i}finishDraft(t,e){const i=t&&t[Sr];i&&i.isManual_||Tr(9);const{scope_:o}=i;return Gr(o,e),Xr(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const o=e[i];if(0===o.path.length&&"replace"===o.op){t=o.value;break}}i>-1&&(e=e.slice(i+1));const o=Hr("Patches").applyPatches_;return $r(t)?o(t,e):this.produce(t,(t=>o(t,e)))}},ua=da.produce;da.produceWithPatches.bind(da),da.setAutoFreeze.bind(da),da.setUseStrictShallowCopy.bind(da),da.applyPatches.bind(da),da.createDraft.bind(da),da.finishDraft.bind(da);const pa=t=>(e,i,o)=>(o.setState=(t,i,...o)=>{const n="function"==typeof t?ua(t):t;return e(n,i,...o)},t(o.setState,i,o));var ma=wr(pa(((t,e)=>({languageNames:{},languageCode:"",workspace:null,flow:null,isTranslating:!1,fetchRevision:async(e,i=null)=>{i||(i="latest");const o=await fetch(`${e}/${i}/?version=14.3`);if(!o.ok)throw new Error("Network response was not ok");const n=await o.json();t({flow:n})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const o=await i.json();t({workspace:o})},fetchAllLanguages:async e=>{const i=(await Wt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flow.info.results,getResultByKey:t=>e().flow.info.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language,o=t.languageCode||i;t.flow=e,t.isTranslating=i!==o,t.languageCode=o||i}))},setFlowInfo:e=>{t((t=>{t.flow.info=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flow.definition.language!==e}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flow.definition._ui.nodes[i].position=e[i]}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flow.definition._ui.nodes[i];t.flow.definition.nodes=t.flow.definition.nodes.filter((t=>!e.includes(t.uuid)))}))}}))));const{setLocale:ga}=(t=>(function(t){if(vr)throw new Error("lit-localize can only be configured once");fr=t,vr=!0}(((t,e)=>nr(cr,t,e))),dr=ar=t.sourceLocale,lr=new Set(t.targetLocales),lr.add(t.sourceLocale),hr=t.loadLocale,{getLocale:mr,setLocale:gr}))({sourceLocale:"en",targetLocales:yr,loadLocale:t=>import(`./locales/${t}.js`)});class fa extends pe{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return r`
|
|
389
|
+
`,t([ce({type:Number})],xr.prototype,"scale",void 0),t([ce({type:Boolean})],xr.prototype,"showName",void 0),t([ce({type:Boolean})],xr.prototype,"system",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"bgimage",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"bgcolor",void 0),t([ce({type:String,attribute:!1})],xr.prototype,"initials",void 0),t([ce({type:String})],xr.prototype,"name",void 0),t([ce({type:String})],xr.prototype,"email",void 0),t([ce({type:String})],xr.prototype,"avatar",void 0);const wr=t=>{let e;const i=new Set,o=(t,o)=>{const n="function"==typeof t?t(e):t;if(!Object.is(n,e)){const t=e;e=(null!=o?o:"object"!=typeof n||null===n)?n:Object.assign({},e,n),i.forEach((i=>i(e,t)))}},n=()=>e,s={setState:o,getState:n,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(o,n,s);return s};var kr=Symbol.for("immer-nothing"),Ar=Symbol.for("immer-draftable"),Sr=Symbol.for("immer-state"),Cr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Tr(t,...e){{const i=Cr[t],o="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${o}`)}}var Er=Object.getPrototypeOf;function $r(t){return!!t&&!!t[Sr]}function Or(t){return!!t&&(Lr(t)||Array.isArray(t)||!!t[Ar]||!!t.constructor?.[Ar]||Nr(t)||Br(t))}var zr=Object.prototype.constructor.toString();function Lr(t){if(!t||"object"!=typeof t)return!1;const e=Er(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===zr}function Mr(t,e){0===Ir(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,o)=>e(o,i,t)))}function Ir(t){const e=t[Sr];return e?e.type_:Array.isArray(t)?1:Nr(t)?2:Br(t)?3:0}function Pr(t,e){return 2===Ir(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Dr(t,e,i){const o=Ir(t);2===o?t.set(e,i):3===o?t.add(i):t[e]=i}function Nr(t){return t instanceof Map}function Br(t){return t instanceof Set}function Rr(t){return t.copy_||t.base_}function qr(t,e){if(Nr(t))return new Map(t);if(Br(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Lr(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Sr];let i=Reflect.ownKeys(e);for(let o=0;o<i.length;o++){const n=i[o],s=e[n];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[n]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[n]})}return Object.create(Er(t),e)}{const e=Er(t);if(null!==e&&i)return{...t};const o=Object.create(e);return Object.assign(o,t)}}function Fr(t,e=!1){return jr(t)||$r(t)||!Or(t)||(Ir(t)>1&&(t.set=t.add=t.clear=t.delete=Ur),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Fr(e,!0)))),t}function Ur(){Tr(2)}function jr(t){return Object.isFrozen(t)}var Vr,Zr={};function Hr(t){const e=Zr[t];return e||Tr(0,t),e}function Wr(){return Vr}function Gr(t,e){e&&(Hr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kr(t){Yr(t),t.drafts_.forEach(Jr),t.drafts_=null}function Yr(t){t===Vr&&(Vr=t.parent_)}function Qr(t){return Vr={drafts_:[],parent_:Vr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jr(t){const e=t[Sr];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function Xr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Sr].modified_&&(Kr(e),Tr(4)),Or(t)&&(t=ta(e,t),e.parent_||ia(e,t)),e.patches_&&Hr("Patches").generateReplacementPatches_(i[Sr].base_,t,e.patches_,e.inversePatches_)):t=ta(e,i,[]),Kr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==kr?t:void 0}function ta(t,e,i){if(jr(e))return e;const o=e[Sr];if(!o)return Mr(e,((n,s)=>ea(t,o,e,n,s,i))),e;if(o.scope_!==t)return e;if(!o.modified_)return ia(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const e=o.copy_;let n=e,s=!1;3===o.type_&&(n=new Set(e),e.clear(),s=!0),Mr(n,((n,r)=>ea(t,o,e,n,r,i,s))),ia(t,e,!1),i&&t.patches_&&Hr("Patches").generatePatches_(o,i,t.patches_,t.inversePatches_)}return o.copy_}function ea(t,e,i,o,n,s,r){if(n===i&&Tr(5),$r(n)){const r=ta(t,n,s&&e&&3!==e.type_&&!Pr(e.assigned_,o)?s.concat(o):void 0);if(Dr(i,o,r),!$r(r))return;t.canAutoFreeze_=!1}else r&&i.add(n);if(Or(n)&&!jr(n)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ta(t,n),e&&e.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(i,o)||ia(t,n)}}function ia(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Fr(e,i)}var oa={get(t,e){if(e===Sr)return t;const i=Rr(t);if(!Pr(i,e))return function(t,e,i){const o=ra(e,i);return o?"value"in o?o.value:o.get?.call(t.draft_):void 0}(t,i,e);const o=i[e];return t.finalized_||!Or(o)?o:o===sa(t.base_,e)?(la(t),t.copy_[e]=ha(o,t)):o},has:(t,e)=>e in Rr(t),ownKeys:t=>Reflect.ownKeys(Rr(t)),set(t,e,i){const o=ra(Rr(t),e);if(o?.set)return o.set.call(t.draft_,i),!0;if(!t.modified_){const o=sa(Rr(t),e),n=o?.[Sr];if(n&&n.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,o)&&(void 0!==i||Pr(t.base_,e)))return!0;la(t),aa(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==sa(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,la(t),aa(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Rr(t),o=Reflect.getOwnPropertyDescriptor(i,e);return o?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:o.enumerable,value:i[e]}:o},defineProperty(){Tr(11)},getPrototypeOf:t=>Er(t.base_),setPrototypeOf(){Tr(12)}},na={};function sa(t,e){const i=t[Sr];return(i?Rr(i):t)[e]}function ra(t,e){if(!(e in t))return;let i=Er(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Er(i)}}function aa(t){t.modified_||(t.modified_=!0,t.parent_&&aa(t.parent_))}function la(t){t.copy_||(t.copy_=qr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}Mr(oa,((t,e)=>{na[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),na.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Tr(13),na.set.call(this,t,e,void 0)},na.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Tr(14),oa.set.call(this,t[0],e,i,t[0])};function ha(t,e){const i=Nr(t)?Hr("MapSet").proxyMap_(t,e):Br(t)?Hr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),o={type_:i?1:0,scope_:e?e.scope_:Wr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,s=oa;i&&(n=[o],s=na);const{revoke:r,proxy:a}=Proxy.revocable(n,s);return o.draft_=a,o.revoke_=r,a}(t,e);return(e?e.scope_:Wr()).drafts_.push(i),i}function ca(t){if(!Or(t)||jr(t))return t;const e=t[Sr];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=qr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=qr(t,!0);return Mr(i,((t,e)=>{Dr(i,t,ca(e))})),e&&(e.finalized_=!1),i}var da=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const o=this;return function(t=i,...n){return o.produce(t,(t=>e.call(this,t,...n)))}}let o;if("function"!=typeof e&&Tr(6),void 0!==i&&"function"!=typeof i&&Tr(7),Or(t)){const n=Qr(this),s=ha(t,void 0);let r=!0;try{o=e(s),r=!1}finally{r?Kr(n):Yr(n)}return Gr(n,i),Xr(o,n)}if(!t||"object"!=typeof t){if(o=e(t),void 0===o&&(o=t),o===kr&&(o=void 0),this.autoFreeze_&&Fr(o,!0),i){const e=[],n=[];Hr("Patches").generateReplacementPatches_(t,o,e,n),i(e,n)}return o}Tr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,o;const n=this.produce(t,e,((t,e)=>{i=t,o=e}));return[n,i,o]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Or(t)||Tr(8),$r(t)&&(t=function(t){$r(t)||Tr(10,t);return ca(t)}(t));const e=Qr(this),i=ha(t,void 0);return i[Sr].isManual_=!0,Yr(e),i}finishDraft(t,e){const i=t&&t[Sr];i&&i.isManual_||Tr(9);const{scope_:o}=i;return Gr(o,e),Xr(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const o=e[i];if(0===o.path.length&&"replace"===o.op){t=o.value;break}}i>-1&&(e=e.slice(i+1));const o=Hr("Patches").applyPatches_;return $r(t)?o(t,e):this.produce(t,(t=>o(t,e)))}},ua=da.produce;da.produceWithPatches.bind(da),da.setAutoFreeze.bind(da),da.setUseStrictShallowCopy.bind(da),da.applyPatches.bind(da),da.createDraft.bind(da),da.finishDraft.bind(da);const pa=t=>(e,i,o)=>(o.setState=(t,i,...o)=>{const n="function"==typeof t?ua(t):t;return e(n,i,...o)},t(o.setState,i,o));var ma=wr(pa(((t,e)=>({languageNames:{},languageCode:"",workspace:null,flow:null,isTranslating:!1,fetchRevision:async(e,i=null)=>{i||(i="latest");const o=await fetch(`${e}/${i}/?version=14.3`);if(!o.ok)throw new Error("Network response was not ok");const n=await o.json();t({flow:n})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const o=await i.json();t({workspace:o})},fetchAllLanguages:async e=>{const i=(await Wt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flow.info.results,getResultByKey:t=>e().flow.info.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language,o=t.languageCode||i;t.flow=e,t.isTranslating=i!==o,t.languageCode=o||i}))},setFlowInfo:e=>{t((t=>{t.flow.info=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flow.definition.language!==e}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flow.definition._ui.nodes[i]&&(t.flow.definition._ui.nodes[i].position=e[i])}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flow.definition._ui.nodes[i];t.flow.definition.nodes=t.flow.definition.nodes.filter((t=>!e.includes(t.uuid)))}))}}))));const{setLocale:ga}=(t=>(function(t){if(vr)throw new Error("lit-localize can only be configured once");fr=t,vr=!0}(((t,e)=>nr(cr,t,e))),dr=ar=t.sourceLocale,lr=new Set(t.targetLocales),lr.add(t.sourceLocale),hr=t.loadLocale,{getLocale:mr,setLocale:gr}))({sourceLocale:"en",targetLocales:yr,loadLocale:t=>import(`./locales/${t}.js`)});class fa extends pe{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return r`
|
|
390
390
|
:host {
|
|
391
391
|
position: fixed;
|
|
392
392
|
z-index: 1000;
|
|
@@ -397,7 +397,7 @@ let fr=Ks,vr=!1;const yr=["es","fr","pt"],br="data:image/png;base64,iVBORw0KGgoA
|
|
|
397
397
|
width: 100%;
|
|
398
398
|
top: 0.5em;
|
|
399
399
|
}
|
|
400
|
-
`}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Le(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(oe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(Vt(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(Kt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(Kt(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(Kt(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(Vt(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return Kt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return Kt(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return Kt(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent($e.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const o=Math.round(t.shiftTo(e).get(e));return 1==o?`1 ${i}`:`${o} ${e}`}getCountdown(t){const e=t.diff(Hs.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Hs.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Hs.fromISO(t),o=e?Hs.fromISO(e):Hs.now();return this.getShortDuration(i,o)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=yr.find((e=>e===t));e&&ga(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Hs.fromISO(t).setLocale(this.getLocale()).toLocaleString(Hs.DATETIME_SHORT)}postJSON(t,e=""){return Qt(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const o=new FormData;return Object.keys(e).forEach((t=>{o.append(t,e[t])})),Jt(t,o,i)})(t,e,i)}postUrl(t,e="",i={},o=null){return Yt(t,e,i,o)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):Vt(t,e.controller,e.headers||{}).then((i=>new Promise(((o,n)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),o(i)):n("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,o=this.cache.get(i);return!e.force&&o?new Promise((t=>{t(o)})):new Promise((e=>{const o=this.pendingResolves[t]||[];o.push(e),this.pendingResolves[t]=o,o.length<=1&&Wt(t).then((e=>{this.cache.set(i,e);const o=this.pendingResolves[t]||[];for(;o.length>0;){o.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent($e.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const o=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let n=t;for(let t=0;t<i.length&&(n=n[i[t]],n);t++);n&&n.email&&o.add(n.email)}))}));const n=[];o.forEach((t=>{n.push(this.getUrl(`/api/v2/users.json?email=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(n).then((o=>{o.forEach((i=>{if(i&&i.json){const o=i.json.results;if(o&&1===o.length){const i=o[0];t.forEach((t=>{e.forEach((e=>{const o=e.split(".");let n=t,s=n;for(let t=0;t<o.length&&(s=n,n=n[o[t]],n);t++);if(n&&n.email===i.email){const t=s[o[o.length-1]];t.avatar=i.avatar,t.name=_r(i),s[o[o.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],o=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let n=this.cache.get(t);n&&!e.force?(n=e.prepareData?e.prepareData(n):n,this.fireCustomEvent($e.StoreUpdated,{url:t,data:n})):(e=e||{},this.fetching[t]=o,Wt(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent($e.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return V`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flow.info;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:
|
|
400
|
+
`}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Le(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(oe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(Vt(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(Kt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(Kt(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(Kt(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(Vt(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return Kt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return Kt(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return Kt(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent($e.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const o=Math.round(t.shiftTo(e).get(e));return 1==o?`1 ${i}`:`${o} ${e}`}getCountdown(t){const e=t.diff(Hs.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Hs.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Hs.fromISO(t),o=e?Hs.fromISO(e):Hs.now();return this.getShortDuration(i,o)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=yr.find((e=>e===t));e&&ga(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Hs.fromISO(t).setLocale(this.getLocale()).toLocaleString(Hs.DATETIME_SHORT)}postJSON(t,e=""){return Qt(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const o=new FormData;return Object.keys(e).forEach((t=>{o.append(t,e[t])})),Jt(t,o,i)})(t,e,i)}postUrl(t,e="",i={},o=null){return Yt(t,e,i,o)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):Vt(t,e.controller,e.headers||{}).then((i=>new Promise(((o,n)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),o(i)):n("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,o=this.cache.get(i);return!e.force&&o?new Promise((t=>{t(o)})):new Promise((e=>{const o=this.pendingResolves[t]||[];o.push(e),this.pendingResolves[t]=o,o.length<=1&&Wt(t).then((e=>{this.cache.set(i,e);const o=this.pendingResolves[t]||[];for(;o.length>0;){o.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent($e.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const o=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let n=t;for(let t=0;t<i.length&&(n=n[i[t]],n);t++);n&&n.email&&o.add(n.email)}))}));const n=[];o.forEach((t=>{n.push(this.getUrl(`/api/v2/users.json?email=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(n).then((o=>{o.forEach((i=>{if(i&&i.json){const o=i.json.results;if(o&&1===o.length){const i=o[0];t.forEach((t=>{e.forEach((e=>{const o=e.split(".");let n=t,s=n;for(let t=0;t<o.length&&(s=n,n=n[o[t]],n);t++);if(n&&n.email===i.email){const t=s[o[o.length-1]];t.avatar=i.avatar,t.name=_r(i),s[o[o.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],o=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let n=this.cache.get(t);n&&!e.force?(n=e.prepareData?e.prepareData(n):n,this.fireCustomEvent($e.StoreUpdated,{url:t,data:n})):(e=e||{},this.fetching[t]=o,Wt(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent($e.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return V`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flow.info;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:this.keyedAssets[t]||[]}getApp(){return ma}getState(){return ma.getState()}}t([ce({type:Number})],fa.prototype,"ttl",void 0),t([ce({type:Number})],fa.prototype,"max",void 0),t([ce({type:Boolean})],fa.prototype,"ready",void 0),t([ce({type:Boolean})],fa.prototype,"loader",void 0),t([ce({type:String,attribute:"completion"})],fa.prototype,"completionEndpoint",void 0),t([ce({type:String,attribute:"fields"})],fa.prototype,"fieldsEndpoint",void 0),t([ce({type:String,attribute:"groups"})],fa.prototype,"groupsEndpoint",void 0),t([ce({type:String,attribute:"globals"})],fa.prototype,"globalsEndpoint",void 0),t([ce({type:String,attribute:"languages"})],fa.prototype,"languagesEndpoint",void 0),t([ce({type:String,attribute:"workspace"})],fa.prototype,"workspaceEndpoint",void 0),t([ce({type:String,attribute:"shortcuts"})],fa.prototype,"shortcutsEndpoint",void 0),t([ce({type:Object,attribute:!1})],fa.prototype,"schema",void 0),t([ce({type:Object,attribute:!1})],fa.prototype,"fnOptions",void 0),t([ce({type:Object,attribute:!1})],fa.prototype,"keyedAssets",void 0);class va extends pe{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.internalFocusDisabled=!1,this.nameKey="name",this.loading=!1,this.hideShadow=!1,this.getName=function(t){return t[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.scrollParent=null,this.setCursor=ee((function(t){this.internalFocusDisabled||t!==this.cursorIndex&&(this.cursorIndex=t)}),50)}static get styles(){return r`
|
|
401
401
|
:host {
|
|
402
402
|
--transition-speed: 0;
|
|
403
403
|
}
|