@nyaruka/temba-components 0.111.1 → 0.111.3
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 +12 -0
- package/dist/temba-components.js +2 -2
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/dialog/Modax.js +6 -0
- package/out-tsc/src/dialog/Modax.js.map +1 -1
- package/out-tsc/src/utils/index.js +4 -1
- package/out-tsc/src/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/dialog/Modax.ts +7 -0
- package/src/utils/index.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,20 @@ 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.111.3](https://github.com/nyaruka/temba-components/compare/v0.111.2...v0.111.3)
|
|
8
|
+
|
|
9
|
+
- Add full doc redirect [`0b4330a`](https://github.com/nyaruka/temba-components/commit/0b4330a67d79262be318e5c77b5044ee413c21e3)
|
|
10
|
+
|
|
11
|
+
#### [v0.111.2](https://github.com/nyaruka/temba-components/compare/v0.111.1...v0.111.2)
|
|
12
|
+
|
|
13
|
+
> 8 November 2024
|
|
14
|
+
|
|
15
|
+
- Don't include org_id unless its in page [`7af31f5`](https://github.com/nyaruka/temba-components/commit/7af31f540bde1494a7ba646cfc5649140cf93585)
|
|
16
|
+
|
|
7
17
|
#### [v0.111.1](https://github.com/nyaruka/temba-components/compare/v0.111.0...v0.111.1)
|
|
8
18
|
|
|
19
|
+
> 7 November 2024
|
|
20
|
+
|
|
9
21
|
- Omit servicing urls [`e7136ec`](https://github.com/nyaruka/temba-components/commit/e7136ecd280f89d3347127e10d39d6db03173c3f)
|
|
10
22
|
|
|
11
23
|
#### [v0.111.0](https://github.com/nyaruka/temba-components/compare/v0.110.3...v0.111.0)
|
package/dist/temba-components.js
CHANGED
|
@@ -21,7 +21,7 @@ const k=globalThis,A=k.trustedTypes,S=A?A.createPolicy("lit-html",{createHTML:t=
|
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
23
|
*/
|
|
24
|
-
let lt=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const o=i?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=i?.renderBefore??null;o._$litPart$=n=new tt(e.insertBefore(M(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}};lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const ht=globalThis.litElementPolyfillSupport;ht?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.0.4");var ct,dt,ut,pt,mt,gt,ft,vt,bt,yt,_t,xt,wt,kt,At,St,Ct,Tt,Et=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},$t=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Ot=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},Lt="0123456789abcdef".split(""),Mt=[-2147483648,8388608,32768,128],zt=[24,16,8,0],It=[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],Pt=[];class Dt{constructor(t=!1,e=!1){ct.set(this,void 0),dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),gt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),yt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),At.set(this,void 0),St.set(this,void 0),Ct.set(this,0),Tt.set(this,void 0),this.init(t,e)}init(t,e){e?(Pt[0]=Pt[16]=Pt[1]=Pt[2]=Pt[3]=Pt[4]=Pt[5]=Pt[6]=Pt[7]=Pt[8]=Pt[9]=Pt[10]=Pt[11]=Pt[12]=Pt[13]=Pt[14]=Pt[15]=0,Et(this,dt,Pt)):Et(this,dt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Et(this,gt,3238371032),Et(this,ft,914150663),Et(this,vt,812702999),Et(this,bt,4144912697),Et(this,yt,4290775857),Et(this,_t,1750603025),Et(this,xt,1694076839),Et(this,wt,3204075428)):(Et(this,gt,1779033703),Et(this,ft,3144134277),Et(this,vt,1013904242),Et(this,bt,2773480762),Et(this,yt,1359893119),Et(this,_t,2600822924),Et(this,xt,528734635),Et(this,wt,1541459225)),Et(this,ct,Et(this,Tt,Et(this,ut,Et(this,At,0)))),Et(this,pt,Et(this,kt,!1)),Et(this,mt,!0),Et(this,St,t)}update(t){if($t(this,pt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=$t(this,dt);for(;i<o;){let t;if($t(this,kt)&&(Et(this,kt,!1),n[0]=$t(this,ct),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=$t(this,Tt);i<o&&t<64;++i)n[t>>2]|=e[i]<<zt[3&t++];else for(t=$t(this,Tt);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<zt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<zt[3&t++],n[t>>2]|=(128|o>>6&63)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<zt[3&t++],n[t>>2]|=(128|o>>12&63)<<zt[3&t++],n[t>>2]|=(128|o>>6&63)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++])}Et(this,Ct,t),Et(this,ut,$t(this,ut)+(t-$t(this,Tt))),t>=64?(Et(this,ct,n[16]),Et(this,Tt,t-64),this.hash(),Et(this,kt,!0)):Et(this,Tt,t)}return $t(this,ut)>4294967295&&(Et(this,At,$t(this,At)+($t(this,ut)/4294967296|0)),Et(this,ut,$t(this,ut)%4294967296)),this}finalize(){if($t(this,pt))return;Et(this,pt,!0);const t=$t(this,dt),e=$t(this,Ct);t[16]=$t(this,ct),t[e>>2]|=Mt[3&e],Et(this,ct,t[16]),e>=56&&($t(this,kt)||this.hash(),t[0]=$t(this,ct),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]=$t(this,At)<<3|$t(this,ut)>>>29,t[15]=$t(this,ut)<<3,this.hash()}hash(){let t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt);const l=$t(this,dt);let h,c,d,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],h=(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]+h+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)$t(this,mt)?($t(this,St)?(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),Et(this,mt,!1)):(h=(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,d=g^t&i^b,m=n&s^~n&r,u=a+c+m+It[y]+l[y],p=h+d,a=o+u|0,o=u+p|0),h=(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,d=f^o&e^g,m=a&n^~a&s,u=r+c+m+It[y+1]+l[y+1],p=h+d,r=i+u|0,i=u+p|0,h=(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,d=v^i&t^f,m=r&a^~r&n,u=s+c+m+It[y+2]+l[y+2],p=h+d,s=e+u|0,e=u+p|0,h=(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,d=b^e&o^v,m=s&r^~s&a,u=n+c+m+It[y+3]+l[y+3],p=h+d,n=t+u|0,t=u+p|0;Et(this,gt,$t(this,gt)+t|0),Et(this,ft,$t(this,ft)+e|0),Et(this,vt,$t(this,vt)+i|0),Et(this,bt,$t(this,bt)+o|0),Et(this,yt,$t(this,yt)+n|0),Et(this,_t,$t(this,_t)+s|0),Et(this,xt,$t(this,xt)+r|0),Et(this,wt,$t(this,wt)+a|0)}hex(){this.finalize();const t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt);let l=Lt[t>>28&15]+Lt[t>>24&15]+Lt[t>>20&15]+Lt[t>>16&15]+Lt[t>>12&15]+Lt[t>>8&15]+Lt[t>>4&15]+Lt[15&t]+Lt[e>>28&15]+Lt[e>>24&15]+Lt[e>>20&15]+Lt[e>>16&15]+Lt[e>>12&15]+Lt[e>>8&15]+Lt[e>>4&15]+Lt[15&e]+Lt[i>>28&15]+Lt[i>>24&15]+Lt[i>>20&15]+Lt[i>>16&15]+Lt[i>>12&15]+Lt[i>>8&15]+Lt[i>>4&15]+Lt[15&i]+Lt[o>>28&15]+Lt[o>>24&15]+Lt[o>>20&15]+Lt[o>>16&15]+Lt[o>>12&15]+Lt[o>>8&15]+Lt[o>>4&15]+Lt[15&o]+Lt[n>>28&15]+Lt[n>>24&15]+Lt[n>>20&15]+Lt[n>>16&15]+Lt[n>>12&15]+Lt[n>>8&15]+Lt[n>>4&15]+Lt[15&n]+Lt[s>>28&15]+Lt[s>>24&15]+Lt[s>>20&15]+Lt[s>>16&15]+Lt[s>>12&15]+Lt[s>>8&15]+Lt[s>>4&15]+Lt[15&s]+Lt[r>>28&15]+Lt[r>>24&15]+Lt[r>>20&15]+Lt[r>>16&15]+Lt[r>>12&15]+Lt[r>>8&15]+Lt[r>>4&15]+Lt[15&r];return $t(this,St)||(l+=Lt[a>>28&15]+Lt[a>>24&15]+Lt[a>>20&15]+Lt[a>>16&15]+Lt[a>>12&15]+Lt[a>>8&15]+Lt[a>>4&15]+Lt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt),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 $t(this,St)||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($t(this,St)?28:32),e=new DataView(t);return e.setUint32(0,$t(this,gt)),e.setUint32(4,$t(this,ft)),e.setUint32(8,$t(this,vt)),e.setUint32(12,$t(this,bt)),e.setUint32(16,$t(this,yt)),e.setUint32(20,$t(this,_t)),e.setUint32(24,$t(this,xt)),$t(this,St)||e.setUint32(28,$t(this,wt)),t}}function Nt(t){const e=new Dt;return e.update(t),parseInt(e.hex().substring(0,8),16)}ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,gt=new WeakMap,ft=new WeakMap,vt=new WeakMap,bt=new WeakMap,yt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,At=new WeakMap,St=new WeakMap,Ct=new WeakMap,Tt=new WeakMap;const Bt=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 Rt="/api/v2/media.json",qt=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=Nt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Ot)}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 Bt.apply(this,e)}hex(t){var e,i=this.rgb(t);return e="#",i.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}};var Ft;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(Ft||(Ft={}));const Ut=(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)},Vt=(t={})=>{let e=(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(!e){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(e=t.value)}const i=e?{"X-CSRFToken":e}:{};return i["X-Temba-Org"]=window.org_id,i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete i["X-Temba-Org"],i[e]=t[e]})),i},Zt=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:Vt(i)};e&&(s.signal=e.signal),fetch(t,s).then((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)}))})),jt=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()},Ht=(t,e=null,i={})=>new Promise(((o,n)=>{Zt(t,e,i).then((t=>{o({results:t.json.results,next:t.json.next})})).catch((t=>n(t)))})),Wt=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],o=t;for(;o;){const t=await Ht(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},Gt=t=>new Promise(((e,i)=>{Zt(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Yt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Gt(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Qt=(t,e,i={},o=null)=>{const n=Vt(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)}))}))},Kt=(t,e)=>Qt(t,JSON.stringify(e),!1,"application/json"),Jt=(t,e,i={})=>new Promise(((o,n)=>{Qt(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===Rt?e:"Server failure")})).catch((t=>{console.error(t),n(t)}))})),Xt=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:Xt(e):null}return null},te=(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)}},ee=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},ie=(t,e="and")=>1===t.length?t[0]:2===t.length?"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" "):"object"==typeof t[0]?t.map(((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`)):t.join(", ")+e+t[t.length-1],oe=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};var ne;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(ne||(ne={}));const se=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),re=t=>{t&&(t.stopPropagation(),t.preventDefault())},ae=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()},le=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},he=t=>{t.position||(t.position="right");let e=t.name;t.user&&t.user.first_name&&t.user.last_name&&(e=`${t.user.first_name} ${t.user.last_name}`);let i="",o="";t.user&&t.user.avatar?o=`url('${t.user.avatar}') center / contain no-repeat`:e&&(o=qt.hex(e),i=ae(e));return Z`
|
|
24
|
+
let lt=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const o=i?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=i?.renderBefore??null;o._$litPart$=n=new tt(e.insertBefore(M(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}};lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const ht=globalThis.litElementPolyfillSupport;ht?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.0.4");var ct,dt,ut,pt,mt,gt,ft,vt,bt,yt,_t,xt,wt,kt,At,St,Ct,Tt,Et=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},$t=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Ot=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},Lt="0123456789abcdef".split(""),Mt=[-2147483648,8388608,32768,128],zt=[24,16,8,0],It=[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],Pt=[];class Dt{constructor(t=!1,e=!1){ct.set(this,void 0),dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),gt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),yt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),At.set(this,void 0),St.set(this,void 0),Ct.set(this,0),Tt.set(this,void 0),this.init(t,e)}init(t,e){e?(Pt[0]=Pt[16]=Pt[1]=Pt[2]=Pt[3]=Pt[4]=Pt[5]=Pt[6]=Pt[7]=Pt[8]=Pt[9]=Pt[10]=Pt[11]=Pt[12]=Pt[13]=Pt[14]=Pt[15]=0,Et(this,dt,Pt)):Et(this,dt,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Et(this,gt,3238371032),Et(this,ft,914150663),Et(this,vt,812702999),Et(this,bt,4144912697),Et(this,yt,4290775857),Et(this,_t,1750603025),Et(this,xt,1694076839),Et(this,wt,3204075428)):(Et(this,gt,1779033703),Et(this,ft,3144134277),Et(this,vt,1013904242),Et(this,bt,2773480762),Et(this,yt,1359893119),Et(this,_t,2600822924),Et(this,xt,528734635),Et(this,wt,1541459225)),Et(this,ct,Et(this,Tt,Et(this,ut,Et(this,At,0)))),Et(this,pt,Et(this,kt,!1)),Et(this,mt,!0),Et(this,St,t)}update(t){if($t(this,pt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=$t(this,dt);for(;i<o;){let t;if($t(this,kt)&&(Et(this,kt,!1),n[0]=$t(this,ct),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=$t(this,Tt);i<o&&t<64;++i)n[t>>2]|=e[i]<<zt[3&t++];else for(t=$t(this,Tt);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<zt[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<zt[3&t++],n[t>>2]|=(128|o>>6&63)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<zt[3&t++],n[t>>2]|=(128|o>>12&63)<<zt[3&t++],n[t>>2]|=(128|o>>6&63)<<zt[3&t++],n[t>>2]|=(128|63&o)<<zt[3&t++])}Et(this,Ct,t),Et(this,ut,$t(this,ut)+(t-$t(this,Tt))),t>=64?(Et(this,ct,n[16]),Et(this,Tt,t-64),this.hash(),Et(this,kt,!0)):Et(this,Tt,t)}return $t(this,ut)>4294967295&&(Et(this,At,$t(this,At)+($t(this,ut)/4294967296|0)),Et(this,ut,$t(this,ut)%4294967296)),this}finalize(){if($t(this,pt))return;Et(this,pt,!0);const t=$t(this,dt),e=$t(this,Ct);t[16]=$t(this,ct),t[e>>2]|=Mt[3&e],Et(this,ct,t[16]),e>=56&&($t(this,kt)||this.hash(),t[0]=$t(this,ct),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]=$t(this,At)<<3|$t(this,ut)>>>29,t[15]=$t(this,ut)<<3,this.hash()}hash(){let t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt);const l=$t(this,dt);let h,c,d,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],h=(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]+h+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)$t(this,mt)?($t(this,St)?(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),Et(this,mt,!1)):(h=(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,d=g^t&i^b,m=n&s^~n&r,u=a+c+m+It[y]+l[y],p=h+d,a=o+u|0,o=u+p|0),h=(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,d=f^o&e^g,m=a&n^~a&s,u=r+c+m+It[y+1]+l[y+1],p=h+d,r=i+u|0,i=u+p|0,h=(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,d=v^i&t^f,m=r&a^~r&n,u=s+c+m+It[y+2]+l[y+2],p=h+d,s=e+u|0,e=u+p|0,h=(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,d=b^e&o^v,m=s&r^~s&a,u=n+c+m+It[y+3]+l[y+3],p=h+d,n=t+u|0,t=u+p|0;Et(this,gt,$t(this,gt)+t|0),Et(this,ft,$t(this,ft)+e|0),Et(this,vt,$t(this,vt)+i|0),Et(this,bt,$t(this,bt)+o|0),Et(this,yt,$t(this,yt)+n|0),Et(this,_t,$t(this,_t)+s|0),Et(this,xt,$t(this,xt)+r|0),Et(this,wt,$t(this,wt)+a|0)}hex(){this.finalize();const t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt);let l=Lt[t>>28&15]+Lt[t>>24&15]+Lt[t>>20&15]+Lt[t>>16&15]+Lt[t>>12&15]+Lt[t>>8&15]+Lt[t>>4&15]+Lt[15&t]+Lt[e>>28&15]+Lt[e>>24&15]+Lt[e>>20&15]+Lt[e>>16&15]+Lt[e>>12&15]+Lt[e>>8&15]+Lt[e>>4&15]+Lt[15&e]+Lt[i>>28&15]+Lt[i>>24&15]+Lt[i>>20&15]+Lt[i>>16&15]+Lt[i>>12&15]+Lt[i>>8&15]+Lt[i>>4&15]+Lt[15&i]+Lt[o>>28&15]+Lt[o>>24&15]+Lt[o>>20&15]+Lt[o>>16&15]+Lt[o>>12&15]+Lt[o>>8&15]+Lt[o>>4&15]+Lt[15&o]+Lt[n>>28&15]+Lt[n>>24&15]+Lt[n>>20&15]+Lt[n>>16&15]+Lt[n>>12&15]+Lt[n>>8&15]+Lt[n>>4&15]+Lt[15&n]+Lt[s>>28&15]+Lt[s>>24&15]+Lt[s>>20&15]+Lt[s>>16&15]+Lt[s>>12&15]+Lt[s>>8&15]+Lt[s>>4&15]+Lt[15&s]+Lt[r>>28&15]+Lt[r>>24&15]+Lt[r>>20&15]+Lt[r>>16&15]+Lt[r>>12&15]+Lt[r>>8&15]+Lt[r>>4&15]+Lt[15&r];return $t(this,St)||(l+=Lt[a>>28&15]+Lt[a>>24&15]+Lt[a>>20&15]+Lt[a>>16&15]+Lt[a>>12&15]+Lt[a>>8&15]+Lt[a>>4&15]+Lt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=$t(this,gt),e=$t(this,ft),i=$t(this,vt),o=$t(this,bt),n=$t(this,yt),s=$t(this,_t),r=$t(this,xt),a=$t(this,wt),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 $t(this,St)||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($t(this,St)?28:32),e=new DataView(t);return e.setUint32(0,$t(this,gt)),e.setUint32(4,$t(this,ft)),e.setUint32(8,$t(this,vt)),e.setUint32(12,$t(this,bt)),e.setUint32(16,$t(this,yt)),e.setUint32(20,$t(this,_t)),e.setUint32(24,$t(this,xt)),$t(this,St)||e.setUint32(28,$t(this,wt)),t}}function Nt(t){const e=new Dt;return e.update(t),parseInt(e.hex().substring(0,8),16)}ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,gt=new WeakMap,ft=new WeakMap,vt=new WeakMap,bt=new WeakMap,yt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,At=new WeakMap,St=new WeakMap,Ct=new WeakMap,Tt=new WeakMap;const Bt=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 Rt="/api/v2/media.json",qt=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=Nt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Ot)}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 Bt.apply(this,e)}hex(t){var e,i=this.rgb(t);return e="#",i.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}};var Ft;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(Ft||(Ft={}));const Ut=(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)},Vt=(t={})=>{let e=(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(!e){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(e=t.value)}const i=e?{"X-CSRFToken":e}:{},o=window.org_id;return o&&(i["X-Temba-Org"]=o),i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete i["X-Temba-Org"],i[e]=t[e]})),i},Zt=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:Vt(i)};e&&(s.signal=e.signal),fetch(t,s).then((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)}))})),jt=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()},Ht=(t,e=null,i={})=>new Promise(((o,n)=>{Zt(t,e,i).then((t=>{o({results:t.json.results,next:t.json.next})})).catch((t=>n(t)))})),Wt=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],o=t;for(;o;){const t=await Ht(o,null,e);t.results&&(i=i.concat(t.results)),o=t.next}return i},Gt=t=>new Promise(((e,i)=>{Zt(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Yt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Gt(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Qt=(t,e,i={},o=null)=>{const n=Vt(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)}))}))},Kt=(t,e)=>Qt(t,JSON.stringify(e),!1,"application/json"),Jt=(t,e,i={})=>new Promise(((o,n)=>{Qt(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===Rt?e:"Server failure")})).catch((t=>{console.error(t),n(t)}))})),Xt=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:Xt(e):null}return null},te=(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)}},ee=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},ie=(t,e="and")=>1===t.length?t[0]:2===t.length?"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" "):"object"==typeof t[0]?t.map(((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`)):t.join(", ")+e+t[t.length-1],oe=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};var ne;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(ne||(ne={}));const se=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),re=t=>{t&&(t.stopPropagation(),t.preventDefault())},ae=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()},le=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},he=t=>{t.position||(t.position="right");let e=t.name;t.user&&t.user.first_name&&t.user.last_name&&(e=`${t.user.first_name} ${t.user.last_name}`);let i="",o="";t.user&&t.user.avatar?o=`url('${t.user.avatar}') center / contain no-repeat`:e&&(o=qt.hex(e),i=ae(e));return Z`
|
|
25
25
|
<div
|
|
26
26
|
style="display:flex; flex-direction: column; align-items:center;transform:scale(${t.scale||1});"
|
|
27
27
|
>
|
|
@@ -1420,7 +1420,7 @@ let br=Ks,yr=!1;const _r=["es","fr","pt"],{setLocale:xr}=(t=>(function(t){if(yr)
|
|
|
1420
1420
|
flex-direction: row;
|
|
1421
1421
|
margin-left: 0.6em;
|
|
1422
1422
|
}
|
|
1423
|
-
`}handleSlotClicked(){this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):this.setBody(""))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return Z`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:ml.SECONDARY,name:"Cancel",closes:!0},{type:ml.PRIMARY,name:t.value}]:[{type:ml.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=$r(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),Zt(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?document.location=t.url:(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Le.Loaded,{body:this.getBody()})})))}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),Qt(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("temba-success")
|
|
1423
|
+
`}handleSlotClicked(){this.open=!0}updated(t){if(super.updated(t),t.has("open")&&(this.open?this.fetchForm():void 0!==t.get("open")&&(this.open?window.setTimeout((()=>{this.body=this.getLoading(),this.submitting=!1}),500):this.setBody(""))),t.has("body")&&this.open&&this.body&&!this.fetching){this.shadowRoot.querySelector("temba-dialog").focusFirstInput()}}getLoading(){return Z`<temba-loading units="6" size="8"></temba-loading>`}updatePrimaryButton(){const t=this.shadowRoot.querySelector("#wizard-form");t&&(this.wizardStep=parseInt(t.dataset.step),this.wizardStepCount=parseInt(t.dataset.steps)),this.noSubmit||this.updateComplete.then((()=>{const t=this.shadowRoot.querySelector("input[type='submit'],button[type='submit']");this.buttons=t?[{type:ml.SECONDARY,name:"Cancel",closes:!0},{type:ml.PRIMARY,name:t.value}]:[{type:ml.SECONDARY,name:"Ok",closes:!0}],this.submitting=!1}))}setBody(t){const e=this.shadowRoot.querySelector(".scripts");for(const t of e.children)t.remove();const i=this.ownerDocument.createElement("div");i.innerHTML=t;const o=i.getElementsByTagName("script"),n=[];for(let t=o.length-1;t>=0;t--){const e=this.ownerDocument.createElement("script"),i=o[t].innerText;o[t].src&&-1===o[t].src.indexOf("web-dev-server")?(e.src=o[t].src,e.type="text/javascript",e.async=!0,e.onload=function(){},n.push(e)):i&&(e.appendChild(this.ownerDocument.createTextNode(i)),n.push(e)),o[t].remove()}const s=!!i.querySelector(".success-script");return s||(this.body=$r(i.innerHTML)),this.updateComplete.then((()=>{for(const t of n)e.appendChild(t)})),!s}getHeaders(){const t=this.headers;return t["X-PJAX"]=1,t}fetchForm(){this.fetching=!0,this.body=this.getLoading(),Zt(this.endpoint,null,this.getHeaders()).then((t=>{0==t.body.indexOf("<!DOCTYPE HTML>")?(this.open=!1,document.location=t.url):(this.setBody(t.body),this.fetching=!1,this.updateComplete.then((()=>{this.updatePrimaryButton(),this.fireCustomEvent(Le.Loaded,{body:this.getBody()})})))}))}submit(t={}){this.submitting=!0;const e=this.shadowRoot.querySelector("form");let i=e?function(t){const e=[];for(let i=0;i<t.elements.length;i++){const o=t.elements[i];if(o.name&&!o.disabled&&"file"!==o.type&&"reset"!==o.type&&"submit"!==o.type&&"button"!==o.type)if("select-multiple"===o.type)for(let t=0;t<o.options.length;t++)o.options[t].selected&&o.options[t].value&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(o.options[t].value));else if("checkbox"!==o.type&&"radio"!==o.type||o.checked){let t=o.value;!t&&o.checked&&(t="1"),t&&e.push(encodeURIComponent(o.name)+"="+encodeURIComponent(t))}}return e.join("&")}(e):"";t&&Object.keys(t).forEach((e=>{i+=(i.length>1?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t[e])})),Qt(this.endpoint,i,this.getHeaders(),"application/x-www-form-urlencoded").then((t=>{window.setTimeout((()=>{let e=t.headers.get("temba-success");if(!e&&t.url&&-1===t.url.indexOf(this.endpoint)&&(e=t.url),e)"hide"===e?this.updateComplete.then((()=>{this.open=!1,this.fireCustomEvent(Le.Submitted)})):(this.fireCustomEvent(Le.Redirected,{url:e}),this.open=!1);else{if(0==t.body.indexOf("<!DOCTYPE HTML>"))return this.open=!1,void(document.location=t.url);this.setBody(t.body)&&this.updateComplete.then((()=>{this.updatePrimaryButton()}))}}),1e3)})).catch((t=>{console.error(t)}))}handleDialogClick(t){const e=t.detail.button,i=t.detail.detail;e.disabled||e.submitting||(e.primary||e.destructive)&&(this.suspendSubmit||this.submit()),i.closes&&(this.open=!1,this.fetching=!1,this.cancelName=void 0)}handleDialogHidden(){this.open=!1,this.fetching=!1}isDestructive(){return this.endpoint&&(this.endpoint.indexOf("delete")>-1||this.endpoint.indexOf("interrupt")>-1)}handleGotoStep(t){const e=t.target.dataset.gotoStep;e&&this.submit({wizard_goto_step:e})}getBody(){return this.shadowRoot.querySelector(".modax-body")}render(){const t=[],e=this.shadowRoot.querySelector("#wizard-form");if(e){const i=(e.getAttribute("data-completed")||"").split(",").filter((t=>t.length>0));for(let e=0;e<this.wizardStepCount;e++)t.push(Z`<div
|
|
1424
1424
|
data-goto-step=${i[e]}
|
|
1425
1425
|
@click=${this.handleGotoStep.bind(this)}
|
|
1426
1426
|
class="${jt({"step-ball":!0,active:this.wizardStep-1===e,complete:e<i.length})}"
|