@epam/statgpt-conversation-view 0.4.0-rc.17 → 0.4.0-rc.18

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.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +7 -2
  3. package/package.json +6 -6
package/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  `).split(`
5
5
  `).map(s=>s.replace(xi," ").trim()).filter(Boolean)[0]??"";return(t.length>As?t.substring(0,As):t).trim()},yi=(e,t,n,s,a,i)=>{const l=`${e}/${t}`;return{name:n,folderId:l,prompt:a,id:se.generateConversationId({folderId:l,name:n}),messages:[{role:me.Role.Assistant,content:s}],custom_fields:{configuration:{choice:i}}}};var Di=Object.defineProperty,Pt=Object.getOwnPropertySymbols,ba=Object.prototype.hasOwnProperty,Sa=Object.prototype.propertyIsEnumerable,js=(e,t,n)=>t in e?Di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tn=(e,t)=>{for(var n in t||(t={}))ba.call(t,n)&&js(e,n,t[n]);if(Pt)for(var n of Pt(t))Sa.call(t,n)&&js(e,n,t[n]);return e},nn=(e,t)=>{var n={};for(var s in e)ba.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Pt)for(var s of Pt(e))t.indexOf(s)<0&&Sa.call(e,s)&&(n[s]=e[s]);return n};var qe;(e=>{const t=class ne{constructor(o,u,c,m){if(this.version=o,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],o<ne.MIN_VERSION||o>ne.MAX_VERSION)throw new RangeError("Version value out of range");if(m<-1||m>7)throw new RangeError("Mask value out of range");this.size=o*4+17;let h=[];for(let p=0;p<this.size;p++)h.push(!1);for(let p=0;p<this.size;p++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(c);if(this.drawCodewords(g),m==-1){let p=1e9;for(let x=0;x<8;x++){this.applyMask(x),this.drawFormatBits(x);const w=this.getPenaltyScore();w<p&&(m=x,p=w),this.applyMask(x)}}a(0<=m&&m<=7),this.mask=m,this.applyMask(m),this.drawFormatBits(m),this.isFunction=[]}static encodeText(o,u){const c=e.QrSegment.makeSegments(o);return ne.encodeSegments(c,u)}static encodeBinary(o,u){const c=e.QrSegment.makeBytes(o);return ne.encodeSegments([c],u)}static encodeSegments(o,u,c=1,m=40,h=-1,g=!0){if(!(ne.MIN_VERSION<=c&&c<=m&&m<=ne.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let p,x;for(p=c;;p++){const C=ne.getNumDataCodewords(p,u)*8,v=l.getTotalBits(o,p);if(v<=C){x=v;break}if(p>=m)throw new RangeError("Data too long")}for(const C of[ne.Ecc.MEDIUM,ne.Ecc.QUARTILE,ne.Ecc.HIGH])g&&x<=ne.getNumDataCodewords(p,C)*8&&(u=C);let w=[];for(const C of o){n(C.mode.modeBits,4,w),n(C.numChars,C.mode.numCharCountBits(p),w);for(const v of C.getData())w.push(v)}a(w.length==x);const b=ne.getNumDataCodewords(p,u)*8;a(w.length<=b),n(0,Math.min(4,b-w.length),w),n(0,(8-w.length%8)%8,w),a(w.length%8==0);for(let C=236;w.length<b;C^=253)n(C,8,w);let y=[];for(;y.length*8<w.length;)y.push(0);return w.forEach((C,v)=>y[v>>>3]|=C<<7-(v&7)),new ne(p,u,y,h)}getModule(o,u){return 0<=o&&o<this.size&&0<=u&&u<this.size&&this.modules[u][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const o=this.getAlignmentPatternPositions(),u=o.length;for(let c=0;c<u;c++)for(let m=0;m<u;m++)c==0&&m==0||c==0&&m==u-1||c==u-1&&m==0||this.drawAlignmentPattern(o[c],o[m]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){const u=this.errorCorrectionLevel.formatBits<<3|o;let c=u;for(let h=0;h<10;h++)c=c<<1^(c>>>9)*1335;const m=(u<<10|c)^21522;a(m>>>15==0);for(let h=0;h<=5;h++)this.setFunctionModule(8,h,s(m,h));this.setFunctionModule(8,7,s(m,6)),this.setFunctionModule(8,8,s(m,7)),this.setFunctionModule(7,8,s(m,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,s(m,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,s(m,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,s(m,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let o=this.version;for(let c=0;c<12;c++)o=o<<1^(o>>>11)*7973;const u=this.version<<12|o;a(u>>>18==0);for(let c=0;c<18;c++){const m=s(u,c),h=this.size-11+c%3,g=Math.floor(c/3);this.setFunctionModule(h,g,m),this.setFunctionModule(g,h,m)}}drawFinderPattern(o,u){for(let c=-4;c<=4;c++)for(let m=-4;m<=4;m++){const h=Math.max(Math.abs(m),Math.abs(c)),g=o+m,p=u+c;0<=g&&g<this.size&&0<=p&&p<this.size&&this.setFunctionModule(g,p,h!=2&&h!=4)}}drawAlignmentPattern(o,u){for(let c=-2;c<=2;c++)for(let m=-2;m<=2;m++)this.setFunctionModule(o+m,u+c,Math.max(Math.abs(m),Math.abs(c))!=1)}setFunctionModule(o,u,c){this.modules[u][o]=c,this.isFunction[u][o]=!0}addEccAndInterleave(o){const u=this.version,c=this.errorCorrectionLevel;if(o.length!=ne.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const m=ne.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],h=ne.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],g=Math.floor(ne.getNumRawDataModules(u)/8),p=m-g%m,x=Math.floor(g/m);let w=[];const b=ne.reedSolomonComputeDivisor(h);for(let C=0,v=0;C<m;C++){let M=o.slice(v,v+x-h+(C<p?0:1));v+=M.length;const T=ne.reedSolomonComputeRemainder(M,b);C<p&&M.push(0),w.push(M.concat(T))}let y=[];for(let C=0;C<w[0].length;C++)w.forEach((v,M)=>{(C!=x-h||M>=p)&&y.push(v[C])});return a(y.length==g),y}drawCodewords(o){if(o.length!=Math.floor(ne.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let m=0;m<this.size;m++)for(let h=0;h<2;h++){const g=c-h,x=(c+1&2)==0?this.size-1-m:m;!this.isFunction[x][g]&&u<o.length*8&&(this.modules[x][g]=s(o[u>>>3],7-(u&7)),u++)}}a(u==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let m;switch(o){case 0:m=(c+u)%2==0;break;case 1:m=u%2==0;break;case 2:m=c%3==0;break;case 3:m=(c+u)%3==0;break;case 4:m=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:m=c*u%2+c*u%3==0;break;case 6:m=(c*u%2+c*u%3)%2==0;break;case 7:m=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&m&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let o=0;for(let h=0;h<this.size;h++){let g=!1,p=0,x=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[h][w]==g?(p++,p==5?o+=ne.PENALTY_N1:p>5&&o++):(this.finderPenaltyAddHistory(p,x),g||(o+=this.finderPenaltyCountPatterns(x)*ne.PENALTY_N3),g=this.modules[h][w],p=1);o+=this.finderPenaltyTerminateAndCount(g,p,x)*ne.PENALTY_N3}for(let h=0;h<this.size;h++){let g=!1,p=0,x=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][h]==g?(p++,p==5?o+=ne.PENALTY_N1:p>5&&o++):(this.finderPenaltyAddHistory(p,x),g||(o+=this.finderPenaltyCountPatterns(x)*ne.PENALTY_N3),g=this.modules[w][h],p=1);o+=this.finderPenaltyTerminateAndCount(g,p,x)*ne.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let g=0;g<this.size-1;g++){const p=this.modules[h][g];p==this.modules[h][g+1]&&p==this.modules[h+1][g]&&p==this.modules[h+1][g+1]&&(o+=ne.PENALTY_N2)}let u=0;for(const h of this.modules)u=h.reduce((g,p)=>g+(p?1:0),u);const c=this.size*this.size,m=Math.ceil(Math.abs(u*20-c*10)/c)-1;return a(0<=m&&m<=9),o+=m*ne.PENALTY_N4,a(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{const o=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2;let c=[6];for(let m=this.size-7;c.length<o;m-=u)c.splice(1,0,m);return c}}static getNumRawDataModules(o){if(o<ne.MIN_VERSION||o>ne.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*o+128)*o+64;if(o>=2){const c=Math.floor(o/7)+2;u-=(25*c-10)*c-55,o>=7&&(u-=36)}return a(208<=u&&u<=29648),u}static getNumDataCodewords(o,u){return Math.floor(ne.getNumRawDataModules(o)/8)-ne.ECC_CODEWORDS_PER_BLOCK[u.ordinal][o]*ne.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let u=[];for(let m=0;m<o-1;m++)u.push(0);u.push(1);let c=1;for(let m=0;m<o;m++){for(let h=0;h<u.length;h++)u[h]=ne.reedSolomonMultiply(u[h],c),h+1<u.length&&(u[h]^=u[h+1]);c=ne.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(o,u){let c=u.map(m=>0);for(const m of o){const h=m^c.shift();c.push(0),u.forEach((g,p)=>c[p]^=ne.reedSolomonMultiply(g,h))}return c}static reedSolomonMultiply(o,u){if(o>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let m=7;m>=0;m--)c=c<<1^(c>>>7)*285,c^=(u>>>m&1)*o;return a(c>>>8==0),c}finderPenaltyCountPatterns(o){const u=o[1];a(u<=this.size*3);const c=u>0&&o[2]==u&&o[3]==u*3&&o[4]==u&&o[5]==u;return(c&&o[0]>=u*4&&o[6]>=u?1:0)+(c&&o[6]>=u*4&&o[0]>=u?1:0)}finderPenaltyTerminateAndCount(o,u,c){return o&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(o,u){u[0]==0&&(o+=this.size),u.pop(),u.unshift(o)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(f,o,u){if(o<0||o>31||f>>>o)throw new RangeError("Value out of range");for(let c=o-1;c>=0;c--)u.push(f>>>c&1)}function s(f,o){return(f>>>o&1)!=0}function a(f){if(!f)throw new Error("Assertion error")}const i=class xe{constructor(o,u,c){if(this.mode=o,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(o){let u=[];for(const c of o)n(c,8,u);return new xe(xe.Mode.BYTE,o.length,u)}static makeNumeric(o){if(!xe.isNumeric(o))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<o.length;){const m=Math.min(o.length-c,3);n(parseInt(o.substring(c,c+m),10),m*3+1,u),c+=m}return new xe(xe.Mode.NUMERIC,o.length,u)}static makeAlphanumeric(o){if(!xe.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=o.length;c+=2){let m=xe.ALPHANUMERIC_CHARSET.indexOf(o.charAt(c))*45;m+=xe.ALPHANUMERIC_CHARSET.indexOf(o.charAt(c+1)),n(m,11,u)}return c<o.length&&n(xe.ALPHANUMERIC_CHARSET.indexOf(o.charAt(c)),6,u),new xe(xe.Mode.ALPHANUMERIC,o.length,u)}static makeSegments(o){return o==""?[]:xe.isNumeric(o)?[xe.makeNumeric(o)]:xe.isAlphanumeric(o)?[xe.makeAlphanumeric(o)]:[xe.makeBytes(xe.toUtf8ByteArray(o))]}static makeEci(o){let u=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)n(o,8,u);else if(o<16384)n(2,2,u),n(o,14,u);else if(o<1e6)n(6,3,u),n(o,21,u);else throw new RangeError("ECI assignment value out of range");return new xe(xe.Mode.ECI,0,u)}static isNumeric(o){return xe.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return xe.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,u){let c=0;for(const m of o){const h=m.mode.numCharCountBits(u);if(m.numChars>=1<<h)return 1/0;c+=4+h+m.bitData.length}return c}static toUtf8ByteArray(o){o=encodeURI(o);let u=[];for(let c=0;c<o.length;c++)o.charAt(c)!="%"?u.push(o.charCodeAt(c)):(u.push(parseInt(o.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let l=i;e.QrSegment=i})(qe||(qe={}));(e=>{(t=>{const n=class{constructor(a,i){this.ordinal=a,this.formatBits=i}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(qe||(qe={}));(e=>{(t=>{const n=class{constructor(a,i){this.modeBits=a,this.numBitsCharCount=i}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(qe||(qe={}));var et=qe;var Mi={L:et.QrCode.Ecc.LOW,M:et.QrCode.Ecc.MEDIUM,Q:et.QrCode.Ecc.QUARTILE,H:et.QrCode.Ecc.HIGH},ya=128,Da="L",Ma="#FFFFFF",ka="#000000",Ta=!1,Ea=1,ki=4,Ti=0,Ei=.1;function Na(e,t=0){const n=[];return e.forEach(function(s,a){let i=null;s.forEach(function(l,f){if(!l&&i!==null){n.push(`M${i+t} ${a+t}h${f-i}v1H${i+t}z`),i=null;return}if(f===s.length-1){if(!l)return;i===null?n.push(`M${f+t},${a+t} h1v1H${f+t}z`):n.push(`M${i+t},${a+t} h${f+1-i}v1H${i+t}z`);return}l&&i===null&&(i=f)})}),n.join("")}function Aa(e,t){return e.slice().map((n,s)=>s<t.y||s>=t.y+t.h?n:n.map((a,i)=>i<t.x||i>=t.x+t.w?a:!1))}function Ni(e,t,n,s){if(s==null)return null;const a=e.length+n*2,i=Math.floor(t*Ei),l=a/t,f=(s.width||i)*l,o=(s.height||i)*l,u=s.x==null?e.length/2-f/2:s.x*l,c=s.y==null?e.length/2-o/2:s.y*l,m=s.opacity==null?1:s.opacity;let h=null;if(s.excavate){let p=Math.floor(u),x=Math.floor(c),w=Math.ceil(f+u-p),b=Math.ceil(o+c-x);h={x:p,y:x,w,h:b}}const g=s.crossOrigin;return{x:u,y:c,h:o,w:f,excavation:h,opacity:m,crossOrigin:g}}function Ai(e,t){return t!=null?Math.max(Math.floor(t),0):e?ki:Ti}function ja({value:e,level:t,minVersion:n,includeMargin:s,marginSize:a,imageSettings:i,size:l,boostLevel:f}){let o=d.useMemo(()=>{const p=(Array.isArray(e)?e:[e]).reduce((x,w)=>(x.push(...et.QrSegment.makeSegments(w)),x),[]);return et.QrCode.encodeSegments(p,Mi[t],n,void 0,void 0,f)},[e,t,n,f]);const{cells:u,margin:c,numCells:m,calculatedImageSettings:h}=d.useMemo(()=>{let g=o.getModules();const p=Ai(s,a),x=g.length+p*2,w=Ni(g,l,p,i);return{cells:g,margin:p,numCells:x,calculatedImageSettings:w}},[o,l,i,s,a]);return{qrcode:o,margin:c,cells:u,numCells:m,calculatedImageSettings:h}}var ji=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Ii=d.forwardRef(function(t,n){const s=t,{value:a,size:i=ya,level:l=Da,bgColor:f=Ma,fgColor:o=ka,includeMargin:u=Ta,minVersion:c=Ea,boostLevel:m,marginSize:h,imageSettings:g}=s,x=nn(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=x,b=nn(x,["style"]),y=g?.src,C=d.useRef(null),v=d.useRef(null),M=d.useCallback(R=>{C.current=R,typeof n=="function"?n(R):n&&(n.current=R)},[n]),[T,j]=d.useState(!1),{margin:N,cells:O,numCells:k,calculatedImageSettings:E}=ja({value:a,level:l,minVersion:c,boostLevel:m,includeMargin:u,marginSize:h,imageSettings:g,size:i});d.useEffect(()=>{if(C.current!=null){const R=C.current,L=R.getContext("2d");if(!L)return;let P=O;const U=v.current,G=E!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;G&&E.excavation!=null&&(P=Aa(O,E.excavation));const J=window.devicePixelRatio||1;R.height=R.width=i*J;const te=i/k*J;L.scale(te,te),L.fillStyle=f,L.fillRect(0,0,k,k),L.fillStyle=o,ji?L.fill(new Path2D(Na(P,N))):O.forEach(function(q,W){q.forEach(function(ie,fe){ie&&L.fillRect(fe+N,W+N,1,1)})}),E&&(L.globalAlpha=E.opacity),G&&L.drawImage(U,E.x+N,E.y+N,E.w,E.h)}}),d.useEffect(()=>{j(!1)},[y]);const A=tn({height:i,width:i},w);let I=null;return y!=null&&(I=d.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{j(!0)},ref:v,crossOrigin:E?.crossOrigin})),d.createElement(d.Fragment,null,d.createElement("canvas",tn({style:A,height:i,width:i,ref:M,role:"img"},b)),I)});Ii.displayName="QRCodeCanvas";var Ia=d.forwardRef(function(t,n){const s=t,{value:a,size:i=ya,level:l=Da,bgColor:f=Ma,fgColor:o=ka,includeMargin:u=Ta,minVersion:c=Ea,boostLevel:m,title:h,marginSize:g,imageSettings:p}=s,x=nn(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:b,numCells:y,calculatedImageSettings:C}=ja({value:a,level:l,minVersion:c,boostLevel:m,includeMargin:u,marginSize:g,imageSettings:p,size:i});let v=b,M=null;p!=null&&C!=null&&(C.excavation!=null&&(v=Aa(b,C.excavation)),M=d.createElement("image",{href:p.src,height:C.h,width:C.w,x:C.x+w,y:C.y+w,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const T=Na(v,w);return d.createElement("svg",tn({height:i,width:i,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},x),!!h&&d.createElement("title",null,h),d.createElement("path",{fill:f,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),d.createElement("path",{fill:o,d:T,shapeRendering:"crispEdges"}),M)});Ia.displayName="QRCodeSVG";const Li=(e,t)=>({invitationType:se.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...t]}),Pi=e=>{const t=e?.invitationLink?.split("/").at(-1)||"";return`/${$.SHARE_CONVERSATION_ROUTE}/${t}`},Ri=(e,t)=>t?.find(n=>{const s=e?.id?.split("/")?.pop(),a=n?.url?.split("/")?.pop()||"";return a===s||decodeURI(a)===s}),Oi=e=>e?.messages?.filter(n=>!!n?.custom_content?.attachments)?.flatMap(n=>n?.custom_content?.attachments?.map(s=>({url:s?.url||""}))||[])?.filter(n=>!!n?.url)||[],_i=({conversation:e,locale:t,onCloseModal:n,modalDividers:s,getConversation:a,generateConversationLink:i,chatExpiration:l,chatExpirationDays:f,close:o,chatWarning:u,shareLink:c,shareCopyLink:m,shareCopiedLink:h,shareDescription:g,shareRemoveAccessToUsers:p,chatName:x,getSharedConversations:w,revokeSharedConversations:b,baseUrl:y,id:C,clientSharedPage:v,clientSharedProp:M})=>{const[T,j]=d.useState(null),[N,O]=d.useState(),[k,E]=d.useState(!1),[A,I]=d.useState(!1),[R,L]=d.useState(),P=d.useMemo(()=>{const q=y||window.location.origin;if(y&&y!==window.location.origin&&v&&M){const W=T?.split(`/${$.SHARE_CONVERSATION_ROUTE}/`)?.[1];return`${q}/${v}?${M}=${W}`}return`${q}/${t}${T}`},[y,T,t,v,M]);d.useEffect(()=>{(async()=>{try{const W=decodeURI(e?e?.id:`${C?.[0]}/${t}/${C?.[1]}`),ie=`${decodeURI(W)}`,fe=await a?.(ie),H=Li(W,Oi(fe)),Z=await i?.(H),Q=await w?.(se.getSharedConversationsRequest(se.ShareTarget.OTHERS));Z&&Q&&(E(!0),j(Pi(Z)),O(Ri(e,Q?.resources)))}catch(W){E(!1),console.error("Error sharing conversation",W)}})()},[e,i,a,w,C,t]);const U=d.useCallback(()=>{n(),j(null),E(!1),I(!1)},[n]),G=d.useCallback(()=>{I(!0),navigator.clipboard.writeText(P||"")},[P]),J=async()=>{try{L(!0),N&&await b?.({resources:[N]})}catch(q){L(!1),console.error("Error revoking shared conversation",q)}},te=d.useCallback(()=>r.jsx(S.Button,{buttonClassName:A?"text-button-secondary":"text-button-primary",iconBefore:A?r.jsx(Me.IconCheck,{width:20,height:20}):r.jsx(Me.IconCopy,{width:20,height:20}),title:A?h??"Copied":m??"Copy link",disabled:A,onClick:G}),[A,G,h,m]);return r.jsxs(S.Popup,{heading:c??"Share link",portalId:"share",size:S.PopUpSize.SM,dividers:s,onClose:U,closeButtonTitle:o??"Close",children:[k?r.jsxs("div",{className:"share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0",children:[e?.name?r.jsxs("div",{className:"share-info flex w-full",children:[r.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:x??"Chat name:"}),r.jsx("h3",{className:"min-w-0 flex-1 truncate",title:e?.name,children:e?.name})]}):null,r.jsxs("div",{className:"share-info flex",children:[r.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:l??"Link expiration date:"}),r.jsxs("h3",{children:["3 ",f??"days"]})]}),r.jsx(Ia,{className:"min-h-[200px] self-center rounded border border-neutrals-600 p-2",value:P,size:200}),r.jsx("p",{className:"body-2 text-neutrals-1000",children:g??"Your name, special instructions, and any messages you add after sharing remain confidential."}),r.jsx(S.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:P,value:P,inputId:"conversationLink",iconAfterInput:te()})]}):r.jsx("div",{className:"flex items-center justify-center p-6",children:r.jsx(S.Loader,{})}),k?e&&N?r.jsx("div",{className:"remove-access",children:r.jsx(S.Button,{title:p??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:R,onClick:J})}):r.jsx("p",{className:"body-2 share-footer text-neutrals-800",children:u??"This chat has not been shared with anyone yet."}):r.jsx("div",{})]})},La=({shareButtonClass:e,shareIcon:t,...n})=>{const[s,a]=d.useState(S.PopUpState.Closed),i=()=>{a(S.PopUpState.Opened)},l=d.useCallback(()=>{a(S.PopUpState.Closed)},[]);return r.jsxs(r.Fragment,{children:[r.jsx(S.Button,{buttonClassName:e||"text-button-secondary",title:n?.share||"Share",iconBefore:t,onClick:i}),s===S.PopUpState.Opened&&r.jsx(_i,{onCloseModal:l,...n})]})},Pa=({conversation:e,locale:t,isOpenedAdvancedView:n,isShowShareButton:s,shareConversationProps:a})=>r.jsx(r.Fragment,{children:r.jsxs("header",{className:V("bg-white border-b px-6 py-2 border-gray-200 flex justify-between items-center sm:hidden","conversation-view-header"),children:[r.jsx("span",{className:V("flex-1 min-w-0 truncate h4","conversation-view-header-text"),title:e?.name,children:e?.name}),r.jsx("div",{className:"flex gap-4",children:!n&&s&&r.jsx("div",{className:"flex gap-x-2",children:r.jsx(La,{conversation:e,locale:t,...a})})})]})}),Ra=({content:e,textColorClass:t})=>{const{isOpenedAdvancedView:n}=Ee();return r.jsx("div",{className:V("prose max-w-none break-words",n?"body-2":"body-1",t),children:r.jsx(ua,{remarkPlugins:[fa],components:{strong:s=>r.jsx("strong",{className:t,...s}),a:({href:s,children:a,...i})=>r.jsx("a",{href:s,target:"_blank",rel:"noreferrer",...i,children:a})},children:e})})},Oa=({choiceButtons:e,disabled:t,onClick:n})=>{const s=V("flex w-full min-h-[72px] flex-col items-start justify-center rounded border px-4 py-2 text-left","border-hues-200 hover:bg-hues-100","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent");return e.map(a=>r.jsx("div",{className:"mt-4",children:r.jsxs("button",{type:"button",className:s,disabled:t,onClick:()=>n(a[me.DialSchemaProperties.DialWidgetOptions]?.populateText,a?.const),"aria-label":"button",children:[r.jsx("h3",{className:"mb-1",children:a.title}),a.const!==Vt.COMPLETE&&r.jsx("p",{className:"body-1 text-neutrals-800",children:a[me.DialSchemaProperties.DialWidgetOptions]?.populateText})]})},a.title))},Fi=({titles:e,messageContent:t,choiceButtons:n,disabled:s,onClick:a,handleOnboardingSkip:i})=>r.jsxs("div",{className:"onboarding flex size-full flex-1 flex-col overflow-auto",children:[r.jsx(Pa,{conversation:{name:e?.onboardingTitle??"Introducing the AI assistant"}}),r.jsxs("div",{className:"onboarding-content flex flex-col",children:[r.jsx(Ra,{content:t}),r.jsx("div",{className:"mt-4",children:r.jsx(Oa,{choiceButtons:n,disabled:s,onClick:a})}),r.jsxs("div",{className:"mt-8 flex",children:[r.jsx(S.Button,{title:e?.skipOnboardingNow,buttonClassName:"text-button-secondary mr-4",disabled:s,onClick:()=>i?.(),isSmallButton:!0}),r.jsx(S.Button,{title:e?.refuseOnboarding,buttonClassName:"text-button-tertiary",disabled:s,onClick:()=>i?.(!0),isSmallButton:!0})]})]})]}),_a=({titles:e,openNewConversation:t})=>r.jsxs("div",{className:"body-3 bg-accent-300 p-2 text-center",children:[r.jsx("span",{className:"mr-2 text-neutrals-900",children:e?.onboardingFooter}),r.jsxs("span",{onClick:t,className:"inline-flex cursor-pointer align-top",children:[r.jsx(Me.IconPlus,{width:15,height:15}),r.jsx("p",{className:"ml-1",children:e?.onboardingFooterLink})]})]}),Fa=({firstLine:e,secondLine:t})=>{const n=e!=null&&e.trim()!=="",s=t!=null&&t.trim()!=="";return r.jsxs("div",{className:V("text-center body-3",s?"p-0":n?"p-1":"p-3"),children:[n&&r.jsx("div",{className:"text-neutrals-800",children:e}),s&&r.jsx("div",{className:"text-neutrals-800",children:t})]})},Vi=({suggestionsList:e,welcomeText:t,titleIcon:n,actions:s,titles:a,inputMessageStyles:i,isBottomInputPosition:l,prompt:f,onboardingMessageSchema:o,handleConversationClick:u,setConversations:c,locale:m,setSharedConversations:h})=>{const[g,p]=d.useState(null),[x,w]=d.useState(!0),[b,y]=d.useState(!1),{onboardingFileSchema:C,onboardingFileName:v,onboardingFilePath:M,isShowOnboarding:T,setIsShowOnboarding:j,setOnboardingFileSchema:N}=Ae(),{isAgentAvailable:O}=S.useAgentAvailability(),{statusMessages:k}=dn();d.useEffect(()=>{(async()=>{try{const L=await s.getBucket();p(L.bucket)}catch(L){console.error(L instanceof Error?L.message:"Request error")}finally{w(!1)}})()},[s]);const E=d.useCallback(async(R,L)=>{if(!g){console.error("No bucket");return}y(!0);try{const P=T?yi(g,m,a?.onboardingTitle??"Introducing the AI assistant",o?.properties?.choice?.description??"",R,L):bi(g,m,a.newChat??"New chat",R),U=await s.createConversation(P,m,T),G=await s.getConversations(m),J=await s.getSharedConversations(se.getSharedConversationsRequest(se.ShareTarget.ME));if(o&&C){const te={...C,isStarted:!0};await s.putOnboardingFile?.(v,M,te),N?.(te)}c($.cleanConversationNames(G)),h($.cleanConversationNames(ci.transformSharedConversations(J,m))),u(U.folderId,U.id)}catch(P){console.error(P instanceof Error?P.message:"Creation conversation failed"),y(!1)}},[s,g,u,T,m,v,M,C,o,c,N,h,a.newChat,a?.onboardingTitle]),A=d.useCallback(async R=>{if(j(!1),R&&C){const L={...C,isSkipped:!0};await s.putOnboardingFile?.(v,M,L),N?.(L)}},[s,v,M,C,j,N]);d.useEffect(()=>{f&&g&&E(f)},[g,f]);const I=()=>{const R=!g;return O?r.jsxs(r.Fragment,{children:[r.jsx(xa,{containerClasses:V(i.inputContainerClass,l&&"order-3 mt-auto"),inputClasses:"mr-2",disabled:R,placeholder:a?.askAnything??"Ask anything...",sendMessageIcon:i.sendMessageIcon,onSendMessage:E}),r.jsx("div",{className:"no-scrollbar max-w-full overflow-x-auto",children:r.jsx("div",{className:V("flex flex-wrap justify-center gap-2 sm:flex-nowrap","tags-container"),children:e.map(L=>r.jsx(S.Tag,{title:L.title,text:L[me.DialSchemaProperties.DialWidgetOptions]?.populateText,disabled:R,onClick:E},L.title))})})]}):r.jsx(S.InlineAlert,{type:S.InlineAlertType.Error,children:k.assistantUnavailable})};return r.jsxs("div",{className:"flex size-full flex-col",children:[b||f&&x?r.jsx(S.Loader,{}):T?r.jsx(Fi,{titles:a,messageContent:o?.properties?.choice?.description||"",choiceButtons:o?.properties?.choice?.oneOf||[],disabled:!g,handleOnboardingSkip:A,onClick:E}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center sm:px-4",children:[r.jsxs("div",{className:V("flex items-center max-w-full sm-min:px-4",l?"mt-auto mb-8":"mb-6"),children:[n,r.jsx("h1",{className:"sm:h2 text-center text-hues-800",children:t??a?.welcomeTitle??"How can I help you?"})]}),I()]}),T&&r.jsx(_a,{titles:a,openNewConversation:()=>j(!1)}),!T&&r.jsx(Fa,{firstLine:a.footerFirstLine,secondLine:a.footerSecondLine})]})},un=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M11.3301 6.25L8.00008 9.75L4.67008 6.25L11.3301 6.25Z",fill:"currentColor"})),Ui=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M8.00016 1.33325C4.3135 1.33325 1.3335 4.31325 1.3335 7.99992C1.3335 11.6866 4.3135 14.6666 8.00016 14.6666C11.6868 14.6666 14.6668 11.6866 14.6668 7.99992C14.6668 4.31325 11.6868 1.33325 8.00016 1.33325ZM8.00016 13.3333C5.06016 13.3333 2.66683 10.9399 2.66683 7.99992C2.66683 5.05992 5.06016 2.66659 8.00016 2.66659C10.9402 2.66659 13.3335 5.05992 13.3335 7.99992C13.3335 10.9399 10.9402 13.3333 8.00016 13.3333ZM10.3935 4.66659L8.00016 7.05992L5.60683 4.66659L4.66683 5.60659L7.06016 7.99992L4.66683 10.3933L5.60683 11.3333L8.00016 8.93992L10.3935 11.3333L11.3335 10.3933L8.94016 7.99992L11.3335 5.60659L10.3935 4.66659Z",fill:"currentColor"})),Gi=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M12.8232 7C12.926 7 13.012 7.07201 13.0244 7.16797L13.1807 8.22754C13.4315 8.32754 13.6621 8.46012 13.876 8.62012L14.9004 8.21973C14.9208 8.21186 14.9453 8.20803 14.9697 8.20801C15.0436 8.20801 15.1133 8.24392 15.1504 8.30762L15.9736 9.69238C16.0227 9.7803 16.0018 9.88834 15.9238 9.94824L15.0566 10.6084C15.0731 10.7363 15.085 10.8642 15.085 11C15.085 11.1358 15.0731 11.2637 15.0566 11.3916L15.9238 12.0518C16.0018 12.1117 16.0227 12.2197 15.9736 12.3076L15.1504 13.6924C15.1133 13.7561 15.0434 13.792 14.9736 13.792C14.9492 13.7919 14.9248 13.7881 14.9004 13.7803L13.876 13.3799C13.6621 13.5359 13.4315 13.6725 13.1807 13.7725L13.0244 14.832C13.012 14.928 12.926 15 12.8232 15H11.1787C11.0759 15 10.9889 14.928 10.9766 14.832L10.8203 13.7725C10.5696 13.6725 10.3397 13.5398 10.126 13.3799L9.10156 13.7803C9.08115 13.7882 9.05667 13.792 9.03223 13.792C8.95826 13.792 8.88761 13.7563 8.85059 13.6924L8.02832 12.3076C7.97924 12.2197 8.0001 12.1117 8.07812 12.0518L8.94531 11.3916C8.92889 11.2637 8.91699 11.1319 8.91699 11C8.91699 10.8681 8.92889 10.7363 8.94531 10.6084L8.07812 9.94824C8.0001 9.88832 7.97515 9.78032 8.02832 9.69238L8.85059 8.30762C8.88754 8.24383 8.95763 8.20816 9.02734 8.20801C9.05192 8.20801 9.07699 8.21179 9.10156 8.21973L10.126 8.62012C10.3397 8.46418 10.5696 8.32752 10.8203 8.22754L10.9766 7.16797C10.9889 7.07197 11.0759 7 11.1787 7H12.8232ZM11.7129 7.7998L11.6309 8.33984L11.5654 8.79199L11.1289 8.96387C10.9604 9.03184 10.792 9.12795 10.6152 9.25586L10.2451 9.52832L9.81738 9.36035L9.29492 9.15625L9.00684 9.63965L9.45117 9.97559L9.81738 10.2559L9.75977 10.708C9.74743 10.828 9.73926 10.92 9.73926 11C9.73926 11.08 9.74743 11.1719 9.75977 11.2959L9.81738 11.748L9.45117 12.0283L9.00684 12.3643L9.29492 12.8477L9.81738 12.6436L10.2529 12.4717L10.627 12.752C10.7913 12.8719 10.9561 12.9642 11.1328 13.0361L11.5693 13.208L11.6348 13.6602L11.7129 14.2002H12.2891L12.3711 13.6602L12.4365 13.208L12.873 13.0361C13.0415 12.9681 13.21 12.8721 13.3867 12.7441L13.7568 12.4717L14.1846 12.6396L14.707 12.8438L14.9941 12.3604L14.5508 12.0244L14.1846 11.7441L14.2422 11.292C14.2545 11.172 14.2627 11.084 14.2627 11C14.2627 10.916 14.2586 10.832 14.2422 10.708L14.1846 10.2559L14.5508 9.97559L14.9902 9.63574L14.7021 9.15234L14.1807 9.35645L13.7441 9.52832L13.3701 9.24805C13.2057 9.12808 13.0411 9.03586 12.8643 8.96387L12.4287 8.79199L12.3623 8.33984L12.2842 7.7998H11.7129ZM3.33301 12.6338H2V11.3008H3.33301V12.6338ZM7.00977 11.3008C7.03732 11.7651 7.12864 12.2121 7.27441 12.6338H4.66699V11.3008H7.00977ZM12.001 9.40039C12.9097 9.40043 13.6455 10.116 13.6455 11C13.6455 11.884 12.9097 12.5996 12.001 12.5996C11.0922 12.5996 10.3564 11.884 10.3564 11C10.3564 10.116 11.0922 9.40039 12.001 9.40039ZM12.001 10.2002C11.5486 10.2002 11.1787 10.56 11.1787 11C11.1787 11.44 11.5486 11.7998 12.001 11.7998C12.4533 11.7998 12.8232 11.44 12.8232 11C12.8232 10.56 12.4533 10.2002 12.001 10.2002ZM3.33301 8.63379H2V7.30078H3.33301V8.63379ZM8.63574 7.30078C8.21765 7.68124 7.86483 8.13197 7.59473 8.63379H4.66699V7.30078H8.63574ZM3.33301 4.7334H2V3.40039H3.33301V4.7334ZM14 4.7334H4.66699V3.40039H14V4.7334Z",fill:"currentColor"}));function Va(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var it={exports:{}},Bi=it.exports,Is;function zi(){return Is||(Is=1,(function(e,t){(function(n,s){s(t)})(Bi,(function(n){var s=function(){return s=Object.assign||function(Fe){for(var yt,Yt=1,li=arguments.length;Yt<li;Yt++){yt=arguments[Yt];for(var Kt in yt)Object.prototype.hasOwnProperty.call(yt,Kt)&&(Fe[Kt]=yt[Kt])}return Fe},s.apply(this,arguments)},a=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},i={weekdays:{shorthand:["أحد","اثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],longhand:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]},months:{shorthand:["1","2","3","4","5","6","7","8","9","10","11","12"],longhand:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]},firstDayOfWeek:6,rangeSeparator:" إلى ",weekAbbreviation:"Wk",scrollTitle:"قم بالتمرير للزيادة",toggleTitle:"اضغط للتبديل",amPM:["ص","م"],yearAriaLabel:"سنة",monthAriaLabel:"شهر",hourAriaLabel:"ساعة",minuteAriaLabel:"دقيقة",time_24hr:!1};a.l10ns.ar=i,a.l10ns;var l=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},f={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};l.l10ns.at=f,l.l10ns;var o=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},u={weekdays:{shorthand:["B.","B.e.","Ç.a.","Ç.","C.a.","C.","Ş."],longhand:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","İyn","İyl","Avq","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmaq üçün sürüşdürün",toggleTitle:"Aç / Bağla",amPM:["GƏ","GS"],time_24hr:!0};o.l10ns.az=u,o.l10ns;var c=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},m={weekdays:{shorthand:["Нд","Пн","Аў","Ср","Чц","Пт","Сб"],longhand:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"]},months:{shorthand:["Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"],longhand:["Студзень","Люты","Сакавік","Красавік","Травень","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Тыд.",scrollTitle:"Пракруціце для павелічэння",toggleTitle:"Націсніце для пераключэння",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};c.l10ns.be=m,c.l10ns;var h=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},g={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Juni","Juli","Avgust","Septembar","Oktobar","Novembar","Decembar"]},time_24hr:!0};h.l10ns.bs=g,h.l10ns;var p=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},x={weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},months:{shorthand:["Яну","Фев","Март","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек"],longhand:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"]},time_24hr:!0,firstDayOfWeek:1};p.l10ns.bg=x,p.l10ns;var w=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},b={weekdays:{shorthand:["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],longhand:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},months:{shorthand:["জানু","ফেব্রু","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],longhand:["জানুয়ারী","ফেব্রুয়ারী","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"]}};w.l10ns.bn=b,w.l10ns;var y=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},C={weekdays:{shorthand:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],longhand:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},months:{shorthand:["Gen","Febr","Març","Abr","Maig","Juny","Jul","Ag","Set","Oct","Nov","Des"],longhand:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"]},ordinal:function(ue){var Fe=ue%100;if(Fe>3&&Fe<21)return"è";switch(Fe%10){case 1:return"r";case 2:return"n";case 3:return"r";case 4:return"t";default:return"è"}},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};y.l10ns.cat=y.l10ns.ca=C,y.l10ns;var v=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},M={weekdays:{shorthand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"],longhand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"]},months:{shorthand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"],longhand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"]},firstDayOfWeek:6,ordinal:function(){return""}};v.l10ns.ckb=M,v.l10ns;var T=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},j={weekdays:{shorthand:["Ne","Po","Út","St","Čt","Pá","So"],longhand:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"]},months:{shorthand:["Led","Ún","Bře","Dub","Kvě","Čer","Čvc","Srp","Zář","Říj","Lis","Pro"],longhand:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" do ",weekAbbreviation:"Týd.",scrollTitle:"Rolujte pro změnu",toggleTitle:"Přepnout dopoledne/odpoledne",amPM:["dop.","odp."],yearAriaLabel:"Rok",time_24hr:!0};T.l10ns.cs=j,T.l10ns;var N=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},O={weekdays:{shorthand:["Sul","Llun","Maw","Mer","Iau","Gwe","Sad"],longhand:["Dydd Sul","Dydd Llun","Dydd Mawrth","Dydd Mercher","Dydd Iau","Dydd Gwener","Dydd Sadwrn"]},months:{shorthand:["Ion","Chwef","Maw","Ebr","Mai","Meh","Gorff","Awst","Medi","Hyd","Tach","Rhag"],longhand:["Ionawr","Chwefror","Mawrth","Ebrill","Mai","Mehefin","Gorffennaf","Awst","Medi","Hydref","Tachwedd","Rhagfyr"]},firstDayOfWeek:1,ordinal:function(ue){return ue===1?"af":ue===2?"ail":ue===3||ue===4?"ydd":ue===5||ue===6?"ed":ue>=7&&ue<=10||ue==12||ue==15||ue==18||ue==20?"fed":ue==11||ue==13||ue==14||ue==16||ue==17||ue==19?"eg":ue>=21&&ue<=39?"ain":""},time_24hr:!0};N.l10ns.cy=O,N.l10ns;var k=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},E={weekdays:{shorthand:["søn","man","tir","ons","tors","fre","lør"],longhand:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"uge",time_24hr:!0};k.l10ns.da=E,k.l10ns;var A=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},I={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};A.l10ns.de=I,A.l10ns;var R={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(ue){var Fe=ue%100;if(Fe>3&&Fe<21)return"th";switch(Fe%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},L=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},P={firstDayOfWeek:1,rangeSeparator:" ĝis ",weekAbbreviation:"Sem",scrollTitle:"Rulumu por pligrandigi la valoron",toggleTitle:"Klaku por ŝalti",weekdays:{shorthand:["Dim","Lun","Mar","Mer","Ĵaŭ","Ven","Sab"],longhand:["dimanĉo","lundo","mardo","merkredo","ĵaŭdo","vendredo","sabato"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aŭg","Sep","Okt","Nov","Dec"],longhand:["januaro","februaro","marto","aprilo","majo","junio","julio","aŭgusto","septembro","oktobro","novembro","decembro"]},ordinal:function(){return"-a"},time_24hr:!0};L.l10ns.eo=P,L.l10ns;var U=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},G={weekdays:{shorthand:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],longhand:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]},months:{shorthand:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],longhand:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ordinal:function(){return"º"},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};U.l10ns.es=G,U.l10ns;var J=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},te={weekdays:{shorthand:["P","E","T","K","N","R","L"],longhand:["Pühapäev","Esmaspäev","Teisipäev","Kolmapäev","Neljapäev","Reede","Laupäev"]},months:{shorthand:["Jaan","Veebr","Märts","Apr","Mai","Juuni","Juuli","Aug","Sept","Okt","Nov","Dets"],longhand:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"]},firstDayOfWeek:1,ordinal:function(){return"."},weekAbbreviation:"Näd",rangeSeparator:" kuni ",scrollTitle:"Keri, et suurendada",toggleTitle:"Klõpsa, et vahetada",time_24hr:!0};J.l10ns.et=te,J.l10ns;var q=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},W={weekdays:{shorthand:["یک","دو","سه","چهار","پنج","جمعه","شنبه"],longhand:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنچ‌شنبه","جمعه","شنبه"]},months:{shorthand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],longhand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]},firstDayOfWeek:6,ordinal:function(){return""}};q.l10ns.fa=W,q.l10ns;var ie=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},fe={firstDayOfWeek:1,weekdays:{shorthand:["su","ma","ti","ke","to","pe","la"],longhand:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},months:{shorthand:["tammi","helmi","maalis","huhti","touko","kesä","heinä","elo","syys","loka","marras","joulu"],longhand:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},ordinal:function(){return"."},time_24hr:!0};ie.l10ns.fi=fe,ie.l10ns;var H=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Z={weekdays:{shorthand:["Sun","Mán","Týs","Mik","Hós","Frí","Ley"],longhand:["Sunnudagur","Mánadagur","Týsdagur","Mikudagur","Hósdagur","Fríggjadagur","Leygardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","Apríl","Mai","Juni","Juli","August","Septembur","Oktobur","Novembur","Desembur"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",scrollTitle:"Rulla fyri at broyta",toggleTitle:"Trýst fyri at skifta",yearAriaLabel:"Ár",time_24hr:!0};H.l10ns.fo=Z,H.l10ns;var Q=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},re={firstDayOfWeek:1,weekdays:{shorthand:["dim","lun","mar","mer","jeu","ven","sam"],longhand:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},months:{shorthand:["janv","févr","mars","avr","mai","juin","juil","août","sept","oct","nov","déc"],longhand:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},ordinal:function(ue){return ue>1?"":"er"},rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"Défiler pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};Q.l10ns.fr=re,Q.l10ns;var ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ve={weekdays:{shorthand:["Κυ","Δε","Τρ","Τε","Πέ","Πα","Σά"],longhand:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},months:{shorthand:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αύγ","Σεπ","Οκτ","Νοέ","Δεκ"],longhand:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"Εβδ",rangeSeparator:" έως ",scrollTitle:"Μετακυλήστε για προσαύξηση",toggleTitle:"Κάντε κλικ για αλλαγή",amPM:["ΠΜ","ΜΜ"],yearAriaLabel:"χρόνος",monthAriaLabel:"μήνας",hourAriaLabel:"ώρα",minuteAriaLabel:"λεπτό"};ce.l10ns.gr=ve,ce.l10ns;var De=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},pe={weekdays:{shorthand:["א","ב","ג","ד","ה","ו","ש"],longhand:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},months:{shorthand:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],longhand:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},rangeSeparator:" אל ",time_24hr:!0};De.l10ns.he=pe,De.l10ns;var Te=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Pe={weekdays:{shorthand:["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],longhand:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"]},months:{shorthand:["जन","फर","मार्च","अप्रेल","मई","जून","जूलाई","अग","सित","अक्ट","नव","दि"],longhand:["जनवरी ","फरवरी","मार्च","अप्रेल","मई","जून","जूलाई","अगस्त ","सितम्बर","अक्टूबर","नवम्बर","दिसम्बर"]}};Te.l10ns.hi=Pe,Te.l10ns;var Y=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},X={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"],longhand:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"]},time_24hr:!0};Y.l10ns.hr=X,Y.l10ns;var K=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},we={firstDayOfWeek:1,weekdays:{shorthand:["V","H","K","Sz","Cs","P","Szo"],longhand:["Vasárnap","Hétfő","Kedd","Szerda","Csütörtök","Péntek","Szombat"]},months:{shorthand:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Szep","Okt","Nov","Dec"],longhand:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"]},ordinal:function(){return"."},weekAbbreviation:"Hét",scrollTitle:"Görgessen",toggleTitle:"Kattintson a váltáshoz",rangeSeparator:" - ",time_24hr:!0};K.l10ns.hu=we,K.l10ns;var B=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},de={weekdays:{shorthand:["Կիր","Երկ","Երք","Չրք","Հնգ","Ուրբ","Շբթ"],longhand:["Կիրակի","Եկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},months:{shorthand:["Հնվ","Փտր","Մար","Ապր","Մայ","Հնս","Հլս","Օգս","Սեպ","Հոկ","Նմբ","Դեկ"],longhand:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"ՇԲՏ",scrollTitle:"Ոլորեք՝ մեծացնելու համար",toggleTitle:"Սեղմեք՝ փոխելու համար",amPM:["ՄԿ","ԿՀ"],yearAriaLabel:"Տարի",monthAriaLabel:"Ամիս",hourAriaLabel:"Ժամ",minuteAriaLabel:"Րոպե",time_24hr:!0};B.l10ns.hy=de,B.l10ns;var oe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},he={weekdays:{shorthand:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],longhand:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],longhand:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0,rangeSeparator:" - "};oe.l10ns.id=he,oe.l10ns;var be=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ge={weekdays:{shorthand:["Sun","Mán","Þri","Mið","Fim","Fös","Lau"],longhand:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maí","Jún","Júl","Ágú","Sep","Okt","Nóv","Des"],longhand:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",yearAriaLabel:"Ár",time_24hr:!0};be.l10ns.is=ge,be.l10ns;var Se=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ze={weekdays:{shorthand:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],longhand:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]},months:{shorthand:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],longhand:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},firstDayOfWeek:1,ordinal:function(){return"°"},rangeSeparator:" al ",weekAbbreviation:"Se",scrollTitle:"Scrolla per aumentare",toggleTitle:"Clicca per cambiare",time_24hr:!0};Se.l10ns.it=ze,Se.l10ns;var Xe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vt={weekdays:{shorthand:["日","月","火","水","木","金","土"],longhand:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},months:{shorthand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],longhand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},time_24hr:!0,rangeSeparator:" から ",monthAriaLabel:"月",amPM:["午前","午後"],yearAriaLabel:"年",hourAriaLabel:"時間",minuteAriaLabel:"分"};Xe.l10ns.ja=vt,Xe.l10ns;var xt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ye={weekdays:{shorthand:["კვ","ორ","სა","ოთ","ხუ","პა","შა"],longhand:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]},months:{shorthand:["იან","თებ","მარ","აპრ","მაი","ივნ","ივლ","აგვ","სექ","ოქტ","ნოე","დეკ"],longhand:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"კვ.",scrollTitle:"დასქროლეთ გასადიდებლად",toggleTitle:"დააკლიკეთ გადართვისთვის",amPM:["AM","PM"],yearAriaLabel:"წელი",time_24hr:!0};xt.l10ns.ka=Ye,xt.l10ns;var bt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_={weekdays:{shorthand:["일","월","화","수","목","금","토"],longhand:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},months:{shorthand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],longhand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},ordinal:function(){return"일"},rangeSeparator:" ~ ",amPM:["오전","오후"]};bt.l10ns.ko=_,bt.l10ns;var F=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},z={weekdays:{shorthand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស.","សុក្រ","សៅរ៍"],longhand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស្បតិ៍","សុក្រ","សៅរ៍"]},months:{shorthand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"],longhand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"]},ordinal:function(){return""},firstDayOfWeek:1,rangeSeparator:" ដល់ ",weekAbbreviation:"សប្តាហ៍",scrollTitle:"រំកិលដើម្បីបង្កើន",toggleTitle:"ចុចដើម្បីផ្លាស់ប្ដូរ",yearAriaLabel:"ឆ្នាំ",time_24hr:!0};F.l10ns.km=z,F.l10ns;var ae=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ee={weekdays:{shorthand:["Жс","Дс","Сc","Ср","Бс","Жм","Сб"],longhand:["Жексенбi","Дүйсенбi","Сейсенбi","Сәрсенбi","Бейсенбi","Жұма","Сенбi"]},months:{shorthand:["Қаң","Ақп","Нау","Сәу","Мам","Мау","Шiл","Там","Қыр","Қаз","Қар","Жел"],longhand:["Қаңтар","Ақпан","Наурыз","Сәуiр","Мамыр","Маусым","Шiлде","Тамыз","Қыркүйек","Қазан","Қараша","Желтоқсан"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Апта",scrollTitle:"Үлкейту үшін айналдырыңыз",toggleTitle:"Ауыстыру үшін басыңыз",amPM:["ТД","ТК"],yearAriaLabel:"Жыл"};ae.l10ns.kz=ee,ae.l10ns;var ye=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Re={weekdays:{shorthand:["S","Pr","A","T","K","Pn","Š"],longhand:["Sekmadienis","Pirmadienis","Antradienis","Trečiadienis","Ketvirtadienis","Penktadienis","Šeštadienis"]},months:{shorthand:["Sau","Vas","Kov","Bal","Geg","Bir","Lie","Rgp","Rgs","Spl","Lap","Grd"],longhand:["Sausis","Vasaris","Kovas","Balandis","Gegužė","Birželis","Liepa","Rugpjūtis","Rugsėjis","Spalis","Lapkritis","Gruodis"]},firstDayOfWeek:1,ordinal:function(){return"-a"},rangeSeparator:" iki ",weekAbbreviation:"Sav",scrollTitle:"Keisti laiką pelės rateliu",toggleTitle:"Perjungti laiko formatą",time_24hr:!0};ye.l10ns.lt=Re,ye.l10ns;var Qe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},je={firstDayOfWeek:1,weekdays:{shorthand:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],longhand:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jūn","Jūl","Aug","Sep","Okt","Nov","Dec"],longhand:["Janvāris","Februāris","Marts","Aprīlis","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"]},rangeSeparator:" līdz ",time_24hr:!0};Qe.l10ns.lv=je,Qe.l10ns;var He=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},St={weekdays:{shorthand:["Не","По","Вт","Ср","Че","Пе","Са"],longhand:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},months:{shorthand:["Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Ное","Дек"],longhand:["Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"]},firstDayOfWeek:1,weekAbbreviation:"Нед.",rangeSeparator:" до ",time_24hr:!0};He.l10ns.mk=St,He.l10ns;var Pn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Rn={firstDayOfWeek:1,weekdays:{shorthand:["Да","Мя","Лх","Пү","Ба","Бя","Ня"],longhand:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},months:{shorthand:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],longhand:["Нэгдүгээр сар","Хоёрдугаар сар","Гуравдугаар сар","Дөрөвдүгээр сар","Тавдугаар сар","Зургаадугаар сар","Долдугаар сар","Наймдугаар сар","Есдүгээр сар","Аравдугаар сар","Арваннэгдүгээр сар","Арванхоёрдугаар сар"]},rangeSeparator:"-с ",time_24hr:!0};Pn.l10ns.mn=Rn,Pn.l10ns;var ri=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ii={weekdays:{shorthand:["Aha","Isn","Sel","Rab","Kha","Jum","Sab"],longhand:["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},months:{shorthand:["Jan","Feb","Mac","Apr","Mei","Jun","Jul","Ogo","Sep","Okt","Nov","Dis"],longhand:["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},firstDayOfWeek:1,ordinal:function(){return""}};ri.l10ns;var On=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_n={weekdays:{shorthand:["နွေ","လာ","ဂါ","ဟူး","ကြာ","သော","နေ"],longhand:["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"]},months:{shorthand:["ဇန်","ဖေ","မတ်","ပြီ","မေ","ဇွန်","လိုင်","သြ","စက်","အောက်","နို","ဒီ"],longhand:["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","သြဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0};On.l10ns.my=_n,On.l10ns;var Fn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Vn={weekdays:{shorthand:["zo","ma","di","wo","do","vr","za"],longhand:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},months:{shorthand:["jan","feb","mrt","apr","mei","jun","jul","aug","sept","okt","nov","dec"],longhand:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},firstDayOfWeek:1,weekAbbreviation:"wk",rangeSeparator:" t/m ",scrollTitle:"Scroll voor volgende / vorige",toggleTitle:"Klik om te wisselen",time_24hr:!0,ordinal:function(ue){return ue===1||ue===8||ue>=20?"ste":"de"}};Fn.l10ns.nl=Vn,Fn.l10ns;var Un=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gn={weekdays:{shorthand:["Sø.","Må.","Ty.","On.","To.","Fr.","La."],longhand:["Søndag","Måndag","Tysdag","Onsdag","Torsdag","Fredag","Laurdag"]},months:{shorthand:["Jan","Feb","Mars","Apr","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Veke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};Un.l10ns.nn=Gn,Un.l10ns;var Bn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},zn={weekdays:{shorthand:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],longhand:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Uke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};Bn.l10ns.no=zn,Bn.l10ns;var Hn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Wn={weekdays:{shorthand:["ਐਤ","ਸੋਮ","ਮੰਗਲ","ਬੁੱਧ","ਵੀਰ","ਸ਼ੁੱਕਰ","ਸ਼ਨਿੱਚਰ"],longhand:["ਐਤਵਾਰ","ਸੋਮਵਾਰ","ਮੰਗਲਵਾਰ","ਬੁੱਧਵਾਰ","ਵੀਰਵਾਰ","ਸ਼ੁੱਕਰਵਾਰ","ਸ਼ਨਿੱਚਰਵਾਰ"]},months:{shorthand:["ਜਨ","ਫ਼ਰ","ਮਾਰ","ਅਪ੍ਰੈ","ਮਈ","ਜੂਨ","ਜੁਲਾ","ਅਗ","ਸਤੰ","ਅਕ","ਨਵੰ","ਦਸੰ"],longhand:["ਜਨਵਰੀ","ਫ਼ਰਵਰੀ","ਮਾਰਚ","ਅਪ੍ਰੈਲ","ਮਈ","ਜੂਨ","ਜੁਲਾਈ","ਅਗਸਤ","ਸਤੰਬਰ","ਅਕਤੂਬਰ","ਨਵੰਬਰ","ਦਸੰਬਰ"]},time_24hr:!0};Hn.l10ns.pa=Wn,Hn.l10ns;var $n=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Jn={weekdays:{shorthand:["Nd","Pn","Wt","Śr","Cz","Pt","So"],longhand:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"]},months:{shorthand:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],longhand:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"]},rangeSeparator:" do ",weekAbbreviation:"tydz.",scrollTitle:"Przewiń, aby zwiększyć",toggleTitle:"Kliknij, aby przełączyć",firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return"."}};$n.l10ns.pl=Jn,$n.l10ns;var Yn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Kn={weekdays:{shorthand:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],longhand:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"]},months:{shorthand:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],longhand:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},rangeSeparator:" até ",time_24hr:!0};Yn.l10ns.pt=Kn,Yn.l10ns;var qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Zn={weekdays:{shorthand:["Dum","Lun","Mar","Mie","Joi","Vin","Sâm"],longhand:["Duminică","Luni","Marți","Miercuri","Joi","Vineri","Sâmbătă"]},months:{shorthand:["Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Noi","Dec"],longhand:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"]},firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return""}};qn.l10ns.ro=Zn,qn.l10ns;var Xn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Qn={weekdays:{shorthand:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},months:{shorthand:["Янв","Фев","Март","Апр","Май","Июнь","Июль","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Нед.",scrollTitle:"Прокрутите для увеличения",toggleTitle:"Нажмите для переключения",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};Xn.l10ns.ru=Qn,Xn.l10ns;var es=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ts={weekdays:{shorthand:["ඉ","ස","අ","බ","බ්‍ර","සි","සෙ"],longhand:["ඉරිදා","සඳුදා","අඟහරුවාදා","බදාදා","බ්‍රහස්පතින්දා","සිකුරාදා","සෙනසුරාදා"]},months:{shorthand:["ජන","පෙබ","මාර්","අප්‍රේ","මැයි","ජුනි","ජූලි","අගෝ","සැප්","ඔක්","නොවැ","දෙසැ"],longhand:["ජනවාරි","පෙබරවාරි","මාර්තු","අප්‍රේල්","මැයි","ජුනි","ජූලි","අගෝස්තු","සැප්තැම්බර්","ඔක්තෝබර්","නොවැම්බර්","දෙසැම්බර්"]},time_24hr:!0};es.l10ns.si=ts,es.l10ns;var ns=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ss={weekdays:{shorthand:["Ned","Pon","Ut","Str","Štv","Pia","Sob"],longhand:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Máj","Jún","Júl","Aug","Sep","Okt","Nov","Dec"],longhand:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};ns.l10ns.sk=ss,ns.l10ns;var as=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},rs={weekdays:{shorthand:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"],longhand:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};as.l10ns.sl=rs,as.l10ns;var is=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},os={weekdays:{shorthand:["Di","Hë","Ma","Më","En","Pr","Sh"],longhand:["E Diel","E Hënë","E Martë","E Mërkurë","E Enjte","E Premte","E Shtunë"]},months:{shorthand:["Jan","Shk","Mar","Pri","Maj","Qer","Kor","Gus","Sht","Tet","Nën","Dhj"],longhand:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"]},firstDayOfWeek:1,rangeSeparator:" deri ",weekAbbreviation:"Java",yearAriaLabel:"Viti",monthAriaLabel:"Muaji",hourAriaLabel:"Ora",minuteAriaLabel:"Minuta",time_24hr:!0};is.l10ns.sq=os,is.l10ns;var ls=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},cs={weekdays:{shorthand:["Ned","Pon","Uto","Sre","Čet","Pet","Sub"],longhand:["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"]},firstDayOfWeek:1,weekAbbreviation:"Ned.",rangeSeparator:" do ",time_24hr:!0};ls.l10ns.sr=cs,ls.l10ns;var ds=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},us={firstDayOfWeek:1,weekAbbreviation:"v",weekdays:{shorthand:["sön","mån","tis","ons","tor","fre","lör"],longhand:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},rangeSeparator:" till ",time_24hr:!0,ordinal:function(){return"."}};ds.l10ns.sv=us,ds.l10ns;var fs=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ms={weekdays:{shorthand:["อา","จ","อ","พ","พฤ","ศ","ส"],longhand:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"]},months:{shorthand:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],longhand:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},firstDayOfWeek:1,rangeSeparator:" ถึง ",scrollTitle:"เลื่อนเพื่อเพิ่มหรือลด",toggleTitle:"คลิกเพื่อเปลี่ยน",time_24hr:!0,ordinal:function(){return""}};fs.l10ns.th=ms,fs.l10ns;var hs=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},gs={weekdays:{shorthand:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],longhand:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},months:{shorthand:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],longhand:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmak için kaydırın",toggleTitle:"Aç/Kapa",amPM:["ÖÖ","ÖS"],time_24hr:!0};hs.l10ns.tr=gs,hs.l10ns;var ps=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ws={firstDayOfWeek:1,weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},months:{shorthand:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],longhand:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"]},time_24hr:!0};ps.l10ns.uk=ws,ps.l10ns;var Cs=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vs={weekdays:{shorthand:["Якш","Душ","Сеш","Чор","Пай","Жум","Шан"],longhand:["Якшанба","Душанба","Сешанба","Чоршанба","Пайшанба","Жума","Шанба"]},months:{shorthand:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январ","Феврал","Март","Апрел","Май","Июн","Июл","Август","Сентябр","Октябр","Ноябр","Декабр"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Ҳафта",scrollTitle:"Катталаштириш учун айлантиринг",toggleTitle:"Ўтиш учун босинг",amPM:["AM","PM"],yearAriaLabel:"Йил",time_24hr:!0};Cs.l10ns.uz=vs,Cs.l10ns;var xs=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},bs={weekdays:{shorthand:["Ya","Du","Se","Cho","Pa","Ju","Sha"],longhand:["Yakshanba","Dushanba","Seshanba","Chorshanba","Payshanba","Juma","Shanba"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","Iyun","Iyul","Avg","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avgust","Sentabr","Oktabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Hafta",scrollTitle:"Kattalashtirish uchun aylantiring",toggleTitle:"O‘tish uchun bosing",amPM:["AM","PM"],yearAriaLabel:"Yil",time_24hr:!0};xs.l10ns.uz_latn=bs,xs.l10ns;var Ss=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ys={weekdays:{shorthand:["CN","T2","T3","T4","T5","T6","T7"],longhand:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"]},months:{shorthand:["Th1","Th2","Th3","Th4","Th5","Th6","Th7","Th8","Th9","Th10","Th11","Th12"],longhand:["Tháng một","Tháng hai","Tháng ba","Tháng tư","Tháng năm","Tháng sáu","Tháng bảy","Tháng tám","Tháng chín","Tháng mười","Tháng mười một","Tháng mười hai"]},firstDayOfWeek:1,rangeSeparator:" đến "};Ss.l10ns.vn=ys,Ss.l10ns;var Ds=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ms={weekdays:{shorthand:["周日","周一","周二","周三","周四","周五","周六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"周",scrollTitle:"滚动切换",toggleTitle:"点击切换 12/24 小时时制"};Ds.l10ns.zh=Ms,Ds.l10ns;var ks=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ts={weekdays:{shorthand:["週日","週一","週二","週三","週四","週五","週六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"週",scrollTitle:"滾動切換",toggleTitle:"點擊切換 12/24 小時時制"};ks.l10ns.zh_tw=Ts,ks.l10ns;var oi={ar:i,at:f,az:u,be:m,bg:x,bn:b,bs:g,ca:C,ckb:M,cat:C,cs:j,cy:O,da:E,de:I,default:s({},R),en:R,eo:P,es:G,et:te,fa:W,fi:fe,fo:Z,fr:re,gr:ve,he:pe,hi:Pe,hr:X,hu:we,hy:de,id:he,is:ge,it:ze,ja:vt,ka:Ye,ko:_,km:z,kz:ee,lt:Re,lv:je,mk:St,mn:Rn,ms:ii,my:_n,nl:Vn,nn:Gn,no:zn,pa:Wn,pl:Jn,pt:Kn,ro:Zn,ru:Qn,si:ts,sk:ss,sl:rs,sq:os,sr:cs,sv:us,th:ms,tr:gs,uk:ws,vn:ys,zh:Ms,zh_tw:Ts,uz:vs,uz_latn:bs};n.default=oi,Object.defineProperty(n,"__esModule",{value:!0})}))})(it,it.exports)),it.exports}var Hi=zi();const Wi=Va(Hi);var Tt={exports:{}},$i=Tt.exports,Ls;function Ji(){return Ls||(Ls=1,(function(e,t){(function(n,s){e.exports=s()})($i,(function(){var n=function(){return n=Object.assign||function(u){for(var c,m=1,h=arguments.length;m<h;m++){c=arguments[m];for(var g in c)Object.prototype.hasOwnProperty.call(c,g)&&(u[g]=c[g])}return u},n.apply(this,arguments)},s=function(o,u,c){return c.months[u?"shorthand":"longhand"][o]};function a(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function i(o){try{if(typeof o.composedPath=="function"){var u=o.composedPath();return u[0]}return o.target}catch{return o.target}}var l={shorthand:!1,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function f(o){var u=n(n({},l),o);return function(c){c.config.dateFormat=u.dateFormat,c.config.altFormat=u.altFormat;var m={monthsContainer:null};function h(){if(c.rContainer){a(c.rContainer);for(var k=0;k<c.monthElements.length;k++){var E=c.monthElements[k];E.parentNode&&E.parentNode.removeChild(E)}}}function g(){c.rContainer&&(m.monthsContainer=c._createElement("div","flatpickr-monthSelect-months"),m.monthsContainer.tabIndex=-1,p(),c.rContainer.appendChild(m.monthsContainer),c.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+u.theme))}function p(){if(m.monthsContainer){a(m.monthsContainer);for(var k=document.createDocumentFragment(),E=0;E<12;E++){var A=c.createDay("flatpickr-monthSelect-month",new Date(c.currentYear,E),0,E);A.dateObj.getMonth()===new Date().getMonth()&&A.dateObj.getFullYear()===new Date().getFullYear()&&A.classList.add("today"),A.textContent=s(E,u.shorthand,c.l10n),A.addEventListener("click",y),k.appendChild(A)}m.monthsContainer.appendChild(k),c.config.minDate&&c.currentYear===c.config.minDate.getFullYear()?c.prevMonthNav.classList.add("flatpickr-disabled"):c.prevMonthNav.classList.remove("flatpickr-disabled"),c.config.maxDate&&c.currentYear===c.config.maxDate.getFullYear()?c.nextMonthNav.classList.add("flatpickr-disabled"):c.nextMonthNav.classList.remove("flatpickr-disabled")}}function x(){c._bind(c.prevMonthNav,"click",function(k){k.preventDefault(),k.stopPropagation(),c.changeYear(c.currentYear-1),b(),p()}),c._bind(c.nextMonthNav,"click",function(k){k.preventDefault(),k.stopPropagation(),c.changeYear(c.currentYear+1),b(),p()}),c._bind(m.monthsContainer,"mouseover",function(k){c.config.mode==="range"&&c.onMouseOver(i(k),"flatpickr-monthSelect-month")})}function w(){if(c.rContainer&&c.selectedDates.length){for(var k=c.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"),E=0;E<k.length;E++)k[E].classList.remove("selected");var A=c.selectedDates[0].getMonth(),I=c.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(A+1)+")");I&&I.classList.add("selected")}}function b(){var k=c.selectedDates[0];if(k&&(k=new Date(k),k.setFullYear(c.currentYear),c.config.minDate&&k<c.config.minDate&&(k=c.config.minDate),c.config.maxDate&&k>c.config.maxDate&&(k=c.config.maxDate),c.currentYear=k.getFullYear()),c.currentYearElement.value=String(c.currentYear),c.rContainer){var E=c.rContainer.querySelectorAll(".flatpickr-monthSelect-month");E.forEach(function(A){A.dateObj.setFullYear(c.currentYear),c.config.minDate&&A.dateObj<c.config.minDate||c.config.maxDate&&A.dateObj>c.config.maxDate?A.classList.add("flatpickr-disabled"):A.classList.remove("flatpickr-disabled")})}w()}function y(k){k.preventDefault(),k.stopPropagation();var E=i(k);if(E instanceof Element&&!E.classList.contains("flatpickr-disabled")&&!E.classList.contains("notAllowed")&&(C(E.dateObj),c.config.closeOnSelect)){var A=c.config.mode==="single",I=c.config.mode==="range"&&c.selectedDates.length===2;(A||I)&&c.close()}}function C(k){var E=new Date(c.currentYear,k.getMonth(),k.getDate()),A=[];switch(c.config.mode){case"single":A=[E];break;case"multiple":A.push(E);break;case"range":c.selectedDates.length===2?A=[E]:(A=c.selectedDates.concat([E]),A.sort(function(I,R){return I.getTime()-R.getTime()}));break}c.setDate(A,!0),w()}var v={37:-1,39:1,40:3,38:-3};function M(k,E,A,I){var R=v[I.keyCode]!==void 0;if(!(!R&&I.keyCode!==13)&&!(!c.rContainer||!m.monthsContainer)){var L=c.rContainer.querySelector(".flatpickr-monthSelect-month.selected"),P=Array.prototype.indexOf.call(m.monthsContainer.children,document.activeElement);if(P===-1){var U=L||m.monthsContainer.firstElementChild;U.focus(),P=U.$i}R?m.monthsContainer.children[(12+P+v[I.keyCode])%12].focus():I.keyCode===13&&m.monthsContainer.contains(document.activeElement)&&C(document.activeElement.dateObj)}}function T(){var k;((k=c.config)===null||k===void 0?void 0:k.mode)==="range"&&c.selectedDates.length===1&&c.clear(!1),c.selectedDates.length||p()}function j(){u._stubbedCurrentMonth=c._initialDate.getMonth(),c._initialDate.setMonth(u._stubbedCurrentMonth),c.currentMonth=u._stubbedCurrentMonth}function N(){u._stubbedCurrentMonth&&(c._initialDate.setMonth(u._stubbedCurrentMonth),c.currentMonth=u._stubbedCurrentMonth,delete u._stubbedCurrentMonth)}function O(){if(m.monthsContainer!==null)for(var k=m.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"),E=0;E<k.length;E++)k[E].removeEventListener("click",y)}return{onParseConfig:function(){c.config.enableTime=!1},onValueUpdate:w,onKeyDown:M,onReady:[j,h,g,x,w,function(){c.config.onClose.push(T),c.loadedPlugins.push("monthSelect")}],onDestroy:[N,O,function(){c.config.onClose=c.config.onClose.filter(function(k){return k!==T})}]}}}return f}))})(Tt)),Tt.exports}var Yi=Ji();const Ki=Va(Yi),Ps=(e,t,n,s,a=!1,i)=>{const l={...Wi[s]},f=Ki;a&&(l.firstDayOfWeek=1);const o={minDate:n===$.CalendarResolution.MONTH?new Date(e.getFullYear(),e.getMonth()):e,maxDate:n===$.CalendarResolution.MONTH?new Date(t.getFullYear(),t.getMonth()):t,locale:l};return n===$.CalendarResolution.MONTH?{...o,dateFormat:"M Y",plugins:[new f({shorthand:!0,dateFormat:"M Y"})]}:{...o,monthSelectorType:"static",dateFormat:i||"d.m.Y"}},Rs=e=>{e?.setMinutes(e.getMinutes()-e.getTimezoneOffset())},qi={year:"numeric",month:"short",day:"numeric"},Rt=(e,t)=>e?.toLocaleDateString(t,qi)||"",Zi=(e,t)=>{const{startPeriod:n,endPeriod:s}=e;if(!t.startPeriod&&!t.endPeriod&&n&&s)return{startPeriod:new Date(n?.getTime()),endPeriod:new Date(s?.getTime())};const a=n?new Date(Math.max(n.getTime(),t.startPeriod.getTime())):t.startPeriod,i=s?new Date(Math.min(s.getTime(),t.endPeriod.getTime())):t.endPeriod;return{startPeriod:a,endPeriod:i}},Xi=(e,t)=>{const{endPeriod:n}=e,s=n?.getFullYear()||new Date().getFullYear(),a=s+ +t,i=new Date(+t<0?s:a,n?.getMonth()||0,n?.getDate()||1),l=new Date(+t<0?a:s,0,1);return{startPeriod:new Date(Math.max(l.getTime(),e?.startPeriod?.getTime()||0)),endPeriod:i}},Qi=e=>({quarterly:e?.quarterly||"Q",monthly:e?.monthly||"M"}),Ua=(e,t)=>{const n=Qi(t);return D.isQuarterly(e)&&n?.quarterly?e?.replace(/Q/g,n?.quarterly):D.isMonthly(e)&&n?.monthly?e?.replace(/M/g,n?.monthly):e};var $e=(e=>(e.FLAT_LIST="FLAT_LIST",e.HIERARCHY="HIERARCHY",e))($e||{});const Ga=(e,t,n,s,a)=>e?.map(i=>{const l=D.findCodelistByDimension(t?.codelists,t?.conceptSchemes,i)?.codes,f=D.getAvailableCodes(i,n,l,s),o=l?.some(u=>u?.parent);return{id:i?.id,title:D.getDimensionTitle(t?.conceptSchemes,i,s),dimensionValues:f,isTimeDimension:i?.type===D.DimensionType.TIME_DIMENSION,isHierarchical:o,displayMode:o?$e.HIERARCHY:$e.FLAT_LIST,datasetUrn:a,filterType:"dataset"}})||[],eo=e=>e?.filterType==="shared",lt=e=>{if(e?.id)return eo(e)?`shared:${e.id}`:e?.datasetUrn?`${e.datasetUrn}:${e.id}`:e.id},Ie=(e,t)=>lt(e)===lt(t),Ot=(e,t)=>e?.map(n=>t&&Ie(n,t)?{...t,isSelectedFilter:!0}:{...n,isSelectedFilter:!1}),Ba=(e,t,n)=>e?e.map(s=>Ie(s,t)?{...s,displayMode:n}:s):[],za=e=>e?.filter(t=>!!t?.isSelectedValue)||[],Ut=e=>e?.map(t=>({...t,dimensionValues:za(t?.dimensionValues)})).filter(t=>t.dimensionValues?.length||t.timeRange?.startPeriod||t.timeRange?.endPeriod),fn=e=>e?.reduce((t,n)=>(n?.dimensionValues?.length??0)+t,0)||0,Ha=e=>({...e,dimensionValues:e?.dimensionValues?.map(t=>({...t,isSelectedValue:!1})),timeRange:void 0}),Wa=(e,t)=>e?.map(n=>Ie(n,t)?Ha(n):n),$a=e=>e?.map(t=>Ha(t)),Ja=(e,t,n)=>e.map(s=>{const a=t?.filters.find(l=>l.componentCode===s.id);let i=[];if(a)if(s.isTimeDimension){const l=a.values.filter(m=>!!m),f=D.getAnnotationPeriod(n?.[0]?.annotations),o=l[0]?$.getTimePeriod(l[0]):null,u=l[1]?$.getTimePeriod(l[1]):null;let c=f;return o&&u&&(c=f?Zi({startPeriod:o,endPeriod:u},f):{startPeriod:o,endPeriod:u}),{...s,timeRange:c}}else i=s?.dimensionValues?.map(f=>a?.values?.includes(f.id)?{...f,isSelectedValue:!0}:f);else i=s.dimensionValues;return{...s,dimensionValues:i}}),_t=e=>e?.map(t=>({...t,isDisabled:!0})),to=e=>new Map(e?.map(t=>[t.id,{...t,children:[]}])),no=e=>{if(!e)return[];const t=to(e),n=[];return e.forEach(s=>{if(s&&s.parent){const a=t.get(s.parent),i=t.get(s.id);a&&a.children&&i&&(a.children=[...a.children,i])}else{const a=t.get(s.id);a&&n.push(a)}}),n},so=(e,t=!1)=>t?`${e*S.TREE_NODE_PADDING-S.TREE_NODE_ARROW_SIZE}px`:`${e*S.TREE_NODE_PADDING}px`,ot=e=>e?.children?.reduce((t,n)=>[...t,n,...ot(n)],[])||[],Dt=(e,t)=>e?e.map(n=>({...n,isSelectedValue:t})):[],ao=e=>{const t=e.children?.every(s=>s.isSelectedValue),n=e.children?.every(s=>!s.isSelectedValue);if(e.isSelectedValue){if(e.isSelectedValue&&t)return[{...e,isSelectedValue:!1},...Dt(ot(e),!0)]}else{if(n)return[{...e,isSelectedValue:!0},...Dt(ot(e),!0)];if(t)return[{...e,isSelectedValue:!0},...Dt(ot(e),!1)]}return[{...e,isSelectedValue:!1},...Dt(ot(e),!1)]},ro=e=>[{key:$e.HIERARCHY,title:e?.hierarchy||"Hierarchy"},{key:$e.FLAT_LIST,title:e?.flatList||"Flat list"}],io=({calendarResolution:e,timeRange:t,timeRangeOptions:n,calendarStartFromMonday:s=!0,locale:a=$.Locale.EN,radioIcon:i,initialConstraints:l,onValueChange:f,calendarIcon:o,dateFormat:u,titles:c,defaultTimeOption:m})=>{const h=D.getAnnotationPeriod(l?.[0]?.annotations),[g,p]=d.useState(t),x=!t||t?.startPeriod?.getTime()===h?.startPeriod?.getTime()&&t?.endPeriod?.getTime()===h?.endPeriod?.getTime()?0:$.CUSTOM_PERIOD,[w,b]=d.useState(m??x),y=d.useMemo(()=>{const{startPeriod:j,endPeriod:N}=h,O=j?.getFullYear(),k=N?.getFullYear(),E=new Date().getFullYear();return n.filter(A=>A.value===$.CUSTOM_PERIOD||A.value===0||+A.value>=0&&k-E>=+A.value||+A.value<0&&O-E<+A.value)},[h,n]);d.useEffect(()=>{f(g,w)},[g]);const C=j=>{j&&(Rs(j),p(N=>N?{...N,startPeriod:j||null}:{endPeriod:null,startPeriod:j||null}))},v=j=>{j&&(Rs(j),p(N=>N?{...N,endPeriod:j||null}:{startPeriod:null,endPeriod:j||null}))};if(h==null)return null;const M=Ps(h.startPeriod,g?.endPeriod||h.endPeriod,e,a,s,u),T=Ps(g?.startPeriod||h.startPeriod,h.endPeriod,e,a,s,u);return r.jsxs("div",{className:"mt-3 flex h-full min-w-0 flex-1 flex-col overflow-auto py-2 pr-3",children:[r.jsx("div",{className:"w-full",children:y.map(j=>r.jsx(S.Radio,{id:j.value.toString(),checked:w===j.value,label:j.title,onChange:()=>{const{value:N}=j;b(N),N!==$.CUSTOM_PERIOD&&p(N===0?h:Xi(h,N))},radioIcon:i},j.value.toString()))}),r.jsx("div",{className:"w-full",children:w===$.CUSTOM_PERIOD&&r.jsxs("div",{className:"filters-time-period caption mt-3 flex gap-4 text-neutral-700",children:[r.jsx(S.Calendar,{onChange:C,options:M,value:g?.startPeriod||h?.startPeriod,label:c?.from||"From",id:"time-options-start",icon:o}),r.jsx(S.Calendar,{onChange:v,options:T,value:g?.endPeriod||h?.endPeriod,label:c?.to||"To",id:"time-options-end",icon:o,isEndDate:!0})]})})]})},oo=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M6.25 4.66668L9.75 8.00001L6.25 11.3333L6.25 4.66668Z",fill:"currentColor"})),Ya=({node:e,level:t=1,checkboxIcon:n,selectFilterValue:s,selectHierarchicalNodes:a,expandHierarchicalValue:i})=>{const[l,f]=d.useState(!1),o="cursor-pointer text-neutrals-1000 w-6 h-6 shrink-0";d.useEffect(()=>{f(!!e?.children?.length)},[e]);const u=(c,m)=>{e?.children?.length?a?.(ao(e)):s?.(c,m)};return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"flex items-center",style:{paddingLeft:so(t,l)},children:[l&&(e?.isExpanded?r.jsx(oo,{className:o,onClick:()=>i?.(e)}):r.jsx(un,{className:o,onClick:()=>i?.(e)})),r.jsx(S.Checkbox,{id:e?.id,label:e?.name,checked:!!e.isSelectedValue,checkboxIcon:n,onChange:u})]}),l&&e?.isExpanded&&r.jsx(r.Fragment,{children:e?.children?.map(c=>r.jsx(Ya,{node:c,level:t+1,checkboxIcon:n,selectFilterValue:s,selectHierarchicalNodes:a,expandHierarchicalValue:i},c?.id))})]},e?.id)},lo=({filterValues:e,checkboxIcon:t,selectFilterValue:n,selectHierarchicalNodes:s,expandHierarchicalValue:a})=>{const[i,l]=d.useState([]);return d.useEffect(()=>{l(no(e))},[e]),i?.map(f=>r.jsx(Ya,{node:f,checkboxIcon:t,selectFilterValue:n,selectHierarchicalNodes:s,expandHierarchicalValue:a},f?.id))},Os=({style:e,filterValue:t,checkboxIcon:n,selectFilterValue:s})=>r.jsx("div",{style:e,children:r.jsx(S.Checkbox,{id:t.id,label:t.name,checked:!!t.isSelectedValue,checkboxIcon:n,onChange:s})}),co={isMetadataInSidePanel:!1,isCrossDatasetModeOn:!1,isTableSettingsFeatureEnabled:!1},Ka=d.createContext(co);function uo({children:e,isMetadataInSidePanel:t=!1,isCrossDatasetModeOn:n=!1,isTableSettingsFeatureEnabled:s=!1}){const a=d.useMemo(()=>({isMetadataInSidePanel:t,isCrossDatasetModeOn:n,isTableSettingsFeatureEnabled:s}),[t,n,s]);return r.jsx(Ka.Provider,{value:a,children:e})}function ke(){return d.useContext(Ka)}const Et=(e,t,n,s,a=$.Locale.EN)=>{const i=t?.map(l=>{const f=D.findCodelistByDimension(n?.codelists,n?.conceptSchemes,l),o=D.getAvailableCodesFromConstrains(f?.codes,l.id,s,a);return{...l,dimensionValues:o}});return e?.map(l=>{const o=(i?.find(u=>u.id===l.id)?.dimensionValues||[]).map(u=>{const c=l.dimensionValues?.find(m=>m?.id===u?.id)?.isSelectedValue;return{...u,isSelectedValue:c}});return{...l,isDisabled:!1,dimensionValues:o}})||[]},sn=(e,t)=>{let n=[];return mn(e).filter(s=>s.timeRange||s.dimensionValues?.some(a=>a.isSelectedValue)).forEach(s=>{const{id:a,dimensionValues:i}=s;s.isTimeDimension?n=[...n,...fo(s.timeRange,a)]:n.push({componentCode:a,operator:D.SeriesFilterOperator.EQUALS,value:i?.filter(l=>l.isSelectedValue)?.map(l=>l.id).join(D.GET_v3_FILTER_AND)||""})}),n},fo=(e,t)=>e==null||e.startPeriod==null||e.endPeriod==null?[]:[{componentCode:t,operator:D.SeriesFilterOperator.GREATER_OR_EQUAL,value:_s(new Date(e.startPeriod))},{componentCode:t,operator:D.SeriesFilterOperator.LESS_OR_EQUAL,value:_s(new Date(e.endPeriod),1)}],mo=1e3*60*60*24,_s=(e,t=0)=>{e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());let n=e.getTime();return n+=t?mo-1:0,e=new Date(n),n.toString()},ct=e=>[...e].map(t=>({...t,value:t.value.split(",").sort().join(",")})).sort((t,n)=>t.componentCode.localeCompare(n.componentCode)),Nt=new Map,At=new Map;function ho(e,t){return`${e.name??""}::${t}`}function Oe(...e){return JSON.stringify(e)}async function _e(e,t,n){const s=ho(e,t);if(Nt.has(s))return Nt.get(s);const a=At.get(s);if(a)return a;const i=n().then(l=>(Nt.set(s,l),l)).finally(()=>{At.delete(s)});return At.set(s,i),i}function Fs(){Nt.clear(),At.clear()}const go=e=>e.map(t=>({componentCode:t.id||"",operator:$.QueryFilterType.IN,values:t.dimensionValues?.map(n=>n.id)||[]})),qa=(e,t)=>{const n=t?.timeDimensions?.[0],s=D.getTimeRangeFromAttachment(e,n)||null;return s?D.getQueryTimePeriodFilters(s,n?.id):null},Za=(e,t,n)=>{const s=Ut(mn(e)),a=s.find(i=>i?.isTimeDimension&&i?.timeRange);return{filterKey:D.getTimeSeriesFilterKey(t||[],go(s)),timeFilter:D.getQueryTimePeriodFilters(a?.timeRange,a?.id)}},Xa=(e,t)=>mn(e)?.filter(n=>n.timeRange||n.dimensionValues?.some(s=>s.isSelectedValue)).map(n=>n?.isTimeDimension?{componentCode:n?.id,operator:$.QueryFilterType.BETWEEN,values:[Vs(n?.timeRange?.startPeriod||void 0)||"",Vs(n?.timeRange?.endPeriod||void 0)||""]}:{componentCode:n?.id,operator:$.QueryFilterType.IN,values:n?.dimensionValues?.filter(s=>s.isSelectedValue)?.map(s=>s.id)||[]}),Vs=e=>{if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear();return`${n}-${t}-${s}`},po="COUNTRY",wo="FREQUENCY",Co="TIME_PERIOD",Us=()=>(e,t)=>{const n=e?.name?.trim()?.toLocaleLowerCase();return n?vo(n):xo(t||"",e.id)},vo=e=>`name:${e}`,xo=(e,t)=>`dataset:${e}:id:${t}`,Qa=[{id:po,getMergedValueKey:Us()},{id:wo,getMergedValueKey:Us()},{id:Co,getMergedValueKey:e=>e.id}],bo=new Map(Qa.map(e=>[e.id,e])),So=e=>e?bo.get(e):void 0,er=e=>!!So(e),yo=e=>e?.filterType==="shared"&&er(e?.id),Do=(e,t)=>{const n=new Map;return e.forEach(s=>{s.dimensionValues?.forEach(a=>{const i=t.getMergedValueKey(a,s.datasetUrn),l={datasetUrn:s.datasetUrn,id:a.id,name:a.name,parent:a.parent},f=n.get(i);if(f){f.isSelectedValue=f.isSelectedValue||a.isSelectedValue,f.sourceValues=[...f.sourceValues||[],l];return}n.set(i,{id:i,name:a.name,isSelectedValue:a.isSelectedValue,parent:a.parent,sourceValues:[l]})})}),Array.from(n.values())},tr=e=>{const t=new Map,n=[];return e.forEach(a=>{if(er(a?.id)&&a?.datasetUrn){const i=t.get(a.id)||[];t.set(a.id,[...i,a]);return}n.push(a)}),[...Qa.flatMap(a=>{const i=t.get(a.id);if(!i?.length)return[];const l={...i[0],datasetUrn:void 0,filterType:"shared",sourceDatasetUrns:i.map(f=>f.datasetUrn).filter(f=>!!f),dimensionValues:Do(i,a)};return l.isTimeDimension&&(l.timeRange=ko(i)),l}),...n]},Mo=e=>{if(!yo(e))return[e];if(e.isTimeDimension)return(e.sourceDatasetUrns||[]).map(n=>({...e,datasetUrn:n,filterType:"dataset"}));const t=new Map;return e.dimensionValues?.forEach(n=>{n.sourceValues?.forEach(s=>{const a=s.datasetUrn||"",i=t.get(a),l={id:s.id,name:s.name,parent:s.parent,isSelectedValue:n.isSelectedValue};if(i){i.dimensionValues=[...i.dimensionValues||[],l];return}t.set(a,{...e,datasetUrn:a,filterType:"dataset",dimensionValues:[l]})})}),Array.from(t.values())},ko=e=>{const t=e.map(s=>s.timeRange?.startPeriod).filter(s=>!!s),n=e.map(s=>s.timeRange?.endPeriod).filter(s=>!!s);if(!(!t.length||!n.length))return{startPeriod:new Date(Math.min(...t.map(s=>s.getTime()))),endPeriod:new Date(Math.max(...n.map(s=>s.getTime())))}},To=(e,t)=>{if(!e.isTimeDimension||!e.timeRange)return e;const n=D.getAnnotationPeriod(t?.[0]?.annotations),s=n.startPeriod,a=n.endPeriod;if(!s||!a)return e;const{startPeriod:i,endPeriod:l}=e.timeRange;return l&&l<s?{...e,timeRange:{startPeriod:new Date(s),endPeriod:new Date(s)}}:i&&i>a?{...e,timeRange:{startPeriod:new Date(a),endPeriod:new Date(a)}}:{...e,timeRange:{startPeriod:i?new Date(Math.max(i.getTime(),s.getTime())):new Date(s),endPeriod:l?new Date(Math.min(l.getTime(),a.getTime())):new Date(a)}}},Eo=(e,t)=>e?.dimensionsMap?new Map(Array.from(e.dimensionsMap.entries()).map(([n,s])=>[n,Ga(s,e?.structuresMap?.get(n),e?.structureDimensionsMap?.get(n),t,n)])):new Map,No=(e,t)=>new Map(Array.from(e?.dimensionsMap?.entries()||[]).map(([n,s])=>{const a=s?.map(i=>{const l=D.findCodelistByDimension(e?.structuresMap?.get(n)?.codelists,e?.structuresMap?.get(n)?.conceptSchemes,i),f=D.getAvailableCodesFromConstrains(l?.codes,i.id,e?.constraintsMap?.get(n),t);return{...i,dimensionValues:f}})||[];return[n,a]})),Ao=(e,t)=>{const n=Eo(e,t),s=No(e,t);return new Map(Array.from(n?.entries()||[]).map(([a,i])=>{const l=s?.get(a),f=i.map(o=>({...o,dimensionValues:l?.find(u=>u.id===o.id)?.dimensionValues||[]}));return[a,f]}))},jo=(e,t,n)=>tr(t?.flatMap(s=>{const a=s?.urn,i=e?.get(a)||[],l=n?.get(a)||[];return Ja(i,s,l)})||[]),qt=(e,t)=>e?.flatMap(n=>Mo(n))?.reduce((n,s)=>{const a=s?.datasetUrn||"",i=To(s,t?.get(a));return n.has(a)||n.set(a,[]),n?.get(a)?.push(i),n},new Map),Mt=(e,t,n=$.Locale.EN)=>{const s=[];return Array.from(e?.entries())?.forEach(([a,i])=>{const l=t?.dimensionsMap?.get(a),f=t?.structuresMap?.get(a),o=t?.constraintsMap?.get(a);s.push(...Et(i,l,f,o,n))}),tr(s)},mn=(e,t)=>e.filter(n=>n.filterType!=="shared"),nr=(e,t)=>{if(e?.filterType==="shared")return;const n=e?.datasetUrn?t?.get(e.datasetUrn)?.dataflows?.[0]:void 0;return n?D.generateShortUrn(n?.name,"",n?.agencyID):void 0},Io=(e,t)=>e?.length?!!t?.dimensionsMap&&!!t?.structuresMap&&!!t?.structureDimensionsMap&&!!t?.constraintsMap:!1,Gs=(e,t,n)=>e?.map(s=>{const a=s?.urn??"",i=ct(sn(t?.get(a)||[]).filter(l=>l.componentCode!==D.TIME_PERIOD));return n?_e(n.getConstraints,Oe(a,i),()=>n.getConstraints(a,i)):Promise.resolve({})})||[],Bs=e=>new Map(e?.map(t=>{const n=t?.data?.dataConstraints;return[D.generateShortUrn(n?.[0]?.id,n?.[0]?.version,n?.[0]?.agencyID),n]})),sr=(e,t,n,s)=>{if(e&&t?.filterType==="shared"&&t?.isTimeDimension){const i=Array.from(s?.values()||[]).flatMap(o=>o||[]).map(o=>D.getAnnotationPeriod(o?.annotations)).filter(o=>o.startPeriod!==null&&o.endPeriod!==null);if(!i.length)return[];const l=new Date(Math.min(...i.map(o=>o.startPeriod.getTime()))),f=new Date(Math.max(...i.map(o=>o.endPeriod.getTime())));return[{id:t.id||D.TIME_PERIOD,annotations:[{id:D.TIME_PERIOD_START_ANNOTATION_KEY,title:l.toISOString()},{id:D.TIME_PERIOD_END_ANNOTATION_KEY,title:f.toISOString()}]}]}return e?s?.get(t?.datasetUrn??"")??[]:n??[]},Lo=(e,t,n)=>new Map(t?.map(s=>{const a=s?.urn;return[a,Za(e.get(a)||[],n?.get(a))]})),Po=(e,t)=>new Map(e?.map(n=>{const s=n?.urn;return[s,Xa(t?.get(s)||[])]})),hn=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M8 14C6.32222 14 4.90278 13.7417 3.74167 13.225C2.58056 12.7083 2 12.0778 2 11.3333V4.66667C2 3.93333 2.58611 3.30556 3.75833 2.78333C4.93056 2.26111 6.34444 2 8 2C9.65556 2 11.0694 2.26111 12.2417 2.78333C13.4139 3.30556 14 3.93333 14 4.66667V11.3333C14 12.0778 13.4194 12.7083 12.2583 13.225C11.0972 13.7417 9.67778 14 8 14ZM8 6.01667C8.98889 6.01667 9.98333 5.875 10.9833 5.59167C11.9833 5.30833 12.5444 5.00556 12.6667 4.68333C12.5444 4.36111 11.9861 4.05556 10.9917 3.76667C9.99722 3.47778 9 3.33333 8 3.33333C6.98889 3.33333 5.99722 3.475 5.025 3.75833C4.05278 4.04167 3.48889 4.35 3.33333 4.68333C3.48889 5.01667 4.05278 5.32222 5.025 5.6C5.99722 5.87778 6.98889 6.01667 8 6.01667ZM8 9.33333C8.46667 9.33333 8.91667 9.31111 9.35 9.26667C9.78333 9.22222 10.1972 9.15833 10.5917 9.075C10.9861 8.99167 11.3583 8.88889 11.7083 8.76667C12.0583 8.64444 12.3778 8.50556 12.6667 8.35V6.35C12.3778 6.50556 12.0583 6.64444 11.7083 6.76667C11.3583 6.88889 10.9861 6.99167 10.5917 7.075C10.1972 7.15833 9.78333 7.22222 9.35 7.26667C8.91667 7.31111 8.46667 7.33333 8 7.33333C7.53333 7.33333 7.07778 7.31111 6.63333 7.26667C6.18889 7.22222 5.76944 7.15833 5.375 7.075C4.98056 6.99167 4.61111 6.88889 4.26667 6.76667C3.92222 6.64444 3.61111 6.50556 3.33333 6.35V8.35C3.61111 8.50556 3.92222 8.64444 4.26667 8.76667C4.61111 8.88889 4.98056 8.99167 5.375 9.075C5.76944 9.15833 6.18889 9.22222 6.63333 9.26667C7.07778 9.31111 7.53333 9.33333 8 9.33333ZM8 12.6667C8.51111 12.6667 9.03056 12.6278 9.55833 12.55C10.0861 12.4722 10.5722 12.3694 11.0167 12.2417C11.4611 12.1139 11.8333 11.9694 12.1333 11.8083C12.4333 11.6472 12.6111 11.4833 12.6667 11.3167V9.68333C12.3778 9.83889 12.0583 9.97778 11.7083 10.1C11.3583 10.2222 10.9861 10.325 10.5917 10.4083C10.1972 10.4917 9.78333 10.5556 9.35 10.6C8.91667 10.6444 8.46667 10.6667 8 10.6667C7.53333 10.6667 7.07778 10.6444 6.63333 10.6C6.18889 10.5556 5.76944 10.4917 5.375 10.4083C4.98056 10.325 4.61111 10.2222 4.26667 10.1C3.92222 9.97778 3.61111 9.83889 3.33333 9.68333V11.3333C3.38889 11.5 3.56389 11.6611 3.85833 11.8167C4.15278 11.9722 4.52222 12.1139 4.96667 12.2417C5.41111 12.3694 5.9 12.4722 6.43333 12.55C6.96667 12.6278 7.48889 12.6667 8 12.6667Z",fill:"currentColor"})),Ro=e=>le.createElement("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M6.66663 6.175L10.4833 10L6.66663 13.825L7.84163 15L12.8416 10L7.84163 5L6.66663 6.175Z",fill:"currentColor"})),Oo=di.FixedSizeList,zs=24,Hs=232,Zt=({selectedFilter:e,filterValues:t,checkboxIcon:n,isHierarchicalView:s,isVirtualized:a=!0,isScrollable:i=!0,isDisableValues:l,structuresMap:f,selectFilterValue:o,selectHierarchicalNodes:u,expandHierarchicalValue:c})=>{const m=S.useIsMobile(),{isCrossDatasetModeOn:h}=ke();if(!t)return null;const g=e?nr(e,f):void 0,p=h&&e?.filterType!=="shared"&&!!g&&!!e?.title,x=t.length*zs,w=x>Hs?Hs:x;return r.jsxs("div",{className:V(l&&"pointer-events-none opacity-[0.7]",i?"flex h-full min-h-0 flex-col":"flex flex-col"),children:[p&&r.jsxs("div",{className:"mb-2 flex items-center gap-x-1",children:[r.jsx(hn,{className:"size-4 shrink-0 text-neutrals-700"}),r.jsx("span",{className:"h4 text-neutrals-800",children:g}),r.jsx(Ro,{className:"size-4 shrink-0 text-neutrals-1000"}),r.jsx("span",{className:"h4 text-neutrals-1000",children:e?.title})]}),r.jsx("div",{className:V(i?"min-h-0 flex-1 overflow-auto":"overflow-visible"),style:i&&m?{height:`${w}px`}:void 0,children:s?r.jsx(lo,{filterValues:t,checkboxIcon:n,selectFilterValue:o,selectHierarchicalNodes:u,expandHierarchicalValue:c}):a?r.jsx(ui,{children:({width:b,height:y})=>r.jsx(Oo,{itemCount:t.length,itemSize:zs,width:b,height:y,children:({index:C,style:v})=>r.jsx(Os,{style:v,filterValue:t[C],checkboxIcon:n,selectFilterValue:o})})}):r.jsx("div",{className:"flex flex-col gap-y-1",children:t.map(b=>r.jsx(Os,{filterValue:b,checkboxIcon:n,selectFilterValue:o},b.id))})})]})},Ws=2,ar=({filtersList:e,selectedFilter:t,filterValuesProps:n,locale:s,isDisableValues:a,timeRangeOptions:i,onTimePeriodChange:l,selectFilterValue:f,titles:o,initialConstraints:u,structuresMap:c,selectHierarchicalNodes:m,expandHierarchicalValue:h,selectedTimeOption:g})=>{const[p,x]=d.useState(""),[w,b]=d.useState(!1),{isCrossDatasetModeOn:y}=ke(),C=t?.displayMode===$e.HIERARCHY,v=lt(t),M=t?.filterType==="shared",T=p?.trim().toLowerCase(),j=y?T.length>=Ws:!!T,N=j&&y&&!M,O=y&&w&&T.length<Ws,k=d.useCallback(L=>{if(!L?.dimensionValues)return{filterValues:[],matchedCount:0};const P=L.dimensionValues.filter(U=>U?.name?.toLowerCase()?.includes(T));return{filterValues:L.displayMode===$e.HIERARCHY?D.getFilteredItemsWithParents(L.dimensionValues,P):P,matchedCount:P.length}},[T]),E=d.useMemo(()=>j?k(t).filterValues:t?.dimensionValues,[j,k,t]),A=d.useMemo(()=>N?(e||[]).reduce((L,P)=>{if(Ie(P,t)||P.filterType==="shared")return L;const{filterValues:U,matchedCount:G}=k(P);return G?[...L,{filter:P,filterValues:U,matchedCount:G,isHierarchicalView:P.displayMode===$e.HIERARCHY}]:L},[]):[],[N,e,t,k]),I=d.useMemo(()=>A.reduce((L,P)=>L+P.matchedCount,0),[A]);d.useEffect(()=>{x(""),b(!1)},[v]);const R=d.useCallback(L=>{x(L)},[x]);return r.jsx(r.Fragment,{children:t?.isTimeDimension&&u?r.jsx(io,{titles:o,initialConstraints:u,calendarResolution:$.CalendarResolution.DAY,timeRange:t?.timeRange||null,timeRangeOptions:i||[],calendarStartFromMonday:!0,locale:s,radioIcon:n?.radioIcon,onValueChange:l,calendarIcon:n?.calendarIcon,dateFormat:n?.dateFormat,defaultTimeOption:g}):r.jsxs("div",{className:V("flex flex-col pt-2 pb-2 h-full flex-1 min-w-0 sm:border-0","filter-values-container"),children:[r.jsx(S.InputWithIcon,{inputId:"filters-search-input",containerClasses:"gap-2 items-center filters-search-input",cssClass:"filters-search-input-text",placeholder:o?.searchPlaceholder??"Search",value:p,onChange:R,onFocus:()=>b(!0),onBlur:()=>b(!1),iconBeforeInput:r.jsx(Me.IconSearch,{width:n?.searchIconSize,height:n?.searchIconSize,className:"text-primary"})}),y&&r.jsx("span",{className:V("caption text-neutrals-800 mt-1",{invisible:!O}),children:o?.searchMinCharsCaption??"Enter at least 2 characters to start searching"}),r.jsx("div",{className:"body-2 mt-3 flex min-h-0 flex-1 flex-col overflow-auto",children:N?r.jsxs(r.Fragment,{children:[t&&r.jsxs("div",{className:"shrink-0 pb-4",children:[r.jsx(Zt,{selectedFilter:t,filterValues:E,checkboxIcon:n?.checkboxIcon,isHierarchicalView:C,isVirtualized:!1,isScrollable:!1,isDisableValues:a,structuresMap:c,selectFilterValue:f,selectHierarchicalNodes:m,expandHierarchicalValue:h}),!E?.length&&r.jsx("span",{className:"body-2 text-neutrals-700",children:o?.noResultsInSection?.(t.title??"")??`No results found in ${t.title??""}`})]}),r.jsxs("div",{className:"pb-3",children:[r.jsxs("span",{className:"h2 text-neutrals-1000",children:[o?.otherResults??"Other results",":"," ",I]}),I===0&&r.jsx("p",{className:"body-2 text-neutrals-700 mt-1",children:o?.noResultsInOtherDimensions??"No results found in other dimensions"})]}),A.map(({filter:L,filterValues:P,isHierarchicalView:U})=>r.jsx("div",{className:"shrink-0 pb-4 last:pb-0",children:r.jsx(Zt,{selectedFilter:L,filterValues:P,checkboxIcon:n?.checkboxIcon,isHierarchicalView:U,isVirtualized:!1,isScrollable:!1,isDisableValues:a,structuresMap:c,selectFilterValue:(G,J)=>f(G,J,L),selectHierarchicalNodes:G=>m(G,L),expandHierarchicalValue:G=>h(G,L)})},lt(L)))]}):r.jsx(Zt,{selectedFilter:t,filterValues:E,checkboxIcon:n?.checkboxIcon,isHierarchicalView:C,isDisableValues:a,structuresMap:c,selectFilterValue:f,selectHierarchicalNodes:m,expandHierarchicalValue:h})})]})})},_o=({filtersList:e,filter:t,onSelectFilter:n,onSelectDisplayMode:s,onDeleteFilter:a,locale:i,titles:l,initialConstraints:f,datasetIcon:o,datasetName:u,hideFacetCounterByDefault:c,filterValuesProps:m,isDisableValues:h,timeRangeOptions:g,onTimePeriodChange:p,selectFilterValue:x,selectHierarchicalNodes:w,expandHierarchicalValue:b})=>{const y=S.useIsMobile(),[C,v]=d.useState(0),[M,T]=d.useState(!1),j=t?.isTimeDimension&&t?.timeRange,N=d.useMemo(()=>t?.timeRange?.startPeriod&&t?.timeRange?.endPeriod?`${Rt(t?.timeRange?.startPeriod,i)} -
6
6
  ${Rt(t?.timeRange?.endPeriod,i)}`:"",[i,t?.timeRange]);d.useEffect(()=>{v(za(t?.dimensionValues)?.length)},[t?.dimensionValues]);const O=A=>{s?.(t,A)},k=c?C>0:!0;d.useEffect(()=>{t.isSelectedFilter||T(!1)},[t.isSelectedFilter]);const E=()=>{y&&T(A=>!A),n(t)};return r.jsxs("div",{className:"flex flex-col",children:[u&&r.jsxs("h4",{className:"filters-facet-dataset-name",children:[r.jsx("span",{className:"filters-facet-dataset-icon",children:o}),u]}),r.jsxs("div",{className:V("flex justify-between items-center p-2 hover:bg-hues-100 py-2 sm:py-4 sm:hover:bg-white","filters-facet-item cursor-pointer",t?.isSelectedFilter&&!y&&"bg-hues-100",t?.isDisabled&&"cursor-default pointer-events-none opacity-[0.7]"),onClick:E,children:[r.jsxs("h3",{className:"w-full min-w-0 flex-1 truncate sm:flex sm:items-center",title:t?.title,children:[r.jsx("span",{className:"truncate",children:t?.title}),y&&r.jsx(un,{className:V("chevron-icon w-6 h-6 shrink-0",M&&"rotate-180")})]}),r.jsxs("div",{className:"ml-2 flex items-center gap-2 text-neutrals-800",children:[j&&r.jsx("span",{className:"filters-facet-item-counter border-none",children:N}),!j&&k&&r.jsx("span",{className:V("px-2 text-center","filters-facet-item-counter"),children:C?`${C}/${t?.dimensionValues?.length||0}`:l?.all||"All"}),j?null:r.jsxs("div",{className:"filters-facet-item-settings flex items-center gap-2",children:[r.jsx(S.Dropdown,{triggerButton:r.jsx(S.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:r.jsx(Gi,{width:16,height:16}),title:l?.displayOrder||"Display Order",disabled:!t?.isHierarchical}),options:ro(l),selectedOption:t?.displayMode,disabled:!t?.isHierarchical,onOptionSelect:O}),C>0&&r.jsx(S.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:r.jsx(Ui,{width:16,height:16}),title:l?.reset||"Reset",onClick:A=>{A.stopPropagation(),a?.(t)}})]})]})]}),M&&r.jsx(ar,{filtersList:e,titles:l,selectedFilter:t,locale:i,isDisableValues:h,timeRangeOptions:g,selectFilterValue:x,selectHierarchicalNodes:w,expandHierarchicalValue:b,onTimePeriodChange:p,filterValuesProps:m,initialConstraints:f})]})},Fo=({filtersList:e,hideFacetCounterByDefault:t,locale:n,onSelectFilter:s,onDeleteFilter:a,onSelectDisplayMode:i,filterValuesProps:l,isDisableValues:f,timeRangeOptions:o,initialConstraints:u,initialConstraintsMap:c,datasetIcon:m,structuresMap:h,onTimePeriodChange:g,selectFilterValue:p,selectHierarchicalNodes:x,titles:w,expandHierarchicalValue:b})=>{const{isCrossDatasetModeOn:y}=ke();return r.jsx("div",{className:V("overflow-y-auto advanced-view-filters-list min-w-[320px] pr-3 h-full sm:w-full"),children:e?.map(C=>r.jsx(_o,{filtersList:e,titles:w,locale:n,filter:C,onSelectFilter:s,onSelectDisplayMode:i,onDeleteFilter:a,hideFacetCounterByDefault:t,isDisableValues:f,timeRangeOptions:o,selectFilterValue:p,selectHierarchicalNodes:x,expandHierarchicalValue:b,onTimePeriodChange:g,filterValuesProps:l,initialConstraints:sr(y,C,u,c),datasetIcon:m,datasetName:nr(C,h)},lt(C)))})},rr=({filtersList:e,titles:t,selectedFilter:n,modalProps:s,locale:a,isDisableValues:i,timeSeriesCount:l,timeRangeOptions:f,initialConstraints:o,initialConstraintsMap:u,datasetIcon:c,structuresMap:m,setSelectedFilter:h,onSelectDisplayMode:g,onDeleteFilter:p,onClearAllFilters:x,updateSelectedFilterValues:w,onTimePeriodChange:b,selectedTimeOption:y})=>{const C=S.useIsMobile(),{isCrossDatasetModeOn:v}=ke(),M=fn(Ut(e)),T=d.useCallback(E=>{const A=e?.find(I=>Ie(I,E));if(!A){h(void 0);return}h({...A,isSelectedFilter:!0})},[e,h]),j=(E,A,I)=>{const R=I||n,L=!I||Ie(I,n);if(!R)return;const P={...R,dimensionValues:R?.dimensionValues?.map(U=>U?.id===E?{...U,isSelectedValue:A}:U)};L&&h(P),w&&w(P)},N=(E,A)=>{const I=A||n,R=!A||Ie(A,n);if(!I)return;const L={...I,dimensionValues:I?.dimensionValues?.map(P=>E?.find(G=>G?.id===P?.id)||P)};R&&h(L),w&&w(L)},O=(E,A)=>{const I=A||n,R=!A||Ie(A,n);if(!I)return;const L={...I,dimensionValues:I?.dimensionValues?.map(P=>P?.id===E?.id?{...P,isExpanded:!E?.isExpanded}:P)};R&&h(L),w&&w(L)},k=(E,A)=>{if(!n)return;const I={...n,timeRange:E||void 0};b?.(A),h(I),w&&w(I)};return r.jsxs("div",{className:V("flex flex-row gap-5 flex-1 min-h-0 sm:p-0","filters-settings"),children:[r.jsxs("div",{className:V("h-full sm:w-full",s?.isShowTimeSeriesCount&&"flex flex-col justify-between"),children:[v&&r.jsxs("div",{className:"mb-4 flex items-center justify-between gap-x-4",children:[r.jsxs("span",{className:"body-3 text-neutrals-900",children:[t?.appliedFilters??"Applied filters",": ",M]}),r.jsx(S.Button,{buttonClassName:"text-button-tertiary p-0",title:t?.clearAll??"Clear All",onClick:x,isSmallButton:C})]}),r.jsx(Fo,{filtersList:e,hideFacetCounterByDefault:s?.isHideFacetCounterByDefault,locale:a,titles:t,onSelectFilter:T,onSelectDisplayMode:g,onDeleteFilter:p,isDisableValues:i,initialConstraints:o,initialConstraintsMap:u,datasetIcon:c,structuresMap:m,timeRangeOptions:f,selectFilterValue:j,selectHierarchicalNodes:N,expandHierarchicalValue:O,onTimePeriodChange:k,filterValuesProps:s?.filterValuesProps}),s?.isShowTimeSeriesCount&&l?r.jsxs("h4",{className:"my-4 text-neutrals-800",children:[t?.timeSeries??"Timeseries",": ",l]}):null]}),!C&&r.jsx(ar,{filtersList:e,selectedFilter:n,locale:a,titles:t,isDisableValues:i,timeRangeOptions:f,selectFilterValue:j,selectHierarchicalNodes:N,expandHierarchicalValue:O,onTimePeriodChange:k,filterValuesProps:s?.filterValuesProps,structuresMap:m,initialConstraints:sr(v,n,o,u),selectedTimeOption:y})]})},Vo=({timeseriesLength:e=0,limitMessages:t})=>{const n=!e||S.SERIES_LIMIT>e;return r.jsx("div",{className:"body-3 flex items-center gap-x-[4px] text-neutrals-800 sm:justify-center sm:text-center",children:n?r.jsx("span",{children:t?.seriesCount?.(e)}):r.jsxs(r.Fragment,{children:[r.jsx("span",{children:t?.warningIcon}),r.jsx("span",{children:t?.counterLimit?.(e,S.SERIES_LIMIT)})]})})},ir=({modalProps:e,onApply:t,onClearAllFilters:n,onClose:s,titles:a,applyDisabled:i,timeseriesLength:l,limitMessages:f})=>{const o=S.useIsMobile(),u=e?.footerActionsPosition==="right",c=e?.isShowCancelButton,m=e?.isShowClearAllButton??!0,h=c?u?"justify-end":"justify-start":u?"flex-row items-center justify-between sm:flex-col-reverse sm:gap-y-4":"gap-x-8 flex-row-reverse items-center justify-between sm:flex-col sm:gap-y-4",g=c?u?"items-center gap-x-8":"justify-between":u?"flex-row justify-end items-center sm:flex-col-reverse sm:gap-y-4":"gap-x-8 flex-row-reverse justify-end items-center sm:flex-col-reverse sm:gap-y-4";return r.jsxs("div",{className:V("flex py-4 px-6 modal-footer-wrapper",h),children:[!c&&r.jsx(Vo,{timeseriesLength:l,limitMessages:f}),r.jsxs("div",{className:V("flex",g),children:[m&&r.jsx(S.Button,{iconBefore:o?e?.resetIcon:void 0,buttonClassName:"text-button-tertiary p-0",title:e?.isShowClearIcon?a?.clearAllFilters??"Clear All Filters":a?.clearAll??"Clear All",onClick:()=>n(),isSmallButton:o}),r.jsxs("div",{className:"flex items-center gap-x-3",children:[e?.isShowCancelButton?r.jsx(S.Button,{buttonClassName:"text-button-tertiary sm:h8",title:a?.cancel??"Cancel",onClick:s,isSmallButton:o}):null,r.jsx(S.Button,{buttonClassName:"advanced-view-filters-modal-apply-button",title:a?.apply??"Apply",onClick:t,isSmallButton:o,disabled:i})]})]})]})},Uo=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M3.33333 13.3327V8.66602H2V7.33268H6V8.66602H4.66667V13.3327H3.33333ZM3.33333 5.99935V2.66602H4.66667V5.99935H3.33333ZM6 5.99935V4.66602H7.33333V2.66602H8.66667V4.66602H10V5.99935H6ZM7.33333 13.3327V7.33268H8.66667V13.3327H7.33333ZM11.3333 13.3327V11.3327H10V9.99935H14V11.3327H12.6667V13.3327H11.3333ZM11.3333 8.66602V2.66602H12.6667V8.66602H11.3333Z",fill:"currentColor"}));var Ce=(e=>(e.DATA_GRID="dataGrid",e.METADATA_PER_SERIES="metadataPerSeries",e.CHARTS="charts",e.CHARTS_NAVIGATION="chartsNavigation",e.OPEN_ADVANCED_VIEW="openAdvancedView",e.FILTERS="filters",e.CHART_PER_SERIES="chartPerSeries",e.METADATA_PER_DATASET="metadataPerDataset",e.EXIT_ADVANCED_VIEW="exitAdvancedView",e))(Ce||{});const gn=["charts","chartsNavigation"],$s=["dataGrid","metadataPerSeries",...gn,"openAdvancedView"],or=["filters","chartPerSeries","metadataPerDataset","exitAdvancedView"],Ge=(e,t)=>{const n=t?.[`${e}Title`],s=t?.[`${e}Description`];return{title:typeof n=="string"?n:"",description:typeof s=="string"?s:""}},an=(e,t)=>e.find(n=>!t.infoElements?.[n])||"",Go=(e,t)=>{if(!e||!t)return"";if($s.includes(t)){const s=an($s,e);if(s)return s}const n=an(or,e);return n||""},lr=(e,t)=>{const n=an(e,t);return{...t,infoElements:{...t?.infoElements,[t.lastDisplayedElement]:!1,...n?{[n]:!0}:{}},lastDisplayedElement:n}},cr=e=>lr(or,e),Bo=e=>lr(gn,e),zo=e=>(!e?.infoElements?.charts||!e?.infoElements?.chartsNavigation)&&!gn.includes(e.lastDisplayedElement),Ve=5,Ho=({targetPosition:e,overlayClasses:t,onClose:n})=>r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"overlay overlay-top",style:{height:e.top,top:0-Ve,bottom:e.top+Ve}}),r.jsx("div",{className:"overlay overlay-bottom",style:{top:e.bottom+Ve,bottom:0}}),r.jsx("div",{className:"overlay overlay-left",style:{top:e.top-Ve,height:e.height+Ve*2,width:e.left,left:0-Ve,right:e.left-Ve*2}}),r.jsx("div",{className:"overlay overlay-right",style:{top:e.top-Ve,left:e.right+Ve,height:e.height+Ve*2,right:0}}),r.jsx("div",{className:V("outline-block z-10",t),onClick:n,style:{top:e.top,left:e.left,height:e.height,width:e.width}})]}),Be=({reference:e,title:t,description:n,onReferenceClick:s,shouldCloseTooltip:a,shouldMoveToNextStep:i,supressReferenceClick:l})=>{const[f,o]=d.useState(!0),[u,c]=d.useState(!1),m=d.useRef(null),{isShowOnboarding:h,onboardingFileSchema:g,setOnboardingFileSchema:p}=Ae(),{refs:x,floatingStyles:w,context:b,placement:y}=Le.useFloating({open:f,onOpenChange:o,placement:"right-start",elements:{reference:e?.current},middleware:[Le.offset({mainAxis:12,crossAxis:-4}),Le.flip(),Le.shift(),Le.arrow({element:m})],whileElementsMounted:Le.autoUpdate}),C=Le.useClick(b),{getFloatingProps:v}=Le.useInteractions([C]),M=d.useCallback(()=>{if(h){const O=Go(g,g?.lastDisplayedElement);p?.({...g,infoElements:{...g?.infoElements,...O?{[O]:!0}:{}},lastDisplayedElement:O})}o?.(!1)},[h,g,p]);d.useEffect(()=>{x.setReference(e?.current??null)},[e,x]);const T=()=>M(),j=e?.current?.getBoundingClientRect();d.useEffect(()=>{a&&!u&&(M(),c(!0))},[a,M,u]);const N=()=>{s?(s?.(),i?M():o(!1)):l||(M(),e?.current?.click())};return r.jsx(r.Fragment,{children:f&&r.jsxs(Le.FloatingPortal,{children:[j&&r.jsx(Ho,{overlayClasses:l?"cursor-default":"cursor-pointer",targetPosition:j,onClose:N}),r.jsxs("div",{ref:x.setFloating,style:w,...v(),className:"tooltip z-tooltip max-w-[350px]",children:[r.jsxs("div",{className:"tooltip-header",children:[r.jsx("h3",{children:t}),r.jsx(S.CloseButton,{btnClassNames:"w-4 h-4",onClick:T})]}),r.jsx("div",{className:"tooltip-description",children:r.jsx("p",{children:n})}),r.jsx("div",{ref:m,className:V("tooltip-arrow absolute w-3 h-3 rotate-45",y?.includes("right")?"left-[-4px]":"right-[-6px]",y?.includes("end")?"bottom-2 tooltip-arrow-white":"top-3")})]})]})})},dr=({buttonProps:e,selectedFiltersCount:t=0,isLoading:n,setModalState:s,titles:a,isModalClosed:i,warningIcon:l,filterIconClassName:f,timeSeriesCount:o})=>{const u=d.useRef(null),[c,m]=d.useState(""),[h,g]=d.useState(""),[p,x]=d.useState(!1),{onboardingFileSchema:w,isShowOnboarding:b}=Ae(),y=S.SERIES_LIMIT<(o??0),C=d.useMemo(()=>e?.isShowBadge?e?.title:`${e?.title}: ${t}`,[e?.isShowBadge,e?.title,t]);return d.useEffect(()=>{if(b){const{title:v,description:M}=Ge(Ce.FILTERS,a);m(v),g(M)}},[a,b]),d.useEffect(()=>{b&&x(w?.lastDisplayedElement===Ce.FILTERS)},[w?.lastDisplayedElement,b]),r.jsx("div",{className:"filter-button-container relative",ref:u,children:n?r.jsx(S.Loader,{}):r.jsxs(r.Fragment,{children:[r.jsx(S.Button,{iconBefore:r.jsx(Uo,{className:V("size-4",f)}),iconAfter:y?l:void 0,title:C,buttonClassName:"text-button-secondary filter-button",isSmallButton:!0,onClick:()=>s(S.PopUpState.Opened)}),e?.isShowBadge&&r.jsx("div",{className:"filter-count-badge",children:r.jsx("h5",{children:t})}),p&&r.jsx(Be,{reference:u,title:c,description:h,onReferenceClick:()=>s(S.PopUpState.Opened),shouldCloseTooltip:i})]})})},Js=e=>{const t=[];return e.custom_content?.attachments&&t.push(...e.custom_content.attachments),t};function pn(e){return e.type===se.AttachmentType.MARKDOWN&&e.title!=null&&e.title?.startsWith("URL Query")}function ur(e){return e.type===se.AttachmentType.JSON&&e.title!=null&&e.title?.startsWith("Query (JSON)")}function fr(e){return e.type===se.AttachmentType.MARKDOWN&&!pn(e)}function Wo(e){return e.type===se.AttachmentType.CSV}function wn(e){return e.type===se.AttachmentType.TABLE}function Ke(e){return e.type===se.AttachmentType.CUSTOM_DATA_GRID}function jt(e){return e.type===se.AttachmentType.CUSTOM_CHART}function $o(e){return e.type===se.AttachmentType.PLOTLY}function Cn(e){return e.type===se.AttachmentType.CUSTOM_CODE_SAMPLE}function Gt(e){return e.type===se.AttachmentType.CROSS_DATASET_GRID}const Jo=(e,t)=>e?.filter((n,s)=>n?.custom_content?.attachments&&s<t)?.at(-1),Yo=e=>e?.reduce((t,n,s)=>n?.custom_content?.attachments?.some(a=>ur(a))?s:t,-1),Ko=e=>e?.reduce((t,n)=>n?.role===me.Role.Assistant?n:t,{}),qo=(e,t,n,s,a)=>({role:me.Role.System,content:"",custom_content:{attachments:n?.map(i=>{const l=e&&t?.urn===i?.urn?e:i?.filters;return{type:se.AttachmentType.JSON,title:i?.title,data:JSON.stringify({urn:i?.urn,metadata:i?.metadata,filters:a?a?.get(i?.urn):l})}})||[],form_schema:s?.custom_content?.form_schema}}),mr=(e,t,n,s,a)=>{if(!e)return[];const i=e?.at(-1);return i&&i.role===me.Role.System&&e?.pop(),[...e,qo(s,a,t,Ko(e),n)]},hr=(e,t,n,s)=>e?.map(a=>({...a,filters:t?t?.get(a?.urn)||[]:n&&s?.urn===a?.urn?n:a?.filters}))||[],Zo=({actions:e,dimensions:t,structureDimensions:n,structures:s,buttonProps:a,modalProps:i,attachmentsDataQuery:l,dataQueries:f,initialConstraints:o,onFiltersChange:u,locale:c,timeRangeOptions:m,titles:h,conversationKey:g,conversation:p,setConversation:x,updateConversation:w,updateDataQueries:b,limitMessages:y,filterIconClassName:C})=>{const[v,M]=d.useState(S.PopUpState.Closed),[T,j]=d.useState([]),[N,O]=d.useState([]),[k,E]=d.useState(),[A,I]=d.useState([]),[R,L]=d.useState(void 0),P=d.useRef(o||[]),[U,G]=d.useState([]),[J,te]=d.useState(),[q,W]=d.useState(),ie=d.useRef(!1),[fe,H]=d.useState(!1),Z=B=>{const de=B?T.map(oe=>Ie(oe,B)?B:oe):T;W(!0),j(_t(de)),te?.(!0),Q(B?.isTimeDimension?Ot(de,B):de,j,te)};d.useEffect(()=>{v===S.PopUpState.Closed&&G(P.current)},[v]);const Q=d.useCallback((B,de,oe)=>{const he=l?.urn??"",be=ct(sn(B).filter(Se=>Se.componentCode!==D.TIME_PERIOD));(e?_e(e.getConstraints,Oe(he,be),()=>e.getConstraints(he,be)):Promise.resolve(void 0)).then(Se=>{const ze=Se?.data?.dataConstraints||[];P.current=ze,oe?.(!1),de(Et(B,t,s,ze,c))}).catch(()=>{P.current=[],oe?.(!1),de(Et(B,t,s,[],c))}).finally(()=>{W(!1)})},[e,l?.urn,t,c,s]);d.useEffect(()=>{const B=Ga(t,s,n,c),de=t?.map(he=>{const be=D.findCodelistByDimension(s?.codelists,s?.conceptSchemes,he),ge=D.getAvailableCodesFromConstrains(be?.codes,he.id,P.current,c);return{...he,dimensionValues:ge}}),oe=B.map(he=>{const be=de?.find(ge=>ge.id===he.id)?.dimensionValues||[];return{...he,dimensionValues:be}});if(!ie.current){if(!s)return;const he=Ja(oe,l,P.current);te?.(!0),Q(he,O,te),ie.current=!0}},[t,n,s,l,c,o,Q]),d.useEffect(()=>{N?.length&&I(Ut(N))},[N]),d.useEffect(()=>{j(B=>Ot(B,k))},[k]),d.useEffect(()=>{v===S.PopUpState.Opened&&(E({...N?.[0],isSelectedFilter:!0}),j(N)),v===S.PopUpState.Closed&&E(void 0)},[N,v]);const re=d.useCallback(async B=>{const de=Xa(B),oe=p?{...p,messages:mr(p?.messages,f,void 0,de,l)}:null;x?.(oe),b?.(hr(f,void 0,de,l)),await w(decodeURI(g),{name:oe?.name,messages:oe?.messages||[]})},[l,p,g,f,x,w,b]),ce=d.useCallback((B,de)=>{j(oe=>Ba(oe,B,de)),Ie(k,B)&&E(oe=>oe&&{...oe,displayMode:de})},[k]),ve=d.useCallback(B=>Za(B,t),[t]),De=d.useCallback((B,de)=>{const oe=Et(de,t,s,B,c);P.current=B,E(he=>oe?.find(be=>Ie(be,he))||he),j(oe),W(!1)},[t,c,s]),pe=d.useCallback(B=>{W(!0),j(_t(B));const de=l?.urn??"",oe=ct(sn(B).filter(be=>be.componentCode!==D.TIME_PERIOD));(e?_e(e.getConstraints,Oe(de,oe),()=>e.getConstraints(de,oe)):Promise.resolve(void 0)).then(be=>{De(be?.data?.dataConstraints||[],B)}).catch(()=>{De([],B)})},[e,l?.urn,De]),Te=d.useCallback(B=>{const de=Wa(T,B);pe(de)},[pe,T]),Pe=d.useCallback(()=>{P.current=U,M(S.PopUpState.Closed),H(!0)},[U]),Y=d.useCallback(()=>{const B=$a(T);pe(B)},[pe,T]),X=d.useCallback(()=>{const B=ve(T);u?.(B,P.current,T),O(T),M(S.PopUpState.Closed),H(!0),d.startTransition(()=>{re(T)})},[ve,T,u,re,P]),K=B=>{L(B)},we=Number(D.getTimeSeriesCount(P?.current?.[0]?.annotations));return r.jsxs("div",{className:"filters-container",children:[r.jsx(dr,{buttonProps:a,selectedFiltersCount:fn(A),isLoading:J,setModalState:M,titles:h,isModalClosed:fe,warningIcon:y?.warningIcon,filterIconClassName:C,timeSeriesCount:we}),r.jsx(r.Fragment,{children:v===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:h?.settings||"Settings",portalId:"filters",size:S.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:i?.isShowDividers,onClose:Pe,closeButtonTitle:h?.close||"Close",children:[r.jsx(rr,{locale:c,titles:h,timeRangeOptions:m,filtersList:T,selectedFilter:k,isDisableValues:q,modalProps:i,initialConstraints:o,timeSeriesCount:`${we}`,setSelectedFilter:E,onSelectDisplayMode:ce,onDeleteFilter:Te,onClearAllFilters:Y,updateSelectedFilterValues:Z,onTimePeriodChange:K,selectedTimeOption:R}),r.jsx(ir,{titles:h,onApply:X,onClose:Pe,onClearAllFilters:Y,modalProps:i,applyDisabled:J||q,timeseriesLength:we,limitMessages:y})]})})]})},Xo=({setToTitle:e,datasetName:t,datasetIcon:n,isShowDatasetDetails:s,queryFilterDetails:a})=>r.jsxs("div",{children:[t&&s&&r.jsxs("p",{className:"caption attachment-dataset-name mt-4 inline-flex items-center",children:[r.jsx("span",{className:"attachment-dataset-icon mr-1",children:n}),t]}),a?.map(i=>r.jsxs("p",{className:"body-1 mb-2 last:mb-0",children:[i?.title,r.jsx("span",{children:e??" set to "}),r.jsx("span",{className:"font-bold",children:i?.valuesTitles?.join(", ")})]},i?.title))]}),Qo=({titles:e,attachmentInfoList:t,datasetIcon:n})=>r.jsxs("div",{className:"attachment-details flex flex-col",children:[r.jsx("p",{className:V("body-1",t&&t.length<=1&&"mb-2"),children:e?.queryUpdatedManuallyTitle??"Query has been updated manually."}),t?.map(s=>!!s?.queryFiltersDetails?.length&&r.jsx(Xo,{setToTitle:e?.setToTitle,datasetName:s?.datasetName,datasetIcon:n,isShowDatasetDetails:t?.length>1,queryFilterDetails:s?.queryFiltersDetails},s?.datasetName))]}),el=({icon:e,title:t})=>r.jsx("div",{className:V("px-3 py-4 rounded border mt-3","attachment-collapsed"),children:r.jsxs("p",{className:V("flex body-3 items-center"),children:[e,r.jsxs("span",{className:"ml-2",children:[" ",t]})]})}),tl=e=>le.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),le.createElement("circle",{cx:32,cy:12,r:10,fill:"white"})),nl=e=>le.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),le.createElement("circle",{cx:12,cy:12,r:10,fill:"white"})),Ys=[{value:D.SdmxDataFormat.JSON,title:"SDMX-JSON"},{value:D.SdmxDataFormat.XML,title:"SDMX-ML (XML)"},{value:D.SdmxDataFormat.CSV,title:"SDMX-CSV"}],sl=e=>[{value:D.FileColumnsAttribute.ID,title:e?.idOptions||"ID",description:e?.idOptionsDescription},{value:D.FileColumnsAttribute.NAME,title:e?.nameOptions||"Name",description:e?.nameOptionsDescription},{value:D.FileColumnsAttribute.ID_NAME,title:e?.idAndNameOptions||"Combined ID and Name",description:e?.idAndNameOptionsDescription}],Ks=({title:e,items:t,selectedValue:n,setSelectedValue:s,infoMessage:a})=>r.jsxs(S.CollapsibleBlock,{title:e,value:n.title,children:[r.jsx("div",{className:"flex flex-col gap-y-1",children:t.map(i=>r.jsx("div",{className:"flex flex-col",children:r.jsx(S.Radio,{id:i.value,checked:n.value===i.value,label:i.title,description:i.description,onChange:()=>{s(i)},radioIcon:r.jsx(Me.IconCircleFilled,{className:"size-3"})},i.value)},i.value))}),a]}),al=(e,t,n,s)=>{if(s?.filterKey&&e===D.DownloadType.DATA_IN_TABLE)return s;let a=null,i=null;return t&&n&&e===D.DownloadType.DATA_IN_TABLE&&(a=n==null?null:D.getTimeSeriesFilterKey(n,t.filters),i=D.getTimeQueryFilter(t,D.getTimeDimension(n))),{filterKey:a,timeFilter:i}},rl=({actions:e,dataQuery:t,datasetIcon:n,isDisplayDatasetIcon:s=!0,datasetName:a,onCloseModal:i,type:l=D.DownloadType.FULL_DATASET,locale:f=$.Locale.EN,dimensions:o,filters:u,urn:c,titles:m,limitMessages:h,showLimitMessage:g,externalLink:p})=>{const x=sl(m),[w,b]=d.useState(Ys[0]),[y,C]=d.useState(x[0]),[v,M]=d.useState(!0),T=d.useCallback(()=>{const j=al(l,t,o,u),N=t?.urn||c||"",O=y.value,k=w.value,E=`${a}.${k}`;e.downloadDataSet(N,k,f,O,j,E,v),i()},[l,t,o,u,c,y.value,w.value,e,f,v,i,a]);return r.jsxs(S.Popup,{heading:r.jsx("p",{className:"download-heading h2",children:m?.download||"Download"}),portalId:"filters",size:S.PopUpSize.LG,containerClassName:"download-popup h-[80%]",dividers:!1,onClose:i,closeButtonTitle:m?.close||"Close",children:[r.jsxs("div",{className:"download-info flex flex-col gap-1 px-6",children:[r.jsxs("div",{className:"download-info-text flex gap-1",children:[r.jsxs("p",{className:"body-3 text-neutrals-800",children:[m?.dataset||"Dataset",":"]}),r.jsxs("span",{className:"h4 flex min-w-0 flex-1 flex-row gap-x-1",children:[s&&n,r.jsx("p",{className:"min-w-0 flex-1 truncate",children:a})]})]}),g&&r.jsx(S.RequestLimitMessage,{limitMessages:h,isDownload:!0,query:p})]}),r.jsxs("div",{className:"download-settings flex flex-col overflow-auto p-6",children:[r.jsx(Ks,{title:m?.dataFormat||"Data Format",selectedValue:w,setSelectedValue:b,items:Ys,infoMessage:r.jsx(S.DownloadFormatMessage,{limitMessages:h,query:p})}),r.jsx(Ks,{title:m?.attributes||"Attributes",selectedValue:y,setSelectedValue:C,items:x}),r.jsx(S.CollapsibleBlock,{title:m?.metadata||"Metadata",value:v?m?.all||"Included":m?.none||"Not included",children:r.jsxs("div",{className:`download-metadata flex cursor-pointer gap-4 ${v?"download-metadata-active":""}`,children:[v?r.jsx(tl,{width:44,height:24,className:"text-primary",onClick:()=>{M(!v)}}):r.jsx(nl,{width:44,height:24,className:"text-neutrals-500",onClick:()=>{M(!v)}}),r.jsx("div",{children:m?.includeMetadata||"Include Metadata"})]})})]}),r.jsx("div",{className:"download-button mt-auto flex p-6",children:r.jsx(S.Button,{buttonClassName:"text-button-primary",title:m?.download||"Download",onClick:T})})]})},il=({id:e,title:t,version:n,agency:s,isActive:a,isSingleTab:i,onSelectDataset:l})=>r.jsx("div",{className:V("dataset-tab truncate last:mr-4",a?"dataset-tab-active":"border-b-transparent",i?"dataset-tab-single cursor-default":"cursor-pointer"),title:t,onClick:()=>{i||l(D.generateShortUrn(e,n,s))},children:r.jsx("h3",{className:"dataset-tab-title truncate",title:t,children:t})}),ol=({datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,initialSelectedDatasetUrn:a,selectDataset:i,onOpenAdvancedView:l,titles:f})=>{const{isOpenedAdvancedView:o}=Ee(),[u,c]=d.useState(),m=d.useRef(null),[h,g]=d.useState(""),[p,x]=d.useState(""),[w,b]=d.useState(!1),{onboardingFileSchema:y,isShowOnboarding:C}=Ae();d.useEffect(()=>{if(C){const{title:M,description:T}=Ge(Ce.OPEN_ADVANCED_VIEW,f);g(M),x(T)}},[f,C]),d.useEffect(()=>{if(C){const M=y?.lastDisplayedElement===Ce.OPEN_ADVANCED_VIEW;b(M),M&&m?.current?.scrollIntoView({block:"center",behavior:"smooth"})}},[y?.lastDisplayedElement,C]),d.useEffect(()=>{if(!a&&!u&&e?.[0]){const M=D.generateShortUrn(e[0].id,e[0].version,e[0].agencyID);c(M),i?.(M)}else a&&a!==u&&(c(a),i?.(a))},[e,i,a,u]);const v=d.useCallback(M=>{c(M),i?.(M)},[i]);return r.jsxs("div",{className:V("dataset-tabs flex justify-between items-center w-full",n&&o&&"hide-advance-button"),children:[r.jsx("div",{className:"flex w-full items-center gap-4 overflow-y-auto sm:w-[calc(100%-30px)]",children:e?.map(M=>r.jsx(il,{id:M?.id,title:D.getLocalizedName(M,t||$.Locale.EN),version:M?.version,agency:M?.agencyID,isActive:e?.length>1&&u===D.generateShortUrn(M?.id,M?.version,M?.agencyID),isSingleTab:e?.length===1,onSelectDataset:v},M?.id))}),!n&&r.jsx("div",{ref:m,children:r.jsx(S.IconButton,{buttonClassName:"advanced-view-button",icon:s,onClick:l})}),w&&r.jsx(Be,{reference:m,title:h,description:p,onReferenceClick:l,shouldCloseTooltip:o})]})},ll=3,cl=({datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,onOpenAdvancedView:a,titles:i})=>{const{isOpenedAdvancedView:l}=Ee(),f=d.useRef(null),[o,u]=d.useState(""),[c,m]=d.useState(""),[h,g]=d.useState(!1),{onboardingFileSchema:p,isShowOnboarding:x}=Ae();d.useEffect(()=>{if(x){const{title:v,description:M}=Ge(Ce.OPEN_ADVANCED_VIEW,i);u(v),m(M)}},[i,x]),d.useEffect(()=>{if(x){const v=p?.lastDisplayedElement===Ce.OPEN_ADVANCED_VIEW;g(v),v&&f?.current?.scrollIntoView({block:"center",behavior:"smooth"})}},[p?.lastDisplayedElement,x]);const w=d.useMemo(()=>(e||[]).map(v=>({urn:D.generateShortUrn(v?.id,v?.version,v?.agencyID),title:D.getLocalizedName(v,t||$.Locale.EN)})),[e,t]),b=d.useMemo(()=>w.slice(0,ll),[w]),y=Math.max(w.length-b.length,0),C=w.filter(v=>!b.some(M=>M.urn===v.urn)).map(v=>v.title).join(`
7
- `);return r.jsxs("div",{className:V("cross-dataset-tabs flex justify-between items-center w-full",n&&l&&"hide-advance-button"),children:[r.jsxs("div",{className:"cross-dataset-tabs-list sm:w-[calc(100%-30px)]",children:[b.map((v,M)=>r.jsxs("span",{className:"cross-dataset-tabs-item-wrapper",children:[r.jsx("span",{className:"cross-dataset-tabs-item",title:v.title,children:v.title}),M<b.length-1&&r.jsx("span",{className:"cross-dataset-tabs-separator","aria-hidden":"true"})]},v.urn)),y>0&&r.jsxs("span",{className:"cross-dataset-tabs-counter",title:C,children:["+",y]})]}),!n&&r.jsx("div",{ref:f,children:r.jsx(S.IconButton,{buttonClassName:"advanced-view-button-cross-dataset-mode",icon:s,onClick:a})}),h&&r.jsx(Be,{reference:f,title:o,description:c,onReferenceClick:a,shouldCloseTooltip:l})]})},gr=({datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,initialSelectedDatasetUrn:a,selectDataset:i,onOpenAdvancedView:l,titles:f})=>{const{isCrossDatasetModeOn:o}=ke();return o?r.jsx(cl,{datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,onOpenAdvancedView:l,titles:f}):r.jsx(ol,{datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,initialSelectedDatasetUrn:a,selectDataset:i,onOpenAdvancedView:l,titles:f})},dl=(e,t,n,s)=>t?.map(a=>{const i=e?.find(m=>m?.urn===a?.urn),l=n?.get(a?.urn),f=l?.conceptSchemes||[],o=l?.codelists||[],u=D.getDimensions(l),c=[...u?.dimensions||[],...u?.timeDimensions||[]];return{datasetName:D.getLocalizedName(l?.dataflows?.[0],s),queryFiltersDetails:ul(qs(i?.filters||[],c,f,o,s),qs(a?.filters,c,f,o,s))}}),ul=(e,t)=>{const n=new Map(e?.map(s=>[s?.id,s]));return t?.filter(s=>!ln.isEqual(n?.get(s?.id)?.valuesTitles?.sort(),s?.valuesTitles?.sort()))||[]},qs=(e,t,n,s,a)=>e?.map(i=>{const l=t.find(u=>u?.id===i?.componentCode),f=D.getConcept(l?.conceptIdentity||"",n),o=D.findCodelistByDimension(s,n,l);return{id:i?.componentCode,title:D.getLocalizedName(f,a),valuesTitles:i?.operator===$.QueryFilterType.BETWEEN?[`${Rt($.getTimePeriod(i?.values?.[0]),a)} - ${Rt($.getTimePeriod(i?.values?.[1]),a)}`]:i?.values?.map(u=>D.getLocalizedName(o?.codes?.find(c=>c?.id===u),a)||u)}}),fl=(e,t,n)=>{let s="",a="";if(e?.timeFilter){const l=decodeURIComponent(e.timeFilter||"")?.split(":");s=l[1]||"",a=l[3]||""}else if(t){const l=t?.filters.find(f=>f.componentCode===D.TIME_PERIOD);s=l?.values?.[0]||"",a=l?.values?.[1]||""}return`&filter=${e?.filterKey||D.getTimeSeriesFilterKey(n||[],t?.filters||[])}&startPeriod=${s}&endPeriod=${a}`},pr=(e,t,n,s)=>{const a=n?.metadata?.datasetUrl;if(!a)return"";const i=e?fl(t,n,s):"";return a+i},wr=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M2.33325 12.3267L6.33325 8.32001L8.99992 10.9867L14.6666 4.61334L13.7266 3.67334L8.99992 8.98667L6.33325 6.32001L1.33325 11.3267L2.33325 12.3267Z",fill:"currentColor"})),ml=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50644 4.00043L1.97857 7.52207L1.5 7.99979L1.97857 8.47751L5.50644 11.9991L6.46019 11.0437L3.41088 7.99979L6.46019 4.95587L5.50644 4.00043ZM10.4918 4.00043L14.0197 7.52207L14.4983 7.99979L14.0197 8.47751L10.4918 11.9991L9.53809 11.0437L12.5874 7.99979L9.53809 4.95587L10.4918 4.00043Z",fill:"currentColor"})),Cr=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M2.3999 4V12H13.5999V4H2.3999ZM5.7359 10.8H3.5999V5.2H5.7359V10.8ZM9.0639 10.8H6.9359V5.2H9.0719V10.8H9.0639ZM12.3999 10.8H10.2639V5.2H12.3999V10.8Z",fill:"currentColor"})),hl=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.18519 10.4815H7.18116C7.31033 10.9089 7.50501 11.3078 7.7535 11.6667H2.18519C1.53333 11.6667 1 11.1333 1 10.4815V2.18519C1 1.53333 1.53333 1 2.18519 1H10.4815C11.1333 1 11.6667 1.53333 11.6667 2.18519V5.02017C11.5296 5.00683 11.3906 5 11.25 5C10.9876 5 10.7307 5.02378 10.4815 5.06931V2.18519H2.18519V10.4815ZM7.69316 6.92288C7.99945 6.45568 8.39531 6.05248 8.85633 5.73769H3.37044V6.92288H7.69316ZM7 9.25C7 8.8544 7.05405 8.47143 7.15517 8.10807H3.37044V9.29326H7.00022L7 9.25ZM3.37044 4.5525H9.29636V3.36731H3.37044V4.5525ZM11.6624 10.9695C12.5981 10.8087 13.2264 9.91979 13.0656 8.98403C12.9049 8.04827 12.016 7.42002 11.0802 7.58078C10.1444 7.74155 9.51618 8.63046 9.67695 9.56621C9.83771 10.502 10.7266 11.1302 11.6624 10.9695ZM11.8656 12.1521C11.9243 12.142 11.9824 12.1303 12.0396 12.1168L14.5611 15.5477L15.5281 14.8371L13.1449 11.5944C13.9785 10.9558 14.4384 9.88763 14.2483 8.78085C13.9753 7.19192 12.4659 6.12513 10.877 6.39811C9.28808 6.67109 8.22129 8.18047 8.49428 9.7694C8.76726 11.3583 10.2766 12.4251 11.8656 12.1521Z",fill:"currentColor"})),gl=({attachment:e,index:t,selectedAttachmentIndex:n,onSelectedAttachmentChange:s,showTabIcon:a,dataGridTitle:i,titles:l})=>{const f=d.useRef(null),[o,u]=d.useState(""),[c,m]=d.useState(""),[h,g]=d.useState(!1),{onboardingFileSchema:p,isShowOnboarding:x}=Ae(),w=d.useCallback((y,C="")=>a?$o(y)||jt(y)?r.jsx(wr,{className:C}):Ke(y)||Gt(y)?r.jsx(Cr,{className:C}):pn(y)?r.jsx(hl,{className:C}):fr(y)||Cn(y)?r.jsx(ml,{className:C}):null:null,[a]),b=d.useCallback(y=>Ke(y)?i||"Data Grid":y.title,[i]);return d.useEffect(()=>{if(x&&jt(e)){const{title:y,description:C}=Ge(Ce.CHARTS,l);u(y),m(C)}},[e,l,x]),d.useEffect(()=>{if(jt(e)&&x){const y=p?.lastDisplayedElement===Ce.CHARTS;g(y),y&&f?.current?.scrollIntoView({block:"end",behavior:"smooth"})}},[p?.lastDisplayedElement,e,x]),r.jsxs("div",{ref:f,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",n===t?"attachment-tab-active text-primary":""),onClick:()=>s(t),children:[w(e,"w-4 h-4"),r.jsx("h4",{className:"max-w-[130px] truncate",title:b(e),children:b(e)}),h&&r.jsx(Be,{reference:f,title:o,description:c})]},e.index||t)},pl=({attachments:e,...t})=>r.jsx("div",{className:"attachments-tabs flex w-fit flex-wrap items-center",children:e.map((n,s)=>r.jsx(gl,{attachment:n,index:s,...t},s))}),wl=({attachments:e,selectedAttachmentIndex:t,selectedAttachment:n,attachmentsStyles:s,titles:a,externalLink:i,isExternaLinkIncludeFilters:l,limitMessages:f,onSelectedAttachmentChange:o,onDownloadClick:u,showAdvancedView:c,isTableSettingsOpen:m,onTableSettingsOpen:h})=>{const{isTableSettingsFeatureEnabled:g}=ke(),p=g&&!c&&!!h&&!!(n&&(Ke(n)||Gt(n)));return r.jsxs("div",{className:"itms-center flex w-full min-w-0 justify-between",children:[r.jsx(pl,{dataGridTitle:s?.dataGridTitle,attachments:e,selectedAttachmentIndex:t,showTabIcon:s?.showTabIcon,onSelectedAttachmentChange:o,titles:a}),r.jsxs("div",{className:"attachments-buttons flex w-fit flex-wrap items-center justify-end gap-x-3",children:[n&&Ke(n)&&l&&r.jsx("a",{href:i,target:"_blank",rel:"noreferrer",children:r.jsx(S.Button,{title:f?.dataExplorer||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:f?.dataExplorerIcon})}),p&&r.jsx(S.Button,{disabled:m,buttonClassName:"text-button-tertiary !p-0 !h-6",textClassName:"ml-1 h4",iconBefore:r.jsx(Cr,{className:"size-4"}),title:s?.columnsTitle||"Columns",onClick:h}),n&&Ke(n)&&r.jsx(S.Button,{title:s?.downloadTitle||"Download",buttonClassName:"text-button-tertiary small-icon-button !p-0 !h-6",textClassName:"ml-1",onClick:u,iconBefore:s?.downloadIcon}),n&&Cn(n)&&r.jsx(S.CopyButton,{title:s?.copyTitle,copiedTitle:s?.copiedTitle,tooltip:s?.copiedTooltip,icon:s?.copyIcon,copiedIcon:s?.copiedIcon,onClick:()=>navigator.clipboard.writeText(n.data??"")})]})]})},Cl=({downloadTitles:e,attachment:t,actions:n,className:s=""})=>{const a=t.url,[i,l]=d.useState(null);async function f(o){if(o==null)return;const u=await n.getFile(o);l(u)}return r.jsxs("div",{className:`rounded-lg border bg-white p-3 transition-colors ${s}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"body-2 truncate text-neutrals-800",title:t.title,children:t.title})})}),a&&r.jsx("div",{className:"shrink-0",children:r.jsx(S.Button,{title:e??"Download",onClick:()=>f(t.url),buttonClassName:"text-button-tertiary"})})]}),i&&r.jsx("div",{className:"mt-3",children:r.jsx("pre",{className:"overflow-x-auto rounded-md bg-white p-3",children:r.jsx("code",{children:JSON.stringify(i,null,2)})})})]})},vr="json";function vl(e){return bl(e)?xl(e?.slice(vr.length)):e}function xl(e){let t="";if(e)try{t=JSON.stringify(JSON.parse(e),null,2)}catch{t=e.toString()}return t}function bl(e){return e?.startsWith(vr)||!1}const Sl=({attachment:e,className:t=""})=>{const n=vl(e.data);return n?r.jsxs("div",{className:`attachment-json rounded-lg border bg-white ${t}`,children:[r.jsx("div",{className:"flex items-center justify-between rounded-t-lg border-b border-neutrals-200 bg-neutrals-100 px-3 py-2",children:r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),r.jsx("div",{className:"p-3",children:r.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap break-words text-neutrals-800",children:r.jsx("code",{children:n})})})]}):null},yl=e=>{try{const t=new URL(e);return["http:","https:","data:"].includes(t.protocol)}catch{return!1}},Dl=e=>yl(e)?e:"",Ml=e=>le.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M11.3333 4.66667H8.66659V6.00001H11.3333C12.4333 6.00001 13.3333 6.9 13.3333 8C13.3333 9.1 12.4333 10 11.3333 10H8.66659V11.3333H11.3333C13.1733 11.3333 14.6666 9.84 14.6666 8C14.6666 6.16 13.1733 4.66667 11.3333 4.66667ZM7.33325 10H4.66659C3.56659 10 2.66659 9.1 2.66659 8C2.66659 6.9 3.56659 6.00001 4.66659 6.00001H7.33325V4.66667H4.66659C2.82659 4.66667 1.33325 6.16 1.33325 8C1.33325 9.84 2.82659 11.3333 4.66659 11.3333H7.33325V10ZM5.33325 7.33334H10.6666V8.66667H5.33325V7.33334Z",fill:"currentColor"})),kl=({attachment:e,openLinkTitle:t,className:n=""})=>{const s=Dl(e.data||"");if(!s)return null;const a=i=>{window.open(i,"_blank")?.focus()};return r.jsx("div",{className:`max-w-[500px] rounded-lg border bg-white py-3 pl-4 pr-3 ${n}`,children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"mt-1 shrink-0 text-hues-800",role:"img","aria-label":"Link",children:r.jsx(Ml,{width:16,height:16})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"mb-1",children:r.jsx(S.Link,{url:s,title:e.title})}),r.jsx("div",{className:"truncate break-all text-neutrals-600",children:s})]}),r.jsx("div",{className:"shrink-0",children:r.jsx(S.Button,{title:t??"Open link",onClick:()=>a(s),buttonClassName:"text-button-tertiary"})})]})})},xr=({dimensionsInfo:e})=>r.jsx("div",{className:"sidebar flex min-h-0 w-[176px] flex-col gap-3 overflow-auto",children:e.map(t=>r.jsxs("div",{className:"flex flex-col",children:[r.jsx("h5",{className:"text-neutrals-800",children:t.title}),r.jsx("h5",{className:"font-bold",children:t.value})]},t.title))}),Tl=({titles:e,chart:t,isOpen:n,onClose:s,datasetTitle:a})=>{const[i,l]=d.useState(S.PopUpState.Closed);d.useEffect(()=>{l(n?S.PopUpState.Opened:S.PopUpState.Closed)},[n]);const f=d.useCallback(()=>{l(S.PopUpState.Closed),s?.()},[s]);return r.jsx(r.Fragment,{children:i===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:r.jsx("h1",{className:"single-chart-popup-heading",children:e?.chart??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:S.PopUpSize.LG,dividers:!1,onClose:f,closeButtonTitle:e?.close??"Close",children:[r.jsxs("div",{className:"single-chart-popup-content flex h-full min-h-0 flex-1 flex-row gap-4",children:[r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a&&r.jsxs("div",{className:"mb-2 flex items-center gap-1",children:[r.jsx(hn,{className:"size-4 shrink-0 text-neutrals-1000"}),r.jsx("h4",{className:"text-neutrals-1000",children:a})]}),r.jsx(ma,{option:t.config,className:"size-full",style:{width:"100%",height:"100%"}})]}),r.jsx(xr,{dimensionsInfo:t.dimensions})]}),r.jsx("div",{})]})})},vn=e=>{const[t,n]=d.useState(!1),s=d.useRef(null),[a,i]=d.useState(""),[l,f]=d.useState(""),[o,u]=d.useState(!1),{onboardingFileSchema:c,isShowOnboarding:m}=Ae(),{isCrossDatasetModeOn:h}=ke(),[g,p]=d.useState(!1),x=d.useCallback(()=>{n(!0)},[]),w=d.useCallback(()=>{n(!1),p(!0)},[]);return d.useEffect(()=>{if(m){const{title:b,description:y}=Ge(Ce.CHART_PER_SERIES,e.titles);i(b),f(y)}},[e.titles,m]),d.useEffect(()=>{m&&u(c?.lastDisplayedElement===Ce.CHART_PER_SERIES&&e.node.rowIndex===0)},[c?.lastDisplayedElement,e.node.rowIndex,m]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:s,children:r.jsx(S.IconButton,{title:e.titles?.chart??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:r.jsx(wr,{className:"size-5"}),onClick:x})}),o&&r.jsx(Be,{reference:s,title:a,description:l,onReferenceClick:x,shouldCloseTooltip:g}),t&&r.jsx(Tl,{chart:e.value,isOpen:t,onClose:w,titles:e.titles,datasetTitle:h?e.data?.datasetTitle??void 0:void 0})]})},ft=32,Bt=32,El=16,Ze="padding-0",nt=200,tt={flex:1,minWidth:nt},Nl=ft,zt="observationValueCell",Ht="metadataCell",br="chartCell",Sr="mergedDimensionCell",yr="datasetDetailCell",dt="Chart_column",Al=(e,t,n,s,a,i)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Ze,cellRenderer:Ht,cellRendererParams:{attributesData:t,dataSetData:e,locale:n,metadataSettings:s,titles:a,action:i}});function Dr(e,t,n,s=Nl,a,i){return{headerName:"",field:dt,colId:dt,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:s,maxWidth:s,minWidth:s,cellClass:Ze,suppressColumnsToolPanel:!0,cellRenderer:vn,cellRendererParams:{attributesData:t,dataSetData:e,locale:n,titles:a,action:i}}}function jl(e,t,n){return{headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Ze,cellRenderer:Ht,cellRendererParams:{structuresMap:e,locale:t,titles:n}}}const rn=["index","value"],Il=e=>({columns:Rl(e),data:Ll(e)}),Ll=e=>{const t=e.metadata.time_column,n={};for(const s of e.data.data){const{value:a,...i}=s,l=Pl(s,t);n[l]={...n[l]||{},...i,[s[t]]:a}}return Object.values(n)},Pl=(e,t)=>Object.keys(e).filter(n=>!rn.includes(n)&&n!==t).map(n=>e[n]).join("."),Rl=e=>{const{metadata:t,data:n}=e,s=t.time_column,a=t.pinned_columns||[],i=n.schema.fields,l=[],f=n.data.map(h=>h[s]),u=Array.from(new Set(f)).filter(h=>h!=null).map(h=>({field:h,colId:h,headerName:h,cellClass:"text-right",width:nt})),c=a.map(h=>i.find(g=>g.name===h)).filter(h=>h!=null),m=i.filter(h=>!a.includes(h.name)).filter(h=>h!=null);if(c.length>0)for(const h of[...c])h.name===s||rn.includes(h.name)||l.push({colId:h.name,field:h.name,headerName:h.name,pinned:"left",...tt,tooltipValueGetter:g=>g.value});for(const h of[...m])h.name===s||rn.includes(h.name)||l.push({colId:h.name,field:h.name,headerName:h.name,pinned:!1,...tt,tooltipValueGetter:g=>g.value});return l.push(...u),l},xn=e=>e*Bt+ft+El,Ol=({attachment:e,actions:t,className:n="",showLimitMessage:s})=>{const[a,i]=d.useState(!1),[l,f]=d.useState([]),[o,u]=d.useState(),[c,m]=d.useState(400);d.useEffect(()=>{e.url!=null&&(i(!0),t.getFile(e.url).then(g=>{if(g==null){f([]),u([]),i(!1);return}const{columns:p,data:x}=Il(g);f(x),u(p),i(!1)}))},[e.url,t]),d.useEffect(()=>{l?(m(xn(l.length)),s?.(l.length>=S.SERIES_LIMIT)):s?.(!1)},[l,s]);const h=d.useMemo(()=>r.jsx(cn.AgGridReact,{headerHeight:ft,rowHeight:Bt,rowData:l,columnDefs:o,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:o&&o?.length>5?"fitCellContents":"fitGridWidth"}}),[l,o]);return a?r.jsx(S.Loader,{}):r.jsx("div",{className:`w-full ${n}`,children:r.jsx("div",{className:"ag-theme-quartz max-h-[400px] min-h-[80px] w-full",style:{height:c},children:h})})},Mr=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M7.4665 6.39967H8.53317V5.33301H7.4665V6.39967ZM7.4665 10.6663H8.53317V7.46634H7.4665V10.6663ZM7.9945 13.333C5.0505 13.333 2.6665 10.9437 2.6665 7.99967C2.6665 5.05567 5.0505 2.66634 7.9945 2.66634C10.9438 2.66634 13.3332 5.05567 13.3332 7.99967C13.3332 10.9437 10.9438 13.333 7.9945 13.333ZM7.99984 3.73301C5.6425 3.73301 3.73317 5.64234 3.73317 7.99967C3.73317 10.357 5.6425 12.2663 7.99984 12.2663C10.3572 12.2663 12.2665 10.357 12.2665 7.99967C12.2665 5.64234 10.3572 3.73301 7.99984 3.73301Z",fill:"currentColor"})),_l=({title:e,value:t})=>{const n=d.useCallback(()=>Array.isArray(t)?t.join(", "):t,[t]);return r.jsxs("div",{className:"body-3 flex gap-x-3",children:[r.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),r.jsx("p",{title:n(),className:"truncate pr-3 font-semibold",children:n()})]})},Fl=({title:e,value:t,attachedKeysTitles:n,locale:s})=>{const[a,i]=d.useState(!1),[l,f]=d.useState(!1),o=d.useRef(null),u=d.useCallback(()=>{l&&i(m=>!m)},[i,l]),c=d.useCallback(()=>Array.isArray(t)?t?.map(m=>typeof m=="object"?m?.[s]:m)?.join(", "):t,[s,t]);return d.useEffect(()=>{o?.current&&f(o?.current?.scrollHeight>o?.current?.offsetHeight)},[o]),r.jsxs("div",{className:"metadata-item",children:[n?.map(m=>r.jsx("div",{title:m,className:"metadata-item-key mb-1 pr-3 text-neutrals-800",children:m},m)),r.jsxs("div",{className:V("flex items-center",l&&"justify-between"),children:[r.jsx("h2",{title:e,className:"metadata-item-title",children:e}),l&&r.jsx(S.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",a?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:r.jsx(un,{width:24,height:24}),onClick:u})]}),r.jsx("p",{title:c(),className:V("metadata-item-value pr-3",!a&&"line-clamp-4"),ref:o,children:c()})]})},Vl=({metadata:e,metadataDescription:t=[],titles:n,locale:s})=>r.jsxs("div",{className:"metadata-content h-full overflow-hidden",children:[t?.length>0&&r.jsx("div",{className:"metadata-description",children:t?.map(a=>r.jsx(_l,{title:a?.title,value:a?.value},a?.title))}),r.jsx("div",{className:"metadata-list h-full overflow-y-auto",children:e&&e?.length>0?e?.map(a=>r.jsx(Fl,{title:a?.title,value:a?.value,locale:s,attachedKeysTitles:a?.attachedKeysTitles},a?.id||a?.title)):r.jsx("div",{className:"metadata-empty flex h-full items-center justify-center text-neutrals-700",children:n?.noMetadata||"No metadata"})})]}),bn=({metadata:e,metadataDescription:t=[],isOpenMetadata:n,onCloseMetadata:s,titles:a,locale:i})=>{const[l,f]=d.useState(S.PopUpState.Closed);d.useEffect(()=>{f(n?S.PopUpState.Opened:S.PopUpState.Closed)},[n]);const o=d.useCallback(()=>{f(S.PopUpState.Closed),s?.()},[s]);return r.jsx(r.Fragment,{children:l===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:r.jsx("h1",{className:"metadata-heading",children:a?.metadata||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:S.PopUpSize.LG,dividers:!1,onClose:o,closeButtonTitle:a?.close||"Close",children:[r.jsx(Vl,{titles:a,locale:i,metadata:e,metadataDescription:t}),r.jsx("div",{})]})})},Ue={dataset:"dataset",agency:"agency",lastUpdated:"lastUpdated"},Ul=({dataset:e,agency:t,lastUpdated:n,externalLink:s,formatValue:a})=>r.jsxs("div",{className:"mb-6 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Me.IconDatabase,{className:"size-4 text-neutrals-700"}),r.jsx("p",{className:"h4 break-words text-neutrals-1000",children:a(e?.value)}),s&&r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Me.IconExternalLink,{className:"size-4 shrink-0 cursor-pointer text-primary"})})]}),t&&r.jsxs("div",{className:"body-3 flex gap-1",children:[r.jsxs("span",{className:"text-neutrals-800",children:[t?.title,":"]}),r.jsx("span",{className:"break-words text-neutrals-1000",children:a(t?.value)})]}),n&&r.jsxs("div",{className:"body-3 flex gap-1",children:[r.jsxs("span",{className:"text-neutrals-800",children:[n?.title,":"]}),r.jsx("span",{className:"break-words text-neutrals-1000",children:a(n?.value)})]})]}),Gl=new Set(Object.values(Ue)),Bl=", ",mt=({metadata:e,metadataDescription:t=[],datasetInfo:n,externalLink:s,titles:a,locale:i})=>{const l=d.useCallback(g=>Array.isArray(g)?g.map(p=>typeof p=="object"?p?.[i]??"":p).join(Bl):typeof g=="object"&&g!==null?g?.[i]??"":g??"",[i]),{dataset:f,agency:o,lastUpdated:u,hasStructuredDatasetInfo:c}=d.useMemo(()=>{const g=t.find(C=>C?.id===Ue.dataset),p=t.find(C=>C?.id===Ue.agency),x=t.find(C=>C?.id===Ue.lastUpdated),w=n?.dataset||g,b=n?.agency||p,y=n?.lastUpdated||x;return{dataset:w,agency:b,lastUpdated:y,hasStructuredDatasetInfo:!!w}},[n,t]),m=d.useMemo(()=>c?t.filter(g=>!g?.id||!Gl.has(g.id)):t,[c,t]),h=c||m.length>0||!!e?.length;return r.jsx("div",{className:"flex h-full flex-col overflow-hidden px-5 pb-4",children:h?r.jsxs(r.Fragment,{children:[c&&f&&r.jsx(Ul,{dataset:f,agency:o,lastUpdated:u,externalLink:s,formatValue:l}),m.length>0&&r.jsx("div",{className:"mb-4 flex flex-col gap-2",children:m.map((g,p)=>r.jsxs("div",{className:"body-3 flex gap-2",children:[r.jsxs("span",{className:"shrink-0 text-neutrals-800",children:[g?.title||g?.id,":"]}),r.jsx("span",{className:"min-w-0 truncate font-semibold text-neutrals-1000",children:l(g?.value)})]},`${g?.id||g?.title}-${p}`))}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx("div",{className:"flex flex-col gap-4",children:e?.map(g=>r.jsxs("div",{className:"flex flex-col gap-1",children:[g?.attachedKeysTitles?.map((p,x)=>r.jsx("div",{title:p,className:"body-3 text-neutrals-800",children:p},`${p}-${x}`)),r.jsx("p",{title:g?.title,className:"body-3 text-neutrals-800",children:g?.title||g?.id}),r.jsx("p",{title:l(g?.value),className:"body-2 break-words text-neutrals-1000",children:l(g?.value)})]},g?.id||g?.title))})})]}):r.jsx("div",{className:"body-3 flex h-full items-center justify-center text-neutrals-700",children:a?.noMetadata||"No metadata"})})},zl=e=>e?.data[e?.colDef?.field||0]?.obsAttributes,Hl=e=>e?.data?.attributes,kr=(e,t)=>Object.entries(e?.data).filter(([n])=>t?.get(n)).map(([n,s])=>({name:n,value:String(s)})),Zs=(e,t,n)=>{const s=typeof e=="object"?e?.[t]:e;return n?D.getLocalizedName(n?.codes?.find(a=>a?.id===e),t)||"":s},ut=(e,t,n)=>e?.map(s=>{const a=s?.name||"",i=t?.get(a),l=i?.codes?.length?i:void 0,f=Array.isArray(s?.value)?s?.value.map(o=>Zs(o,n,l)):Zs(s?.value,n,l);return{id:D.getLocalizedName(l,n)||s?.name,title:D.getLocalizedName(l||i,n),value:f||s?.value}})||[],ht=(e,t,n)=>({title:n?.dataset||"Dataset",value:D.getLocalizedName(e,t)}),Wl=(e,t,n,s)=>[{...ht(e,n,s),id:Ue.dataset},{id:Ue.agency,title:s?.agency??"Agency",value:e?.agencyID},{id:Ue.lastUpdated,title:s?.lastUpdated??"Last updated",value:t}],gt=(e,t,n,s)=>({dataset:e?{...ht(e,n,s),id:Ue.dataset}:void 0,agency:e?{id:Ue.agency,title:s?.agency??"Agency",value:e?.agencyID}:void 0,lastUpdated:e?{id:Ue.lastUpdated,title:s?.lastUpdated??"Last updated",value:t}:void 0}),Tr=(e,t,n)=>({title:D.getDimensionTitle(e?.conceptSchemes,D.getDimensions(e)?.timeDimensions?.[0],t),value:n?.colId||""}),Er=(e,t)=>({title:t?.observation||"Observation",value:e}),Nr=(e,t,n,s,a,i)=>{const l={title:s?.timeSeries||"Time Series",value:i?.originalData?.name};return n?[Tr(e,t,a),l,Er(n,s)]:[l]},$l=e=>{const t=e?.dataSets?.[0]?.attributes||[],n=e?.structures?.[0]?.attributes?.dataSet||[];return t?.length?n.map((s,a)=>s?.values?.length>0?{...s}:{...s,values:[{value:t?.[a]}]}):n},Jl=(e,t,n)=>e?.map(s=>{const a=s?.id,i=s?.values?.[0]?.value||s?.values?.[0]?.id,l=s?.values?.[0]?.ids,f=t?.get(a),o=f?.codes?.length?f:void 0,u=D.getLocalizedName(o?.codes?.find(m=>m?.id===i),n)||i,c=l&&l.map(m=>D.getLocalizedName(o?.codes?.find(h=>h?.id===m),n)||m);return{id:a,title:D.getLocalizedName(f,n)||a,value:l?c:u}}).filter(({value:s})=>!!s)||[],Yl=(e,t)=>{const n=e?.dataSets?.[0],a=e?.structures?.[0]?.attributes?.dimensionGroup||[],i=n?.dimensionGroupAttributes;return new Map(a.map(l=>{const f=l?.relationship?.dimensions,{codedSeriesKey:o,decodedSeriesKey:u}=Kl(e,t,f);return[l.id,{values:i?.[o]||[],decodedSeriesKey:u,codedSeriesKey:o}]}))},Kl=(e,t,n)=>{const s=e?.structures?.[0],a=[...s?.dimensions.series||[],...s?.dimensions.observation||[]],i=new Array(a?.length)?.fill(""),l=new Array(a?.length)?.fill("");return n&&n?.forEach(f=>{const o=a?.findIndex(m=>m?.id===f)||0,u=t[o],c=a[o]?.values?.findIndex(m=>m?.id===u||m?.value===u)||0;i[o]=c>=0?c:u,l[o]=u}),{codedSeriesKey:i?.join(":"),decodedSeriesKey:l?.join(":")}},ql=(e,t)=>{if(t==null)return;const n=e?.values?.[t],s=typeof t=="object"&&!Array.isArray(t),a=Array.isArray(t);return n||(s||a?{values:t}:{value:t?.toString()})},Zl=e=>{const t=e?.value||e?.id,n=e?.values||e?.ids;return t!=null?[t]:n||[null]},Ar=(e,t,n)=>t==null?t:n?.get(e||"")?.codes?.find(a=>a?.id===t)?.name||t,Xl=(e,t,n,s=$.Locale.EN)=>{const a=n?.dataStructureComponents?.dimensionList,i=[...a?.dimensions||[],...a?.timeDimensions||[]],l=[];return(e?.split(":")||[])?.forEach((o,u)=>{if(o!==""){const c=i?.[u]?.id||"",m=D.getLocalizedName(t?.get(c),s),h=Ar(c,o,t);l.push(`${m}: ${h}`)}}),l},Ql=(e,t,n,s,a=$.Locale.EN)=>{if(!e||!t||!s)return[];const i=e?.structures?.[0]?.attributes?.dimensionGroup||[],l=Yl(e,s);return i?.map((f,o)=>{const u=l?.get(f?.id),c=n?.get(f?.id),m=Zl(ql(f,u?.values?.[o]));return{id:f?.id,title:D.getLocalizedName(c,a),value:Array.isArray(m)?m?.map(h=>Ar(f?.id,h,n)||""):m,attachedKeysTitles:Xl(u?.decodedSeriesKey,n,t)}})?.filter(({value:f})=>f?.some(o=>!!o))||[]},ec=fi.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function We(...e){return ec(V(...e))}function tc({title:e,headerExtension:t,headerClassName:n,onClose:s,bodyClassName:a,panelClassName:i,children:l}){return r.jsxs("div",{className:We("h-full w-[362px] bg-white border-l border-neutrals-500 flex flex-col overflow-hidden",i),children:[r.jsxs("div",{className:We("flex justify-between px-5 py-6",n),children:[r.jsx("div",{className:"h2 text-neutrals-1000",children:e}),r.jsxs("div",{className:"flex items-center gap-2",children:[t,t&&r.jsx("div",{className:"h-3 w-px bg-neutrals-600"}),r.jsx("button",{type:"button",onClick:s,children:r.jsx(Me.IconX,{className:"size-5 text-neutrals-1000"})})]})]}),r.jsx("div",{className:We("flex-1 min-h-0 overflow-hidden",a),children:l})]})}const jr=d.createContext(null);function nc({children:e}){const[t,n]=d.useState(null),s=d.useCallback(f=>{n(f)},[]),a=d.useCallback(()=>{n(null)},[]),i=d.useCallback(f=>f?t?.id===f:t!==null,[t]),l=d.useMemo(()=>({panel:t,openPanel:s,closePanel:a,isPanelOpen:i}),[t,s,a,i]);return r.jsx(jr.Provider,{value:l,children:e})}function Ir(){return d.useContext(jr)}function Je(){const e=Ir();if(!e)return null;const{openPanel:t,closePanel:n,isPanelOpen:s}=e;return{openPanel:t,closePanel:n,isPanelOpen:s}}function Lr({scope:e}){const t=Ir();if(!t)return null;const{panel:n,closePanel:s}=t;if(!n)return null;const a=n.scope??"any";return a!=="any"&&a!==e?null:r.jsx(tc,{title:n.title,headerExtension:n.headerExtension,headerClassName:n.headerClassName,onClose:s,bodyClassName:n.bodyClassName,panelClassName:n.panelClassName,children:n.content})}function Xt(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function st(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,f=n?.width?String(n.width):l;a=e.formattingValues[f]||e.formattingValues[l]}else{const l=e.defaultWidth,f=n?.width?String(n.width):e.defaultWidth;a=e.values[f]||e.values[l]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}function at(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const l=i[0],f=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(f)?ac(f,m=>m.test(l)):sc(f,m=>m.test(l));let u;u=e.valueCallback?e.valueCallback(o):o,u=n.valueCallback?n.valueCallback(u):u;const c=t.slice(l.length);return{value:u,rest:c}}}function sc(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ac(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function rc(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],i=t.match(e.parsePattern);if(!i)return null;let l=e.valueCallback?e.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const f=t.slice(a.length);return{value:l,rest:f}}}const Xs=Symbol.for("constructDateFrom");function Pr(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Xs in e?e[Xs](t):e instanceof Date?new e.constructor(t):new Date(t)}function ic(e,...t){const n=Pr.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}let oc={};function lc(){return oc}function Sn(e,t){return Pr(t||e,e)}function Qs(e,t){const n=lc(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Sn(e,t?.in),i=a.getDay(),l=(i<s?7:0)+i-s;return a.setDate(a.getDate()-l),a.setHours(0,0,0,0),a}function Rr(e,t,n){const[s,a]=ic(n?.in,e,t);return+Qs(s,n)==+Qs(a,n)}function rt(e,t){if(e.one!==void 0&&t===1)return e.one;const n=t%10,s=t%100;return n===1&&s!==11?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(s<10||s>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function Ne(e){return(t,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?e.future?rt(e.future,t):"за "+rt(e.regular,t):e.past?rt(e.past,t):rt(e.regular,t)+" тому":rt(e.regular,t)}const cc=(e,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",dc={lessThanXSeconds:Ne({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:Ne({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:cc,lessThanXMinutes:Ne({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:Ne({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:Ne({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:Ne({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:Ne({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:Ne({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:Ne({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:Ne({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:Ne({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:Ne({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:Ne({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:Ne({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:Ne({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},uc=(e,t,n)=>(n=n||{},dc[e](t,n)),fc={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},mc={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},hc={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gc={date:Xt({formats:fc,defaultWidth:"full"}),time:Xt({formats:mc,defaultWidth:"full"}),dateTime:Xt({formats:hc,defaultWidth:"full"})},yn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function pc(e){const t=yn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+t+" о' p";case 1:case 2:case 4:return"'у минулий "+t+" о' p"}}function Or(e){return"'у "+yn[e]+" о' p"}function wc(e){const t=yn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+t+" о' p";case 1:case 2:case 4:return"'у наступний "+t+" о' p"}}const Cc=(e,t,n)=>{const s=Sn(e),a=s.getDay();return Rr(s,t,n)?Or(a):pc(a)},vc=(e,t,n)=>{const s=Sn(e),a=s.getDay();return Rr(s,t,n)?Or(a):wc(a)},xc={lastWeek:Cc,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:vc,other:"P"},bc=(e,t,n,s)=>{const a=xc[e];return typeof a=="function"?a(t,n,s):a},Sc={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},yc={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Dc={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},Mc={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},kc={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Tc={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранок",afternoon:"день",evening:"вечір",night:"ніч"}},Ec={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"}},Nc=(e,t)=>{const n=String(t?.unit),s=Number(e);let a;return n==="date"?s===3||s===23?a="-є":a="-е":n==="minute"||n==="second"||n==="hour"?a="-а":a="-й",s+a},Ac={ordinalNumber:Nc,era:st({values:Sc,defaultWidth:"wide"}),quarter:st({values:yc,defaultWidth:"wide",argumentCallback:e=>e-1}),month:st({values:Dc,defaultWidth:"wide",formattingValues:Mc,defaultFormattingWidth:"wide"}),day:st({values:kc,defaultWidth:"wide"}),dayPeriod:st({values:Tc,defaultWidth:"any",formattingValues:Ec,defaultFormattingWidth:"wide"})},jc=/^(\d+)(-?(е|й|є|а|я))?/i,Ic=/\d+/i,Lc={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Pc={any:[/^д/i,/^н/i]},Rc={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},Oc={any:[/1/i,/2/i,/3/i,/4/i]},_c={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},Fc={narrow:[/^с/i,/^л/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^л/i,/^с/i,/^в/i,/^ж/i,/^л/i,/^г/i],any:[/^сі/i,/^лю/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^лип/i,/^се/i,/^в/i,/^ж/i,/^лис/i,/^г/i]},Vc={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},Uc={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},Gc={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Bc={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},zc={ordinalNumber:rc({matchPattern:jc,parsePattern:Ic,valueCallback:e=>parseInt(e,10)}),era:at({matchPatterns:Lc,defaultMatchWidth:"wide",parsePatterns:Pc,defaultParseWidth:"any"}),quarter:at({matchPatterns:Rc,defaultMatchWidth:"wide",parsePatterns:Oc,defaultParseWidth:"any",valueCallback:e=>e+1}),month:at({matchPatterns:_c,defaultMatchWidth:"wide",parsePatterns:Fc,defaultParseWidth:"any"}),day:at({matchPatterns:Vc,defaultMatchWidth:"wide",parsePatterns:Uc,defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:Gc,defaultMatchWidth:"wide",parsePatterns:Bc,defaultParseWidth:"any"})},Hc={code:"uk",formatDistance:uc,formatLong:gc,formatRelative:bc,localize:Ac,match:zc,options:{weekStartsOn:1,firstWeekContainsDate:1}},Wc=e=>e===$.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",pt=(e,t)=>{const n=Wc(t);return e!=null&&e!==""&&n&&Ns.isValid(new Date(e))?Ns.format(new Date(e),n,t===$.Locale.UK?{locale:Hc}:void 0):""},_r=e=>{const t="grid-metadata-side-panel",[n,s]=d.useState(!1),a=d.useRef(null),[i,l]=d.useState(""),[f,o]=d.useState(""),[u,c]=d.useState(!1),{onboardingFileSchema:m,isShowOnboarding:h}=Ae(),{isOpenedAdvancedView:g}=Ee(),p=Je(),{isMetadataInSidePanel:x}=ke(),[w,b]=d.useState(!1),y=e?.context?.externalLink,C=d.useMemo(()=>{if(e.structuresMap){const k=e?.data?.dataset?.urn;return k!=null?e.structuresMap.get(k):void 0}return e.dataSetData},[e.structuresMap,e.data,e.dataSetData]),v=d.useMemo(()=>D.getStructureComponentsMap(C),[C]),M=d.useMemo(()=>[ht(C?.dataflows?.[0],e?.locale,e.titles),...ut(kr(e,v),v,e?.locale),...ut(Hl(e),v,e?.locale),...Ql(e?.attributesData,C?.dataStructures?.[0],v,e?.data?.originalData?.parsedTimeSeriesValue,e?.locale)],[e,C,v]),T=d.useMemo(()=>Nr(C,e?.locale,e?.valueFormatted||e?.value,e.titles,e?.colDef,e?.data),[e,C]),j=d.useMemo(()=>{const k=C?.dataflows?.[0],E=pt(D.getLastUpdatedTime(k),e?.locale);return gt(k,E,e?.locale,e.titles)},[C,e?.locale,e.titles]),N=d.useCallback(()=>{if(x&&p){p.openPanel({id:t,scope:g?"advanced":"conversation",title:e.titles?.timeseriesMetadataPanel||"Timeseries Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e?.locale,metadata:M,datasetInfo:j,externalLink:y,metadataDescription:e?.metadataSettings?.isMetadataDescription?T:[]})}),b(!0);return}s(!0)},[x,g,M,T,j,y,e?.locale,e?.metadataSettings?.isMetadataDescription,e.titles,p]),O=d.useCallback(()=>{s(!1),b(!0)},[]);return d.useEffect(()=>{if(h){const{title:k,description:E}=Ge(Ce.METADATA_PER_SERIES,e.titles);l(k),o(E)}},[e.titles,h]),d.useEffect(()=>{if(h){const k=m?.lastDisplayedElement===Ce.METADATA_PER_SERIES&&e.node.rowIndex===0;c(k),k&&setTimeout(()=>{a?.current?.scrollIntoView({block:"end",behavior:"smooth"})})}},[m?.lastDisplayedElement,e.node.rowIndex,h]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:a,children:r.jsx(S.IconButton,{title:e.titles?.metadata||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:r.jsx(Mr,{className:"size-5"}),onClick:N})}),u&&r.jsx(Be,{reference:a,title:i,description:f,onReferenceClick:N,shouldCloseTooltip:w}),n&&r.jsx(bn,{titles:e.titles,locale:e?.locale,metadata:M,metadataDescription:e?.metadataSettings?.isMetadataDescription?T:[],isOpenMetadata:n,onCloseMetadata:O})]})},Fr=e=>{const t="observation-metadata-side-panel",[n,s]=d.useState(!1),{isOpenedAdvancedView:a}=Ee(),i=Je(),{isMetadataInSidePanel:l}=ke(),f=e?.context?.externalLink,o=d.useMemo(()=>{if(e.structuresMap){const w=e?.data?.dataset?.urn;return w!=null?e.structuresMap.get(w):void 0}return e.dataSetData},[e.structuresMap,e.data,e.dataSetData]),u=d.useMemo(()=>D.getStructureComponentsMap(o),[o]),c=d.useMemo(()=>ut(zl(e),u,e?.locale),[e,u]),m=d.useMemo(()=>[ht(o?.dataflows?.[0],e?.locale,e?.titles),...ut(kr(e,u),u,e?.locale),...e?.metadataSettings?.isMetadataDescription?[]:[Tr(o,e?.locale,e?.colDef),Er(e?.valueFormatted||e?.value,e?.titles)],...c],[e,o,u,c]),h=d.useMemo(()=>Nr(o,e?.locale,e?.valueFormatted||e?.value,e?.titles,e?.colDef,e?.data),[e,o]),g=d.useMemo(()=>{const w=o?.dataflows?.[0],b=pt(D.getLastUpdatedTime(w),e?.locale);return gt(w,b,e?.locale,e?.titles)},[o,e?.locale,e?.titles]),p=d.useCallback(()=>{if(l&&i){i.openPanel({id:t,scope:a?"advanced":"conversation",title:e.titles?.metadata||"Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e?.locale,metadata:m,datasetInfo:g,externalLink:f,metadataDescription:e?.metadataSettings?.isMetadataDescription?h:[]})});return}s(!0)},[l,a,m,h,g,f,e?.locale,e?.metadataSettings?.isMetadataDescription,e.titles,i]),x=d.useCallback(()=>{s(!1)},[]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative size-full p-2 text-end",children:[e?.valueFormatted||e?.value,c?.length>0&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:p})]}),n&&r.jsx(bn,{titles:e.titles,locale:e?.locale,metadata:m,metadataDescription:e?.metadataSettings?.isMetadataDescription?h:[],isOpenMetadata:n,onCloseMetadata:x})]})},Vr=({ref:e,fixHeight:t,gridHeight:n,children:s})=>r.jsx("div",{ref:e,className:V("ag-theme-quartz w-full min-h-[80px]",t?"max-h-[400px]":"max-h-full"),style:{height:n},children:s}),$c=({attachment:e,isDataLoading:t,isChartColumnVisible:n,fixHeight:s,titles:a,externalLink:i,showLimitMessage:l,onApiReady:f})=>{const[o,u]=d.useState(!1),[c,m]=d.useState([]),[h,g]=d.useState(),[p,x]=d.useState(400),w=d.useRef(null),[b,y]=d.useState(""),[C,v]=d.useState(""),[M,T]=d.useState(!1),{isShowOnboarding:j,onboardingFileSchema:N,setOnboardingFileSchema:O}=Ae();d.useEffect(()=>{if(e.grid_data==null)u(!0);else{const A=e.grid_data.columns.map(I=>I.colId===dt?{...I,hide:!n}:I);m(e.grid_data.data),g(A),u(!1)}},[e.grid_data,n]),d.useEffect(()=>{c?(x(xn(c.length)),l?.(c.length>=S.SERIES_LIMIT)):l?.(!1)},[c,l]),d.useEffect(()=>{if(j){const{title:A,description:I}=Ge(Ce.DATA_GRID,a);y(A),v(I)}},[a,j]),d.useEffect(()=>{N&&!N?.infoElements?.dataGrid&&O?.({...N,infoElements:{...N?.infoElements,dataGrid:!0},lastDisplayedElement:Ce.DATA_GRID})},[N,O]),d.useEffect(()=>{if(j){const A=N?.lastDisplayedElement===Ce.DATA_GRID;T(A),!o&&!t&&A&&setTimeout(()=>{w?.current?.scrollIntoView({block:"end",behavior:"smooth"})})}},[N?.lastDisplayedElement,j,t,o]);const k=d.useCallback(A=>{f?.(A.api)},[f]),E=d.useMemo(()=>r.jsx(cn.AgGridReact,{onGridReady:k,headerHeight:ft,rowHeight:Bt,rowData:c,enableCellTextSelection:!0,columnDefs:h,context:{externalLink:i},domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Ht]:_r,[zt]:Fr,[br]:vn}}),[c,h,k,i]);return o||t?r.jsx(S.Loader,{}):r.jsxs("div",{className:"size-full",children:[r.jsx(Vr,{ref:w,fixHeight:s,gridHeight:p,children:E}),M&&r.jsx(Be,{reference:w,title:b,description:C,supressReferenceClick:!0})]})},Jc=200,Yc=8,Kc=2,qc=({currentIndex:e,totalCount:t,icons:n,titles:s,onPrev:a,onNext:i})=>{const l=d.useRef(null),[f,o]=d.useState(""),[u,c]=d.useState(""),[m,h]=d.useState(!1),{onboardingFileSchema:g,isShowOnboarding:p}=Ae();d.useEffect(()=>{if(p){const{title:y,description:C}=Ge(Ce.CHARTS_NAVIGATION,s);o(y),c(C)}},[s,p]),d.useEffect(()=>{if(p){const y=g?.lastDisplayedElement===Ce.CHARTS_NAVIGATION;h(y),y&&l?.current?.scrollIntoView({block:"center",behavior:"smooth"})}},[g?.lastDisplayedElement,p]);const x=t>0?e/t*100:0,w=t>0?Math.min(Yc*t,Jc):0,b=t>0?Math.max(w/t,Kc):0;return r.jsxs("div",{className:"flex w-full flex-row items-center justify-center gap-2",children:[r.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:a,children:n?.[Lt.PREVIOUS]}),r.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[r.jsx("div",{className:"relative h-[4px] rounded-full bg-neutral-300",style:{width:`${w}px`},children:r.jsx("div",{className:"absolute h-full rounded-full bg-primary",style:{left:`${x}%`,width:`${b}px`}})}),r.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",t]})]}),r.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===t?"text-neutrals-700":"text-primary"),onClick:i,ref:l,children:n?.[Lt.NEXT]}),m&&r.jsx(Be,{reference:l,title:f,description:u})]})},Zc=({limitAmount:e,titles:t,openAdvancedView:n})=>{const[s,a]=d.useState(!1),{refs:i,floatingStyles:l,context:f}=Le.useFloating({open:s,onOpenChange:a,placement:"top-start"}),o=Le.useHover(f,{handleClose:Le.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:u,getFloatingProps:c}=Le.useInteractions([o]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex w-fit",ref:i.setReference,...u(),children:r.jsxs("div",{className:"mt-1 flex w-fit gap-1 bg-hues-100 px-4 py-2",children:[r.jsx("h5",{className:"font-bold",children:t?.limits||"Limited to"}),r.jsxs("h5",{children:[e," ",t?.timeseriesLimit||"Timeseries"]})]})}),s&&r.jsx("div",{className:"floating",ref:i.setFloating,style:l,...c(),children:r.jsxs("div",{className:"z-10 mb-2 flex w-[300px] flex-col gap-2 rounded bg-white p-4 shadow",children:[r.jsxs("div",{children:[r.jsxs("h5",{className:"text-neutrals-900",children:[r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP1_1||"The number of timeseries displayed in a single chart i"}),r.jsxs("span",{className:"pr-0.5 font-bold",children:[t?.limitLinkInfoP1_2||"limited to"," ",e]}),t?.limitLinkInfoP1_3||"for better clarity and performance."]}),r.jsxs("h5",{className:"text-neutrals-900",children:[r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP2_1||"To visualize specific timeseries"}),r.jsx("span",{className:"pr-0.5 font-bold",children:t?.limitLinkInfoP2_2||"filter"}),r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP2_3||"your request, or"}),r.jsx("span",{className:"pr-0.5 font-bold",children:t?.limitLinkInfoP2_4||"refine"}),t?.limitLinkInfoP2_5||"it in the chat."]})]}),n&&r.jsx("h4",{className:"cursor-pointer text-primary",onClick:n,children:t?.limitLinkInfoLink||"Open Advanced View"})]})})]})};function Xc(e,t,n){const s=(e.getZr()?.painter).getRenderedCanvas()?.getContext("2d");if(!s)return 0;const a=n.textStyle?.fontSize??12,i=n.textStyle?.fontFamily??"sans-serif";s.font=`${a}px ${i}`;const l=s.measureText(t).width,f=n.itemWidth??25,o=n.itemGap??10;return l+f+o}const Qc=({option:e,style:t})=>{const n=d.useRef(null),[s,a]=d.useState(e);d.useEffect(()=>{a(ln.cloneDeep(e))},[e]);const i=d.useCallback(()=>{const l=n.current?.getEchartsInstance?.();if(!l)return;const o=l.getDom().clientWidth,u=e.legend||{},c=u.itemHeight??14,m=u.textStyle?.fontSize??12,h=l.getModel()?.getComponent("legend")?.getData()||[];let g=0;h.forEach(b=>{const y=b.option.name||"";g+=Xc(l,y,u)});const x=Math.max(1,Math.ceil(g/o))*(+c+ +m+6),w=20;a(b=>({...b,grid:{...b.grid||{},bottom:x+w}}))},[e.legend]);return d.useEffect(()=>{i();const l=()=>{i()};return window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)}},[e,i]),r.jsx(ma,{notMerge:!0,lazyUpdate:!1,ref:n,option:s,style:t})},ed=({attachment:e,icons:t,isDataLoading:n,openAdvancedView:s,fixHeight:a=!0,titles:i})=>{const[l,f]=d.useState(!0),[o,u]=d.useState([]),[c,m]=d.useState(0),[h,g]=d.useState(void 0),[p,x]=d.useState(),{onboardingFileSchema:w,isShowOnboarding:b,setOnboardingFileSchema:y}=Ae(),C=d.useRef(null);d.useEffect(()=>{f(e.charting_data==null);const T=e.charting_data?.groups??[],j=e.charting_data?.units??[];u(T.length>0?T.flatMap(N=>N.units.map(O=>({unit:O,groupTitle:N.title}))):j.map(N=>({unit:N})))},[e.charting_data]),d.useEffect(()=>{const T=o.length>c,j=T?o[c]:o[0];g(!l&&j!=null?j.unit:void 0),x(j?.groupTitle),T||m(0)},[l,o,c]),d.useEffect(()=>{w&&b&&!l&&(zo(w)&&(y?.(Bo(w)),C?.current?.scrollIntoView({block:"center",behavior:"smooth"})),w.lastDisplayedElement===Ce.CHART_PER_SERIES&&y?.(cr(w)))},[l,y,w,b]);const v=d.useCallback(()=>{m(T=>Math.min(T+1,o.length-1))},[o.length]),M=d.useCallback(()=>{m(T=>Math.max(T-1,0))},[]);return l||n?r.jsx(S.Loader,{}):r.jsx("div",{className:"chart-attachment size-full",ref:C,children:e.charting_data&&r.jsx("div",{className:"flex size-full flex-col gap-4",children:o.length==0||h==null?r.jsx("h4",{className:"ml-1",children:i?.chartInfo||"No data"}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("h3",{className:"chart-attachment-title",children:[i?.chart||"Chart"," ",c+1,"/",o.length]}),r.jsx("span",{className:"h4 chart-attachment-info text-neutrals-700",children:i?.chartInfo||"Chart Information"})]}),r.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",a&&"max-h-[400px] min-h-[400px]",!a&&"min-h-[300px]"),children:[r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[p&&r.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[r.jsx(hn,{className:"size-4 shrink-0 text-neutrals-1000"}),r.jsx("h4",{className:"text-neutrals-1000",children:p})]}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:[r.jsx(Qc,{option:h.config,style:{width:"100%",height:"100%",minHeight:0}}),h.limitedByRowsAmountTo&&r.jsx(Zc,{limitAmount:h.limitedByRowsAmountTo,openAdvancedView:s,titles:i}),o.length>1&&r.jsx(qc,{icons:t,currentIndex:c,totalCount:o.length,titles:i,onNext:v,onPrev:M})]})]}),r.jsx(xr,{dimensionsInfo:h.dimensions})]})]})})})},td=({attachment:e,className:t})=>{const{data:n,language:s}=e;return r.jsx("div",{className:We(["h-full w-full [&_.cursors-layer]:hidden",t]),children:r.jsx(mi,{value:n,language:s,theme:"vs-light",options:{readOnly:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},wordWrap:"on",automaticLayout:!0,tabSize:2}})})},Ur=d.createContext(void 0);function Dn({children:e,titles:t}){return r.jsx(Ur.Provider,{value:t,children:e})}function Mn(){return d.useContext(Ur)}const nd="Dataset",ea="dataset_name",sd="Agency",ta="agency",ad="Country dimensions",wt="country_aggregated",rd="Indicator dimensions",Ct="indicator_aggregated",id="Frequency",Wt="frequency_aggregated",Gr=".";function na(e){return{columnState:e.getColumnState(),columnGroupState:e.getColumnGroupState()}}function od(e,t){t&&(e.applyColumnState({state:t.columnState,applyOrder:!0}),e.setColumnGroupState(t.columnGroupState))}const sa=["columnVisible","columnMoved","displayedColumnsChanged","newColumnsLoaded","gridColumnsChanged","columnPinned"];function Br(e,t){d.useEffect(()=>{if(e){for(const n of sa)e.addEventListener(n,t);return()=>{for(const n of sa)e.removeEventListener(n,t)}}},[e,t])}function ld({currentUrn:e}){const[t,n]=d.useState(),[s,a]=d.useState(null),i=d.useRef(new Map),l=d.useRef(new Map),f=d.useCallback(u=>{if(n(u),i.current.has(e))s==null&&a(i.current.get(e)??null);else{const m=na(u);i.current.set(e,m),a(m)}const c=l.current.get(e);c&&(u.applyColumnState({state:c.columnState,applyOrder:!0}),u.setColumnGroupState(c.columnGroupState))},[e]);d.useEffect(()=>{a(i.current.get(e)??null)},[e]);const o=d.useCallback(()=>{t&&l.current.set(e,na(t))},[e,t]);return Br(t,o),{gridApi:t,onGridApiReady:f,initialColumnsState:s}}const kn=d.createContext(null);function cd({currentUrn:e,structuresMap:t,locale:n,dataQueries:s,children:a}){const{gridApi:i,onGridApiReady:l,initialColumnsState:f}=ld({currentUrn:e}),[o,u]=d.useState(new Map),c=d.useCallback((x,w,b)=>{u(y=>{const C=new Map(y),v=new Map(C.get(x)??[]),M=v.get(w)??{order:[],hidden:new Set};return v.set(w,b(M)),C.set(x,v),C}),i?.refreshCells({columns:[w]})},[i]),m=d.useCallback((x,w,b)=>{c(x,w,y=>({...y,order:b}))},[c]),h=d.useCallback(()=>{u(new Map)},[]),g=d.useCallback((x,w,b,y)=>{c(x,w,C=>{const v=new Set(C.hidden);return y?v.add(b):v.delete(b),{...C,hidden:v}})},[c]),p=d.useMemo(()=>({gridApi:i,onGridApiReady:l,initialColumnsState:f,structuresMap:t,locale:n,dataQueries:s,dimensionCustomization:o,setDimensionKeyOrder:m,setDimensionKeyHidden:g,resetDimensionCustomization:h}),[i,f,l,t,n,s,o,m,g,h]);return r.jsx(kn.Provider,{value:p,children:a})}function Tn(){const e=d.useContext(kn);if(!e)throw new Error("useTableSettingsContext must be used within TableSettingsProvider");return e}const dd=()=>d.useContext(kn);function $t(e,t,n){const s=D.getConcept(e.conceptIdentity,t),a=D.getArtifactByUrnWithWildCard(s?.coreRepresentation?.enumeration,n);return{concept:s,codeList:a||void 0}}function zr(e,t,n){const s=e.findIndex(a=>a.id===t);return n.originalData.parsedTimeSeriesValue[s]}function En(e,t,n,s,a){const i=zr(e,t,s),l=n?.codes?.find(f=>f.id===i);return D.getLocalizedName(l,a)}function ud(e,t,n,s){return[fd(e,t,n,s),md(e,t,n,s),hd(e,t,n,s)]}function fd(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.region;return o==null||f==null||l==null||u==null?"":Jt(l,u,o,n)};return Nn(s?.countryDimensions||ad,wt,a,e,t,n,s)}function md(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.indicators;return o==null||f==null||l==null||u==null||u.length===0?"":u.map(m=>Jt(l,m,o,n)||"").join(Gr)};return Nn(s?.indicatorDimensions||rd,Ct,a,e,t,n,s)}function hd(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.frequency;return o==null||f==null||l==null||u==null?"":Jt(l,u,o,n)};return Nn(s?.frequency||id,Wt,a,e,t,n,s)}function Nn(e,t,n,s,a,i,l){return{headerName:e,field:t,colId:t,valueGetter:n,...tt,cellClass:Ze,cellRenderer:Sr,tooltipValueGetter:f=>f.value,cellRendererParams:{structuresMap:s,datasetDimensionsSchemesMap:a,locale:i,titles:l,colId:t}}}function An(e,t){const{data:n}=e,s=n?.dataset?.urn,a=s==null?void 0:t.get(s);return{data:n,urn:s,structures:a}}function Jt(e,t,n,s){const a=e.conceptSchemes||[],i=e.codelists||[],l=D.getDimensions(e)?.dimensions||[],f=l.find(u=>u.id===t);if(f==null)return;const{codeList:o}=$t(f,a,i);return En(l,t,o,n,s)}const Ft="::";function gd(e,t){return`${e}${Ft}${t}`}function aa(e){return e.includes(Ft)}function Qt(e){const t=e.indexOf(Ft);return{urn:e.slice(0,t),dimensionKey:e.slice(t+Ft.length)}}function Hr(e,t){let n=e;return t?.order.length&&(n=[...t.order.filter(s=>e.includes(s)),...e.filter(s=>!t.order.includes(s))]),t?.hidden.size&&(n=n.filter(s=>!t.hidden.has(s))),n}const pd=new Set([Ct,wt,Wt]);function wd(e,t,n){const s=n(t);return s?e===Ct?s.indicators:e===wt?s.region?[s.region]:[]:e===Wt?s.frequency?[s.frequency]:[]:[]:[]}function Cd(e,t,n){const s=e.getDimensionConfig(t,n);if(s?.alias)return s.alias;const a=e.structuresMap.get(t),l=(a?D.getDimensions(a)?.dimensions??[]:[]).find(f=>f.id===n);return D.getDimensionTitle(a?.conceptSchemes??[],l,e.locale)??n}function vd(e){return t=>{if(!pd.has(t.id))return t;const n=[];for(const{urn:s}of e.dataQueries){const a=wd(t.id,s,e.getDimensionsScheme);if(!a.length)continue;const i=e.dimensionCustomization?.get(s)?.get(t.id),l=i?.order.length?Hr(a,{order:i.order,hidden:new Set}):a,f=l.length>1,o=l.map(m=>({id:gd(s,m),type:"item",label:Cd(e,s,m),isChecked:!i?.hidden.has(m),draggable:f,checkable:f})),u=e.structuresMap.get(s),c=D.getLocalizedName(u?.dataflows?.[0],e.locale)??s;n.push({id:s,type:"group",label:c,items:o})}return n.length?{...t,items:n}:t}}function ra(e,t){return e===Ct?t.indicators??[]:e===wt?t.region?[t.region]:[]:e===Wt?t.frequency?[t.frequency]:[]:[]}function xd(e,t){return e===Ct?t?.indicatorMetadataPanel||"Indicator dimension details":e===wt?t?.countryMetadataPanel||"Country dimension details":t?.metadata||"Metadata"}const bd="merged-dimension-metadata-side-panel",Sd=e=>{const{isOpenedAdvancedView:t}=Ee(),n=Je(),{isMetadataInSidePanel:s}=ke(),a=dd(),i=e?.data?.dataset?.urn,l=i!=null?e.structuresMap.get(i):void 0,f=i!=null?e.datasetDimensionsSchemesMap.get(i):void 0,o=a?.dimensionCustomization,u=d.useMemo(()=>{if(!l||!f||i==null)return e.valueFormatted??e.value;const p=o?.get(i)?.get(e.colId);return Hr(ra(e.colId,f),p).map(b=>Jt(l,b,e.data,e.locale)).filter(Boolean).join(Gr)},[o,l,f,i,e.valueFormatted,e.value,e.colId,e.data,e.locale]),c=d.useMemo(()=>{if(!l||!f)return[];const p=ra(e.colId,f),x=D.getStructureComponentsMap(l),w=p.filter(b=>e.data[b]!=null).map(b=>({name:b,value:String(e.data[b])}));return ut(w,x,e.locale)},[l,f,e.colId,e.data,e.locale]),m=d.useMemo(()=>{const p=l?.dataflows?.[0];if(!p)return;const x=pt(D.getLastUpdatedTime(p),e.locale);return gt(p,x,e.locale,e.titles)},[l,e.locale,e.titles]),h=s&&!!n&&!!e.value,g=d.useCallback(()=>{n&&n.openPanel({id:bd,scope:t?"advanced":"conversation",title:xd(e.colId,e.titles),bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e.locale,metadata:c,datasetInfo:m})})},[n,t,e.colId,e.titles,e.locale,c,m]);return r.jsxs("div",{className:"relative size-full p-2",children:[u,h&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:g})]})},yd="dataset-detail-metadata-side-panel",Dd=e=>{const{isOpenedAdvancedView:t}=Ee(),n=Je(),{isMetadataInSidePanel:s}=ke(),a=e?.data?.dataset?.urn,i=a!=null?e.structuresMap.get(a):void 0,l=d.useMemo(()=>{const u=i?.dataflows?.[0];if(!u)return;const c=pt(D.getLastUpdatedTime(u),e.locale);return gt(u,c,e.locale,e.titles)},[i,e.locale,e.titles]),f=s&&!!n&&!!e.value,o=d.useCallback(()=>{n&&n.openPanel({id:yd,scope:t?"advanced":"conversation",title:e.titles?.datasetMetadataPanel||"Dataset Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e.locale,metadata:[],datasetInfo:l})})},[n,t,l,e.titles,e.locale]);return r.jsxs("div",{className:"relative size-full p-2",children:[e.valueFormatted??e.value,f&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:o})]})},Md=({attachment:e,isDataLoading:t,isChartColumnVisible:n,fixHeight:s,showLimitMessage:a,onApiReady:i})=>{const[l,f]=d.useState(!1),[o,u]=d.useState([]),[c,m]=d.useState(),[h,g]=d.useState(400);d.useEffect(()=>{if(e.gridContent==null)f(!0);else{const w=e.gridContent.columns.map(b=>b.colId===dt?{...b,hide:!n}:b);u(e.gridContent.data),m(w),f(!1)}},[e.gridContent,n]),d.useEffect(()=>{o?(g(xn(o.length)),a?.(o.length>=S.SERIES_LIMIT)):a?.(!1)},[o,a]);const p=d.useCallback(w=>{i?.(w.api)},[i]),x=d.useMemo(()=>r.jsx(cn.AgGridReact,{headerHeight:ft,rowHeight:Bt,rowData:o,enableCellTextSelection:!0,columnDefs:c,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Ht]:_r,[zt]:Fr,[Sr]:Sd,[br]:vn,[yr]:Dd},onGridReady:p}),[o,c,p]);return l||t?r.jsx(S.Loader,{}):r.jsx("div",{className:"size-full",children:r.jsx(Vr,{fixHeight:s,gridHeight:h,children:x})})},kd=({selectedAttachment:e,actions:t,attachmentsStyles:n,isDataLoading:s,externalLink:a,isOpenedAdvancedView:i,onOpenAdvancedView:l,showLimitMessage:f,onGridApiReady:o})=>{const u=Mn();return r.jsxs("div",{className:"flex min-h-0 w-full flex-1 justify-center",children:[Wo(e)&&r.jsx(Cl,{actions:t,downloadTitles:n?.downloadTitle,attachment:e}),wn(e)&&r.jsx(Ol,{actions:t,attachment:e,showLimitMessage:f}),Ke(e)&&r.jsx($c,{attachment:e,isDataLoading:s,isChartColumnVisible:i,fixHeight:!i,titles:u,showLimitMessage:f,onApiReady:o,externalLink:a}),Gt(e)&&r.jsx(Md,{attachment:e,isDataLoading:s,isChartColumnVisible:i,fixHeight:!i,showLimitMessage:f,onApiReady:o}),jt(e)&&r.jsx(ed,{titles:u,isDataLoading:s,attachment:e,icons:n?.chartingIcons,openAdvancedView:i?void 0:l,fixHeight:!i}),pn(e)&&r.jsx(kl,{attachment:e,openLinkTitle:n?.openLinkTitle}),fr(e)&&r.jsx(Sl,{attachment:e}),Cn(e)&&r.jsx(td,{attachment:e,className:n?.codeAttachmentContainerClassName})]})};Es.ModuleRegistry.registerModules([Es.AllCommunityModule]);const Wr=({attachments:e,actions:t,titles:n,messageStyles:s,attachmentsStyles:a,isSystemAttachments:i,isShowAttachments:l,showAdvancedView:f,currentDataQuery:o,dataQueries:u,attachmentInfoList:c,datasets:m,initialSelectedDatasetUrn:h,isDataLoading:g,isDataSetAttachments:p,locale:x,dimensions:w,filters:b,selectDataset:y,onAdvancedViewOpen:C,limitMessages:v,attachmentsConfig:M,isTableSettingsOpen:T,onTableSettingsOpen:j,onTableSettingsClose:N,onGridApiReady:O})=>{const[k,E]=d.useState(0),[A,I]=d.useState(null),{isOpenedAdvancedView:R,setIsOpenedAdvancedView:L}=Ee(),[P,U]=d.useState(S.PopUpState.Closed),[G,J]=d.useState(!1),[te,q]=d.useState(),[W,ie]=d.useState(),[fe,H]=d.useState(!1),Z={downloadDataSet:t.downloadDataSet,getConstraints:t.getConstraints},Q=D.DownloadType.DATA_IN_TABLE,re=Te=>{E(Te)},ce=d.useCallback(()=>{C?.(),L(!0),t.updateCurrentDataQuery(o||u?.[0]),t.updateDataQueries(u),t.updateDatasets(m)},[t,o,u,m,L,C]);d.useEffect(()=>{I(e[k]||null)},[e,k]),d.useEffect(()=>{J(p&&(m==null||m?.length==0))},[m,p]),d.useEffect(()=>{T&&A&&!Ke(A)&&!Gt(A)&&N?.()},[T,A,N]);const ve=d.useCallback(()=>{U(S.PopUpState.Closed)},[U]),De=M?.isExternaLinkIncludeFilters,pe=pr(De,b,o||u?.[0],w);return!e||e.length===0?null:r.jsx(r.Fragment,{children:R&&!l?r.jsx(el,{icon:s?.advanceViewIcon,title:s?.openAdvanceViewTitle??"Opened in Advanced view"}):r.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!R&&!i?"pt-5":"pt-0"),children:[!R&&G?r.jsx(S.Loader,{}):r.jsxs(r.Fragment,{children:[i&&!R&&r.jsx(Qo,{titles:{queryUpdatedManuallyTitle:n?.queryUpdatedManually,setToTitle:n?.setTo},datasetIcon:a?.datasetIcon,attachmentInfoList:c}),!R&&m?.length!=null&&m?.length>0&&r.jsx(gr,{datasets:m,initialSelectedDatasetUrn:h,locale:x,titles:n,isHideAdvancedViewButton:!f,openAdvancedViewIcon:a?.openAdvancedViewIcon,selectDataset:y,onOpenAdvancedView:ce}),fe&&r.jsx(S.RequestLimitMessage,{limitMessages:v,showAdvancedViewButton:!!A&&wn(A)&&f,onAdvancedViewClick:ce,query:pe}),r.jsx("div",{className:V(!R&&m?.length&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:r.jsxs("div",{className:"flex h-full max-w-full flex-col items-center gap-4",children:[r.jsx(wl,{attachments:e,selectedAttachmentIndex:k,selectedAttachment:A,attachmentsStyles:a,titles:n,externalLink:pe,isExternaLinkIncludeFilters:De,limitMessages:v,onSelectedAttachmentChange:re,onDownloadClick:()=>U(S.PopUpState.Opened),showAdvancedView:f,isTableSettingsOpen:T,onTableSettingsOpen:j}),A!=null&&r.jsx(kd,{selectedAttachment:A,actions:t,attachmentsStyles:a,isDataLoading:g,isOpenedAdvancedView:R,onOpenAdvancedView:ce,showLimitMessage:H,onGridApiReady:O,externalLink:pe})]})})]}),r.jsxs(r.Fragment,{children:[P===S.PopUpState.Opened&&r.jsx(rl,{actions:Z,onCloseModal:ve,dataQuery:o,datasetName:A?.title||"",locale:x,type:Q,dimensions:w,filters:b,urn:o?.urn,datasetIcon:a?.datasetIcon,isDisplayDatasetIcon:a?.isDisplayDatasetIcon,titles:a?.downloadTitles,setIsShowDownloadAlert:q,setDownloadAlertDetails:ie,limitMessages:v,showLimitMessage:fe,externalLink:pe}),te&&r.jsx(S.Alert,{alertDetails:W,successIcon:a?.successDownloadIcon,errorIcon:a?.errorDownloadIcon,onClose:()=>q(!1),closeButtonTitle:a?.closeTitle||"Close"})]})]})})},Td=({label:e,colDef:t})=>!!e.trim()&&!t.suppressColumnsToolPanel;function Ed(e){return e.colId??e.field??null}function Nd(e){return String(e.headerName??e.field??e.colId??"").trim()}function Ad(e){return new Map(e.getColumnState().map(t=>[t.colId,t]))}function jd(e,t){const n=e.getColumnDefs()??[],s=Ad(e),a=[];for(const f of n){const o=Ed(f);if(!o)continue;const u=Nd(f);if(!t({colId:o,label:u,colDef:f}))continue;const c=s.get(o);a.push({id:o,type:"item",label:u,isChecked:!(c?.hide??!1),draggable:!0,checkable:!0})}const i=e.getColumnState().map(f=>f.colId),l=new Map(i.map((f,o)=>[f,o]));return a.sort((f,o)=>{const u=l.get(f.id)??Number.MAX_SAFE_INTEGER,c=l.get(o.id)??Number.MAX_SAFE_INTEGER;return u-c})}function Id(e,t,n){const s=[...t];return e.map(a=>n.has(a)?s.shift()??a:a)}function en(e,t){let n=e,s;for(const a of t){if(s=n.find(i=>i.id===a),!s)return;n=s.type==="group"?s.items:s.items??[]}return s?.type==="item"?s:void 0}function on(e,t){const n=[];for(const s of e){if(s.type==="group"){n.push(...on(s.items,t));continue}if(t?.(s)){n.push(s.id);continue}if(s.items?.length){n.push(...on(s.items,t));continue}n.push(s.id)}return n}function Ld({api:e,searchQuery:t,includeColumn:n=Td,enrichItem:s,onSubItemOrderChange:a,onSubItemVisibilityChange:i}){const[l,f]=d.useState(0),[o,u]=d.useState(new Set),c=d.useCallback(()=>{f(C=>C+1)},[]);Br(e,c);const m=d.useMemo(()=>!e||!e.getColumnState()?[]:jd(e,n),[e,n,l]),h=d.useMemo(()=>(s?m.map(v=>v.type==="item"?s(v):v):m).map(v=>v.type==="item"&&v.items?.length?{...v,isExpanded:!o.has(v.id)}:v),[m,s,o]),g=d.useMemo(()=>new Set(m.map(C=>C.id)),[m]),p=d.useMemo(()=>S.filterDraggableListNodes(h,t),[h,t]),x=d.useCallback(C=>{if(!e)return;if(aa(C.itemId)&&i){const{urn:M,dimensionKey:T}=Qt(C.itemId),j=C.path[0];i(M,j,T,!C.nextChecked);return}const v=en(h,C.path);!v||!g.has(v.id)||(e.applyColumnState({state:[{colId:v.id,hide:!C.nextChecked}]}),c())},[e,h,g,c,i]),w=d.useCallback(C=>{if(!e)return;if(aa(C.itemId)&&i){const{urn:j,dimensionKey:N}=Qt(C.itemId),O=C.path[0],k=en(h,C.path);k?.type==="item"&&i(j,O,N,k.isChecked??!0);return}const v=en(h,C.path);if(!v||!g.has(v.id))return;const T=!(e.getColumnState().find(j=>j.colId===v.id)?.hide??!1);e.applyColumnState({state:[{colId:v.id,hide:T}]}),c()},[e,h,g,c,i]),b=d.useCallback(C=>{const v=C.path[C.path.length-1];u(M=>{const T=new Set(M);return C.nextExpanded?T.delete(v):T.add(v),T})},[]),y=d.useCallback(C=>{if(!e)return;const v=e.getColumnState().map(N=>N.colId),M=new Set(m.map(N=>N.id)),T=on(C,N=>g.has(N.id)),j=Id(v,T,M);if(e.applyColumnState({state:j.map(N=>({colId:N})),applyOrder:!0}),c(),a){for(const N of C)if(!(N.type!=="item"||!g.has(N.id)||!N.items))for(const O of N.items){if(O.type!=="group")continue;const k=O.items.filter(I=>I.type==="item");if(k.length<=1)continue;const E=O.id,A=k.map(I=>Qt(I.id).dimensionKey);a(E,N.id,A)}}},[e,m,g,c,a]);return{items:h,visibleItems:p,handleToggleChecked:x,handleToggleExpanded:b,handleItemClick:w,handleItemsChange:y}}function Pd({api:e,includeColumn:t,enrichItem:n,onSubItemOrderChange:s,onSubItemVisibilityChange:a}){const[i,l]=d.useState(""),f=d.useCallback(x=>{l(x)},[l]),o=d.useCallback(()=>l(""),[l]),u=d.useMemo(()=>r.jsx("button",{type:"button",onClick:o,children:r.jsx(Me.IconX,{className:"size-4 text-neutrals-1000"})}),[o]),{visibleItems:c,handleItemsChange:m,handleToggleChecked:h,handleToggleExpanded:g,handleItemClick:p}=Ld({api:e,includeColumn:t,searchQuery:i,enrichItem:n,onSubItemOrderChange:s,onSubItemVisibilityChange:a});return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-5 py-7",children:[r.jsx(S.InputWithIcon,{inputId:"columns-search-input",containerClasses:"items-center filters-search-input gap-1 !p-2",cssClass:"filters-search-input-text",placeholder:"Search",iconBeforeInput:r.jsx(Me.IconSearch,{className:"size-4 text-neutrals-1000"}),iconAfterInput:i?u:void 0,value:i,onChange:f}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(S.DraggableList,{items:c,onItemsChange:m,onToggleChecked:h,onToggleExpanded:g,onItemClick:p})})]})}const Rd={},Od={map:Rd,getDimensionsMetadata:()=>{},getDimensionMetadata:()=>{},getRegionDimension:()=>{},getFrequencyDimension:()=>{},getIndicatorDimensions:()=>[],getDimensionsScheme:()=>{}},jn=d.createContext(Od);function _d({map:e,children:t}){const n=d.useMemo(()=>{const s={},a={},i={},l=Object.keys(e);for(const f of l){s[f]={},a[f]={};const o=Object.keys(e[f]);for(const u of o){const c=e[f][u];c.subtype&&(s[f][c.subtype]=u),a[f][c.dimensionType]||(a[f][c.dimensionType]=[]),a[f][c.dimensionType].push(u)}i[f]={timePeriod:a[f]?.TIME_PERIOD?.[0]??void 0,frequency:s[f]?.FREQUENCY??void 0,region:s[f]?.REGION??void 0,indicators:a[f]?.INDICATOR??[],other:(a[f]?.NON_INDICATOR??[]).filter(u=>{const c=e[f][u];return c.subtype!=="FREQUENCY"&&c.subtype!=="REGION"})}}return{map:e,getDimensionsMetadata:f=>e[f],getDimensionMetadata:(f,o)=>e[f]?.[o],getRegionDimension:f=>s[f]?.REGION,getFrequencyDimension:f=>s[f]?.FREQUENCY,getIndicatorDimensions:f=>a[f]?.INDICATOR??[],getDimensionsScheme:f=>i[f]}},[e]);return r.jsx(jn.Provider,{value:n,children:t})}function $r(){return d.useContext(jn)}function Jr(){return d.useContext(jn)}const ia="table-settings-side-panel",Fd=({resetTitle:e})=>{const{gridApi:t,initialColumnsState:n,resetDimensionCustomization:s}=Tn(),a=d.useCallback(()=>{t&&(od(t,n),s())},[t,n,s]);return r.jsxs("button",{type:"button",className:"flex items-center gap-1 text-neutrals-800",onClick:a,children:[r.jsx(Me.IconRotate,{className:"size-4 rotate-180"}),r.jsx("span",{className:"h4",children:e||"Reset"})]})},Vd=()=>{const{gridApi:e,structuresMap:t,locale:n,dataQueries:s,dimensionCustomization:a,setDimensionKeyOrder:i,setDimensionKeyHidden:l}=Tn(),f=Jr(),o=d.useMemo(()=>{if(!(!f||!t||!n||!s?.length))return vd({dataQueries:s,structuresMap:t,getDimensionsScheme:f.getDimensionsScheme,getDimensionConfig:(u,c)=>f.map[u]?.[c],locale:n,dimensionCustomization:a})},[f,t,n,s,a]);return e?r.jsx(Pd,{api:e,enrichItem:o,onSubItemOrderChange:i,onSubItemVisibilityChange:l}):null},Ud=({attachmentsStyles:e,...t})=>{const{onGridApiReady:n}=Tn(),s=Je(),a=d.useCallback(()=>{s&&s.openPanel({id:ia,scope:"advanced",title:e?.columnsTitle||"Columns",headerClassName:"border-b border-neutrals-500",headerExtension:r.jsx(Fd,{resetTitle:e?.columnsResetTitle}),content:r.jsx(Vd,{})})},[e?.columnsResetTitle,e?.columnsTitle,s]);return r.jsx(Wr,{...t,attachmentsStyles:e,isTableSettingsOpen:s?.isPanelOpen(ia)??!1,onTableSettingsOpen:s?a:void 0,onTableSettingsClose:s?.closePanel,onGridApiReady:n})},Gd=({actions:e,structureDataMaps:t,buttonProps:n,modalProps:s,dataQueries:a,onMultipleDataFiltersChange:i,locale:l,timeRangeOptions:f,titles:o,datasetIcon:u,conversationKey:c,conversation:m,setConversation:h,updateConversation:g,updateDataQueries:p,limitMessages:x,filterIconClassName:w})=>{const[b,y]=d.useState(S.PopUpState.Closed),[C,v]=d.useState([]),[M,T]=d.useState([]),[j,N]=d.useState(),[O,k]=d.useState([]),[E,A]=d.useState(void 0),I=d.useRef(t?.constraintsMap),[R,L]=d.useState(),[P,U]=d.useState(),[G,J]=d.useState(),[te,q]=d.useState(!1),W=d.useMemo(()=>Io(a,t),[a,t]),ie=Y=>{const X=Y?C.map(K=>Ie(K,Y)?Y:K):C;J(!0),v(_t(X)),U?.(!0),fe(Y?.isTimeDimension?Ot(X,Y):X,v,U)};d.useEffect(()=>{b===S.PopUpState.Closed&&L(I.current)},[b]);const fe=d.useCallback((Y,X,K)=>{const we=qt(Y);Promise.all(Gs(a,we,e)).then(B=>{const de=Bs(B);I.current=de,K?.(!1),X(Mt(we,{...t,constraintsMap:de},l))}).catch(()=>{const B=new Map;I.current=B,K?.(!1),X(Mt(we,{...t,constraintsMap:B},l))}).finally(()=>{J(!1)})},[e,a,l,t]);d.useEffect(()=>{if(!W){U(!0);return}const Y=Ao(t,l),X=jo(Y,a,t?.constraintsMap);U?.(!0),fe(X,T,U)},[a,fe,W,l,t]),d.useEffect(()=>{M?.length&&k(Ut(M))},[M]),d.useEffect(()=>{v(Y=>Ot(Y,j))},[j]),d.useEffect(()=>{b===S.PopUpState.Opened&&(A(void 0),N({...M?.[0],isSelectedFilter:!0}),v(M)),b===S.PopUpState.Closed&&N(void 0)},[M,b]);const H=d.useCallback(async Y=>{const X=Po(a,Y),K=m?{...m,messages:mr(m?.messages,a,X)}:null;h?.(K),p?.(hr(a,X)),await g(decodeURI(c),{name:K?.name,messages:K?.messages||[]})},[m,c,a,h,g,p]),Z=d.useCallback((Y,X)=>{v(K=>Ba(K,Y,X)),Ie(j,Y)&&N(K=>K&&{...K,displayMode:X})},[j]),Q=d.useCallback(Y=>Lo(Y,a,t?.dimensionsMap),[a,t?.dimensionsMap]),re=d.useCallback((Y,X)=>{const K=Mt(Y,X,l);I.current=X?.constraintsMap,N(we=>K?.find(B=>Ie(B,we))||we),v(K),J(!1)},[l]),ce=d.useCallback((Y,X)=>{J(!0),v(_t(Y));const K=qt(Y);Promise.all(Gs(X,K,e)).then(we=>{re(K,{...t,constraintsMap:Bs(we)})}).catch(()=>{re(K,{...t,constraintsMap:new Map})})},[e,t,re]),ve=d.useCallback(Y=>{const X=a?.find(we=>we?.urn===Y?.datasetUrn),K=Wa(C,Y);ce(K,X?[X]:[])},[ce,C,a]),De=d.useCallback(()=>{I.current=R,y(S.PopUpState.Closed),q(!0)},[R]),pe=d.useCallback(()=>{const Y=$a(C);ce(Y,a)},[ce,C,a]),Te=d.useCallback(()=>{const Y=qt(C,I.current),X=Mt(Y,{...t,constraintsMap:I.current},l),K=Q(Y);i?.(K,I.current,a),T(X),y(S.PopUpState.Closed),q(!0),d.startTransition(()=>{H(Y)})},[Q,C,t,l,i,a,H]),Pe=Y=>{A(Y)};return r.jsxs("div",{className:"filters-container",children:[r.jsx(dr,{buttonProps:n,selectedFiltersCount:fn(O),isLoading:P,setModalState:y,titles:o,isModalClosed:te,warningIcon:x?.warningIcon,filterIconClassName:w}),r.jsx(r.Fragment,{children:b===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:o?.settings||"Settings",portalId:"filters",size:S.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:s?.isShowDividers,onClose:De,closeButtonTitle:o?.close||"Close",children:[r.jsx(rr,{locale:l,titles:o,timeRangeOptions:f,filtersList:C,selectedFilter:j,isDisableValues:G,modalProps:s,initialConstraintsMap:t?.constraintsMap,datasetIcon:u,structuresMap:t?.structuresMap,setSelectedFilter:N,onSelectDisplayMode:Z,onDeleteFilter:ve,onClearAllFilters:pe,updateSelectedFilterValues:ie,onTimePeriodChange:Pe,selectedTimeOption:E}),r.jsx(ir,{titles:o,onApply:Te,onClose:De,onClearAllFilters:pe,modalProps:s,applyDisabled:P||G,limitMessages:x})]})})]})},Bd=({filtersProps:e,actions:t,attachments:n,attachmentsDataQuery:s,dataQueries:a,dimensions:i,locale:l,attachmentsStyles:f,isDataLoading:o,setIsFiltering:u,titles:c,limitMessages:m,attachmentsConfig:h,filters:g,onFiltersChange:p})=>{const x={getConstraints:t.getConstraints},{isCrossDatasetModeOn:w}=ke();return d.useEffect(()=>{o||u?.(!1)},[o,u]),r.jsx("div",{className:"h-full min-h-0 rounded bg-white",children:r.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-x-hidden",children:[r.jsxs("div",{className:"data-details-header flex items-center justify-between",children:[r.jsx("h2",{children:c?.content??"Content"}),w?r.jsx(Gd,{attachmentsDataQuery:s,dataQueries:a,updateDataQueries:t?.updateDataQueries,locale:l,actions:x,dimensions:i,titles:c,...e,onFiltersChange:p,limitMessages:m}):r.jsx(Zo,{attachmentsDataQuery:s,dataQueries:a,updateDataQueries:t?.updateDataQueries,locale:l,actions:x,dimensions:i,titles:c,...e,onFiltersChange:p,limitMessages:m})]}),r.jsx("div",{className:"advanced-view-attachments-container min-h-0 flex-1",children:r.jsx(Ud,{titles:c,attachments:n,attachmentsStyles:f,currentDataQuery:s,dimensions:i,actions:t,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:o,locale:l,filters:g,limitMessages:m,attachmentsConfig:h})})]})})},zd=({isShowAgency:e,isShowDatasetBadge:t,dataset:n,data:s,structures:a,metadataSettings:i,locale:l,titles:f,getDatasetUpdatedTime:o,externalLink:u,datasetIcon:c,externalLinkIcon:m,metadataButtonClassName:h,metadataIconClassName:g,infoSegmentContainerClassName:p,infoSegmentHeaderClassName:x,nameAndMetadataContainerClassName:w})=>{const b="dataset-metadata-side-panel",[y,C]=d.useState(""),[v,M]=d.useState(!1),T=d.useRef(null),[j,N]=d.useState(""),[O,k]=d.useState(""),[E,A]=d.useState(!1),{onboardingFileSchema:I,isShowOnboarding:R}=Ae(),{isOpenedAdvancedView:L}=Ee(),P=Je(),{isMetadataInSidePanel:U}=ke(),[G,J]=d.useState(!1),te=d.useMemo(()=>i?.isMetadataDescription?Wl(n,y,l,f):[],[n,y,l,i?.isMetadataDescription,f]),q=d.useMemo(()=>[...i?.isMetadataDescription?[]:[ht(n,l,f)],...Jl($l(s),D.getStructureComponentsMap(a),l)],[s,n,l,i?.isMetadataDescription,a,f]),W=d.useMemo(()=>gt(n,y,l,f),[n,y,l,f]),ie=d.useCallback(()=>{if(U&&P){P.openPanel({id:b,scope:L?"advanced":"conversation",title:"Dataset Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:f,locale:l,metadata:q,metadataDescription:te,datasetInfo:W,externalLink:u})}),J(!0);return}M(!0)},[te,q,W,u,U,L,l,P,f]),fe=d.useCallback(()=>{M(!1),J(!0)},[]);d.useEffect(()=>{const Q=o&&o(q)||pt(D.getLastUpdatedTime(n),l);C(Q)},[n,l,q,o]),d.useEffect(()=>{if(R){const{title:Z,description:Q}=Ge(Ce.METADATA_PER_DATASET,f);N(Z),k(Q)}},[f,R]),d.useEffect(()=>{R&&A(I?.lastDisplayedElement===Ce.METADATA_PER_DATASET)},[I?.lastDisplayedElement,R]);const H=(Z,Q)=>r.jsxs("div",{className:We("flex gap-1 text-neutrals-1000",p),children:[r.jsxs("span",{className:We("text-neutral-800",x),children:[Z,":"]}),r.jsx("span",{children:Q})]});return r.jsxs("div",{className:"dataset-info flex flex-col gap-3 bg-white",children:[t&&r.jsxs("div",{className:"bg-accent-500 body-2 flex w-fit items-center gap-1 rounded-[20px] px-2 py-1",children:[c,f?.dataset??"Dataset"]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("div",{role:"heading","aria-level":4,className:We("flex gap-1 items-center h4",w),children:[r.jsx("div",{ref:T,children:r.jsx(S.IconButton,{title:f?.metadata??"View details",buttonClassName:We("!text-neutrals-1000 !border-none !w-4 !h-4 !p-0 shrink-0",h),icon:r.jsx(Mr,{className:We("size-4",g)}),onClick:ie})}),r.jsx("span",{children:D.getLocalizedName(n,l)})]}),u&&r.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:m||r.jsx(Me.IconExternalLink,{className:"size-4 shrink-0 cursor-pointer text-primary"})})]}),r.jsxs("div",{className:"body-3 flex items-center gap-2",children:[e&&r.jsxs(r.Fragment,{children:[H(f?.agency??"Agency",n?.agencyID??""),r.jsx("div",{"aria-hidden":"true",className:"h-[14px] border-l border-l-neutral-500"})]}),H(f?.lastUpdated??"Last updated",y)]})]}),E&&r.jsx(Be,{reference:T,title:j,description:O,onReferenceClick:ie,shouldCloseTooltip:G}),v&&r.jsx(bn,{titles:f,locale:l,metadata:q,metadataDescription:te,isOpenMetadata:v,onCloseMetadata:fe})]})},Hd=({titles:e,locale:t,isShowShare:n,shareConversationProps:s})=>{const{setIsOpenedAdvancedView:a}=Ee(),i=d.useRef(null),[l,f]=d.useState(""),[o,u]=d.useState(""),[c,m]=d.useState(!1),{onboardingFileSchema:h,isShowOnboarding:g}=Ae();return d.useEffect(()=>{if(g){const{title:p,description:x}=Ge(Ce.EXIT_ADVANCED_VIEW,e);f(p),u(x)}},[e,g]),d.useEffect(()=>{g&&m(h?.lastDisplayedElement===Ce.EXIT_ADVANCED_VIEW)},[h?.lastDisplayedElement,g]),r.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[r.jsxs("div",{className:V("flex gap-3 items-center",!n&&"justify-between w-full","advanced-view-header-title"),children:[r.jsx("div",{ref:i,className:V(!n&&"order-2","flex"),children:r.jsx(S.CloseButton,{btnClassNames:"button-close",onClick:()=>a(!1),title:e?.close||"Close"})}),c&&r.jsx(Be,{reference:i,title:l,description:o,onReferenceClick:()=>a(!1),shouldMoveToNextStep:!0}),r.jsx("h2",{children:e?.advanceViewTitle??"Advanced view"})]}),n&&r.jsx(La,{locale:t,...s})]})};function Wd(e,t,n,s,a,i,l,f,o){const u=$d(e,n),c=o?.startPeriod&&o.endPeriod?D.getAdditionalColumns(f,o):[],m=Jd(e,t,n,s,a,i,c);return[Al(e,t?.data,n,a,i,l),...u,...m,Dr(e,t?.data,n,void 0,i,l)]}function $d(e,t){const n=e.conceptSchemes||[],s=e.codelists||[],a=D.getDimensions(e)?.dimensions||[];return a.map(i=>{const{codeList:l,concept:f}=$t(i,n,s),o=u=>{const{data:c,colDef:m}=u,h=m.field;return En(a,h,l,c,t)};return{headerName:D.getLocalizedName(f,t),field:i.id,colId:i.id,valueGetter:o,...tt,tooltipValueGetter:u=>u.value}})}function Jd(e,t,n,s,a,i,l){const f=qd(l,D.getTimePeriods(t));return Kd(f,(u,c)=>Yd(u,c||u,s,i),e,n,a,i)}const Yd=(e,t,n=$.defaultFormatNumbers,s)=>({headerName:Ua(t,s),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:nt,cellClass:["justify-end","cell-with-meta"],valueFormatter:a=>$.formatNumberBySign(a.value,n)}),Kd=(e,t,n,s,a,i)=>{const l=[];return e.sort((o,u)=>D.sortPeriods(o,u)).forEach(o=>{l.push({headerName:o.toString(),field:o.toString(),...t(o.toString()),valueGetter:u=>u.data[u.column.getColId()]?.value?.[0]?.value||null,cellClass:Ze,cellRenderer:zt,width:nt,cellRendererParams:{dataSetData:n,locale:s,metadataSettings:a,titles:i}})}),l},qd=(e=[],t=[])=>{if(!e.length)return t;if(!t.length)return e;const n=t.some(u=>D.isYearly(u)),s=t.some(u=>D.isSemiAnnually(u)),a=t.some(u=>D.isQuarterly(u)),i=t.some(u=>D.isMonthly(u)),l=t.some(u=>D.isWeekly(u)),f=t.some(u=>D.isDaily(u)),o=e.filter(u=>D.isYearly(u)?n:D.isSemiAnnually(u)?s:D.isQuarterly(u)?a:D.isMonthly(u)?i:D.isWeekly(u)?l:D.isDaily(u)?f:!0);return Array.from(new Set([...o,...t]))};function Zd(e,t,n){const s=t.map(i=>i.id).filter(i=>i!=null),a=n.map(i=>i.id).filter(i=>i!=null);return Xd(e,s,a,s)}const Xd=(e,t,n,s)=>{const a=eu(e,t),i={};for(const l of a){const f=l.rowTime,o=Yr(f,s);if(i[o]==null){i[o]={};for(const u of s)i[o][u]=f[u]}i[o]={attributes:l.attributes.filter(({value:u})=>u),...i[o],id:o,originalData:l.originalData,...Qd(f,n)}}return Object.values(i)},Yr=(e,t)=>t.map(n=>e[n]).join("_"),Qd=(e,t)=>{const n=Yr(e,t),{OBS_VALUE:s,obsAttributes:a}=e,i={};return i[n]={value:s,obsAttributes:a},i},eu=(e,t)=>{const n=[];for(const s of e){const a={},i=s.name.split(".");for(let l=0;l<t.length;l+=1)a[t[l]]=i[l];if(!s.values.length){const l={...a};l.TIME_PERIOD=void 0,l.OBS_VALUE=void 0,n.push({rowTime:l,attributes:s.attributes,id:s.name,originalData:s})}s.values.forEach(l=>{const f={...a};f.TIME_PERIOD=l.dimensionAtObservation;const o=tu(s,l);f.OBS_VALUE=o,f.obsAttributes=l?.obsAttributes?.filter(({value:u})=>u)||[],n.push({rowTime:f,attributes:s.attributes,id:s.name,originalData:s})})}return n},tu=(e,t)=>{const s=[...e.attributes,...t.obsAttributes].find(({name:a})=>a==="OBS_VALUE");return s?[s]:t.values},nu="#EEEEEE",su="#777777";function au(e,t,n){const s={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:a=>{let i=a[0].axisValueLabel+"<br/>";return a.forEach(l=>{l.value!==null&&l.value!==void 0&&(i+=l.marker+" "+l.seriesName+": "+l.value+"<br/>")}),i}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...oa(n?.ticksColor,n?.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...oa(n?.ticksColor,n?.labelsColor),type:"value"},series:t};return n?.colors!=null&&(s.color=n.colors),s}function oa(e=nu,t=su){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:t},axisLine:{lineStyle:{color:e}}}}function Kr(e,t,n,s){return t.map(i=>{const l=D.getDimensions(n)?.dimensions||[],f=l?.find(u=>u.id===i);if(f==null)return e[i]||"";const{codeList:o}=$t(f,n.conceptSchemes||[],n.codelists||[]);return En(l,i,o,e,s)}).join(" - ")}function ru(e,t){const n=[...t?.metadata?.indicatorDimensions||[]].filter(i=>i!=null),a=D.getDimensions(e)?.dimensions?.filter(i=>i.id!=null&&!n.includes(i.id)&&t?.metadata?.countryDimension!==i.id).map(i=>i.id).filter(i=>i!=null)||[];return[...n,...a]}function iu(e,t,n){const s={};return e.forEach(a=>{const i=ou(a,t,n);s[i]||(s[i]={rows:[]}),s[i].rows.push(a)}),Object.keys(s).map(a=>s[a])}function ou(e,t,n){const s=n.dataStructures?.[0]?.dataStructureComponents?.dimensionList?.dimensions||[];return t.map(i=>s?.find(f=>f.id===i)==null?e[i]||"":zr(s,i,e)).join(" - ")}function lu(e,t){const n={};return e.forEach(s=>n[s]=cu(s,t)),{nonUniqDimensions:e.filter(s=>!n[s])}}function cu(e,t){const n=t.map(a=>du(e,a));return new Set(n).size===1}function du(e,t){return t[e]}const uu="line",kt=10;function qr(e,t,n,s,a){const i=In(t,e,n,s,a),f=D.getTimePeriods(t).sort((m,h)=>D.sortPeriods(m,h)),o=ru(e,n),{nonUniqDimensions:u}=lu(o,i);return{units:iu(i,u,e).map(m=>Zr(m,e,n,f,s,a))}}function fu(e,t,n,s,a,i){return Zr({rows:[e]},n,s,t,a,i)}function Zr(e,t,n,s,a,i){const l=gu(e.rows,t,a),f=l?.find(u=>D.FREQUENCY_DIMENSION_ID.includes(u?.id))?.id,o=mu(e.rows.length>kt?e.rows.slice(0,kt):e.rows,t,n,a,la(s,e?.rows?.[0],f));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>kt?kt:void 0,dimensions:l,config:au(la(s,e?.rows?.[0],f),o,i)}}function la(e,t,n){if(n){const s=t?.[n];if(s===D.Periods.MONTHLY)return e?.filter(a=>D.isMonthly(a));if(s===D.Periods.QUARTERLY)return e?.filter(a=>D.isQuarterly(a));if(s===D.Periods.ANNUAL)return e?.filter(a=>D.isYearly(a))}return e}function mu(e,t,n,s,a){return e.map(i=>({name:n?.metadata?.countryDimension==null?"":Kr(i,[n?.metadata?.countryDimension],t,s),type:uu,data:a.map(l=>hu(l,i))}))}function hu(e,t){return t[e]?.value?.[0]?.value||null}function gu(e,t,n){return(D.getDimensions(t)?.dimensions||[]).map(s=>{if(s.id!=null)return{id:s.id,title:pu(s,t,n),value:Kr(e[0],[s.id],t,n)}}).filter(s=>s!=null)}function pu(e,t,n){const s=t.conceptSchemes||[],a=t.codelists||[],{concept:i}=$t(e,s,a);return D.getLocalizedName(i,n)||e.id}function In(e,t,n,s,a){const i=e==null?[]:D.getParsedResponse(e),l=D.getDimensions(t)?.dimensions||[],f=D.getDimensions(t)?.timeDimensions||[],o=Zd(i,l,f);return wu(o,e,t,n,s,a)}function wu(e,t,n,s,a,i){const f=D.getTimePeriods(t).sort((o,u)=>D.sortPeriods(o,u));return e.map(o=>({...o,[dt]:fu(o,f,n,s,a,i)}))}function Cu(e,t,n,s,a,i,l,f,o,u,c){return{columns:Wd(e,t,s,a,i,f,o,u,c),data:In(t,e,n,s,l)}}function vu(e,t,n,s,a,i,l,f,o,u,c){const m=e.dataflows?.[0]?.names?.[s],h=Cu(e,t,n,s,a,i,l,f,o,u,c);return{title:m||f?.dataGrid||"Data Grid",grid_data:h}}function xu(e){const t=e.replace(/\r\n/g,`
7
+ `);return r.jsxs("div",{className:V("cross-dataset-tabs flex justify-between items-center w-full",n&&l&&"hide-advance-button"),children:[r.jsxs("div",{className:"cross-dataset-tabs-list sm:w-[calc(100%-30px)]",children:[b.map((v,M)=>r.jsxs("span",{className:"cross-dataset-tabs-item-wrapper",children:[r.jsx("span",{className:"cross-dataset-tabs-item",title:v.title,children:v.title}),M<b.length-1&&r.jsx("span",{className:"cross-dataset-tabs-separator","aria-hidden":"true"})]},v.urn)),y>0&&r.jsxs("span",{className:"cross-dataset-tabs-counter",title:C,children:["+",y]})]}),!n&&r.jsx("div",{ref:f,children:r.jsx(S.IconButton,{buttonClassName:"advanced-view-button-cross-dataset-mode",icon:s,onClick:a})}),h&&r.jsx(Be,{reference:f,title:o,description:c,onReferenceClick:a,shouldCloseTooltip:l})]})},gr=({datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,initialSelectedDatasetUrn:a,selectDataset:i,onOpenAdvancedView:l,titles:f})=>{const{isCrossDatasetModeOn:o}=ke();return o?r.jsx(cl,{datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,onOpenAdvancedView:l,titles:f}):r.jsx(ol,{datasets:e,locale:t,isHideAdvancedViewButton:n,openAdvancedViewIcon:s,initialSelectedDatasetUrn:a,selectDataset:i,onOpenAdvancedView:l,titles:f})},dl=(e,t,n,s)=>t?.map(a=>{const i=e?.find(m=>m?.urn===a?.urn),l=n?.get(a?.urn),f=l?.conceptSchemes||[],o=l?.codelists||[],u=D.getDimensions(l),c=[...u?.dimensions||[],...u?.timeDimensions||[]];return{datasetName:D.getLocalizedName(l?.dataflows?.[0],s),queryFiltersDetails:ul(qs(i?.filters||[],c,f,o,s),qs(a?.filters,c,f,o,s))}}),ul=(e,t)=>{const n=new Map(e?.map(s=>[s?.id,s]));return t?.filter(s=>!ln.isEqual(n?.get(s?.id)?.valuesTitles?.sort(),s?.valuesTitles?.sort()))||[]},qs=(e,t,n,s,a)=>e?.map(i=>{const l=t.find(u=>u?.id===i?.componentCode),f=D.getConcept(l?.conceptIdentity||"",n),o=D.findCodelistByDimension(s,n,l);return{id:i?.componentCode,title:D.getLocalizedName(f,a),valuesTitles:i?.operator===$.QueryFilterType.BETWEEN?[`${Rt($.getTimePeriod(i?.values?.[0]),a)} - ${Rt($.getTimePeriod(i?.values?.[1]),a)}`]:i?.values?.map(u=>D.getLocalizedName(o?.codes?.find(c=>c?.id===u),a)||u)}}),fl=(e,t,n)=>{let s="",a="";if(e?.timeFilter){const l=decodeURIComponent(e.timeFilter||"")?.split(":");s=l[1]||"",a=l[3]||""}else if(t){const l=t?.filters.find(f=>f.componentCode===D.TIME_PERIOD);s=l?.values?.[0]||"",a=l?.values?.[1]||""}return`&filter=${e?.filterKey||D.getTimeSeriesFilterKey(n||[],t?.filters||[])}&startPeriod=${s}&endPeriod=${a}`},pr=(e,t,n,s)=>{const a=n?.metadata?.datasetUrl;if(!a)return"";const i=e?fl(t,n,s):"";return a+i},wr=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M2.33325 12.3267L6.33325 8.32001L8.99992 10.9867L14.6666 4.61334L13.7266 3.67334L8.99992 8.98667L6.33325 6.32001L1.33325 11.3267L2.33325 12.3267Z",fill:"currentColor"})),ml=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50644 4.00043L1.97857 7.52207L1.5 7.99979L1.97857 8.47751L5.50644 11.9991L6.46019 11.0437L3.41088 7.99979L6.46019 4.95587L5.50644 4.00043ZM10.4918 4.00043L14.0197 7.52207L14.4983 7.99979L14.0197 8.47751L10.4918 11.9991L9.53809 11.0437L12.5874 7.99979L9.53809 4.95587L10.4918 4.00043Z",fill:"currentColor"})),Cr=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M2.3999 4V12H13.5999V4H2.3999ZM5.7359 10.8H3.5999V5.2H5.7359V10.8ZM9.0639 10.8H6.9359V5.2H9.0719V10.8H9.0639ZM12.3999 10.8H10.2639V5.2H12.3999V10.8Z",fill:"currentColor"})),hl=e=>le.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.18519 10.4815H7.18116C7.31033 10.9089 7.50501 11.3078 7.7535 11.6667H2.18519C1.53333 11.6667 1 11.1333 1 10.4815V2.18519C1 1.53333 1.53333 1 2.18519 1H10.4815C11.1333 1 11.6667 1.53333 11.6667 2.18519V5.02017C11.5296 5.00683 11.3906 5 11.25 5C10.9876 5 10.7307 5.02378 10.4815 5.06931V2.18519H2.18519V10.4815ZM7.69316 6.92288C7.99945 6.45568 8.39531 6.05248 8.85633 5.73769H3.37044V6.92288H7.69316ZM7 9.25C7 8.8544 7.05405 8.47143 7.15517 8.10807H3.37044V9.29326H7.00022L7 9.25ZM3.37044 4.5525H9.29636V3.36731H3.37044V4.5525ZM11.6624 10.9695C12.5981 10.8087 13.2264 9.91979 13.0656 8.98403C12.9049 8.04827 12.016 7.42002 11.0802 7.58078C10.1444 7.74155 9.51618 8.63046 9.67695 9.56621C9.83771 10.502 10.7266 11.1302 11.6624 10.9695ZM11.8656 12.1521C11.9243 12.142 11.9824 12.1303 12.0396 12.1168L14.5611 15.5477L15.5281 14.8371L13.1449 11.5944C13.9785 10.9558 14.4384 9.88763 14.2483 8.78085C13.9753 7.19192 12.4659 6.12513 10.877 6.39811C9.28808 6.67109 8.22129 8.18047 8.49428 9.7694C8.76726 11.3583 10.2766 12.4251 11.8656 12.1521Z",fill:"currentColor"})),gl=({attachment:e,index:t,selectedAttachmentIndex:n,onSelectedAttachmentChange:s,showTabIcon:a,dataGridTitle:i,titles:l})=>{const f=d.useRef(null),[o,u]=d.useState(""),[c,m]=d.useState(""),[h,g]=d.useState(!1),{onboardingFileSchema:p,isShowOnboarding:x}=Ae(),w=d.useCallback((y,C="")=>a?$o(y)||jt(y)?r.jsx(wr,{className:C}):Ke(y)||Gt(y)?r.jsx(Cr,{className:C}):pn(y)?r.jsx(hl,{className:C}):fr(y)||Cn(y)?r.jsx(ml,{className:C}):null:null,[a]),b=d.useCallback(y=>Ke(y)?i||"Data Grid":y.title,[i]);return d.useEffect(()=>{if(x&&jt(e)){const{title:y,description:C}=Ge(Ce.CHARTS,l);u(y),m(C)}},[e,l,x]),d.useEffect(()=>{if(jt(e)&&x){const y=p?.lastDisplayedElement===Ce.CHARTS;g(y),y&&f?.current?.scrollIntoView({block:"end",behavior:"smooth"})}},[p?.lastDisplayedElement,e,x]),r.jsxs("div",{ref:f,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",n===t?"attachment-tab-active text-primary":""),onClick:()=>s(t),children:[w(e,"w-4 h-4"),r.jsx("h4",{className:"max-w-[130px] truncate",title:b(e),children:b(e)}),h&&r.jsx(Be,{reference:f,title:o,description:c})]},e.index||t)},pl=({attachments:e,...t})=>r.jsx("div",{className:"attachments-tabs flex w-fit flex-wrap items-center",children:e.map((n,s)=>r.jsx(gl,{attachment:n,index:s,...t},s))}),wl=({attachments:e,selectedAttachmentIndex:t,selectedAttachment:n,attachmentsStyles:s,titles:a,externalLink:i,isExternaLinkIncludeFilters:l,limitMessages:f,onSelectedAttachmentChange:o,onDownloadClick:u,showAdvancedView:c,isTableSettingsOpen:m,onTableSettingsOpen:h})=>{const{isTableSettingsFeatureEnabled:g}=ke(),p=g&&!c&&!!h&&!!(n&&(Ke(n)||Gt(n)));return r.jsxs("div",{className:"itms-center flex w-full min-w-0 justify-between",children:[r.jsx(pl,{dataGridTitle:s?.dataGridTitle,attachments:e,selectedAttachmentIndex:t,showTabIcon:s?.showTabIcon,onSelectedAttachmentChange:o,titles:a}),r.jsxs("div",{className:"attachments-buttons flex w-fit flex-wrap items-center justify-end gap-x-3",children:[n&&Ke(n)&&l&&r.jsx("a",{href:i,target:"_blank",rel:"noreferrer",children:r.jsx(S.Button,{title:f?.dataExplorer||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:f?.dataExplorerIcon})}),p&&r.jsx(S.Button,{disabled:m,buttonClassName:"text-button-tertiary !p-0 !h-6",textClassName:"ml-1 h4",iconBefore:r.jsx(Cr,{className:"size-4"}),title:s?.columnsTitle||"Columns",onClick:h}),n&&Ke(n)&&r.jsx(S.Button,{title:s?.downloadTitle||"Download",buttonClassName:"text-button-tertiary small-icon-button !p-0 !h-6",textClassName:"ml-1",onClick:u,iconBefore:s?.downloadIcon}),n&&Cn(n)&&r.jsx(S.CopyButton,{title:s?.copyTitle,copiedTitle:s?.copiedTitle,tooltip:s?.copiedTooltip,icon:s?.copyIcon,copiedIcon:s?.copiedIcon,onClick:()=>navigator.clipboard.writeText(n.data??"")})]})]})},Cl=({downloadTitles:e,attachment:t,actions:n,className:s=""})=>{const a=t.url,[i,l]=d.useState(null);async function f(o){if(o==null)return;const u=await n.getFile(o);l(u)}return r.jsxs("div",{className:`rounded-lg border bg-white p-3 transition-colors ${s}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("span",{className:"body-2 truncate text-neutrals-800",title:t.title,children:t.title})})}),a&&r.jsx("div",{className:"shrink-0",children:r.jsx(S.Button,{title:e??"Download",onClick:()=>f(t.url),buttonClassName:"text-button-tertiary"})})]}),i&&r.jsx("div",{className:"mt-3",children:r.jsx("pre",{className:"overflow-x-auto rounded-md bg-white p-3",children:r.jsx("code",{children:JSON.stringify(i,null,2)})})})]})},vr="json";function vl(e){return bl(e)?xl(e?.slice(vr.length)):e}function xl(e){let t="";if(e)try{t=JSON.stringify(JSON.parse(e),null,2)}catch{t=e.toString()}return t}function bl(e){return e?.startsWith(vr)||!1}const Sl=({attachment:e,className:t=""})=>{const n=vl(e.data);return n?r.jsxs("div",{className:`attachment-json rounded-lg border bg-white ${t}`,children:[r.jsx("div",{className:"flex items-center justify-between rounded-t-lg border-b border-neutrals-200 bg-neutrals-100 px-3 py-2",children:r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),r.jsx("div",{className:"p-3",children:r.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap break-words text-neutrals-800",children:r.jsx("code",{children:n})})})]}):null},yl=e=>{try{const t=new URL(e);return["http:","https:","data:"].includes(t.protocol)}catch{return!1}},Dl=e=>yl(e)?e:"",Ml=e=>le.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M11.3333 4.66667H8.66659V6.00001H11.3333C12.4333 6.00001 13.3333 6.9 13.3333 8C13.3333 9.1 12.4333 10 11.3333 10H8.66659V11.3333H11.3333C13.1733 11.3333 14.6666 9.84 14.6666 8C14.6666 6.16 13.1733 4.66667 11.3333 4.66667ZM7.33325 10H4.66659C3.56659 10 2.66659 9.1 2.66659 8C2.66659 6.9 3.56659 6.00001 4.66659 6.00001H7.33325V4.66667H4.66659C2.82659 4.66667 1.33325 6.16 1.33325 8C1.33325 9.84 2.82659 11.3333 4.66659 11.3333H7.33325V10ZM5.33325 7.33334H10.6666V8.66667H5.33325V7.33334Z",fill:"currentColor"})),kl=({attachment:e,openLinkTitle:t,className:n=""})=>{const s=Dl(e.data||"");if(!s)return null;const a=i=>{window.open(i,"_blank")?.focus()};return r.jsx("div",{className:`max-w-[500px] rounded-lg border bg-white py-3 pl-4 pr-3 ${n}`,children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"mt-1 shrink-0 text-hues-800",role:"img","aria-label":"Link",children:r.jsx(Ml,{width:16,height:16})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"mb-1",children:r.jsx(S.Link,{url:s,title:e.title})}),r.jsx("div",{className:"truncate break-all text-neutrals-600",children:s})]}),r.jsx("div",{className:"shrink-0",children:r.jsx(S.Button,{title:t??"Open link",onClick:()=>a(s),buttonClassName:"text-button-tertiary"})})]})})},xr=({dimensionsInfo:e})=>r.jsx("div",{className:"sidebar flex min-h-0 w-[176px] flex-col gap-3 overflow-auto",children:e.map(t=>r.jsxs("div",{className:"flex flex-col",children:[r.jsx("h5",{className:"text-neutrals-800",children:t.title}),r.jsx("h5",{className:"font-bold",children:t.value})]},t.title))}),Tl=({titles:e,chart:t,isOpen:n,onClose:s,datasetTitle:a})=>{const[i,l]=d.useState(S.PopUpState.Closed);d.useEffect(()=>{l(n?S.PopUpState.Opened:S.PopUpState.Closed)},[n]);const f=d.useCallback(()=>{l(S.PopUpState.Closed),s?.()},[s]);return r.jsx(r.Fragment,{children:i===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:r.jsx("h1",{className:"single-chart-popup-heading",children:e?.chart??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:S.PopUpSize.LG,dividers:!1,onClose:f,closeButtonTitle:e?.close??"Close",children:[r.jsxs("div",{className:"single-chart-popup-content flex h-full min-h-0 flex-1 flex-row gap-4",children:[r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a&&r.jsxs("div",{className:"mb-2 flex items-center gap-1",children:[r.jsx(hn,{className:"size-4 shrink-0 text-neutrals-1000"}),r.jsx("h4",{className:"text-neutrals-1000",children:a})]}),r.jsx(ma,{option:t.config,className:"size-full",style:{width:"100%",height:"100%"}})]}),r.jsx(xr,{dimensionsInfo:t.dimensions})]}),r.jsx("div",{})]})})},vn=e=>{const[t,n]=d.useState(!1),s=d.useRef(null),[a,i]=d.useState(""),[l,f]=d.useState(""),[o,u]=d.useState(!1),{onboardingFileSchema:c,isShowOnboarding:m}=Ae(),{isCrossDatasetModeOn:h}=ke(),[g,p]=d.useState(!1),x=d.useCallback(()=>{n(!0)},[]),w=d.useCallback(()=>{n(!1),p(!0)},[]);return d.useEffect(()=>{if(m){const{title:b,description:y}=Ge(Ce.CHART_PER_SERIES,e.titles);i(b),f(y)}},[e.titles,m]),d.useEffect(()=>{m&&u(c?.lastDisplayedElement===Ce.CHART_PER_SERIES&&e.node.rowIndex===0)},[c?.lastDisplayedElement,e.node.rowIndex,m]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:s,children:r.jsx(S.IconButton,{title:e.titles?.chart??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:r.jsx(wr,{className:"size-5"}),onClick:x})}),o&&r.jsx(Be,{reference:s,title:a,description:l,onReferenceClick:x,shouldCloseTooltip:g}),t&&r.jsx(Tl,{chart:e.value,isOpen:t,onClose:w,titles:e.titles,datasetTitle:h?e.data?.datasetTitle??void 0:void 0})]})},ft=32,Bt=32,El=16,Ze="padding-0",nt=200,tt={flex:1,minWidth:nt},Nl=ft,zt="observationValueCell",Ht="metadataCell",br="chartCell",Sr="mergedDimensionCell",yr="datasetDetailCell",dt="Chart_column",Al=(e,t,n,s,a,i)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Ze,cellRenderer:Ht,cellRendererParams:{attributesData:t,dataSetData:e,locale:n,metadataSettings:s,titles:a,action:i}});function Dr(e,t,n,s=Nl,a,i){return{headerName:"",field:dt,colId:dt,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:s,maxWidth:s,minWidth:s,cellClass:Ze,suppressColumnsToolPanel:!0,cellRenderer:vn,cellRendererParams:{attributesData:t,dataSetData:e,locale:n,titles:a,action:i}}}function jl(e,t,n){return{headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Ze,cellRenderer:Ht,cellRendererParams:{structuresMap:e,locale:t,titles:n}}}const rn=["index","value"],Il=e=>({columns:Rl(e),data:Ll(e)}),Ll=e=>{const t=e.metadata.time_column,n={};for(const s of e.data.data){const{value:a,...i}=s,l=Pl(s,t);n[l]={...n[l]||{},...i,[s[t]]:a}}return Object.values(n)},Pl=(e,t)=>Object.keys(e).filter(n=>!rn.includes(n)&&n!==t).map(n=>e[n]).join("."),Rl=e=>{const{metadata:t,data:n}=e,s=t.time_column,a=t.pinned_columns||[],i=n.schema.fields,l=[],f=n.data.map(h=>h[s]),u=Array.from(new Set(f)).filter(h=>h!=null).map(h=>({field:h,colId:h,headerName:h,cellClass:"text-right",width:nt})),c=a.map(h=>i.find(g=>g.name===h)).filter(h=>h!=null),m=i.filter(h=>!a.includes(h.name)).filter(h=>h!=null);if(c.length>0)for(const h of[...c])h.name===s||rn.includes(h.name)||l.push({colId:h.name,field:h.name,headerName:h.name,pinned:"left",...tt,tooltipValueGetter:g=>g.value});for(const h of[...m])h.name===s||rn.includes(h.name)||l.push({colId:h.name,field:h.name,headerName:h.name,pinned:!1,...tt,tooltipValueGetter:g=>g.value});return l.push(...u),l},xn=e=>e*Bt+ft+El,Ol=({attachment:e,actions:t,className:n="",showLimitMessage:s})=>{const[a,i]=d.useState(!1),[l,f]=d.useState([]),[o,u]=d.useState(),[c,m]=d.useState(400);d.useEffect(()=>{e.url!=null&&(i(!0),t.getFile(e.url).then(g=>{if(g==null){f([]),u([]),i(!1);return}const{columns:p,data:x}=Il(g);f(x),u(p),i(!1)}))},[e.url,t]),d.useEffect(()=>{l?(m(xn(l.length)),s?.(l.length>=S.SERIES_LIMIT)):s?.(!1)},[l,s]);const h=d.useMemo(()=>r.jsx(cn.AgGridReact,{headerHeight:ft,rowHeight:Bt,rowData:l,columnDefs:o,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:o&&o?.length>5?"fitCellContents":"fitGridWidth"}}),[l,o]);return a?r.jsx(S.Loader,{}):r.jsx("div",{className:`w-full ${n}`,children:r.jsx("div",{className:"ag-theme-quartz max-h-[400px] min-h-[80px] w-full",style:{height:c},children:h})})},Mr=e=>le.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},le.createElement("path",{d:"M7.4665 6.39967H8.53317V5.33301H7.4665V6.39967ZM7.4665 10.6663H8.53317V7.46634H7.4665V10.6663ZM7.9945 13.333C5.0505 13.333 2.6665 10.9437 2.6665 7.99967C2.6665 5.05567 5.0505 2.66634 7.9945 2.66634C10.9438 2.66634 13.3332 5.05567 13.3332 7.99967C13.3332 10.9437 10.9438 13.333 7.9945 13.333ZM7.99984 3.73301C5.6425 3.73301 3.73317 5.64234 3.73317 7.99967C3.73317 10.357 5.6425 12.2663 7.99984 12.2663C10.3572 12.2663 12.2665 10.357 12.2665 7.99967C12.2665 5.64234 10.3572 3.73301 7.99984 3.73301Z",fill:"currentColor"})),_l=({title:e,value:t})=>{const n=d.useCallback(()=>Array.isArray(t)?t.join(", "):t,[t]);return r.jsxs("div",{className:"body-3 flex gap-x-3",children:[r.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),r.jsx("p",{title:n(),className:"truncate pr-3 font-semibold",children:n()})]})},Fl=({title:e,value:t,attachedKeysTitles:n,locale:s})=>{const[a,i]=d.useState(!1),[l,f]=d.useState(!1),o=d.useRef(null),u=d.useCallback(()=>{l&&i(m=>!m)},[i,l]),c=d.useCallback(()=>Array.isArray(t)?t?.map(m=>typeof m=="object"?m?.[s]:m)?.join(", "):t,[s,t]);return d.useEffect(()=>{o?.current&&f(o?.current?.scrollHeight>o?.current?.offsetHeight)},[o]),r.jsxs("div",{className:"metadata-item",children:[n?.map(m=>r.jsx("div",{title:m,className:"metadata-item-key mb-1 pr-3 text-neutrals-800",children:m},m)),r.jsxs("div",{className:V("flex items-center",l&&"justify-between"),children:[r.jsx("h2",{title:e,className:"metadata-item-title",children:e}),l&&r.jsx(S.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",a?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:r.jsx(un,{width:24,height:24}),onClick:u})]}),r.jsx("p",{title:c(),className:V("metadata-item-value pr-3",!a&&"line-clamp-4"),ref:o,children:c()})]})},Vl=({metadata:e,metadataDescription:t=[],titles:n,locale:s})=>r.jsxs("div",{className:"metadata-content h-full overflow-hidden",children:[t?.length>0&&r.jsx("div",{className:"metadata-description",children:t?.map(a=>r.jsx(_l,{title:a?.title,value:a?.value},a?.title))}),r.jsx("div",{className:"metadata-list h-full overflow-y-auto",children:e&&e?.length>0?e?.map(a=>r.jsx(Fl,{title:a?.title,value:a?.value,locale:s,attachedKeysTitles:a?.attachedKeysTitles},a?.id||a?.title)):r.jsx("div",{className:"metadata-empty flex h-full items-center justify-center text-neutrals-700",children:n?.noMetadata||"No metadata"})})]}),bn=({metadata:e,metadataDescription:t=[],isOpenMetadata:n,onCloseMetadata:s,titles:a,locale:i})=>{const[l,f]=d.useState(S.PopUpState.Closed);d.useEffect(()=>{f(n?S.PopUpState.Opened:S.PopUpState.Closed)},[n]);const o=d.useCallback(()=>{f(S.PopUpState.Closed),s?.()},[s]);return r.jsx(r.Fragment,{children:l===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:r.jsx("h1",{className:"metadata-heading",children:a?.metadata||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:S.PopUpSize.LG,dividers:!1,onClose:o,closeButtonTitle:a?.close||"Close",children:[r.jsx(Vl,{titles:a,locale:i,metadata:e,metadataDescription:t}),r.jsx("div",{})]})})},Ue={dataset:"dataset",agency:"agency",lastUpdated:"lastUpdated"},Ul=({dataset:e,agency:t,lastUpdated:n,externalLink:s,formatValue:a})=>r.jsxs("div",{className:"mb-6 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Me.IconDatabase,{className:"size-4 text-neutrals-700"}),r.jsx("p",{className:"h4 break-words text-neutrals-1000",children:a(e?.value)}),s&&r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Me.IconExternalLink,{className:"size-4 shrink-0 cursor-pointer text-primary"})})]}),t&&r.jsxs("div",{className:"body-3 flex gap-1",children:[r.jsxs("span",{className:"text-neutrals-800",children:[t?.title,":"]}),r.jsx("span",{className:"break-words text-neutrals-1000",children:a(t?.value)})]}),n&&r.jsxs("div",{className:"body-3 flex gap-1",children:[r.jsxs("span",{className:"text-neutrals-800",children:[n?.title,":"]}),r.jsx("span",{className:"break-words text-neutrals-1000",children:a(n?.value)})]})]}),Gl=new Set(Object.values(Ue)),Bl=", ",mt=({metadata:e,metadataDescription:t=[],datasetInfo:n,externalLink:s,titles:a,locale:i})=>{const l=d.useCallback(g=>Array.isArray(g)?g.map(p=>typeof p=="object"?p?.[i]??"":p).join(Bl):typeof g=="object"&&g!==null?g?.[i]??"":g??"",[i]),{dataset:f,agency:o,lastUpdated:u,hasStructuredDatasetInfo:c}=d.useMemo(()=>{const g=t.find(C=>C?.id===Ue.dataset),p=t.find(C=>C?.id===Ue.agency),x=t.find(C=>C?.id===Ue.lastUpdated),w=n?.dataset||g,b=n?.agency||p,y=n?.lastUpdated||x;return{dataset:w,agency:b,lastUpdated:y,hasStructuredDatasetInfo:!!w}},[n,t]),m=d.useMemo(()=>c?t.filter(g=>!g?.id||!Gl.has(g.id)):t,[c,t]),h=c||m.length>0||!!e?.length;return r.jsx("div",{className:"flex h-full flex-col overflow-hidden px-5 pb-4",children:h?r.jsxs(r.Fragment,{children:[c&&f&&r.jsx(Ul,{dataset:f,agency:o,lastUpdated:u,externalLink:s,formatValue:l}),m.length>0&&r.jsx("div",{className:"mb-4 flex flex-col gap-2",children:m.map((g,p)=>r.jsxs("div",{className:"body-3 flex gap-2",children:[r.jsxs("span",{className:"shrink-0 text-neutrals-800",children:[g?.title||g?.id,":"]}),r.jsx("span",{className:"min-w-0 truncate font-semibold text-neutrals-1000",children:l(g?.value)})]},`${g?.id||g?.title}-${p}`))}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx("div",{className:"flex flex-col gap-4",children:e?.map(g=>r.jsxs("div",{className:"flex flex-col gap-1",children:[g?.attachedKeysTitles?.map((p,x)=>r.jsx("div",{title:p,className:"body-3 text-neutrals-800",children:p},`${p}-${x}`)),r.jsx("p",{title:g?.title,className:"body-3 text-neutrals-800",children:g?.title||g?.id}),r.jsx("p",{title:l(g?.value),className:"body-2 break-words text-neutrals-1000",children:l(g?.value)})]},g?.id||g?.title))})})]}):r.jsx("div",{className:"body-3 flex h-full items-center justify-center text-neutrals-700",children:a?.noMetadata||"No metadata"})})},zl=e=>e?.data[e?.colDef?.field||0]?.obsAttributes,Hl=e=>e?.data?.attributes,kr=(e,t)=>Object.entries(e?.data).filter(([n])=>t?.get(n)).map(([n,s])=>({name:n,value:String(s)})),Zs=(e,t,n)=>{const s=typeof e=="object"?e?.[t]:e;return n?D.getLocalizedName(n?.codes?.find(a=>a?.id===e),t)||"":s},ut=(e,t,n)=>e?.map(s=>{const a=s?.name||"",i=t?.get(a),l=i?.codes?.length?i:void 0,f=Array.isArray(s?.value)?s?.value.map(o=>Zs(o,n,l)):Zs(s?.value,n,l);return{id:D.getLocalizedName(l,n)||s?.name,title:D.getLocalizedName(l||i,n),value:f||s?.value}})||[],ht=(e,t,n)=>({title:n?.dataset||"Dataset",value:D.getLocalizedName(e,t)}),Wl=(e,t,n,s)=>[{...ht(e,n,s),id:Ue.dataset},{id:Ue.agency,title:s?.agency??"Agency",value:e?.agencyID},{id:Ue.lastUpdated,title:s?.lastUpdated??"Last updated",value:t}],gt=(e,t,n,s)=>({dataset:e?{...ht(e,n,s),id:Ue.dataset}:void 0,agency:e?{id:Ue.agency,title:s?.agency??"Agency",value:e?.agencyID}:void 0,lastUpdated:e?{id:Ue.lastUpdated,title:s?.lastUpdated??"Last updated",value:t}:void 0}),Tr=(e,t,n)=>({title:D.getDimensionTitle(e?.conceptSchemes,D.getDimensions(e)?.timeDimensions?.[0],t),value:n?.colId||""}),Er=(e,t)=>({title:t?.observation||"Observation",value:e}),Nr=(e,t,n,s,a,i)=>{const l={title:s?.timeSeries||"Time Series",value:i?.originalData?.name};return n?[Tr(e,t,a),l,Er(n,s)]:[l]},$l=e=>{const t=e?.dataSets?.[0]?.attributes||[],n=e?.structures?.[0]?.attributes?.dataSet||[];return t?.length?n.map((s,a)=>s?.values?.length>0?{...s}:{...s,values:[{value:t?.[a]}]}):n},Jl=(e,t,n)=>e?.map(s=>{const a=s?.id,i=s?.values?.[0]?.value||s?.values?.[0]?.id,l=s?.values?.[0]?.ids,f=t?.get(a),o=f?.codes?.length?f:void 0,u=D.getLocalizedName(o?.codes?.find(m=>m?.id===i),n)||i,c=l&&l.map(m=>D.getLocalizedName(o?.codes?.find(h=>h?.id===m),n)||m);return{id:a,title:D.getLocalizedName(f,n)||a,value:l?c:u}}).filter(({value:s})=>!!s)||[],Yl=(e,t)=>{const n=e?.dataSets?.[0],a=e?.structures?.[0]?.attributes?.dimensionGroup||[],i=n?.dimensionGroupAttributes;return new Map(a.map(l=>{const f=l?.relationship?.dimensions,{codedSeriesKey:o,decodedSeriesKey:u}=Kl(e,t,f);return[l.id,{values:i?.[o]||[],decodedSeriesKey:u,codedSeriesKey:o}]}))},Kl=(e,t,n)=>{const s=e?.structures?.[0],a=[...s?.dimensions.series||[],...s?.dimensions.observation||[]],i=new Array(a?.length)?.fill(""),l=new Array(a?.length)?.fill("");return n&&n?.forEach(f=>{const o=a?.findIndex(m=>m?.id===f)||0,u=t[o],c=a[o]?.values?.findIndex(m=>m?.id===u||m?.value===u)||0;i[o]=c>=0?c:u,l[o]=u}),{codedSeriesKey:i?.join(":"),decodedSeriesKey:l?.join(":")}},ql=(e,t)=>{if(t==null)return;const n=e?.values?.[t],s=typeof t=="object"&&!Array.isArray(t),a=Array.isArray(t);return n||(s||a?{values:t}:{value:t?.toString()})},Zl=e=>{const t=e?.value||e?.id,n=e?.values||e?.ids;return t!=null?[t]:n||[null]},Ar=(e,t,n)=>t==null?t:n?.get(e||"")?.codes?.find(a=>a?.id===t)?.name||t,Xl=(e,t,n,s=$.Locale.EN)=>{const a=n?.dataStructureComponents?.dimensionList,i=[...a?.dimensions||[],...a?.timeDimensions||[]],l=[];return(e?.split(":")||[])?.forEach((o,u)=>{if(o!==""){const c=i?.[u]?.id||"",m=D.getLocalizedName(t?.get(c),s),h=Ar(c,o,t);l.push(`${m}: ${h}`)}}),l},Ql=(e,t,n,s,a=$.Locale.EN)=>{if(!e||!t||!s)return[];const i=e?.structures?.[0]?.attributes?.dimensionGroup||[],l=Yl(e,s);return i?.map((f,o)=>{const u=l?.get(f?.id),c=n?.get(f?.id),m=Zl(ql(f,u?.values?.[o]));return{id:f?.id,title:D.getLocalizedName(c,a),value:Array.isArray(m)?m?.map(h=>Ar(f?.id,h,n)||""):m,attachedKeysTitles:Xl(u?.decodedSeriesKey,n,t)}})?.filter(({value:f})=>f?.some(o=>!!o))||[]},ec=fi.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function We(...e){return ec(V(...e))}function tc({title:e,headerExtension:t,headerClassName:n,onClose:s,bodyClassName:a,panelClassName:i,children:l}){return r.jsxs("div",{className:We("h-full w-[362px] bg-white border-l border-neutrals-500 flex flex-col overflow-hidden",i),children:[r.jsxs("div",{className:We("flex justify-between px-5 py-6",n),children:[r.jsx("div",{className:"h2 text-neutrals-1000",children:e}),r.jsxs("div",{className:"flex items-center gap-2",children:[t,t&&r.jsx("div",{className:"h-3 w-px bg-neutrals-600"}),r.jsx("button",{type:"button",onClick:s,children:r.jsx(Me.IconX,{className:"size-5 text-neutrals-1000"})})]})]}),r.jsx("div",{className:We("flex-1 min-h-0 overflow-hidden",a),children:l})]})}const jr=d.createContext(null);function nc({children:e}){const[t,n]=d.useState(null),s=d.useCallback(f=>{n(f)},[]),a=d.useCallback(()=>{n(null)},[]),i=d.useCallback(f=>f?t?.id===f:t!==null,[t]),l=d.useMemo(()=>({panel:t,openPanel:s,closePanel:a,isPanelOpen:i}),[t,s,a,i]);return r.jsx(jr.Provider,{value:l,children:e})}function Ir(){return d.useContext(jr)}function Je(){const e=Ir();if(!e)return null;const{openPanel:t,closePanel:n,isPanelOpen:s}=e;return{openPanel:t,closePanel:n,isPanelOpen:s}}function Lr({scope:e}){const t=Ir();if(!t)return null;const{panel:n,closePanel:s}=t;if(!n)return null;const a=n.scope??"any";return a!=="any"&&a!==e?null:r.jsx(tc,{title:n.title,headerExtension:n.headerExtension,headerClassName:n.headerClassName,onClose:s,bodyClassName:n.bodyClassName,panelClassName:n.panelClassName,children:n.content})}function Xt(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function st(e){return(t,n)=>{const s=n?.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,f=n?.width?String(n.width):l;a=e.formattingValues[f]||e.formattingValues[l]}else{const l=e.defaultWidth,f=n?.width?String(n.width):e.defaultWidth;a=e.values[f]||e.values[l]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}function at(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const l=i[0],f=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(f)?ac(f,m=>m.test(l)):sc(f,m=>m.test(l));let u;u=e.valueCallback?e.valueCallback(o):o,u=n.valueCallback?n.valueCallback(u):u;const c=t.slice(l.length);return{value:u,rest:c}}}function sc(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ac(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function rc(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],i=t.match(e.parsePattern);if(!i)return null;let l=e.valueCallback?e.valueCallback(i[0]):i[0];l=n.valueCallback?n.valueCallback(l):l;const f=t.slice(a.length);return{value:l,rest:f}}}const Xs=Symbol.for("constructDateFrom");function Pr(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Xs in e?e[Xs](t):e instanceof Date?new e.constructor(t):new Date(t)}function ic(e,...t){const n=Pr.bind(null,e||t.find(s=>typeof s=="object"));return t.map(n)}let oc={};function lc(){return oc}function Sn(e,t){return Pr(t||e,e)}function Qs(e,t){const n=lc(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Sn(e,t?.in),i=a.getDay(),l=(i<s?7:0)+i-s;return a.setDate(a.getDate()-l),a.setHours(0,0,0,0),a}function Rr(e,t,n){const[s,a]=ic(n?.in,e,t);return+Qs(s,n)==+Qs(a,n)}function rt(e,t){if(e.one!==void 0&&t===1)return e.one;const n=t%10,s=t%100;return n===1&&s!==11?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(s<10||s>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function Ne(e){return(t,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?e.future?rt(e.future,t):"за "+rt(e.regular,t):e.past?rt(e.past,t):rt(e.regular,t)+" тому":rt(e.regular,t)}const cc=(e,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",dc={lessThanXSeconds:Ne({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:Ne({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:cc,lessThanXMinutes:Ne({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:Ne({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:Ne({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:Ne({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:Ne({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:Ne({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:Ne({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:Ne({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:Ne({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:Ne({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:Ne({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:Ne({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:Ne({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},uc=(e,t,n)=>(n=n||{},dc[e](t,n)),fc={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},mc={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},hc={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gc={date:Xt({formats:fc,defaultWidth:"full"}),time:Xt({formats:mc,defaultWidth:"full"}),dateTime:Xt({formats:hc,defaultWidth:"full"})},yn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function pc(e){const t=yn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+t+" о' p";case 1:case 2:case 4:return"'у минулий "+t+" о' p"}}function Or(e){return"'у "+yn[e]+" о' p"}function wc(e){const t=yn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+t+" о' p";case 1:case 2:case 4:return"'у наступний "+t+" о' p"}}const Cc=(e,t,n)=>{const s=Sn(e),a=s.getDay();return Rr(s,t,n)?Or(a):pc(a)},vc=(e,t,n)=>{const s=Sn(e),a=s.getDay();return Rr(s,t,n)?Or(a):wc(a)},xc={lastWeek:Cc,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:vc,other:"P"},bc=(e,t,n,s)=>{const a=xc[e];return typeof a=="function"?a(t,n,s):a},Sc={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},yc={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Dc={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},Mc={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},kc={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Tc={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранок",afternoon:"день",evening:"вечір",night:"ніч"}},Ec={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"}},Nc=(e,t)=>{const n=String(t?.unit),s=Number(e);let a;return n==="date"?s===3||s===23?a="-є":a="-е":n==="minute"||n==="second"||n==="hour"?a="-а":a="-й",s+a},Ac={ordinalNumber:Nc,era:st({values:Sc,defaultWidth:"wide"}),quarter:st({values:yc,defaultWidth:"wide",argumentCallback:e=>e-1}),month:st({values:Dc,defaultWidth:"wide",formattingValues:Mc,defaultFormattingWidth:"wide"}),day:st({values:kc,defaultWidth:"wide"}),dayPeriod:st({values:Tc,defaultWidth:"any",formattingValues:Ec,defaultFormattingWidth:"wide"})},jc=/^(\d+)(-?(е|й|є|а|я))?/i,Ic=/\d+/i,Lc={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Pc={any:[/^д/i,/^н/i]},Rc={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},Oc={any:[/1/i,/2/i,/3/i,/4/i]},_c={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},Fc={narrow:[/^с/i,/^л/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^л/i,/^с/i,/^в/i,/^ж/i,/^л/i,/^г/i],any:[/^сі/i,/^лю/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^лип/i,/^се/i,/^в/i,/^ж/i,/^лис/i,/^г/i]},Vc={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},Uc={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},Gc={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Bc={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},zc={ordinalNumber:rc({matchPattern:jc,parsePattern:Ic,valueCallback:e=>parseInt(e,10)}),era:at({matchPatterns:Lc,defaultMatchWidth:"wide",parsePatterns:Pc,defaultParseWidth:"any"}),quarter:at({matchPatterns:Rc,defaultMatchWidth:"wide",parsePatterns:Oc,defaultParseWidth:"any",valueCallback:e=>e+1}),month:at({matchPatterns:_c,defaultMatchWidth:"wide",parsePatterns:Fc,defaultParseWidth:"any"}),day:at({matchPatterns:Vc,defaultMatchWidth:"wide",parsePatterns:Uc,defaultParseWidth:"any"}),dayPeriod:at({matchPatterns:Gc,defaultMatchWidth:"wide",parsePatterns:Bc,defaultParseWidth:"any"})},Hc={code:"uk",formatDistance:uc,formatLong:gc,formatRelative:bc,localize:Ac,match:zc,options:{weekStartsOn:1,firstWeekContainsDate:1}},Wc=e=>e===$.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",pt=(e,t)=>{const n=Wc(t);return e!=null&&e!==""&&n&&Ns.isValid(new Date(e))?Ns.format(new Date(e),n,t===$.Locale.UK?{locale:Hc}:void 0):""},_r=e=>{const t="grid-metadata-side-panel",[n,s]=d.useState(!1),a=d.useRef(null),[i,l]=d.useState(""),[f,o]=d.useState(""),[u,c]=d.useState(!1),{onboardingFileSchema:m,isShowOnboarding:h}=Ae(),{isOpenedAdvancedView:g}=Ee(),p=Je(),{isMetadataInSidePanel:x}=ke(),[w,b]=d.useState(!1),y=e?.context?.externalLink,C=d.useMemo(()=>{if(e.structuresMap){const k=e?.data?.dataset?.urn;return k!=null?e.structuresMap.get(k):void 0}return e.dataSetData},[e.structuresMap,e.data,e.dataSetData]),v=d.useMemo(()=>D.getStructureComponentsMap(C),[C]),M=d.useMemo(()=>[ht(C?.dataflows?.[0],e?.locale,e.titles),...ut(kr(e,v),v,e?.locale),...ut(Hl(e),v,e?.locale),...Ql(e?.attributesData,C?.dataStructures?.[0],v,e?.data?.originalData?.parsedTimeSeriesValue,e?.locale)],[e,C,v]),T=d.useMemo(()=>Nr(C,e?.locale,e?.valueFormatted||e?.value,e.titles,e?.colDef,e?.data),[e,C]),j=d.useMemo(()=>{const k=C?.dataflows?.[0],E=pt(D.getLastUpdatedTime(k),e?.locale);return gt(k,E,e?.locale,e.titles)},[C,e?.locale,e.titles]),N=d.useCallback(()=>{if(x&&p){p.openPanel({id:t,scope:g?"advanced":"conversation",title:e.titles?.timeseriesMetadataPanel||"Timeseries Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e?.locale,metadata:M,datasetInfo:j,externalLink:y,metadataDescription:e?.metadataSettings?.isMetadataDescription?T:[]})}),b(!0);return}s(!0)},[x,g,M,T,j,y,e?.locale,e?.metadataSettings?.isMetadataDescription,e.titles,p]),O=d.useCallback(()=>{s(!1),b(!0)},[]);return d.useEffect(()=>{if(h){const{title:k,description:E}=Ge(Ce.METADATA_PER_SERIES,e.titles);l(k),o(E)}},[e.titles,h]),d.useEffect(()=>{if(h){const k=m?.lastDisplayedElement===Ce.METADATA_PER_SERIES&&e.node.rowIndex===0;c(k),k&&setTimeout(()=>{a?.current?.scrollIntoView({block:"end",behavior:"smooth"})})}},[m?.lastDisplayedElement,e.node.rowIndex,h]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:a,children:r.jsx(S.IconButton,{title:e.titles?.metadata||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:r.jsx(Mr,{className:"size-5"}),onClick:N})}),u&&r.jsx(Be,{reference:a,title:i,description:f,onReferenceClick:N,shouldCloseTooltip:w}),n&&r.jsx(bn,{titles:e.titles,locale:e?.locale,metadata:M,metadataDescription:e?.metadataSettings?.isMetadataDescription?T:[],isOpenMetadata:n,onCloseMetadata:O})]})},Fr=e=>{const t="observation-metadata-side-panel",[n,s]=d.useState(!1),{isOpenedAdvancedView:a}=Ee(),i=Je(),{isMetadataInSidePanel:l}=ke(),f=e?.context?.externalLink,o=d.useMemo(()=>{if(e.structuresMap){const w=e?.data?.dataset?.urn;return w!=null?e.structuresMap.get(w):void 0}return e.dataSetData},[e.structuresMap,e.data,e.dataSetData]),u=d.useMemo(()=>D.getStructureComponentsMap(o),[o]),c=d.useMemo(()=>ut(zl(e),u,e?.locale),[e,u]),m=d.useMemo(()=>[ht(o?.dataflows?.[0],e?.locale,e?.titles),...ut(kr(e,u),u,e?.locale),...e?.metadataSettings?.isMetadataDescription?[]:[Tr(o,e?.locale,e?.colDef),Er(e?.valueFormatted||e?.value,e?.titles)],...c],[e,o,u,c]),h=d.useMemo(()=>Nr(o,e?.locale,e?.valueFormatted||e?.value,e?.titles,e?.colDef,e?.data),[e,o]),g=d.useMemo(()=>{const w=o?.dataflows?.[0],b=pt(D.getLastUpdatedTime(w),e?.locale);return gt(w,b,e?.locale,e?.titles)},[o,e?.locale,e?.titles]),p=d.useCallback(()=>{if(l&&i){i.openPanel({id:t,scope:a?"advanced":"conversation",title:e.titles?.metadata||"Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e?.locale,metadata:m,datasetInfo:g,externalLink:f,metadataDescription:e?.metadataSettings?.isMetadataDescription?h:[]})});return}s(!0)},[l,a,m,h,g,f,e?.locale,e?.metadataSettings?.isMetadataDescription,e.titles,i]),x=d.useCallback(()=>{s(!1)},[]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative size-full p-2 text-end",children:[e?.valueFormatted||e?.value,c?.length>0&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:p})]}),n&&r.jsx(bn,{titles:e.titles,locale:e?.locale,metadata:m,metadataDescription:e?.metadataSettings?.isMetadataDescription?h:[],isOpenMetadata:n,onCloseMetadata:x})]})},Vr=({ref:e,fixHeight:t,gridHeight:n,children:s})=>r.jsx("div",{ref:e,className:V("ag-theme-quartz w-full min-h-[80px]",t?"max-h-[400px]":"max-h-full"),style:{height:n},children:s}),$c=({attachment:e,isDataLoading:t,isChartColumnVisible:n,fixHeight:s,titles:a,externalLink:i,showLimitMessage:l,onApiReady:f})=>{const[o,u]=d.useState(!1),[c,m]=d.useState([]),[h,g]=d.useState(),[p,x]=d.useState(400),w=d.useRef(null),[b,y]=d.useState(""),[C,v]=d.useState(""),[M,T]=d.useState(!1),{isShowOnboarding:j,onboardingFileSchema:N,setOnboardingFileSchema:O}=Ae();d.useEffect(()=>{if(e.grid_data==null)u(!0);else{const A=e.grid_data.columns.map(I=>I.colId===dt?{...I,hide:!n}:I);m(e.grid_data.data),g(A),u(!1)}},[e.grid_data,n]),d.useEffect(()=>{c?(x(xn(c.length)),l?.(c.length>=S.SERIES_LIMIT)):l?.(!1)},[c,l]),d.useEffect(()=>{if(j){const{title:A,description:I}=Ge(Ce.DATA_GRID,a);y(A),v(I)}},[a,j]),d.useEffect(()=>{N&&!N?.infoElements?.dataGrid&&O?.({...N,infoElements:{...N?.infoElements,dataGrid:!0},lastDisplayedElement:Ce.DATA_GRID})},[N,O]),d.useEffect(()=>{if(j){const A=N?.lastDisplayedElement===Ce.DATA_GRID;T(A),!o&&!t&&A&&setTimeout(()=>{w?.current?.scrollIntoView({block:"end",behavior:"smooth"})})}},[N?.lastDisplayedElement,j,t,o]);const k=d.useCallback(A=>{f?.(A.api)},[f]),E=d.useMemo(()=>r.jsx(cn.AgGridReact,{onGridReady:k,headerHeight:ft,rowHeight:Bt,rowData:c,enableCellTextSelection:!0,columnDefs:h,context:{externalLink:i},domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Ht]:_r,[zt]:Fr,[br]:vn}}),[c,h,k,i]);return o||t?r.jsx(S.Loader,{}):r.jsxs("div",{className:"size-full",children:[r.jsx(Vr,{ref:w,fixHeight:s,gridHeight:p,children:E}),M&&r.jsx(Be,{reference:w,title:b,description:C,supressReferenceClick:!0})]})},Jc=200,Yc=8,Kc=2,qc=({currentIndex:e,totalCount:t,icons:n,titles:s,onPrev:a,onNext:i})=>{const l=d.useRef(null),[f,o]=d.useState(""),[u,c]=d.useState(""),[m,h]=d.useState(!1),{onboardingFileSchema:g,isShowOnboarding:p}=Ae();d.useEffect(()=>{if(p){const{title:y,description:C}=Ge(Ce.CHARTS_NAVIGATION,s);o(y),c(C)}},[s,p]),d.useEffect(()=>{if(p){const y=g?.lastDisplayedElement===Ce.CHARTS_NAVIGATION;h(y),y&&l?.current?.scrollIntoView({block:"center",behavior:"smooth"})}},[g?.lastDisplayedElement,p]);const x=t>0?e/t*100:0,w=t>0?Math.min(Yc*t,Jc):0,b=t>0?Math.max(w/t,Kc):0;return r.jsxs("div",{className:"flex w-full flex-row items-center justify-center gap-2",children:[r.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:a,children:n?.[Lt.PREVIOUS]}),r.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[r.jsx("div",{className:"relative h-[4px] rounded-full bg-neutral-300",style:{width:`${w}px`},children:r.jsx("div",{className:"absolute h-full rounded-full bg-primary",style:{left:`${x}%`,width:`${b}px`}})}),r.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",t]})]}),r.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===t?"text-neutrals-700":"text-primary"),onClick:i,ref:l,children:n?.[Lt.NEXT]}),m&&r.jsx(Be,{reference:l,title:f,description:u})]})},Zc=({limitAmount:e,titles:t,openAdvancedView:n})=>{const[s,a]=d.useState(!1),{refs:i,floatingStyles:l,context:f}=Le.useFloating({open:s,onOpenChange:a,placement:"top-start"}),o=Le.useHover(f,{handleClose:Le.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:u,getFloatingProps:c}=Le.useInteractions([o]);return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex w-fit",ref:i.setReference,...u(),children:r.jsxs("div",{className:"mt-1 flex w-fit gap-1 bg-hues-100 px-4 py-2",children:[r.jsx("h5",{className:"font-bold",children:t?.limits||"Limited to"}),r.jsxs("h5",{children:[e," ",t?.timeseriesLimit||"Timeseries"]})]})}),s&&r.jsx("div",{className:"floating",ref:i.setFloating,style:l,...c(),children:r.jsxs("div",{className:"z-10 mb-2 flex w-[300px] flex-col gap-2 rounded bg-white p-4 shadow",children:[r.jsxs("div",{children:[r.jsxs("h5",{className:"text-neutrals-900",children:[r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP1_1||"The number of timeseries displayed in a single chart i"}),r.jsxs("span",{className:"pr-0.5 font-bold",children:[t?.limitLinkInfoP1_2||"limited to"," ",e]}),t?.limitLinkInfoP1_3||"for better clarity and performance."]}),r.jsxs("h5",{className:"text-neutrals-900",children:[r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP2_1||"To visualize specific timeseries"}),r.jsx("span",{className:"pr-0.5 font-bold",children:t?.limitLinkInfoP2_2||"filter"}),r.jsx("span",{className:"pr-0.5",children:t?.limitLinkInfoP2_3||"your request, or"}),r.jsx("span",{className:"pr-0.5 font-bold",children:t?.limitLinkInfoP2_4||"refine"}),t?.limitLinkInfoP2_5||"it in the chat."]})]}),n&&r.jsx("h4",{className:"cursor-pointer text-primary",onClick:n,children:t?.limitLinkInfoLink||"Open Advanced View"})]})})]})};function Xc(e,t,n){const s=(e.getZr()?.painter).getRenderedCanvas()?.getContext("2d");if(!s)return 0;const a=n.textStyle?.fontSize??12,i=n.textStyle?.fontFamily??"sans-serif";s.font=`${a}px ${i}`;const l=s.measureText(t).width,f=n.itemWidth??25,o=n.itemGap??10;return l+f+o}const Qc=({option:e,style:t})=>{const n=d.useRef(null),[s,a]=d.useState(e);d.useEffect(()=>{a(ln.cloneDeep(e))},[e]);const i=d.useCallback(()=>{const l=n.current?.getEchartsInstance?.();if(!l)return;const o=l.getDom().clientWidth,u=e.legend||{},c=u.itemHeight??14,m=u.textStyle?.fontSize??12,h=l.getModel()?.getComponent("legend")?.getData()||[];let g=0;h.forEach(b=>{const y=b.option.name||"";g+=Xc(l,y,u)});const x=Math.max(1,Math.ceil(g/o))*(+c+ +m+6),w=20;a(b=>({...b,grid:{...b.grid||{},bottom:x+w}}))},[e.legend]);return d.useEffect(()=>{i();const l=()=>{i()};return window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)}},[e,i]),r.jsx(ma,{notMerge:!0,lazyUpdate:!1,ref:n,option:s,style:t})},ed=({attachment:e,icons:t,isDataLoading:n,openAdvancedView:s,fixHeight:a=!0,titles:i})=>{const[l,f]=d.useState(!0),[o,u]=d.useState([]),[c,m]=d.useState(0),[h,g]=d.useState(void 0),[p,x]=d.useState(),{onboardingFileSchema:w,isShowOnboarding:b,setOnboardingFileSchema:y}=Ae(),C=d.useRef(null);d.useEffect(()=>{f(e.charting_data==null);const T=e.charting_data?.groups??[],j=e.charting_data?.units??[];u(T.length>0?T.flatMap(N=>N.units.map(O=>({unit:O,groupTitle:N.title}))):j.map(N=>({unit:N})))},[e.charting_data]),d.useEffect(()=>{const T=o.length>c,j=T?o[c]:o[0];g(!l&&j!=null?j.unit:void 0),x(j?.groupTitle),T||m(0)},[l,o,c]),d.useEffect(()=>{w&&b&&!l&&(zo(w)&&(y?.(Bo(w)),C?.current?.scrollIntoView({block:"center",behavior:"smooth"})),w.lastDisplayedElement===Ce.CHART_PER_SERIES&&y?.(cr(w)))},[l,y,w,b]);const v=d.useCallback(()=>{m(T=>Math.min(T+1,o.length-1))},[o.length]),M=d.useCallback(()=>{m(T=>Math.max(T-1,0))},[]);return l||n?r.jsx(S.Loader,{}):r.jsx("div",{className:"chart-attachment size-full",ref:C,children:e.charting_data&&r.jsx("div",{className:"flex size-full flex-col gap-4",children:o.length==0||h==null?r.jsx("h4",{className:"ml-1",children:i?.chartInfo||"No data"}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("h3",{className:"chart-attachment-title",children:[i?.chart||"Chart"," ",c+1,"/",o.length]}),r.jsx("span",{className:"h4 chart-attachment-info text-neutrals-700",children:i?.chartInfo||"Chart Information"})]}),r.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",a&&"max-h-[400px] min-h-[400px]",!a&&"min-h-[300px]"),children:[r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[p&&r.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[r.jsx(hn,{className:"size-4 shrink-0 text-neutrals-1000"}),r.jsx("h4",{className:"text-neutrals-1000",children:p})]}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:[r.jsx(Qc,{option:h.config,style:{width:"100%",height:"100%",minHeight:0}}),h.limitedByRowsAmountTo&&r.jsx(Zc,{limitAmount:h.limitedByRowsAmountTo,openAdvancedView:s,titles:i}),o.length>1&&r.jsx(qc,{icons:t,currentIndex:c,totalCount:o.length,titles:i,onNext:v,onPrev:M})]})]}),r.jsx(xr,{dimensionsInfo:h.dimensions})]})]})})})},td=({attachment:e,className:t})=>{const{data:n,language:s}=e,a=(i,l)=>{i.addCommand(l.KeyCode.F1,()=>{})};return r.jsx("div",{className:We(["h-full w-full [&_.cursors-layer]:hidden",t]),children:r.jsx(mi.Editor,{value:n,language:s,theme:"vs-light",onMount:a,options:{readOnly:!0,contextmenu:!1,scrollBeyondLastLine:!1,minimap:{enabled:!1},wordWrap:"on",automaticLayout:!0,tabSize:2}})})},Ur=d.createContext(void 0);function Dn({children:e,titles:t}){return r.jsx(Ur.Provider,{value:t,children:e})}function Mn(){return d.useContext(Ur)}const nd="Dataset",ea="dataset_name",sd="Agency",ta="agency",ad="Country dimensions",wt="country_aggregated",rd="Indicator dimensions",Ct="indicator_aggregated",id="Frequency",Wt="frequency_aggregated",Gr=".";function na(e){return{columnState:e.getColumnState(),columnGroupState:e.getColumnGroupState()}}function od(e,t){t&&(e.applyColumnState({state:t.columnState,applyOrder:!0}),e.setColumnGroupState(t.columnGroupState))}const sa=["columnVisible","columnMoved","displayedColumnsChanged","newColumnsLoaded","gridColumnsChanged","columnPinned"];function Br(e,t){d.useEffect(()=>{if(e){for(const n of sa)e.addEventListener(n,t);return()=>{for(const n of sa)e.removeEventListener(n,t)}}},[e,t])}function ld({currentUrn:e}){const[t,n]=d.useState(),[s,a]=d.useState(null),i=d.useRef(new Map),l=d.useRef(new Map),f=d.useCallback(u=>{if(n(u),i.current.has(e))s==null&&a(i.current.get(e)??null);else{const m=na(u);i.current.set(e,m),a(m)}const c=l.current.get(e);c&&(u.applyColumnState({state:c.columnState,applyOrder:!0}),u.setColumnGroupState(c.columnGroupState))},[e]);d.useEffect(()=>{a(i.current.get(e)??null)},[e]);const o=d.useCallback(()=>{t&&l.current.set(e,na(t))},[e,t]);return Br(t,o),{gridApi:t,onGridApiReady:f,initialColumnsState:s}}const kn=d.createContext(null);function cd({currentUrn:e,structuresMap:t,locale:n,dataQueries:s,children:a}){const{gridApi:i,onGridApiReady:l,initialColumnsState:f}=ld({currentUrn:e}),[o,u]=d.useState(new Map),c=d.useCallback((x,w,b)=>{u(y=>{const C=new Map(y),v=new Map(C.get(x)??[]),M=v.get(w)??{order:[],hidden:new Set};return v.set(w,b(M)),C.set(x,v),C}),i?.refreshCells({columns:[w]})},[i]),m=d.useCallback((x,w,b)=>{c(x,w,y=>({...y,order:b}))},[c]),h=d.useCallback(()=>{u(new Map)},[]),g=d.useCallback((x,w,b,y)=>{c(x,w,C=>{const v=new Set(C.hidden);return y?v.add(b):v.delete(b),{...C,hidden:v}})},[c]),p=d.useMemo(()=>({gridApi:i,onGridApiReady:l,initialColumnsState:f,structuresMap:t,locale:n,dataQueries:s,dimensionCustomization:o,setDimensionKeyOrder:m,setDimensionKeyHidden:g,resetDimensionCustomization:h}),[i,f,l,t,n,s,o,m,g,h]);return r.jsx(kn.Provider,{value:p,children:a})}function Tn(){const e=d.useContext(kn);if(!e)throw new Error("useTableSettingsContext must be used within TableSettingsProvider");return e}const dd=()=>d.useContext(kn);function $t(e,t,n){const s=D.getConcept(e.conceptIdentity,t),a=D.getArtifactByUrnWithWildCard(s?.coreRepresentation?.enumeration,n);return{concept:s,codeList:a||void 0}}function zr(e,t,n){const s=e.findIndex(a=>a.id===t);return n.originalData.parsedTimeSeriesValue[s]}function En(e,t,n,s,a){const i=zr(e,t,s),l=n?.codes?.find(f=>f.id===i);return D.getLocalizedName(l,a)}function ud(e,t,n,s){return[fd(e,t,n,s),md(e,t,n,s),hd(e,t,n,s)]}function fd(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.region;return o==null||f==null||l==null||u==null?"":Jt(l,u,o,n)};return Nn(s?.countryDimensions||ad,wt,a,e,t,n,s)}function md(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.indicators;return o==null||f==null||l==null||u==null||u.length===0?"":u.map(m=>Jt(l,m,o,n)||"").join(Gr)};return Nn(s?.indicatorDimensions||rd,Ct,a,e,t,n,s)}function hd(e,t,n,s){const a=i=>{const{structures:l,urn:f,data:o}=An(i,e),u=t.get(f)?.frequency;return o==null||f==null||l==null||u==null?"":Jt(l,u,o,n)};return Nn(s?.frequency||id,Wt,a,e,t,n,s)}function Nn(e,t,n,s,a,i,l){return{headerName:e,field:t,colId:t,valueGetter:n,...tt,cellClass:Ze,cellRenderer:Sr,tooltipValueGetter:f=>f.value,cellRendererParams:{structuresMap:s,datasetDimensionsSchemesMap:a,locale:i,titles:l,colId:t}}}function An(e,t){const{data:n}=e,s=n?.dataset?.urn,a=s==null?void 0:t.get(s);return{data:n,urn:s,structures:a}}function Jt(e,t,n,s){const a=e.conceptSchemes||[],i=e.codelists||[],l=D.getDimensions(e)?.dimensions||[],f=l.find(u=>u.id===t);if(f==null)return;const{codeList:o}=$t(f,a,i);return En(l,t,o,n,s)}const Ft="::";function gd(e,t){return`${e}${Ft}${t}`}function aa(e){return e.includes(Ft)}function Qt(e){const t=e.indexOf(Ft);return{urn:e.slice(0,t),dimensionKey:e.slice(t+Ft.length)}}function Hr(e,t){let n=e;return t?.order.length&&(n=[...t.order.filter(s=>e.includes(s)),...e.filter(s=>!t.order.includes(s))]),t?.hidden.size&&(n=n.filter(s=>!t.hidden.has(s))),n}const pd=new Set([Ct,wt,Wt]);function wd(e,t,n){const s=n(t);return s?e===Ct?s.indicators:e===wt?s.region?[s.region]:[]:e===Wt?s.frequency?[s.frequency]:[]:[]:[]}function Cd(e,t,n){const s=e.getDimensionConfig(t,n);if(s?.alias)return s.alias;const a=e.structuresMap.get(t),l=(a?D.getDimensions(a)?.dimensions??[]:[]).find(f=>f.id===n);return D.getDimensionTitle(a?.conceptSchemes??[],l,e.locale)??n}function vd(e){return t=>{if(!pd.has(t.id))return t;const n=[];for(const{urn:s}of e.dataQueries){const a=wd(t.id,s,e.getDimensionsScheme);if(!a.length)continue;const i=e.dimensionCustomization?.get(s)?.get(t.id),l=i?.order.length?Hr(a,{order:i.order,hidden:new Set}):a,f=l.length>1,o=l.map(m=>({id:gd(s,m),type:"item",label:Cd(e,s,m),isChecked:!i?.hidden.has(m),draggable:f,checkable:f})),u=e.structuresMap.get(s),c=D.getLocalizedName(u?.dataflows?.[0],e.locale)??s;n.push({id:s,type:"group",label:c,items:o})}return n.length?{...t,items:n}:t}}function ra(e,t){return e===Ct?t.indicators??[]:e===wt?t.region?[t.region]:[]:e===Wt?t.frequency?[t.frequency]:[]:[]}function xd(e,t){return e===Ct?t?.indicatorMetadataPanel||"Indicator dimension details":e===wt?t?.countryMetadataPanel||"Country dimension details":t?.metadata||"Metadata"}const bd="merged-dimension-metadata-side-panel",Sd=e=>{const{isOpenedAdvancedView:t}=Ee(),n=Je(),{isMetadataInSidePanel:s}=ke(),a=dd(),i=e?.data?.dataset?.urn,l=i!=null?e.structuresMap.get(i):void 0,f=i!=null?e.datasetDimensionsSchemesMap.get(i):void 0,o=a?.dimensionCustomization,u=d.useMemo(()=>{if(!l||!f||i==null)return e.valueFormatted??e.value;const p=o?.get(i)?.get(e.colId);return Hr(ra(e.colId,f),p).map(b=>Jt(l,b,e.data,e.locale)).filter(Boolean).join(Gr)},[o,l,f,i,e.valueFormatted,e.value,e.colId,e.data,e.locale]),c=d.useMemo(()=>{if(!l||!f)return[];const p=ra(e.colId,f),x=D.getStructureComponentsMap(l),w=p.filter(b=>e.data[b]!=null).map(b=>({name:b,value:String(e.data[b])}));return ut(w,x,e.locale)},[l,f,e.colId,e.data,e.locale]),m=d.useMemo(()=>{const p=l?.dataflows?.[0];if(!p)return;const x=pt(D.getLastUpdatedTime(p),e.locale);return gt(p,x,e.locale,e.titles)},[l,e.locale,e.titles]),h=s&&!!n&&!!e.value,g=d.useCallback(()=>{n&&n.openPanel({id:bd,scope:t?"advanced":"conversation",title:xd(e.colId,e.titles),bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e.locale,metadata:c,datasetInfo:m})})},[n,t,e.colId,e.titles,e.locale,c,m]);return r.jsxs("div",{className:"relative size-full p-2",children:[u,h&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:g})]})},yd="dataset-detail-metadata-side-panel",Dd=e=>{const{isOpenedAdvancedView:t}=Ee(),n=Je(),{isMetadataInSidePanel:s}=ke(),a=e?.data?.dataset?.urn,i=a!=null?e.structuresMap.get(a):void 0,l=d.useMemo(()=>{const u=i?.dataflows?.[0];if(!u)return;const c=pt(D.getLastUpdatedTime(u),e.locale);return gt(u,c,e.locale,e.titles)},[i,e.locale,e.titles]),f=s&&!!n&&!!e.value,o=d.useCallback(()=>{n&&n.openPanel({id:yd,scope:t?"advanced":"conversation",title:e.titles?.datasetMetadataPanel||"Dataset Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:e.titles,locale:e.locale,metadata:[],datasetInfo:l})})},[n,t,l,e.titles,e.locale]);return r.jsxs("div",{className:"relative size-full p-2",children:[e.valueFormatted??e.value,f&&r.jsx("div",{className:"metadata-indicator",title:e.titles?.metadata||"View details",onClick:o})]})},Md=({attachment:e,isDataLoading:t,isChartColumnVisible:n,fixHeight:s,showLimitMessage:a,onApiReady:i})=>{const[l,f]=d.useState(!1),[o,u]=d.useState([]),[c,m]=d.useState(),[h,g]=d.useState(400);d.useEffect(()=>{if(e.gridContent==null)f(!0);else{const w=e.gridContent.columns.map(b=>b.colId===dt?{...b,hide:!n}:b);u(e.gridContent.data),m(w),f(!1)}},[e.gridContent,n]),d.useEffect(()=>{o?(g(xn(o.length)),a?.(o.length>=S.SERIES_LIMIT)):a?.(!1)},[o,a]);const p=d.useCallback(w=>{i?.(w.api)},[i]),x=d.useMemo(()=>r.jsx(cn.AgGridReact,{headerHeight:ft,rowHeight:Bt,rowData:o,enableCellTextSelection:!0,columnDefs:c,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Ht]:_r,[zt]:Fr,[Sr]:Sd,[br]:vn,[yr]:Dd},onGridReady:p}),[o,c,p]);return l||t?r.jsx(S.Loader,{}):r.jsx("div",{className:"size-full",children:r.jsx(Vr,{fixHeight:s,gridHeight:h,children:x})})},kd=({selectedAttachment:e,actions:t,attachmentsStyles:n,isDataLoading:s,externalLink:a,isOpenedAdvancedView:i,onOpenAdvancedView:l,showLimitMessage:f,onGridApiReady:o})=>{const u=Mn();return r.jsxs("div",{className:"flex min-h-0 w-full flex-1 justify-center",children:[Wo(e)&&r.jsx(Cl,{actions:t,downloadTitles:n?.downloadTitle,attachment:e}),wn(e)&&r.jsx(Ol,{actions:t,attachment:e,showLimitMessage:f}),Ke(e)&&r.jsx($c,{attachment:e,isDataLoading:s,isChartColumnVisible:i,fixHeight:!i,titles:u,showLimitMessage:f,onApiReady:o,externalLink:a}),Gt(e)&&r.jsx(Md,{attachment:e,isDataLoading:s,isChartColumnVisible:i,fixHeight:!i,showLimitMessage:f,onApiReady:o}),jt(e)&&r.jsx(ed,{titles:u,isDataLoading:s,attachment:e,icons:n?.chartingIcons,openAdvancedView:i?void 0:l,fixHeight:!i}),pn(e)&&r.jsx(kl,{attachment:e,openLinkTitle:n?.openLinkTitle}),fr(e)&&r.jsx(Sl,{attachment:e}),Cn(e)&&r.jsx(td,{attachment:e,className:n?.codeAttachmentContainerClassName})]})};Es.ModuleRegistry.registerModules([Es.AllCommunityModule]);const Wr=({attachments:e,actions:t,titles:n,messageStyles:s,attachmentsStyles:a,isSystemAttachments:i,isShowAttachments:l,showAdvancedView:f,currentDataQuery:o,dataQueries:u,attachmentInfoList:c,datasets:m,initialSelectedDatasetUrn:h,isDataLoading:g,isDataSetAttachments:p,locale:x,dimensions:w,filters:b,selectDataset:y,onAdvancedViewOpen:C,limitMessages:v,attachmentsConfig:M,isTableSettingsOpen:T,onTableSettingsOpen:j,onTableSettingsClose:N,onGridApiReady:O})=>{const[k,E]=d.useState(0),[A,I]=d.useState(null),{isOpenedAdvancedView:R,setIsOpenedAdvancedView:L}=Ee(),[P,U]=d.useState(S.PopUpState.Closed),[G,J]=d.useState(!1),[te,q]=d.useState(),[W,ie]=d.useState(),[fe,H]=d.useState(!1),Z={downloadDataSet:t.downloadDataSet,getConstraints:t.getConstraints},Q=D.DownloadType.DATA_IN_TABLE,re=Te=>{E(Te)},ce=d.useCallback(()=>{C?.(),L(!0),t.updateCurrentDataQuery(o||u?.[0]),t.updateDataQueries(u),t.updateDatasets(m)},[t,o,u,m,L,C]);d.useEffect(()=>{I(e[k]||null)},[e,k]),d.useEffect(()=>{J(p&&(m==null||m?.length==0))},[m,p]),d.useEffect(()=>{T&&A&&!Ke(A)&&!Gt(A)&&N?.()},[T,A,N]);const ve=d.useCallback(()=>{U(S.PopUpState.Closed)},[U]),De=M?.isExternaLinkIncludeFilters,pe=pr(De,b,o||u?.[0],w);return!e||e.length===0?null:r.jsx(r.Fragment,{children:R&&!l?r.jsx(el,{icon:s?.advanceViewIcon,title:s?.openAdvanceViewTitle??"Opened in Advanced view"}):r.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!R&&!i?"pt-5":"pt-0"),children:[!R&&G?r.jsx(S.Loader,{}):r.jsxs(r.Fragment,{children:[i&&!R&&r.jsx(Qo,{titles:{queryUpdatedManuallyTitle:n?.queryUpdatedManually,setToTitle:n?.setTo},datasetIcon:a?.datasetIcon,attachmentInfoList:c}),!R&&m?.length!=null&&m?.length>0&&r.jsx(gr,{datasets:m,initialSelectedDatasetUrn:h,locale:x,titles:n,isHideAdvancedViewButton:!f,openAdvancedViewIcon:a?.openAdvancedViewIcon,selectDataset:y,onOpenAdvancedView:ce}),fe&&r.jsx(S.RequestLimitMessage,{limitMessages:v,showAdvancedViewButton:!!A&&wn(A)&&f,onAdvancedViewClick:ce,query:pe}),r.jsx("div",{className:V(!R&&m?.length&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:r.jsxs("div",{className:"flex h-full max-w-full flex-col items-center gap-4",children:[r.jsx(wl,{attachments:e,selectedAttachmentIndex:k,selectedAttachment:A,attachmentsStyles:a,titles:n,externalLink:pe,isExternaLinkIncludeFilters:De,limitMessages:v,onSelectedAttachmentChange:re,onDownloadClick:()=>U(S.PopUpState.Opened),showAdvancedView:f,isTableSettingsOpen:T,onTableSettingsOpen:j}),A!=null&&r.jsx(kd,{selectedAttachment:A,actions:t,attachmentsStyles:a,isDataLoading:g,isOpenedAdvancedView:R,onOpenAdvancedView:ce,showLimitMessage:H,onGridApiReady:O,externalLink:pe})]})})]}),r.jsxs(r.Fragment,{children:[P===S.PopUpState.Opened&&r.jsx(rl,{actions:Z,onCloseModal:ve,dataQuery:o,datasetName:A?.title||"",locale:x,type:Q,dimensions:w,filters:b,urn:o?.urn,datasetIcon:a?.datasetIcon,isDisplayDatasetIcon:a?.isDisplayDatasetIcon,titles:a?.downloadTitles,setIsShowDownloadAlert:q,setDownloadAlertDetails:ie,limitMessages:v,showLimitMessage:fe,externalLink:pe}),te&&r.jsx(S.Alert,{alertDetails:W,successIcon:a?.successDownloadIcon,errorIcon:a?.errorDownloadIcon,onClose:()=>q(!1),closeButtonTitle:a?.closeTitle||"Close"})]})]})})},Td=({label:e,colDef:t})=>!!e.trim()&&!t.suppressColumnsToolPanel;function Ed(e){return e.colId??e.field??null}function Nd(e){return String(e.headerName??e.field??e.colId??"").trim()}function Ad(e){return new Map(e.getColumnState().map(t=>[t.colId,t]))}function jd(e,t){const n=e.getColumnDefs()??[],s=Ad(e),a=[];for(const f of n){const o=Ed(f);if(!o)continue;const u=Nd(f);if(!t({colId:o,label:u,colDef:f}))continue;const c=s.get(o);a.push({id:o,type:"item",label:u,isChecked:!(c?.hide??!1),draggable:!0,checkable:!0})}const i=e.getColumnState().map(f=>f.colId),l=new Map(i.map((f,o)=>[f,o]));return a.sort((f,o)=>{const u=l.get(f.id)??Number.MAX_SAFE_INTEGER,c=l.get(o.id)??Number.MAX_SAFE_INTEGER;return u-c})}function Id(e,t,n){const s=[...t];return e.map(a=>n.has(a)?s.shift()??a:a)}function en(e,t){let n=e,s;for(const a of t){if(s=n.find(i=>i.id===a),!s)return;n=s.type==="group"?s.items:s.items??[]}return s?.type==="item"?s:void 0}function on(e,t){const n=[];for(const s of e){if(s.type==="group"){n.push(...on(s.items,t));continue}if(t?.(s)){n.push(s.id);continue}if(s.items?.length){n.push(...on(s.items,t));continue}n.push(s.id)}return n}function Ld({api:e,searchQuery:t,includeColumn:n=Td,enrichItem:s,onSubItemOrderChange:a,onSubItemVisibilityChange:i}){const[l,f]=d.useState(0),[o,u]=d.useState(new Set),c=d.useCallback(()=>{f(C=>C+1)},[]);Br(e,c);const m=d.useMemo(()=>!e||!e.getColumnState()?[]:jd(e,n),[e,n,l]),h=d.useMemo(()=>(s?m.map(v=>v.type==="item"?s(v):v):m).map(v=>v.type==="item"&&v.items?.length?{...v,isExpanded:!o.has(v.id)}:v),[m,s,o]),g=d.useMemo(()=>new Set(m.map(C=>C.id)),[m]),p=d.useMemo(()=>S.filterDraggableListNodes(h,t),[h,t]),x=d.useCallback(C=>{if(!e)return;if(aa(C.itemId)&&i){const{urn:M,dimensionKey:T}=Qt(C.itemId),j=C.path[0];i(M,j,T,!C.nextChecked);return}const v=en(h,C.path);!v||!g.has(v.id)||(e.applyColumnState({state:[{colId:v.id,hide:!C.nextChecked}]}),c())},[e,h,g,c,i]),w=d.useCallback(C=>{if(!e)return;if(aa(C.itemId)&&i){const{urn:j,dimensionKey:N}=Qt(C.itemId),O=C.path[0],k=en(h,C.path);k?.type==="item"&&i(j,O,N,k.isChecked??!0);return}const v=en(h,C.path);if(!v||!g.has(v.id))return;const T=!(e.getColumnState().find(j=>j.colId===v.id)?.hide??!1);e.applyColumnState({state:[{colId:v.id,hide:T}]}),c()},[e,h,g,c,i]),b=d.useCallback(C=>{const v=C.path[C.path.length-1];u(M=>{const T=new Set(M);return C.nextExpanded?T.delete(v):T.add(v),T})},[]),y=d.useCallback(C=>{if(!e)return;const v=e.getColumnState().map(N=>N.colId),M=new Set(m.map(N=>N.id)),T=on(C,N=>g.has(N.id)),j=Id(v,T,M);if(e.applyColumnState({state:j.map(N=>({colId:N})),applyOrder:!0}),c(),a){for(const N of C)if(!(N.type!=="item"||!g.has(N.id)||!N.items))for(const O of N.items){if(O.type!=="group")continue;const k=O.items.filter(I=>I.type==="item");if(k.length<=1)continue;const E=O.id,A=k.map(I=>Qt(I.id).dimensionKey);a(E,N.id,A)}}},[e,m,g,c,a]);return{items:h,visibleItems:p,handleToggleChecked:x,handleToggleExpanded:b,handleItemClick:w,handleItemsChange:y}}function Pd({api:e,includeColumn:t,enrichItem:n,onSubItemOrderChange:s,onSubItemVisibilityChange:a}){const[i,l]=d.useState(""),f=d.useCallback(x=>{l(x)},[l]),o=d.useCallback(()=>l(""),[l]),u=d.useMemo(()=>r.jsx("button",{type:"button",onClick:o,children:r.jsx(Me.IconX,{className:"size-4 text-neutrals-1000"})}),[o]),{visibleItems:c,handleItemsChange:m,handleToggleChecked:h,handleToggleExpanded:g,handleItemClick:p}=Ld({api:e,includeColumn:t,searchQuery:i,enrichItem:n,onSubItemOrderChange:s,onSubItemVisibilityChange:a});return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-5 py-7",children:[r.jsx(S.InputWithIcon,{inputId:"columns-search-input",containerClasses:"items-center filters-search-input gap-1 !p-2",cssClass:"filters-search-input-text",placeholder:"Search",iconBeforeInput:r.jsx(Me.IconSearch,{className:"size-4 text-neutrals-1000"}),iconAfterInput:i?u:void 0,value:i,onChange:f}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(S.DraggableList,{items:c,onItemsChange:m,onToggleChecked:h,onToggleExpanded:g,onItemClick:p})})]})}const Rd={},Od={map:Rd,getDimensionsMetadata:()=>{},getDimensionMetadata:()=>{},getRegionDimension:()=>{},getFrequencyDimension:()=>{},getIndicatorDimensions:()=>[],getDimensionsScheme:()=>{}},jn=d.createContext(Od);function _d({map:e,children:t}){const n=d.useMemo(()=>{const s={},a={},i={},l=Object.keys(e);for(const f of l){s[f]={},a[f]={};const o=Object.keys(e[f]);for(const u of o){const c=e[f][u];c.subtype&&(s[f][c.subtype]=u),a[f][c.dimensionType]||(a[f][c.dimensionType]=[]),a[f][c.dimensionType].push(u)}i[f]={timePeriod:a[f]?.TIME_PERIOD?.[0]??void 0,frequency:s[f]?.FREQUENCY??void 0,region:s[f]?.REGION??void 0,indicators:a[f]?.INDICATOR??[],other:(a[f]?.NON_INDICATOR??[]).filter(u=>{const c=e[f][u];return c.subtype!=="FREQUENCY"&&c.subtype!=="REGION"})}}return{map:e,getDimensionsMetadata:f=>e[f],getDimensionMetadata:(f,o)=>e[f]?.[o],getRegionDimension:f=>s[f]?.REGION,getFrequencyDimension:f=>s[f]?.FREQUENCY,getIndicatorDimensions:f=>a[f]?.INDICATOR??[],getDimensionsScheme:f=>i[f]}},[e]);return r.jsx(jn.Provider,{value:n,children:t})}function $r(){return d.useContext(jn)}function Jr(){return d.useContext(jn)}const ia="table-settings-side-panel",Fd=({resetTitle:e})=>{const{gridApi:t,initialColumnsState:n,resetDimensionCustomization:s}=Tn(),a=d.useCallback(()=>{t&&(od(t,n),s())},[t,n,s]);return r.jsxs("button",{type:"button",className:"flex items-center gap-1 text-neutrals-800",onClick:a,children:[r.jsx(Me.IconRotate,{className:"size-4 rotate-180"}),r.jsx("span",{className:"h4",children:e||"Reset"})]})},Vd=()=>{const{gridApi:e,structuresMap:t,locale:n,dataQueries:s,dimensionCustomization:a,setDimensionKeyOrder:i,setDimensionKeyHidden:l}=Tn(),f=Jr(),o=d.useMemo(()=>{if(!(!f||!t||!n||!s?.length))return vd({dataQueries:s,structuresMap:t,getDimensionsScheme:f.getDimensionsScheme,getDimensionConfig:(u,c)=>f.map[u]?.[c],locale:n,dimensionCustomization:a})},[f,t,n,s,a]);return e?r.jsx(Pd,{api:e,enrichItem:o,onSubItemOrderChange:i,onSubItemVisibilityChange:l}):null},Ud=({attachmentsStyles:e,...t})=>{const{onGridApiReady:n}=Tn(),s=Je(),a=d.useCallback(()=>{s&&s.openPanel({id:ia,scope:"advanced",title:e?.columnsTitle||"Columns",headerClassName:"border-b border-neutrals-500",headerExtension:r.jsx(Fd,{resetTitle:e?.columnsResetTitle}),content:r.jsx(Vd,{})})},[e?.columnsResetTitle,e?.columnsTitle,s]);return r.jsx(Wr,{...t,attachmentsStyles:e,isTableSettingsOpen:s?.isPanelOpen(ia)??!1,onTableSettingsOpen:s?a:void 0,onTableSettingsClose:s?.closePanel,onGridApiReady:n})},Gd=({actions:e,structureDataMaps:t,buttonProps:n,modalProps:s,dataQueries:a,onMultipleDataFiltersChange:i,locale:l,timeRangeOptions:f,titles:o,datasetIcon:u,conversationKey:c,conversation:m,setConversation:h,updateConversation:g,updateDataQueries:p,limitMessages:x,filterIconClassName:w})=>{const[b,y]=d.useState(S.PopUpState.Closed),[C,v]=d.useState([]),[M,T]=d.useState([]),[j,N]=d.useState(),[O,k]=d.useState([]),[E,A]=d.useState(void 0),I=d.useRef(t?.constraintsMap),[R,L]=d.useState(),[P,U]=d.useState(),[G,J]=d.useState(),[te,q]=d.useState(!1),W=d.useMemo(()=>Io(a,t),[a,t]),ie=Y=>{const X=Y?C.map(K=>Ie(K,Y)?Y:K):C;J(!0),v(_t(X)),U?.(!0),fe(Y?.isTimeDimension?Ot(X,Y):X,v,U)};d.useEffect(()=>{b===S.PopUpState.Closed&&L(I.current)},[b]);const fe=d.useCallback((Y,X,K)=>{const we=qt(Y);Promise.all(Gs(a,we,e)).then(B=>{const de=Bs(B);I.current=de,K?.(!1),X(Mt(we,{...t,constraintsMap:de},l))}).catch(()=>{const B=new Map;I.current=B,K?.(!1),X(Mt(we,{...t,constraintsMap:B},l))}).finally(()=>{J(!1)})},[e,a,l,t]);d.useEffect(()=>{if(!W){U(!0);return}const Y=Ao(t,l),X=jo(Y,a,t?.constraintsMap);U?.(!0),fe(X,T,U)},[a,fe,W,l,t]),d.useEffect(()=>{M?.length&&k(Ut(M))},[M]),d.useEffect(()=>{v(Y=>Ot(Y,j))},[j]),d.useEffect(()=>{b===S.PopUpState.Opened&&(A(void 0),N({...M?.[0],isSelectedFilter:!0}),v(M)),b===S.PopUpState.Closed&&N(void 0)},[M,b]);const H=d.useCallback(async Y=>{const X=Po(a,Y),K=m?{...m,messages:mr(m?.messages,a,X)}:null;h?.(K),p?.(hr(a,X)),await g(decodeURI(c),{name:K?.name,messages:K?.messages||[]})},[m,c,a,h,g,p]),Z=d.useCallback((Y,X)=>{v(K=>Ba(K,Y,X)),Ie(j,Y)&&N(K=>K&&{...K,displayMode:X})},[j]),Q=d.useCallback(Y=>Lo(Y,a,t?.dimensionsMap),[a,t?.dimensionsMap]),re=d.useCallback((Y,X)=>{const K=Mt(Y,X,l);I.current=X?.constraintsMap,N(we=>K?.find(B=>Ie(B,we))||we),v(K),J(!1)},[l]),ce=d.useCallback((Y,X)=>{J(!0),v(_t(Y));const K=qt(Y);Promise.all(Gs(X,K,e)).then(we=>{re(K,{...t,constraintsMap:Bs(we)})}).catch(()=>{re(K,{...t,constraintsMap:new Map})})},[e,t,re]),ve=d.useCallback(Y=>{const X=a?.find(we=>we?.urn===Y?.datasetUrn),K=Wa(C,Y);ce(K,X?[X]:[])},[ce,C,a]),De=d.useCallback(()=>{I.current=R,y(S.PopUpState.Closed),q(!0)},[R]),pe=d.useCallback(()=>{const Y=$a(C);ce(Y,a)},[ce,C,a]),Te=d.useCallback(()=>{const Y=qt(C,I.current),X=Mt(Y,{...t,constraintsMap:I.current},l),K=Q(Y);i?.(K,I.current,a),T(X),y(S.PopUpState.Closed),q(!0),d.startTransition(()=>{H(Y)})},[Q,C,t,l,i,a,H]),Pe=Y=>{A(Y)};return r.jsxs("div",{className:"filters-container",children:[r.jsx(dr,{buttonProps:n,selectedFiltersCount:fn(O),isLoading:P,setModalState:y,titles:o,isModalClosed:te,warningIcon:x?.warningIcon,filterIconClassName:w}),r.jsx(r.Fragment,{children:b===S.PopUpState.Opened&&r.jsxs(S.Popup,{heading:o?.settings||"Settings",portalId:"filters",size:S.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:s?.isShowDividers,onClose:De,closeButtonTitle:o?.close||"Close",children:[r.jsx(rr,{locale:l,titles:o,timeRangeOptions:f,filtersList:C,selectedFilter:j,isDisableValues:G,modalProps:s,initialConstraintsMap:t?.constraintsMap,datasetIcon:u,structuresMap:t?.structuresMap,setSelectedFilter:N,onSelectDisplayMode:Z,onDeleteFilter:ve,onClearAllFilters:pe,updateSelectedFilterValues:ie,onTimePeriodChange:Pe,selectedTimeOption:E}),r.jsx(ir,{titles:o,onApply:Te,onClose:De,onClearAllFilters:pe,modalProps:s,applyDisabled:P||G,limitMessages:x})]})})]})},Bd=({filtersProps:e,actions:t,attachments:n,attachmentsDataQuery:s,dataQueries:a,dimensions:i,locale:l,attachmentsStyles:f,isDataLoading:o,setIsFiltering:u,titles:c,limitMessages:m,attachmentsConfig:h,filters:g,onFiltersChange:p})=>{const x={getConstraints:t.getConstraints},{isCrossDatasetModeOn:w}=ke();return d.useEffect(()=>{o||u?.(!1)},[o,u]),r.jsx("div",{className:"h-full min-h-0 rounded bg-white",children:r.jsxs("div",{className:"flex h-full flex-col gap-4 overflow-x-hidden",children:[r.jsxs("div",{className:"data-details-header flex items-center justify-between",children:[r.jsx("h2",{children:c?.content??"Content"}),w?r.jsx(Gd,{attachmentsDataQuery:s,dataQueries:a,updateDataQueries:t?.updateDataQueries,locale:l,actions:x,dimensions:i,titles:c,...e,onFiltersChange:p,limitMessages:m}):r.jsx(Zo,{attachmentsDataQuery:s,dataQueries:a,updateDataQueries:t?.updateDataQueries,locale:l,actions:x,dimensions:i,titles:c,...e,onFiltersChange:p,limitMessages:m})]}),r.jsx("div",{className:"advanced-view-attachments-container min-h-0 flex-1",children:r.jsx(Ud,{titles:c,attachments:n,attachmentsStyles:f,currentDataQuery:s,dimensions:i,actions:t,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:o,locale:l,filters:g,limitMessages:m,attachmentsConfig:h})})]})})},zd=({isShowAgency:e,isShowDatasetBadge:t,dataset:n,data:s,structures:a,metadataSettings:i,locale:l,titles:f,getDatasetUpdatedTime:o,externalLink:u,datasetIcon:c,externalLinkIcon:m,metadataButtonClassName:h,metadataIconClassName:g,infoSegmentContainerClassName:p,infoSegmentHeaderClassName:x,nameAndMetadataContainerClassName:w})=>{const b="dataset-metadata-side-panel",[y,C]=d.useState(""),[v,M]=d.useState(!1),T=d.useRef(null),[j,N]=d.useState(""),[O,k]=d.useState(""),[E,A]=d.useState(!1),{onboardingFileSchema:I,isShowOnboarding:R}=Ae(),{isOpenedAdvancedView:L}=Ee(),P=Je(),{isMetadataInSidePanel:U}=ke(),[G,J]=d.useState(!1),te=d.useMemo(()=>i?.isMetadataDescription?Wl(n,y,l,f):[],[n,y,l,i?.isMetadataDescription,f]),q=d.useMemo(()=>[...i?.isMetadataDescription?[]:[ht(n,l,f)],...Jl($l(s),D.getStructureComponentsMap(a),l)],[s,n,l,i?.isMetadataDescription,a,f]),W=d.useMemo(()=>gt(n,y,l,f),[n,y,l,f]),ie=d.useCallback(()=>{if(U&&P){P.openPanel({id:b,scope:L?"advanced":"conversation",title:"Dataset Metadata",bodyClassName:"overflow-hidden",content:r.jsx(mt,{titles:f,locale:l,metadata:q,metadataDescription:te,datasetInfo:W,externalLink:u})}),J(!0);return}M(!0)},[te,q,W,u,U,L,l,P,f]),fe=d.useCallback(()=>{M(!1),J(!0)},[]);d.useEffect(()=>{const Q=o&&o(q)||pt(D.getLastUpdatedTime(n),l);C(Q)},[n,l,q,o]),d.useEffect(()=>{if(R){const{title:Z,description:Q}=Ge(Ce.METADATA_PER_DATASET,f);N(Z),k(Q)}},[f,R]),d.useEffect(()=>{R&&A(I?.lastDisplayedElement===Ce.METADATA_PER_DATASET)},[I?.lastDisplayedElement,R]);const H=(Z,Q)=>r.jsxs("div",{className:We("flex gap-1 text-neutrals-1000",p),children:[r.jsxs("span",{className:We("text-neutral-800",x),children:[Z,":"]}),r.jsx("span",{children:Q})]});return r.jsxs("div",{className:"dataset-info flex flex-col gap-3 bg-white",children:[t&&r.jsxs("div",{className:"bg-accent-500 body-2 flex w-fit items-center gap-1 rounded-[20px] px-2 py-1",children:[c,f?.dataset??"Dataset"]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("div",{role:"heading","aria-level":4,className:We("flex gap-1 items-center h4",w),children:[r.jsx("div",{ref:T,children:r.jsx(S.IconButton,{title:f?.metadata??"View details",buttonClassName:We("!text-neutrals-1000 !border-none !w-4 !h-4 !p-0 shrink-0",h),icon:r.jsx(Mr,{className:We("size-4",g)}),onClick:ie})}),r.jsx("span",{children:D.getLocalizedName(n,l)})]}),u&&r.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:m||r.jsx(Me.IconExternalLink,{className:"size-4 shrink-0 cursor-pointer text-primary"})})]}),r.jsxs("div",{className:"body-3 flex items-center gap-2",children:[e&&r.jsxs(r.Fragment,{children:[H(f?.agency??"Agency",n?.agencyID??""),r.jsx("div",{"aria-hidden":"true",className:"h-[14px] border-l border-l-neutral-500"})]}),H(f?.lastUpdated??"Last updated",y)]})]}),E&&r.jsx(Be,{reference:T,title:j,description:O,onReferenceClick:ie,shouldCloseTooltip:G}),v&&r.jsx(bn,{titles:f,locale:l,metadata:q,metadataDescription:te,isOpenMetadata:v,onCloseMetadata:fe})]})},Hd=({titles:e,locale:t,isShowShare:n,shareConversationProps:s})=>{const{setIsOpenedAdvancedView:a}=Ee(),i=d.useRef(null),[l,f]=d.useState(""),[o,u]=d.useState(""),[c,m]=d.useState(!1),{onboardingFileSchema:h,isShowOnboarding:g}=Ae();return d.useEffect(()=>{if(g){const{title:p,description:x}=Ge(Ce.EXIT_ADVANCED_VIEW,e);f(p),u(x)}},[e,g]),d.useEffect(()=>{g&&m(h?.lastDisplayedElement===Ce.EXIT_ADVANCED_VIEW)},[h?.lastDisplayedElement,g]),r.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[r.jsxs("div",{className:V("flex gap-3 items-center",!n&&"justify-between w-full","advanced-view-header-title"),children:[r.jsx("div",{ref:i,className:V(!n&&"order-2","flex"),children:r.jsx(S.CloseButton,{btnClassNames:"button-close",onClick:()=>a(!1),title:e?.close||"Close"})}),c&&r.jsx(Be,{reference:i,title:l,description:o,onReferenceClick:()=>a(!1),shouldMoveToNextStep:!0}),r.jsx("h2",{children:e?.advanceViewTitle??"Advanced view"})]}),n&&r.jsx(La,{locale:t,...s})]})};function Wd(e,t,n,s,a,i,l,f,o){const u=$d(e,n),c=o?.startPeriod&&o.endPeriod?D.getAdditionalColumns(f,o):[],m=Jd(e,t,n,s,a,i,c);return[Al(e,t?.data,n,a,i,l),...u,...m,Dr(e,t?.data,n,void 0,i,l)]}function $d(e,t){const n=e.conceptSchemes||[],s=e.codelists||[],a=D.getDimensions(e)?.dimensions||[];return a.map(i=>{const{codeList:l,concept:f}=$t(i,n,s),o=u=>{const{data:c,colDef:m}=u,h=m.field;return En(a,h,l,c,t)};return{headerName:D.getLocalizedName(f,t),field:i.id,colId:i.id,valueGetter:o,...tt,tooltipValueGetter:u=>u.value}})}function Jd(e,t,n,s,a,i,l){const f=qd(l,D.getTimePeriods(t));return Kd(f,(u,c)=>Yd(u,c||u,s,i),e,n,a,i)}const Yd=(e,t,n=$.defaultFormatNumbers,s)=>({headerName:Ua(t,s),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:nt,cellClass:["justify-end","cell-with-meta"],valueFormatter:a=>$.formatNumberBySign(a.value,n)}),Kd=(e,t,n,s,a,i)=>{const l=[];return e.sort((o,u)=>D.sortPeriods(o,u)).forEach(o=>{l.push({headerName:o.toString(),field:o.toString(),...t(o.toString()),valueGetter:u=>u.data[u.column.getColId()]?.value?.[0]?.value||null,cellClass:Ze,cellRenderer:zt,width:nt,cellRendererParams:{dataSetData:n,locale:s,metadataSettings:a,titles:i}})}),l},qd=(e=[],t=[])=>{if(!e.length)return t;if(!t.length)return e;const n=t.some(u=>D.isYearly(u)),s=t.some(u=>D.isSemiAnnually(u)),a=t.some(u=>D.isQuarterly(u)),i=t.some(u=>D.isMonthly(u)),l=t.some(u=>D.isWeekly(u)),f=t.some(u=>D.isDaily(u)),o=e.filter(u=>D.isYearly(u)?n:D.isSemiAnnually(u)?s:D.isQuarterly(u)?a:D.isMonthly(u)?i:D.isWeekly(u)?l:D.isDaily(u)?f:!0);return Array.from(new Set([...o,...t]))};function Zd(e,t,n){const s=t.map(i=>i.id).filter(i=>i!=null),a=n.map(i=>i.id).filter(i=>i!=null);return Xd(e,s,a,s)}const Xd=(e,t,n,s)=>{const a=eu(e,t),i={};for(const l of a){const f=l.rowTime,o=Yr(f,s);if(i[o]==null){i[o]={};for(const u of s)i[o][u]=f[u]}i[o]={attributes:l.attributes.filter(({value:u})=>u),...i[o],id:o,originalData:l.originalData,...Qd(f,n)}}return Object.values(i)},Yr=(e,t)=>t.map(n=>e[n]).join("_"),Qd=(e,t)=>{const n=Yr(e,t),{OBS_VALUE:s,obsAttributes:a}=e,i={};return i[n]={value:s,obsAttributes:a},i},eu=(e,t)=>{const n=[];for(const s of e){const a={},i=s.name.split(".");for(let l=0;l<t.length;l+=1)a[t[l]]=i[l];if(!s.values.length){const l={...a};l.TIME_PERIOD=void 0,l.OBS_VALUE=void 0,n.push({rowTime:l,attributes:s.attributes,id:s.name,originalData:s})}s.values.forEach(l=>{const f={...a};f.TIME_PERIOD=l.dimensionAtObservation;const o=tu(s,l);f.OBS_VALUE=o,f.obsAttributes=l?.obsAttributes?.filter(({value:u})=>u)||[],n.push({rowTime:f,attributes:s.attributes,id:s.name,originalData:s})})}return n},tu=(e,t)=>{const s=[...e.attributes,...t.obsAttributes].find(({name:a})=>a==="OBS_VALUE");return s?[s]:t.values},nu="#EEEEEE",su="#777777";function au(e,t,n){const s={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:a=>{let i=a[0].axisValueLabel+"<br/>";return a.forEach(l=>{l.value!==null&&l.value!==void 0&&(i+=l.marker+" "+l.seriesName+": "+l.value+"<br/>")}),i}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...oa(n?.ticksColor,n?.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...oa(n?.ticksColor,n?.labelsColor),type:"value"},series:t};return n?.colors!=null&&(s.color=n.colors),s}function oa(e=nu,t=su){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:t},axisLine:{lineStyle:{color:e}}}}function Kr(e,t,n,s){return t.map(i=>{const l=D.getDimensions(n)?.dimensions||[],f=l?.find(u=>u.id===i);if(f==null)return e[i]||"";const{codeList:o}=$t(f,n.conceptSchemes||[],n.codelists||[]);return En(l,i,o,e,s)}).join(" - ")}function ru(e,t){const n=[...t?.metadata?.indicatorDimensions||[]].filter(i=>i!=null),a=D.getDimensions(e)?.dimensions?.filter(i=>i.id!=null&&!n.includes(i.id)&&t?.metadata?.countryDimension!==i.id).map(i=>i.id).filter(i=>i!=null)||[];return[...n,...a]}function iu(e,t,n){const s={};return e.forEach(a=>{const i=ou(a,t,n);s[i]||(s[i]={rows:[]}),s[i].rows.push(a)}),Object.keys(s).map(a=>s[a])}function ou(e,t,n){const s=n.dataStructures?.[0]?.dataStructureComponents?.dimensionList?.dimensions||[];return t.map(i=>s?.find(f=>f.id===i)==null?e[i]||"":zr(s,i,e)).join(" - ")}function lu(e,t){const n={};return e.forEach(s=>n[s]=cu(s,t)),{nonUniqDimensions:e.filter(s=>!n[s])}}function cu(e,t){const n=t.map(a=>du(e,a));return new Set(n).size===1}function du(e,t){return t[e]}const uu="line",kt=10;function qr(e,t,n,s,a){const i=In(t,e,n,s,a),f=D.getTimePeriods(t).sort((m,h)=>D.sortPeriods(m,h)),o=ru(e,n),{nonUniqDimensions:u}=lu(o,i);return{units:iu(i,u,e).map(m=>Zr(m,e,n,f,s,a))}}function fu(e,t,n,s,a,i){return Zr({rows:[e]},n,s,t,a,i)}function Zr(e,t,n,s,a,i){const l=gu(e.rows,t,a),f=l?.find(u=>D.FREQUENCY_DIMENSION_ID.includes(u?.id))?.id,o=mu(e.rows.length>kt?e.rows.slice(0,kt):e.rows,t,n,a,la(s,e?.rows?.[0],f));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>kt?kt:void 0,dimensions:l,config:au(la(s,e?.rows?.[0],f),o,i)}}function la(e,t,n){if(n){const s=t?.[n];if(s===D.Periods.MONTHLY)return e?.filter(a=>D.isMonthly(a));if(s===D.Periods.QUARTERLY)return e?.filter(a=>D.isQuarterly(a));if(s===D.Periods.ANNUAL)return e?.filter(a=>D.isYearly(a))}return e}function mu(e,t,n,s,a){return e.map(i=>({name:n?.metadata?.countryDimension==null?"":Kr(i,[n?.metadata?.countryDimension],t,s),type:uu,data:a.map(l=>hu(l,i))}))}function hu(e,t){return t[e]?.value?.[0]?.value||null}function gu(e,t,n){return(D.getDimensions(t)?.dimensions||[]).map(s=>{if(s.id!=null)return{id:s.id,title:pu(s,t,n),value:Kr(e[0],[s.id],t,n)}}).filter(s=>s!=null)}function pu(e,t,n){const s=t.conceptSchemes||[],a=t.codelists||[],{concept:i}=$t(e,s,a);return D.getLocalizedName(i,n)||e.id}function In(e,t,n,s,a){const i=e==null?[]:D.getParsedResponse(e),l=D.getDimensions(t)?.dimensions||[],f=D.getDimensions(t)?.timeDimensions||[],o=Zd(i,l,f);return wu(o,e,t,n,s,a)}function wu(e,t,n,s,a,i){const f=D.getTimePeriods(t).sort((o,u)=>D.sortPeriods(o,u));return e.map(o=>({...o,[dt]:fu(o,f,n,s,a,i)}))}function Cu(e,t,n,s,a,i,l,f,o,u,c){return{columns:Wd(e,t,s,a,i,f,o,u,c),data:In(t,e,n,s,l)}}function vu(e,t,n,s,a,i,l,f,o,u,c){const m=e.dataflows?.[0]?.names?.[s],h=Cu(e,t,n,s,a,i,l,f,o,u,c);return{title:m||f?.dataGrid||"Data Grid",grid_data:h}}function xu(e){const t=e.replace(/\r\n/g,`
8
8
  `);if(!t.startsWith("```"))return{code:e};const n=t.split(`
9
9
  `),a=n[0].slice(3).trim()||void 0;let i=-1;for(let l=n.length-1;l>0;l--)if(n[l].trim()==="```"){i=l;break}return i===-1?{code:n.slice(1).join(`
10
10
  `),language:a}:{code:n.slice(1,i).join(`
package/index.mjs CHANGED
@@ -20,7 +20,7 @@ import xs from "echarts-for-react";
20
20
  import { AgGridReact as ir } from "ag-grid-react";
21
21
  import { extendTailwindMerge as Rl } from "tailwind-merge";
22
22
  import { isValid as Pl, format as Fl } from "date-fns";
23
- import Vl from "@monaco-editor/react";
23
+ import { Editor as Vl } from "@monaco-editor/react";
24
24
  const Is = nt(
25
25
  void 0
26
26
  ), ig = ({
@@ -10460,7 +10460,10 @@ const Ch = ({ option: e, style: t }) => {
10460
10460
  attachment: e,
10461
10461
  className: t
10462
10462
  }) => {
10463
- const { data: n, language: r } = e;
10463
+ const { data: n, language: r } = e, i = (s, o) => {
10464
+ s.addCommand(o.KeyCode.F1, () => {
10465
+ });
10466
+ };
10464
10467
  return /* @__PURE__ */ c(
10465
10468
  "div",
10466
10469
  {
@@ -10474,8 +10477,10 @@ const Ch = ({ option: e, style: t }) => {
10474
10477
  value: n,
10475
10478
  language: r,
10476
10479
  theme: "vs-light",
10480
+ onMount: i,
10477
10481
  options: {
10478
10482
  readOnly: !0,
10483
+ contextmenu: !1,
10479
10484
  scrollBeyondLastLine: !1,
10480
10485
  minimap: { enabled: !1 },
10481
10486
  wordWrap: "on",
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@epam/statgpt-conversation-view",
3
- "version": "0.4.0-rc.17",
3
+ "version": "0.4.0-rc.18",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "classnames": "^2.5.1",
7
7
  "@epam/ai-dial-shared": "^0.43.3",
8
8
  "@tabler/icons-react": "^3.34.1",
9
- "@epam/statgpt-shared-toolkit": "0.4.0-rc.17",
10
- "@epam/statgpt-ui-components": "0.4.0-rc.17",
11
- "@epam/statgpt-sdmx-toolkit": "0.4.0-rc.17",
9
+ "@epam/statgpt-shared-toolkit": "0.4.0-rc.18",
10
+ "@epam/statgpt-ui-components": "0.4.0-rc.18",
11
+ "@epam/statgpt-sdmx-toolkit": "0.4.0-rc.18",
12
12
  "react-window": "^1.8.11",
13
13
  "react-virtualized-auto-sizer": "^1.0.26",
14
14
  "ag-grid-community": "33.3.2",
@@ -16,10 +16,10 @@
16
16
  "@floating-ui/react": "^0.27.14",
17
17
  "echarts": "^5.6.0",
18
18
  "echarts-for-react": "^3.0.2",
19
- "@epam/statgpt-dial-toolkit": "0.4.0-rc.17",
19
+ "@epam/statgpt-dial-toolkit": "0.4.0-rc.18",
20
20
  "react-markdown": "^10.1.0",
21
21
  "remark-gfm": "^4.0.1",
22
- "@epam/statgpt-conversation-list": "0.4.0-rc.17",
22
+ "@epam/statgpt-conversation-list": "0.4.0-rc.18",
23
23
  "flatpickr": "4.6.13",
24
24
  "react-flatpickr": "^4.0.11",
25
25
  "date-fns": "^4.1.0",