@epam/statgpt-conversation-view 0.2.0-rc.36 → 0.2.0-rc.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),re=require("@epam/ai-dial-shared"),j=require("@epam/statgpt-ui-components"),ye=require("@tabler/icons-react"),V=require("classnames"),se=require("@epam/statgpt-dial-toolkit"),X=require("@epam/statgpt-shared-toolkit"),Er=require("@epam/statgpt-conversation-list"),lo=require("react-markdown"),ao=require("remark-gfm"),A=require("@epam/statgpt-sdmx-toolkit"),Ar=require("react-window"),Dr=require("react-virtualized-auto-sizer"),Se=require("@floating-ui/react"),co=require("echarts-for-react"),uo=require("ag-grid-react"),Rt=require("ag-grid-community"),vn=require("lodash"),It=require("date-fns"),yr=require("tailwind-merge");function Mr(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const oe=Mr(h),ho=h.createContext(void 0),Tr=({children:e})=>{const[n,t]=h.useState(!1);return i.jsx(ho.Provider,{value:{isOpenedAdvancedView:n,setIsOpenedAdvancedView:t},children:e})},_e=()=>{const e=h.useContext(ho);if(e===void 0)throw new Error("useAdvancedView must be used within a AdvancedViewProvider");return e},fo=h.createContext(void 0),Or=({children:e})=>{const[n,t]=h.useState(!1);return i.jsx(fo.Provider,{value:{isStreaming:n,setIsStreaming:t},children:e})},go=()=>{const e=h.useContext(fo);if(e===void 0)throw new Error("useChatMessages must be used within a ChatMessagesProvider");return e},wo=h.createContext(null);function Lr({value:e,children:n}){const t=h.useMemo(()=>e,[e]);return i.jsx(wo.Provider,{value:t,children:n})}function bn(){const e=h.useContext(wo);if(!e)throw new Error("useConversationViewMessages must be used within ConversationViewMessagesProvider");return e}const mo=h.createContext(void 0),_r=({children:e})=>{const[n,t]=h.useState(""),[o,r]=h.useState(""),[s,u]=h.useState(),[f,l]=h.useState();return i.jsx(mo.Provider,{value:{onboardingFileName:n,onboardingFilePath:o,isShowOnboarding:s,onboardingFileSchema:f,setOnboardingFileName:t,setOnboardingFilePath:r,setIsShowOnboarding:u,setOnboardingFileSchema:l},children:e})},ve=()=>{const e=h.useContext(mo);if(e===void 0)throw new Error("useOnboarding must be used within a OnboardingProvider");return e};var Xe=(e=>(e.CHOICE="choice",e.COMPLETION="completion",e))(Xe||{}),rn=(e=>(e.COMPLETE="complete",e))(rn||{}),po=(e=>(e.COMPLETED="completed",e))(po||{}),Qe=(e=>(e.PREVIOUS="previous",e.NEXT="next",e))(Qe||{});const xo=({inProcess:e,containerClasses:n,inputClasses:t,placeholder:o,sendMessageIcon:r,onSendMessage:s,onStopStreaming:u})=>{const[f,l]=h.useState(""),c=h.useCallback(g=>{l(g)},[l]),a=g=>{e||(l(""),s(g))},d=g=>{g.key===j.KeyboardKey.Enter&&!g.shiftKey&&a(f.trim())};return i.jsx(j.InputWithIcon,{inputId:"ask-input",containerClasses:n,placeholder:o,onChange:c,onKeyDown:d,cssClass:V(t,"input-for-ask"),value:f,iconAfterInput:f?e?i.jsx(j.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>u==null?void 0:u(),icon:i.jsx(ye.IconPlayerStopFilled,{})}):i.jsx(j.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>a(f),icon:r}):null})},Pt=160,Rr=':;,=/{}%&\\"',Ir=new RegExp(`[${Rr}]|(\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),re=require("@epam/ai-dial-shared"),E=require("@epam/statgpt-ui-components"),ye=require("@tabler/icons-react"),V=require("classnames"),se=require("@epam/statgpt-dial-toolkit"),X=require("@epam/statgpt-shared-toolkit"),jr=require("@epam/statgpt-conversation-list"),lo=require("react-markdown"),ao=require("remark-gfm"),A=require("@epam/statgpt-sdmx-toolkit"),Ar=require("react-window"),Dr=require("react-virtualized-auto-sizer"),Ee=require("@floating-ui/react"),co=require("echarts-for-react"),uo=require("ag-grid-react"),Rt=require("ag-grid-community"),kn=require("lodash"),It=require("date-fns"),Mr=require("tailwind-merge");function yr(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const oe=yr(h),ho=h.createContext(void 0),Tr=({children:e})=>{const[n,t]=h.useState(!1);return i.jsx(ho.Provider,{value:{isOpenedAdvancedView:n,setIsOpenedAdvancedView:t},children:e})},Ie=()=>{const e=h.useContext(ho);if(e===void 0)throw new Error("useAdvancedView must be used within a AdvancedViewProvider");return e},fo=h.createContext(void 0),Lr=({children:e})=>{const[n,t]=h.useState(!1);return i.jsx(fo.Provider,{value:{isStreaming:n,setIsStreaming:t},children:e})},go=()=>{const e=h.useContext(fo);if(e===void 0)throw new Error("useChatMessages must be used within a ChatMessagesProvider");return e},wo=h.createContext(null);function Or({value:e,children:n}){const t=h.useMemo(()=>e,[e]);return i.jsx(wo.Provider,{value:t,children:n})}function Sn(){const e=h.useContext(wo);if(!e)throw new Error("useConversationViewMessages must be used within ConversationViewMessagesProvider");return e}const mo=h.createContext(void 0),_r=({children:e})=>{const[n,t]=h.useState(""),[o,r]=h.useState(""),[s,u]=h.useState(),[f,l]=h.useState();return i.jsx(mo.Provider,{value:{onboardingFileName:n,onboardingFilePath:o,isShowOnboarding:s,onboardingFileSchema:f,setOnboardingFileName:t,setOnboardingFilePath:r,setIsShowOnboarding:u,setOnboardingFileSchema:l},children:e})},ke=()=>{const e=h.useContext(mo);if(e===void 0)throw new Error("useOnboarding must be used within a OnboardingProvider");return e};var nn=(e=>(e.CHOICE="choice",e.COMPLETION="completion",e))(nn||{}),an=(e=>(e.COMPLETE="complete",e))(an||{}),po=(e=>(e.COMPLETED="completed",e))(po||{}),tn=(e=>(e.PREVIOUS="previous",e.NEXT="next",e))(tn||{});const xo=({inProcess:e,containerClasses:n,inputClasses:t,placeholder:o,sendMessageIcon:r,isLastFailed:s,retryIcon:u,onSendMessage:f,onStopStreaming:l,onRetryFailed:c})=>{const[a,d]=h.useState(""),g=h.useCallback(p=>{d(p)},[d]),w=p=>{e||(d(""),f(p))},m=p=>{p.key===E.KeyboardKey.Enter&&!p.shiftKey&&(s?c==null||c():w(a.trim()))},v=()=>s?i.jsx(E.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>c==null?void 0:c(),icon:u||i.jsx(ye.IconRefresh,{})}):a?e?i.jsx(E.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>l==null?void 0:l(),icon:i.jsx(ye.IconPlayerStopFilled,{})}):i.jsx(E.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>w(a),icon:r}):null;return i.jsx(E.InputWithIcon,{inputId:"ask-input",containerClasses:n,placeholder:o,onChange:g,onKeyDown:m,cssClass:V(t,"input-for-ask"),value:a,iconAfterInput:v()})},Pt=160,Rr=':;,=/{}%&\\"',Ir=new RegExp(`[${Rr}]|(\r
2
2
  |
3
3
  |\r| )|[\0-]`,"gm"),Pr=(e,n,t,o)=>({name:Vr(o||`${t} ${new Date().toLocaleDateString()}`),folderId:`${e}/${n}`,prompt:o}),Vr=e=>{const n=(e==null?void 0:e.replace(/\r\n|\r/gm,`
4
4
  `).split(`
5
- `).map(o=>o.replace(Ir," ").trim()).filter(Boolean)[0])??"";return(n.length>Pt?n.substring(0,Pt):n).trim()},Fr=(e,n,t,o,r,s)=>{const u=`${e}/${n}`;return{name:t,folderId:u,prompt:r,id:se.generateConversationId({folderId:u,name:t}),messages:[{role:re.Role.Assistant,content:o}],custom_fields:{configuration:{choice:s}}}};var Br=Object.defineProperty,en=Object.getOwnPropertySymbols,vo=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Vt=(e,n,t)=>n in e?Br(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,fn=(e,n)=>{for(var t in n||(n={}))vo.call(n,t)&&Vt(e,t,n[t]);if(en)for(var t of en(n))bo.call(n,t)&&Vt(e,t,n[t]);return e},gn=(e,n)=>{var t={};for(var o in e)vo.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&en)for(var o of en(e))n.indexOf(o)<0&&bo.call(e,o)&&(t[o]=e[o]);return t};/**
5
+ `).map(o=>o.replace(Ir," ").trim()).filter(Boolean)[0])??"";return(n.length>Pt?n.substring(0,Pt):n).trim()},Fr=(e,n,t,o,r,s)=>{const u=`${e}/${n}`;return{name:t,folderId:u,prompt:r,id:se.generateConversationId({folderId:u,name:t}),messages:[{role:re.Role.Assistant,content:o}],custom_fields:{configuration:{choice:s}}}};var Br=Object.defineProperty,on=Object.getOwnPropertySymbols,vo=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,Vt=(e,n,t)=>n in e?Br(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,mn=(e,n)=>{for(var t in n||(n={}))vo.call(n,t)&&Vt(e,t,n[t]);if(on)for(var t of on(n))bo.call(n,t)&&Vt(e,t,n[t]);return e},pn=(e,n)=>{var t={};for(var o in e)vo.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&on)for(var o of on(e))n.indexOf(o)<0&&bo.call(e,o)&&(t[o]=e[o]);return t};/**
6
6
  * @license QR Code generator library (TypeScript)
7
7
  * Copyright (c) Project Nayuki.
8
8
  * SPDX-License-Identifier: MIT
9
- */var Pe;(e=>{const n=class Z{constructor(l,c,a,d){if(this.version=l,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],l<Z.MIN_VERSION||l>Z.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let g=[];for(let m=0;m<this.size;m++)g.push(!1);for(let m=0;m<this.size;m++)this.modules.push(g.slice()),this.isFunction.push(g.slice());this.drawFunctionPatterns();const w=this.addEccAndInterleave(a);if(this.drawCodewords(w),d==-1){let m=1e9;for(let x=0;x<8;x++){this.applyMask(x),this.drawFormatBits(x);const p=this.getPenaltyScore();p<m&&(d=x,m=p),this.applyMask(x)}}r(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,c){const a=e.QrSegment.makeSegments(l);return Z.encodeSegments(a,c)}static encodeBinary(l,c){const a=e.QrSegment.makeBytes(l);return Z.encodeSegments([a],c)}static encodeSegments(l,c,a=1,d=40,g=-1,w=!0){if(!(Z.MIN_VERSION<=a&&a<=d&&d<=Z.MAX_VERSION)||g<-1||g>7)throw new RangeError("Invalid value");let m,x;for(m=a;;m++){const v=Z.getNumDataCodewords(m,c)*8,N=u.getTotalBits(l,m);if(N<=v){x=N;break}if(m>=d)throw new RangeError("Data too long")}for(const v of[Z.Ecc.MEDIUM,Z.Ecc.QUARTILE,Z.Ecc.HIGH])w&&x<=Z.getNumDataCodewords(m,v)*8&&(c=v);let p=[];for(const v of l){t(v.mode.modeBits,4,p),t(v.numChars,v.mode.numCharCountBits(m),p);for(const N of v.getData())p.push(N)}r(p.length==x);const C=Z.getNumDataCodewords(m,c)*8;r(p.length<=C),t(0,Math.min(4,C-p.length),p),t(0,(8-p.length%8)%8,p),r(p.length%8==0);for(let v=236;p.length<C;v^=253)t(v,8,p);let k=[];for(;k.length*8<p.length;)k.push(0);return p.forEach((v,N)=>k[N>>>3]|=v<<7-(N&7)),new Z(m,c,k,g)}getModule(l,c){return 0<=l&&l<this.size&&0<=c&&c<this.size&&this.modules[c][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),c=l.length;for(let a=0;a<c;a++)for(let d=0;d<c;d++)a==0&&d==0||a==0&&d==c-1||a==c-1&&d==0||this.drawAlignmentPattern(l[a],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const c=this.errorCorrectionLevel.formatBits<<3|l;let a=c;for(let g=0;g<10;g++)a=a<<1^(a>>>9)*1335;const d=(c<<10|a)^21522;r(d>>>15==0);for(let g=0;g<=5;g++)this.setFunctionModule(8,g,o(d,g));this.setFunctionModule(8,7,o(d,6)),this.setFunctionModule(8,8,o(d,7)),this.setFunctionModule(7,8,o(d,8));for(let g=9;g<15;g++)this.setFunctionModule(14-g,8,o(d,g));for(let g=0;g<8;g++)this.setFunctionModule(this.size-1-g,8,o(d,g));for(let g=8;g<15;g++)this.setFunctionModule(8,this.size-15+g,o(d,g));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let a=0;a<12;a++)l=l<<1^(l>>>11)*7973;const c=this.version<<12|l;r(c>>>18==0);for(let a=0;a<18;a++){const d=o(c,a),g=this.size-11+a%3,w=Math.floor(a/3);this.setFunctionModule(g,w,d),this.setFunctionModule(w,g,d)}}drawFinderPattern(l,c){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const g=Math.max(Math.abs(d),Math.abs(a)),w=l+d,m=c+a;0<=w&&w<this.size&&0<=m&&m<this.size&&this.setFunctionModule(w,m,g!=2&&g!=4)}}drawAlignmentPattern(l,c){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,c+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(l,c,a){this.modules[c][l]=a,this.isFunction[c][l]=!0}addEccAndInterleave(l){const c=this.version,a=this.errorCorrectionLevel;if(l.length!=Z.getNumDataCodewords(c,a))throw new RangeError("Invalid argument");const d=Z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][c],g=Z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][c],w=Math.floor(Z.getNumRawDataModules(c)/8),m=d-w%d,x=Math.floor(w/d);let p=[];const C=Z.reedSolomonComputeDivisor(g);for(let v=0,N=0;v<d;v++){let b=l.slice(N,N+x-g+(v<m?0:1));N+=b.length;const E=Z.reedSolomonComputeRemainder(b,C);v<m&&b.push(0),p.push(b.concat(E))}let k=[];for(let v=0;v<p[0].length;v++)p.forEach((N,b)=>{(v!=x-g||b>=m)&&k.push(N[v])});return r(k.length==w),k}drawCodewords(l){if(l.length!=Math.floor(Z.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let g=0;g<2;g++){const w=a-g,x=(a+1&2)==0?this.size-1-d:d;!this.isFunction[x][w]&&c<l.length*8&&(this.modules[x][w]=o(l[c>>>3],7-(c&7)),c++)}}r(c==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let a=0;a<this.size;a++){let d;switch(l){case 0:d=(a+c)%2==0;break;case 1:d=c%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+c)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(c/2))%2==0;break;case 5:d=a*c%2+a*c%3==0;break;case 6:d=(a*c%2+a*c%3)%2==0;break;case 7:d=((a+c)%2+a*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][a]&&d&&(this.modules[c][a]=!this.modules[c][a])}}getPenaltyScore(){let l=0;for(let g=0;g<this.size;g++){let w=!1,m=0,x=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[g][p]==w?(m++,m==5?l+=Z.PENALTY_N1:m>5&&l++):(this.finderPenaltyAddHistory(m,x),w||(l+=this.finderPenaltyCountPatterns(x)*Z.PENALTY_N3),w=this.modules[g][p],m=1);l+=this.finderPenaltyTerminateAndCount(w,m,x)*Z.PENALTY_N3}for(let g=0;g<this.size;g++){let w=!1,m=0,x=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][g]==w?(m++,m==5?l+=Z.PENALTY_N1:m>5&&l++):(this.finderPenaltyAddHistory(m,x),w||(l+=this.finderPenaltyCountPatterns(x)*Z.PENALTY_N3),w=this.modules[p][g],m=1);l+=this.finderPenaltyTerminateAndCount(w,m,x)*Z.PENALTY_N3}for(let g=0;g<this.size-1;g++)for(let w=0;w<this.size-1;w++){const m=this.modules[g][w];m==this.modules[g][w+1]&&m==this.modules[g+1][w]&&m==this.modules[g+1][w+1]&&(l+=Z.PENALTY_N2)}let c=0;for(const g of this.modules)c=g.reduce((w,m)=>w+(m?1:0),c);const a=this.size*this.size,d=Math.ceil(Math.abs(c*20-a*10)/a)-1;return r(0<=d&&d<=9),l+=d*Z.PENALTY_N4,r(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let a=[6];for(let d=this.size-7;a.length<l;d-=c)a.splice(1,0,d);return a}}static getNumRawDataModules(l){if(l<Z.MIN_VERSION||l>Z.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*l+128)*l+64;if(l>=2){const a=Math.floor(l/7)+2;c-=(25*a-10)*a-55,l>=7&&(c-=36)}return r(208<=c&&c<=29648),c}static getNumDataCodewords(l,c){return Math.floor(Z.getNumRawDataModules(l)/8)-Z.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l]*Z.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let c=[];for(let d=0;d<l-1;d++)c.push(0);c.push(1);let a=1;for(let d=0;d<l;d++){for(let g=0;g<c.length;g++)c[g]=Z.reedSolomonMultiply(c[g],a),g+1<c.length&&(c[g]^=c[g+1]);a=Z.reedSolomonMultiply(a,2)}return c}static reedSolomonComputeRemainder(l,c){let a=c.map(d=>0);for(const d of l){const g=d^a.shift();a.push(0),c.forEach((w,m)=>a[m]^=Z.reedSolomonMultiply(w,g))}return a}static reedSolomonMultiply(l,c){if(l>>>8||c>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(c>>>d&1)*l;return r(a>>>8==0),a}finderPenaltyCountPatterns(l){const c=l[1];r(c<=this.size*3);const a=c>0&&l[2]==c&&l[3]==c*3&&l[4]==c&&l[5]==c;return(a&&l[0]>=c*4&&l[6]>=c?1:0)+(a&&l[6]>=c*4&&l[0]>=c?1:0)}finderPenaltyTerminateAndCount(l,c,a){return l&&(this.finderPenaltyAddHistory(c,a),c=0),c+=this.size,this.finderPenaltyAddHistory(c,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(l,c){c[0]==0&&(l+=this.size),c.pop(),c.unshift(l)}};n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.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]],n.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=n;function t(f,l,c){if(l<0||l>31||f>>>l)throw new RangeError("Value out of range");for(let a=l-1;a>=0;a--)c.push(f>>>a&1)}function o(f,l){return(f>>>l&1)!=0}function r(f){if(!f)throw new Error("Assertion error")}const s=class le{constructor(l,c,a){if(this.mode=l,this.numChars=c,this.bitData=a,c<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(l){let c=[];for(const a of l)t(a,8,c);return new le(le.Mode.BYTE,l.length,c)}static makeNumeric(l){if(!le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let c=[];for(let a=0;a<l.length;){const d=Math.min(l.length-a,3);t(parseInt(l.substring(a,a+d),10),d*3+1,c),a+=d}return new le(le.Mode.NUMERIC,l.length,c)}static makeAlphanumeric(l){if(!le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],a;for(a=0;a+2<=l.length;a+=2){let d=le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a))*45;d+=le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a+1)),t(d,11,c)}return a<l.length&&t(le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a)),6,c),new le(le.Mode.ALPHANUMERIC,l.length,c)}static makeSegments(l){return l==""?[]:le.isNumeric(l)?[le.makeNumeric(l)]:le.isAlphanumeric(l)?[le.makeAlphanumeric(l)]:[le.makeBytes(le.toUtf8ByteArray(l))]}static makeEci(l){let c=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,c);else if(l<16384)t(2,2,c),t(l,14,c);else if(l<1e6)t(6,3,c),t(l,21,c);else throw new RangeError("ECI assignment value out of range");return new le(le.Mode.ECI,0,c)}static isNumeric(l){return le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,c){let a=0;for(const d of l){const g=d.mode.numCharCountBits(c);if(d.numChars>=1<<g)return 1/0;a+=4+g+d.bitData.length}return a}static toUtf8ByteArray(l){l=encodeURI(l);let c=[];for(let a=0;a<l.length;a++)l.charAt(a)!="%"?c.push(l.charCodeAt(a)):(c.push(parseInt(l.substring(a+1,a+3),16)),a+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=s;e.QrSegment=s})(Pe||(Pe={}));(e=>{(n=>{const t=class{constructor(r,s){this.ordinal=r,this.formatBits=s}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),n.Ecc=t})(e.QrCode||(e.QrCode={}))})(Pe||(Pe={}));(e=>{(n=>{const t=class{constructor(r,s){this.modeBits=r,this.numBitsCharCount=s}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),n.Mode=t})(e.QrSegment||(e.QrSegment={}))})(Pe||(Pe={}));var Ve=Pe;/**
9
+ */var Be;(e=>{const n=class Z{constructor(l,c,a,d){if(this.version=l,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],l<Z.MIN_VERSION||l>Z.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let g=[];for(let m=0;m<this.size;m++)g.push(!1);for(let m=0;m<this.size;m++)this.modules.push(g.slice()),this.isFunction.push(g.slice());this.drawFunctionPatterns();const w=this.addEccAndInterleave(a);if(this.drawCodewords(w),d==-1){let m=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const p=this.getPenaltyScore();p<m&&(d=v,m=p),this.applyMask(v)}}r(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,c){const a=e.QrSegment.makeSegments(l);return Z.encodeSegments(a,c)}static encodeBinary(l,c){const a=e.QrSegment.makeBytes(l);return Z.encodeSegments([a],c)}static encodeSegments(l,c,a=1,d=40,g=-1,w=!0){if(!(Z.MIN_VERSION<=a&&a<=d&&d<=Z.MAX_VERSION)||g<-1||g>7)throw new RangeError("Invalid value");let m,v;for(m=a;;m++){const x=Z.getNumDataCodewords(m,c)*8,N=u.getTotalBits(l,m);if(N<=x){v=N;break}if(m>=d)throw new RangeError("Data too long")}for(const x of[Z.Ecc.MEDIUM,Z.Ecc.QUARTILE,Z.Ecc.HIGH])w&&v<=Z.getNumDataCodewords(m,x)*8&&(c=x);let p=[];for(const x of l){t(x.mode.modeBits,4,p),t(x.numChars,x.mode.numCharCountBits(m),p);for(const N of x.getData())p.push(N)}r(p.length==v);const k=Z.getNumDataCodewords(m,c)*8;r(p.length<=k),t(0,Math.min(4,k-p.length),p),t(0,(8-p.length%8)%8,p),r(p.length%8==0);for(let x=236;p.length<k;x^=253)t(x,8,p);let C=[];for(;C.length*8<p.length;)C.push(0);return p.forEach((x,N)=>C[N>>>3]|=x<<7-(N&7)),new Z(m,c,C,g)}getModule(l,c){return 0<=l&&l<this.size&&0<=c&&c<this.size&&this.modules[c][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),c=l.length;for(let a=0;a<c;a++)for(let d=0;d<c;d++)a==0&&d==0||a==0&&d==c-1||a==c-1&&d==0||this.drawAlignmentPattern(l[a],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const c=this.errorCorrectionLevel.formatBits<<3|l;let a=c;for(let g=0;g<10;g++)a=a<<1^(a>>>9)*1335;const d=(c<<10|a)^21522;r(d>>>15==0);for(let g=0;g<=5;g++)this.setFunctionModule(8,g,o(d,g));this.setFunctionModule(8,7,o(d,6)),this.setFunctionModule(8,8,o(d,7)),this.setFunctionModule(7,8,o(d,8));for(let g=9;g<15;g++)this.setFunctionModule(14-g,8,o(d,g));for(let g=0;g<8;g++)this.setFunctionModule(this.size-1-g,8,o(d,g));for(let g=8;g<15;g++)this.setFunctionModule(8,this.size-15+g,o(d,g));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let a=0;a<12;a++)l=l<<1^(l>>>11)*7973;const c=this.version<<12|l;r(c>>>18==0);for(let a=0;a<18;a++){const d=o(c,a),g=this.size-11+a%3,w=Math.floor(a/3);this.setFunctionModule(g,w,d),this.setFunctionModule(w,g,d)}}drawFinderPattern(l,c){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const g=Math.max(Math.abs(d),Math.abs(a)),w=l+d,m=c+a;0<=w&&w<this.size&&0<=m&&m<this.size&&this.setFunctionModule(w,m,g!=2&&g!=4)}}drawAlignmentPattern(l,c){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,c+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(l,c,a){this.modules[c][l]=a,this.isFunction[c][l]=!0}addEccAndInterleave(l){const c=this.version,a=this.errorCorrectionLevel;if(l.length!=Z.getNumDataCodewords(c,a))throw new RangeError("Invalid argument");const d=Z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][c],g=Z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][c],w=Math.floor(Z.getNumRawDataModules(c)/8),m=d-w%d,v=Math.floor(w/d);let p=[];const k=Z.reedSolomonComputeDivisor(g);for(let x=0,N=0;x<d;x++){let b=l.slice(N,N+v-g+(x<m?0:1));N+=b.length;const j=Z.reedSolomonComputeRemainder(b,k);x<m&&b.push(0),p.push(b.concat(j))}let C=[];for(let x=0;x<p[0].length;x++)p.forEach((N,b)=>{(x!=v-g||b>=m)&&C.push(N[x])});return r(C.length==w),C}drawCodewords(l){if(l.length!=Math.floor(Z.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let g=0;g<2;g++){const w=a-g,v=(a+1&2)==0?this.size-1-d:d;!this.isFunction[v][w]&&c<l.length*8&&(this.modules[v][w]=o(l[c>>>3],7-(c&7)),c++)}}r(c==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let a=0;a<this.size;a++){let d;switch(l){case 0:d=(a+c)%2==0;break;case 1:d=c%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+c)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(c/2))%2==0;break;case 5:d=a*c%2+a*c%3==0;break;case 6:d=(a*c%2+a*c%3)%2==0;break;case 7:d=((a+c)%2+a*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][a]&&d&&(this.modules[c][a]=!this.modules[c][a])}}getPenaltyScore(){let l=0;for(let g=0;g<this.size;g++){let w=!1,m=0,v=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[g][p]==w?(m++,m==5?l+=Z.PENALTY_N1:m>5&&l++):(this.finderPenaltyAddHistory(m,v),w||(l+=this.finderPenaltyCountPatterns(v)*Z.PENALTY_N3),w=this.modules[g][p],m=1);l+=this.finderPenaltyTerminateAndCount(w,m,v)*Z.PENALTY_N3}for(let g=0;g<this.size;g++){let w=!1,m=0,v=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][g]==w?(m++,m==5?l+=Z.PENALTY_N1:m>5&&l++):(this.finderPenaltyAddHistory(m,v),w||(l+=this.finderPenaltyCountPatterns(v)*Z.PENALTY_N3),w=this.modules[p][g],m=1);l+=this.finderPenaltyTerminateAndCount(w,m,v)*Z.PENALTY_N3}for(let g=0;g<this.size-1;g++)for(let w=0;w<this.size-1;w++){const m=this.modules[g][w];m==this.modules[g][w+1]&&m==this.modules[g+1][w]&&m==this.modules[g+1][w+1]&&(l+=Z.PENALTY_N2)}let c=0;for(const g of this.modules)c=g.reduce((w,m)=>w+(m?1:0),c);const a=this.size*this.size,d=Math.ceil(Math.abs(c*20-a*10)/a)-1;return r(0<=d&&d<=9),l+=d*Z.PENALTY_N4,r(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let a=[6];for(let d=this.size-7;a.length<l;d-=c)a.splice(1,0,d);return a}}static getNumRawDataModules(l){if(l<Z.MIN_VERSION||l>Z.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*l+128)*l+64;if(l>=2){const a=Math.floor(l/7)+2;c-=(25*a-10)*a-55,l>=7&&(c-=36)}return r(208<=c&&c<=29648),c}static getNumDataCodewords(l,c){return Math.floor(Z.getNumRawDataModules(l)/8)-Z.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l]*Z.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let c=[];for(let d=0;d<l-1;d++)c.push(0);c.push(1);let a=1;for(let d=0;d<l;d++){for(let g=0;g<c.length;g++)c[g]=Z.reedSolomonMultiply(c[g],a),g+1<c.length&&(c[g]^=c[g+1]);a=Z.reedSolomonMultiply(a,2)}return c}static reedSolomonComputeRemainder(l,c){let a=c.map(d=>0);for(const d of l){const g=d^a.shift();a.push(0),c.forEach((w,m)=>a[m]^=Z.reedSolomonMultiply(w,g))}return a}static reedSolomonMultiply(l,c){if(l>>>8||c>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(c>>>d&1)*l;return r(a>>>8==0),a}finderPenaltyCountPatterns(l){const c=l[1];r(c<=this.size*3);const a=c>0&&l[2]==c&&l[3]==c*3&&l[4]==c&&l[5]==c;return(a&&l[0]>=c*4&&l[6]>=c?1:0)+(a&&l[6]>=c*4&&l[0]>=c?1:0)}finderPenaltyTerminateAndCount(l,c,a){return l&&(this.finderPenaltyAddHistory(c,a),c=0),c+=this.size,this.finderPenaltyAddHistory(c,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(l,c){c[0]==0&&(l+=this.size),c.pop(),c.unshift(l)}};n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.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]],n.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=n;function t(f,l,c){if(l<0||l>31||f>>>l)throw new RangeError("Value out of range");for(let a=l-1;a>=0;a--)c.push(f>>>a&1)}function o(f,l){return(f>>>l&1)!=0}function r(f){if(!f)throw new Error("Assertion error")}const s=class le{constructor(l,c,a){if(this.mode=l,this.numChars=c,this.bitData=a,c<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(l){let c=[];for(const a of l)t(a,8,c);return new le(le.Mode.BYTE,l.length,c)}static makeNumeric(l){if(!le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let c=[];for(let a=0;a<l.length;){const d=Math.min(l.length-a,3);t(parseInt(l.substring(a,a+d),10),d*3+1,c),a+=d}return new le(le.Mode.NUMERIC,l.length,c)}static makeAlphanumeric(l){if(!le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],a;for(a=0;a+2<=l.length;a+=2){let d=le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a))*45;d+=le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a+1)),t(d,11,c)}return a<l.length&&t(le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(a)),6,c),new le(le.Mode.ALPHANUMERIC,l.length,c)}static makeSegments(l){return l==""?[]:le.isNumeric(l)?[le.makeNumeric(l)]:le.isAlphanumeric(l)?[le.makeAlphanumeric(l)]:[le.makeBytes(le.toUtf8ByteArray(l))]}static makeEci(l){let c=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,c);else if(l<16384)t(2,2,c),t(l,14,c);else if(l<1e6)t(6,3,c),t(l,21,c);else throw new RangeError("ECI assignment value out of range");return new le(le.Mode.ECI,0,c)}static isNumeric(l){return le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,c){let a=0;for(const d of l){const g=d.mode.numCharCountBits(c);if(d.numChars>=1<<g)return 1/0;a+=4+g+d.bitData.length}return a}static toUtf8ByteArray(l){l=encodeURI(l);let c=[];for(let a=0;a<l.length;a++)l.charAt(a)!="%"?c.push(l.charCodeAt(a)):(c.push(parseInt(l.substring(a+1,a+3),16)),a+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=s;e.QrSegment=s})(Be||(Be={}));(e=>{(n=>{const t=class{constructor(r,s){this.ordinal=r,this.formatBits=s}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),n.Ecc=t})(e.QrCode||(e.QrCode={}))})(Be||(Be={}));(e=>{(n=>{const t=class{constructor(r,s){this.modeBits=r,this.numBitsCharCount=s}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),n.Mode=t})(e.QrSegment||(e.QrSegment={}))})(Be||(Be={}));var He=Be;/**
10
10
  * @license qrcode.react
11
11
  * Copyright (c) Paul O'Shannessy
12
12
  * SPDX-License-Identifier: ISC
13
- */var Hr={L:Ve.QrCode.Ecc.LOW,M:Ve.QrCode.Ecc.MEDIUM,Q:Ve.QrCode.Ecc.QUARTILE,H:Ve.QrCode.Ecc.HIGH},Co=128,ko="L",So="#FFFFFF",No="#000000",jo=!1,Eo=1,Gr=4,zr=0,Ur=.1;function Ao(e,n=0){const t=[];return e.forEach(function(o,r){let s=null;o.forEach(function(u,f){if(!u&&s!==null){t.push(`M${s+n} ${r+n}h${f-s}v1H${s+n}z`),s=null;return}if(f===o.length-1){if(!u)return;s===null?t.push(`M${f+n},${r+n} h1v1H${f+n}z`):t.push(`M${s+n},${r+n} h${f+1-s}v1H${s+n}z`);return}u&&s===null&&(s=f)})}),t.join("")}function Do(e,n){return e.slice().map((t,o)=>o<n.y||o>=n.y+n.h?t:t.map((r,s)=>s<n.x||s>=n.x+n.w?r:!1))}function Wr(e,n,t,o){if(o==null)return null;const r=e.length+t*2,s=Math.floor(n*Ur),u=r/n,f=(o.width||s)*u,l=(o.height||s)*u,c=o.x==null?e.length/2-f/2:o.x*u,a=o.y==null?e.length/2-l/2:o.y*u,d=o.opacity==null?1:o.opacity;let g=null;if(o.excavate){let m=Math.floor(c),x=Math.floor(a),p=Math.ceil(f+c-m),C=Math.ceil(l+a-x);g={x:m,y:x,w:p,h:C}}const w=o.crossOrigin;return{x:c,y:a,h:l,w:f,excavation:g,opacity:d,crossOrigin:w}}function $r(e,n){return n!=null?Math.max(Math.floor(n),0):e?Gr:zr}function yo({value:e,level:n,minVersion:t,includeMargin:o,marginSize:r,imageSettings:s,size:u,boostLevel:f}){let l=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((x,p)=>(x.push(...Ve.QrSegment.makeSegments(p)),x),[]);return Ve.QrCode.encodeSegments(m,Hr[n],t,void 0,void 0,f)},[e,n,t,f]);const{cells:c,margin:a,numCells:d,calculatedImageSettings:g}=h.useMemo(()=>{let w=l.getModules();const m=$r(o,r),x=w.length+m*2,p=Wr(w,u,m,s);return{cells:w,margin:m,numCells:x,calculatedImageSettings:p}},[l,u,s,o,r]);return{qrcode:l,margin:a,cells:c,numCells:d,calculatedImageSettings:g}}var Jr=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Yr=h.forwardRef(function(n,t){const o=n,{value:r,size:s=Co,level:u=ko,bgColor:f=So,fgColor:l=No,includeMargin:c=jo,minVersion:a=Eo,boostLevel:d,marginSize:g,imageSettings:w}=o,x=gn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=x,C=gn(x,["style"]),k=w==null?void 0:w.src,v=h.useRef(null),N=h.useRef(null),b=h.useCallback(K=>{v.current=K,typeof t=="function"?t(K):t&&(t.current=K)},[t]),[E,R]=h.useState(!1),{margin:D,cells:T,numCells:S,calculatedImageSettings:M}=yo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:g,imageSettings:w,size:s});h.useEffect(()=>{if(v.current!=null){const K=v.current,H=K.getContext("2d");if(!H)return;let O=T;const L=N.current,B=M!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;B&&M.excavation!=null&&(O=Do(T,M.excavation));const J=window.devicePixelRatio||1;K.height=K.width=s*J;const Y=s/S*J;H.scale(Y,Y),H.fillStyle=f,H.fillRect(0,0,S,S),H.fillStyle=l,Jr?H.fill(new Path2D(Ao(O,D))):T.forEach(function(G,q){G.forEach(function(ce,ue){ce&&H.fillRect(ue+D,q+D,1,1)})}),M&&(H.globalAlpha=M.opacity),B&&H.drawImage(L,M.x+D,M.y+D,M.w,M.h)}}),h.useEffect(()=>{R(!1)},[k]);const y=fn({height:s,width:s},p);let P=null;return k!=null&&(P=h.createElement("img",{src:k,key:k,style:{display:"none"},onLoad:()=>{R(!0)},ref:N,crossOrigin:M==null?void 0:M.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",fn({style:y,height:s,width:s,ref:b,role:"img"},C)),P)});Yr.displayName="QRCodeCanvas";var Mo=h.forwardRef(function(n,t){const o=n,{value:r,size:s=Co,level:u=ko,bgColor:f=So,fgColor:l=No,includeMargin:c=jo,minVersion:a=Eo,boostLevel:d,title:g,marginSize:w,imageSettings:m}=o,x=gn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:C,numCells:k,calculatedImageSettings:v}=yo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:w,imageSettings:m,size:s});let N=C,b=null;m!=null&&v!=null&&(v.excavation!=null&&(N=Do(C,v.excavation)),b=h.createElement("image",{href:m.src,height:v.h,width:v.w,x:v.x+p,y:v.y+p,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const E=Ao(N,p);return h.createElement("svg",fn({height:s,width:s,viewBox:`0 0 ${k} ${k}`,ref:t,role:"img"},x),!!g&&h.createElement("title",null,g),h.createElement("path",{fill:f,d:`M0,0 h${k}v${k}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:l,d:E,shapeRendering:"crispEdges"}),b)});Mo.displayName="QRCodeSVG";const Kr=(e,n)=>({invitationType:se.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...n]}),Zr=e=>{var t;const n=((t=e==null?void 0:e.invitationLink)==null?void 0:t.split("/").at(-1))||"";return`/${X.SHARE_CONVERSATION_ROUTE}/${n}`},qr=(e,n)=>n==null?void 0:n.find(t=>{var s,u,f,l;const o=(u=(s=e==null?void 0:e.id)==null?void 0:s.split("/"))==null?void 0:u.pop(),r=((l=(f=t==null?void 0:t.url)==null?void 0:f.split("/"))==null?void 0:l.pop())||"";return r===o||decodeURI(r)===o}),Xr=e=>{var t,o;const n=(t=e==null?void 0:e.messages)==null?void 0:t.filter(r=>{var s;return!!((s=r==null?void 0:r.custom_content)!=null&&s.attachments)});return((o=n==null?void 0:n.flatMap(r=>{var s,u;return((u=(s=r==null?void 0:r.custom_content)==null?void 0:s.attachments)==null?void 0:u.map(f=>({url:(f==null?void 0:f.url)||""})))||[]}))==null?void 0:o.filter(r=>!!(r!=null&&r.url)))||[]},Qr=({conversation:e,locale:n,onCloseModal:t,modalDividers:o,getConversation:r,generateConversationLink:s,chatExpiration:u,chatExpirationDays:f,close:l,chatWarning:c,shareLink:a,shareCopyLink:d,shareCopiedLink:g,shareDescription:w,shareRemoveAccessToUsers:m,chatName:x,getSharedConversations:p,revokeSharedConversations:C,baseUrl:k,id:v,clientSharedPage:N,clientSharedProp:b})=>{const[E,R]=h.useState(null),[D,T]=h.useState(),[S,M]=h.useState(!1),[y,P]=h.useState(!1),[K,H]=h.useState(),O=h.useMemo(()=>{var q;const G=k||window.location.origin;if(k&&k!==window.location.origin&&N&&b){const ce=(q=E==null?void 0:E.split(`/${X.SHARE_CONVERSATION_ROUTE}/`))==null?void 0:q[1];return`${G}/${N}?${b}=${ce}`}return`${G}/${n}${E}`},[k,E,n,N,b]);h.useEffect(()=>{(async()=>{try{const q=decodeURI(e?e==null?void 0:e.id:`${v==null?void 0:v[0]}/${n}/${v==null?void 0:v[1]}`),ce=`${decodeURI(q)}`,ue=await(r==null?void 0:r(ce)),ie=Kr(q,Xr(ue)),me=await(s==null?void 0:s(ie)),de=await(p==null?void 0:p(se.getSharedConversationsRequest(se.ShareTarget.OTHERS)));me&&de&&(M(!0),R(Zr(me)),T(qr(e,de==null?void 0:de.resources)))}catch(q){M(!1),console.error("Error sharing conversation",q)}})()},[e,s,r,p,v,n]);const L=h.useCallback(()=>{t(),R(null),M(!1),P(!1)},[t]),B=h.useCallback(()=>{P(!0),navigator.clipboard.writeText(O||"")},[O]),J=async()=>{try{H(!0),D&&await(C==null?void 0:C({resources:[D]}))}catch(G){H(!1),console.error("Error revoking shared conversation",G)}},Y=h.useCallback(()=>i.jsx(j.Button,{buttonClassName:y?"text-button-secondary":"text-button-primary",iconBefore:y?i.jsx(ye.IconCheck,{width:20,height:20}):i.jsx(ye.IconCopy,{width:20,height:20}),title:y?g??"Copied":d??"Copy link",disabled:y,onClick:B}),[y,B,g,d]);return i.jsxs(j.Popup,{heading:a??"Share link",portalId:"share",size:j.PopUpSize.SM,dividers:o,onClose:L,closeButtonTitle:l??"Close",children:[S?i.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[e!=null&&e.name?i.jsxs("div",{className:"flex share-info w-full",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:x??"Chat name:"}),i.jsx("h3",{className:"flex-1 min-w-0 truncate",title:e==null?void 0:e.name,children:e==null?void 0:e.name})]}):null,i.jsxs("div",{className:"flex share-info",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:u??"Link expiration date:"}),i.jsxs("h3",{children:["3 ",f??"days"]})]}),i.jsx(Mo,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:O,size:200}),i.jsx("p",{className:"body-2 text-neutrals-1000",children:w??"Your name, special instructions, and any messages you add after sharing remain confidential."}),i.jsx(j.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:O,value:O,inputId:"conversationLink",iconAfterInput:Y()})]}):i.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:i.jsx(j.Loader,{})}),S?e&&D?i.jsx("div",{className:"remove-access",children:i.jsx(j.Button,{title:m??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:K,onClick:J})}):i.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:c??"This chat has not been shared with anyone yet."}):i.jsx("div",{})]})},To=({shareButtonClass:e,shareIcon:n,...t})=>{const[o,r]=h.useState(j.PopUpState.Closed),s=()=>{r(j.PopUpState.Opened)},u=h.useCallback(()=>{r(j.PopUpState.Closed)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(j.Button,{buttonClassName:e||"text-button-secondary",title:(t==null?void 0:t.share)||"Share",iconBefore:n,onClick:s}),o===j.PopUpState.Opened&&i.jsx(Qr,{onCloseModal:u,...t})]})},Oo=({conversation:e,locale:n,isOpenedAdvancedView:t,isShowShareButton:o,shareConversationProps:r})=>i.jsx(i.Fragment,{children:i.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:[i.jsx("span",{className:V("flex-1 min-w-0 truncate h4","conversation-view-header-text"),title:e==null?void 0:e.name,children:e==null?void 0:e.name}),i.jsx("div",{className:"flex gap-4",children:!t&&o&&i.jsx("div",{className:"flex gap-x-2",children:i.jsx(To,{conversation:e,locale:n,...r})})})]})}),Lo=({content:e,textColorClass:n})=>{const{isOpenedAdvancedView:t}=_e();return i.jsx("div",{className:V("prose max-w-none break-words",t?"body-2":"body-1",n),children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:n,...o}),a:({href:o,children:r,...s})=>i.jsx("a",{href:o,target:"_blank",...s,children:r})},children:e})})},_o=({choiceButtons:e,onClick:n})=>e.map(t=>{var o;return i.jsx("div",{className:"mt-4",children:i.jsxs("button",{type:"button",className:"flex flex-col items-start justify-center text-left w-full rounded border-hues-200 hover:bg-hues-100 min-h-[72px] border px-4 py-2",onClick:()=>{var r;return n((r=t[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:r.populateText,t==null?void 0:t.const)},"aria-label":"button",children:[i.jsx("h3",{className:"mb-1",children:t.title}),t.const!==rn.COMPLETE&&i.jsx("p",{className:"body-1 text-neutrals-800",children:(o=t[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:o.populateText})]})},t.title)}),ei=({titles:e,messageContent:n,choiceButtons:t,onClick:o,handleOnboardingSkip:r})=>i.jsxs("div",{className:"onboarding w-full h-full flex flex-col flex-1 overflow-auto",children:[i.jsx(Oo,{conversation:{name:(e==null?void 0:e.onboardingTitle)??"Introducing the AI assistant"}}),i.jsxs("div",{className:"onboarding-content flex flex-col",children:[i.jsx(Lo,{content:n}),i.jsx("div",{className:"mt-4",children:i.jsx(_o,{choiceButtons:t,onClick:o})}),i.jsxs("div",{className:"flex mt-8",children:[i.jsx(j.Button,{title:e==null?void 0:e.skipOnboardingNow,buttonClassName:"text-button-secondary mr-4",onClick:()=>r==null?void 0:r(),isSmallButton:!0}),i.jsx(j.Button,{title:e==null?void 0:e.refuseOnboarding,buttonClassName:"text-button-tertiary",onClick:()=>r==null?void 0:r(!0),isSmallButton:!0})]})]})]}),Ro=({titles:e,openNewConversation:n})=>i.jsxs("div",{className:"text-center bg-accent-300 body-3 p-2",children:[i.jsx("span",{className:"mr-2 text-neutrals-900",children:e==null?void 0:e.onboardingFooter}),i.jsxs("span",{onClick:n,className:"cursor-pointer inline-flex align-top",children:[i.jsx(ye.IconPlus,{width:15,height:15}),i.jsx("p",{className:"ml-1",children:e==null?void 0:e.onboardingFooterLink})]})]}),Io=({firstLine:e,secondLine:n})=>{const t=e!=null&&e.trim()!=="",o=n!=null&&n.trim()!=="";return i.jsxs("div",{className:V("text-center body-3",o?"p-0":t?"p-1":"p-3"),children:[t&&i.jsx("div",{className:"text-neutrals-800",children:e}),o&&i.jsx("div",{className:"text-neutrals-800",children:n})]})},ni=({suggestionsList:e,welcomeText:n,titleIcon:t,actions:o,titles:r,inputMessageStyles:s,isBottomInputPosition:u,prompt:f,onboardingMessageSchema:l,handleConversationClick:c,setConversations:a,locale:d,setSharedConversations:g})=>{var y,P,K,H;const[w,m]=h.useState(null),[x,p]=h.useState(),{onboardingFileSchema:C,onboardingFileName:k,onboardingFilePath:v,isShowOnboarding:N,setIsShowOnboarding:b,setOnboardingFileSchema:E}=ve(),{isAgentAvailable:R}=j.useAgentAvailability(),{statusMessages:D}=bn();h.useEffect(()=>{(async()=>{try{const L=await o.getBucket();m(L.bucket)}catch(L){console.error(L instanceof Error?L.message:"Request error")}})()},[o]);const T=h.useCallback(async(O,L)=>{var B,J,Y;p(!0),w||console.error("No bucket");try{const G=N?Fr(w||"",d,(r==null?void 0:r.onboardingTitle)??"Introducing the AI assistant",((J=(B=l==null?void 0:l.properties)==null?void 0:B.choice)==null?void 0:J.description)??"",O,L):Pr(w||"",d,r.newChat??"New chat",O),q=await o.createConversation(G,d,N),ce=await o.getConversations(d),ue=await o.getSharedConversations(se.getSharedConversationsRequest(se.ShareTarget.ME));if(l&&C){const ie={...C,isStarted:!0};await((Y=o.putOnboardingFile)==null?void 0:Y.call(o,k,v,ie)),E==null||E(ie)}a(X.cleanConversationNames(ce)),g(X.cleanConversationNames(Er.transformSharedConversations(ue,d))),c(q.folderId,q.id)}catch(G){console.error(G instanceof Error?G.message:"Creation conversation failed"),p(!1)}},[o,w,c,N,d,k,v,C,l,a,E,g,r.newChat,r==null?void 0:r.onboardingTitle]),S=h.useCallback(async O=>{var L;if(b(!1),O&&C){const B={...C,isSkipped:!0};await((L=o.putOnboardingFile)==null?void 0:L.call(o,k,v,B)),E==null||E(B)}},[o,k,v,C,b,E]);h.useEffect(()=>{f&&w&&T(f)},[w,f]);const M=()=>R?i.jsxs(i.Fragment,{children:[i.jsx(xo,{containerClasses:V(s.inputContainerClass,u&&"order-3 mt-auto"),inputClasses:"mr-2",placeholder:(r==null?void 0:r.askAnything)??"Ask anything...",sendMessageIcon:s.sendMessageIcon,onSendMessage:T}),i.jsx("div",{className:"max-w-full overflow-x-auto no-scrollbar",children:i.jsx("div",{className:V("flex flex-wrap justify-center gap-2 sm:flex-nowrap","tags-container"),children:e.map(O=>{var L;return i.jsx(j.Tag,{title:O.title,text:(L=O[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:L.populateText,onClick:T},O.title)})})})]}):i.jsx(j.InlineAlert,{type:j.InlineAlertType.Error,children:D.assistantUnavailable});return i.jsxs("div",{className:"flex flex-col h-full w-full",children:[f||x?i.jsx(j.Loader,{}):N?i.jsx(ei,{titles:r,messageContent:((P=(y=l==null?void 0:l.properties)==null?void 0:y.choice)==null?void 0:P.description)||"",choiceButtons:((H=(K=l==null?void 0:l.properties)==null?void 0:K.choice)==null?void 0:H.oneOf)||[],handleOnboardingSkip:S,onClick:T}):i.jsxs("div",{className:"flex flex-col h-full items-center justify-center sm:px-4",children:[i.jsxs("div",{className:V("flex items-center max-w-full sm-min:px-4",u?"mt-auto mb-8":"mb-6"),children:[t,i.jsx("h1",{className:"text-hues-800 text-center sm:h2",children:n??(r==null?void 0:r.welcomeTitle)??"How can I help you?"})]}),M()]}),N&&i.jsx(Ro,{titles:r,openNewConversation:()=>b(!1)}),!N&&i.jsx(Io,{firstLine:r.footerFirstLine,secondLine:r.footerSecondLine})]})},Cn=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("path",{d:"M11.3301 6.25L8.00008 9.75L4.67008 6.25L11.3301 6.25Z",fill:"currentColor"})),ti=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),oi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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 Po(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue={exports:{}},ri=Ue.exports,Ft;function ii(){return Ft||(Ft=1,(function(e,n){(function(t,o){o(n)})(ri,(function(t){/*! *****************************************************************************
13
+ */var Hr={L:He.QrCode.Ecc.LOW,M:He.QrCode.Ecc.MEDIUM,Q:He.QrCode.Ecc.QUARTILE,H:He.QrCode.Ecc.HIGH},Co=128,ko="L",So="#FFFFFF",No="#000000",Eo=!1,jo=1,Gr=4,zr=0,Ur=.1;function Ao(e,n=0){const t=[];return e.forEach(function(o,r){let s=null;o.forEach(function(u,f){if(!u&&s!==null){t.push(`M${s+n} ${r+n}h${f-s}v1H${s+n}z`),s=null;return}if(f===o.length-1){if(!u)return;s===null?t.push(`M${f+n},${r+n} h1v1H${f+n}z`):t.push(`M${s+n},${r+n} h${f+1-s}v1H${s+n}z`);return}u&&s===null&&(s=f)})}),t.join("")}function Do(e,n){return e.slice().map((t,o)=>o<n.y||o>=n.y+n.h?t:t.map((r,s)=>s<n.x||s>=n.x+n.w?r:!1))}function Wr(e,n,t,o){if(o==null)return null;const r=e.length+t*2,s=Math.floor(n*Ur),u=r/n,f=(o.width||s)*u,l=(o.height||s)*u,c=o.x==null?e.length/2-f/2:o.x*u,a=o.y==null?e.length/2-l/2:o.y*u,d=o.opacity==null?1:o.opacity;let g=null;if(o.excavate){let m=Math.floor(c),v=Math.floor(a),p=Math.ceil(f+c-m),k=Math.ceil(l+a-v);g={x:m,y:v,w:p,h:k}}const w=o.crossOrigin;return{x:c,y:a,h:l,w:f,excavation:g,opacity:d,crossOrigin:w}}function $r(e,n){return n!=null?Math.max(Math.floor(n),0):e?Gr:zr}function Mo({value:e,level:n,minVersion:t,includeMargin:o,marginSize:r,imageSettings:s,size:u,boostLevel:f}){let l=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((v,p)=>(v.push(...He.QrSegment.makeSegments(p)),v),[]);return He.QrCode.encodeSegments(m,Hr[n],t,void 0,void 0,f)},[e,n,t,f]);const{cells:c,margin:a,numCells:d,calculatedImageSettings:g}=h.useMemo(()=>{let w=l.getModules();const m=$r(o,r),v=w.length+m*2,p=Wr(w,u,m,s);return{cells:w,margin:m,numCells:v,calculatedImageSettings:p}},[l,u,s,o,r]);return{qrcode:l,margin:a,cells:c,numCells:d,calculatedImageSettings:g}}var Jr=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Yr=h.forwardRef(function(n,t){const o=n,{value:r,size:s=Co,level:u=ko,bgColor:f=So,fgColor:l=No,includeMargin:c=Eo,minVersion:a=jo,boostLevel:d,marginSize:g,imageSettings:w}=o,v=pn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=v,k=pn(v,["style"]),C=w==null?void 0:w.src,x=h.useRef(null),N=h.useRef(null),b=h.useCallback(K=>{x.current=K,typeof t=="function"?t(K):t&&(t.current=K)},[t]),[j,_]=h.useState(!1),{margin:D,cells:T,numCells:S,calculatedImageSettings:y}=Mo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:g,imageSettings:w,size:s});h.useEffect(()=>{if(x.current!=null){const K=x.current,H=K.getContext("2d");if(!H)return;let L=T;const O=N.current,B=y!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;B&&y.excavation!=null&&(L=Do(T,y.excavation));const Y=window.devicePixelRatio||1;K.height=K.width=s*Y;const U=s/S*Y;H.scale(U,U),H.fillStyle=f,H.fillRect(0,0,S,S),H.fillStyle=l,Jr?H.fill(new Path2D(Ao(L,D))):T.forEach(function(G,q){G.forEach(function(ce,ue){ce&&H.fillRect(ue+D,q+D,1,1)})}),y&&(H.globalAlpha=y.opacity),B&&H.drawImage(O,y.x+D,y.y+D,y.w,y.h)}}),h.useEffect(()=>{_(!1)},[C]);const M=mn({height:s,width:s},p);let I=null;return C!=null&&(I=h.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{_(!0)},ref:N,crossOrigin:y==null?void 0:y.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",mn({style:M,height:s,width:s,ref:b,role:"img"},k)),I)});Yr.displayName="QRCodeCanvas";var yo=h.forwardRef(function(n,t){const o=n,{value:r,size:s=Co,level:u=ko,bgColor:f=So,fgColor:l=No,includeMargin:c=Eo,minVersion:a=jo,boostLevel:d,title:g,marginSize:w,imageSettings:m}=o,v=pn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:k,numCells:C,calculatedImageSettings:x}=Mo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:w,imageSettings:m,size:s});let N=k,b=null;m!=null&&x!=null&&(x.excavation!=null&&(N=Do(k,x.excavation)),b=h.createElement("image",{href:m.src,height:x.h,width:x.w,x:x.x+p,y:x.y+p,preserveAspectRatio:"none",opacity:x.opacity,crossOrigin:x.crossOrigin}));const j=Ao(N,p);return h.createElement("svg",mn({height:s,width:s,viewBox:`0 0 ${C} ${C}`,ref:t,role:"img"},v),!!g&&h.createElement("title",null,g),h.createElement("path",{fill:f,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:l,d:j,shapeRendering:"crispEdges"}),b)});yo.displayName="QRCodeSVG";const Kr=(e,n)=>({invitationType:se.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...n]}),Zr=e=>{var t;const n=((t=e==null?void 0:e.invitationLink)==null?void 0:t.split("/").at(-1))||"";return`/${X.SHARE_CONVERSATION_ROUTE}/${n}`},qr=(e,n)=>n==null?void 0:n.find(t=>{var s,u,f,l;const o=(u=(s=e==null?void 0:e.id)==null?void 0:s.split("/"))==null?void 0:u.pop(),r=((l=(f=t==null?void 0:t.url)==null?void 0:f.split("/"))==null?void 0:l.pop())||"";return r===o||decodeURI(r)===o}),Xr=e=>{var t,o;const n=(t=e==null?void 0:e.messages)==null?void 0:t.filter(r=>{var s;return!!((s=r==null?void 0:r.custom_content)!=null&&s.attachments)});return((o=n==null?void 0:n.flatMap(r=>{var s,u;return((u=(s=r==null?void 0:r.custom_content)==null?void 0:s.attachments)==null?void 0:u.map(f=>({url:(f==null?void 0:f.url)||""})))||[]}))==null?void 0:o.filter(r=>!!(r!=null&&r.url)))||[]},Qr=({conversation:e,locale:n,onCloseModal:t,modalDividers:o,getConversation:r,generateConversationLink:s,chatExpiration:u,chatExpirationDays:f,close:l,chatWarning:c,shareLink:a,shareCopyLink:d,shareCopiedLink:g,shareDescription:w,shareRemoveAccessToUsers:m,chatName:v,getSharedConversations:p,revokeSharedConversations:k,baseUrl:C,id:x,clientSharedPage:N,clientSharedProp:b})=>{const[j,_]=h.useState(null),[D,T]=h.useState(),[S,y]=h.useState(!1),[M,I]=h.useState(!1),[K,H]=h.useState(),L=h.useMemo(()=>{var q;const G=C||window.location.origin;if(C&&C!==window.location.origin&&N&&b){const ce=(q=j==null?void 0:j.split(`/${X.SHARE_CONVERSATION_ROUTE}/`))==null?void 0:q[1];return`${G}/${N}?${b}=${ce}`}return`${G}/${n}${j}`},[C,j,n,N,b]);h.useEffect(()=>{(async()=>{try{const q=decodeURI(e?e==null?void 0:e.id:`${x==null?void 0:x[0]}/${n}/${x==null?void 0:x[1]}`),ce=`${decodeURI(q)}`,ue=await(r==null?void 0:r(ce)),ie=Kr(q,Xr(ue)),ve=await(s==null?void 0:s(ie)),he=await(p==null?void 0:p(se.getSharedConversationsRequest(se.ShareTarget.OTHERS)));ve&&he&&(y(!0),_(Zr(ve)),T(qr(e,he==null?void 0:he.resources)))}catch(q){y(!1),console.error("Error sharing conversation",q)}})()},[e,s,r,p,x,n]);const O=h.useCallback(()=>{t(),_(null),y(!1),I(!1)},[t]),B=h.useCallback(()=>{I(!0),navigator.clipboard.writeText(L||"")},[L]),Y=async()=>{try{H(!0),D&&await(k==null?void 0:k({resources:[D]}))}catch(G){H(!1),console.error("Error revoking shared conversation",G)}},U=h.useCallback(()=>i.jsx(E.Button,{buttonClassName:M?"text-button-secondary":"text-button-primary",iconBefore:M?i.jsx(ye.IconCheck,{width:20,height:20}):i.jsx(ye.IconCopy,{width:20,height:20}),title:M?g??"Copied":d??"Copy link",disabled:M,onClick:B}),[M,B,g,d]);return i.jsxs(E.Popup,{heading:a??"Share link",portalId:"share",size:E.PopUpSize.SM,dividers:o,onClose:O,closeButtonTitle:l??"Close",children:[S?i.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[e!=null&&e.name?i.jsxs("div",{className:"flex share-info w-full",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:v??"Chat name:"}),i.jsx("h3",{className:"flex-1 min-w-0 truncate",title:e==null?void 0:e.name,children:e==null?void 0:e.name})]}):null,i.jsxs("div",{className:"flex share-info",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:u??"Link expiration date:"}),i.jsxs("h3",{children:["3 ",f??"days"]})]}),i.jsx(yo,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:L,size:200}),i.jsx("p",{className:"body-2 text-neutrals-1000",children:w??"Your name, special instructions, and any messages you add after sharing remain confidential."}),i.jsx(E.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:L,value:L,inputId:"conversationLink",iconAfterInput:U()})]}):i.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:i.jsx(E.Loader,{})}),S?e&&D?i.jsx("div",{className:"remove-access",children:i.jsx(E.Button,{title:m??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:K,onClick:Y})}):i.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:c??"This chat has not been shared with anyone yet."}):i.jsx("div",{})]})},To=({shareButtonClass:e,shareIcon:n,...t})=>{const[o,r]=h.useState(E.PopUpState.Closed),s=()=>{r(E.PopUpState.Opened)},u=h.useCallback(()=>{r(E.PopUpState.Closed)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(E.Button,{buttonClassName:e||"text-button-secondary",title:(t==null?void 0:t.share)||"Share",iconBefore:n,onClick:s}),o===E.PopUpState.Opened&&i.jsx(Qr,{onCloseModal:u,...t})]})},Lo=({conversation:e,locale:n,isOpenedAdvancedView:t,isShowShareButton:o,shareConversationProps:r})=>i.jsx(i.Fragment,{children:i.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:[i.jsx("span",{className:V("flex-1 min-w-0 truncate h4","conversation-view-header-text"),title:e==null?void 0:e.name,children:e==null?void 0:e.name}),i.jsx("div",{className:"flex gap-4",children:!t&&o&&i.jsx("div",{className:"flex gap-x-2",children:i.jsx(To,{conversation:e,locale:n,...r})})})]})}),Oo=({content:e,textColorClass:n})=>{const{isOpenedAdvancedView:t}=Ie();return i.jsx("div",{className:V("prose max-w-none break-words",t?"body-2":"body-1",n),children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:n,...o}),a:({href:o,children:r,...s})=>i.jsx("a",{href:o,target:"_blank",...s,children:r})},children:e})})},_o=({choiceButtons:e,onClick:n})=>e.map(t=>{var o;return i.jsx("div",{className:"mt-4",children:i.jsxs("button",{type:"button",className:"flex flex-col items-start justify-center text-left w-full rounded border-hues-200 hover:bg-hues-100 min-h-[72px] border px-4 py-2",onClick:()=>{var r;return n((r=t[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:r.populateText,t==null?void 0:t.const)},"aria-label":"button",children:[i.jsx("h3",{className:"mb-1",children:t.title}),t.const!==an.COMPLETE&&i.jsx("p",{className:"body-1 text-neutrals-800",children:(o=t[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:o.populateText})]})},t.title)}),ei=({titles:e,messageContent:n,choiceButtons:t,onClick:o,handleOnboardingSkip:r})=>i.jsxs("div",{className:"onboarding w-full h-full flex flex-col flex-1 overflow-auto",children:[i.jsx(Lo,{conversation:{name:(e==null?void 0:e.onboardingTitle)??"Introducing the AI assistant"}}),i.jsxs("div",{className:"onboarding-content flex flex-col",children:[i.jsx(Oo,{content:n}),i.jsx("div",{className:"mt-4",children:i.jsx(_o,{choiceButtons:t,onClick:o})}),i.jsxs("div",{className:"flex mt-8",children:[i.jsx(E.Button,{title:e==null?void 0:e.skipOnboardingNow,buttonClassName:"text-button-secondary mr-4",onClick:()=>r==null?void 0:r(),isSmallButton:!0}),i.jsx(E.Button,{title:e==null?void 0:e.refuseOnboarding,buttonClassName:"text-button-tertiary",onClick:()=>r==null?void 0:r(!0),isSmallButton:!0})]})]})]}),Ro=({titles:e,openNewConversation:n})=>i.jsxs("div",{className:"text-center bg-accent-300 body-3 p-2",children:[i.jsx("span",{className:"mr-2 text-neutrals-900",children:e==null?void 0:e.onboardingFooter}),i.jsxs("span",{onClick:n,className:"cursor-pointer inline-flex align-top",children:[i.jsx(ye.IconPlus,{width:15,height:15}),i.jsx("p",{className:"ml-1",children:e==null?void 0:e.onboardingFooterLink})]})]}),Io=({firstLine:e,secondLine:n})=>{const t=e!=null&&e.trim()!=="",o=n!=null&&n.trim()!=="";return i.jsxs("div",{className:V("text-center body-3",o?"p-0":t?"p-1":"p-3"),children:[t&&i.jsx("div",{className:"text-neutrals-800",children:e}),o&&i.jsx("div",{className:"text-neutrals-800",children:n})]})},ni=({suggestionsList:e,welcomeText:n,titleIcon:t,actions:o,titles:r,inputMessageStyles:s,isBottomInputPosition:u,prompt:f,onboardingMessageSchema:l,handleConversationClick:c,setConversations:a,locale:d,setSharedConversations:g})=>{var M,I,K,H;const[w,m]=h.useState(null),[v,p]=h.useState(),{onboardingFileSchema:k,onboardingFileName:C,onboardingFilePath:x,isShowOnboarding:N,setIsShowOnboarding:b,setOnboardingFileSchema:j}=ke(),{isAgentAvailable:_}=E.useAgentAvailability(),{statusMessages:D}=Sn();h.useEffect(()=>{(async()=>{try{const O=await o.getBucket();m(O.bucket)}catch(O){console.error(O instanceof Error?O.message:"Request error")}})()},[o]);const T=h.useCallback(async(L,O)=>{var B,Y,U;p(!0),w||console.error("No bucket");try{const G=N?Fr(w||"",d,(r==null?void 0:r.onboardingTitle)??"Introducing the AI assistant",((Y=(B=l==null?void 0:l.properties)==null?void 0:B.choice)==null?void 0:Y.description)??"",L,O):Pr(w||"",d,r.newChat??"New chat",L),q=await o.createConversation(G,d,N),ce=await o.getConversations(d),ue=await o.getSharedConversations(se.getSharedConversationsRequest(se.ShareTarget.ME));if(l&&k){const ie={...k,isStarted:!0};await((U=o.putOnboardingFile)==null?void 0:U.call(o,C,x,ie)),j==null||j(ie)}a(X.cleanConversationNames(ce)),g(X.cleanConversationNames(jr.transformSharedConversations(ue,d))),c(q.folderId,q.id)}catch(G){console.error(G instanceof Error?G.message:"Creation conversation failed"),p(!1)}},[o,w,c,N,d,C,x,k,l,a,j,g,r.newChat,r==null?void 0:r.onboardingTitle]),S=h.useCallback(async L=>{var O;if(b(!1),L&&k){const B={...k,isSkipped:!0};await((O=o.putOnboardingFile)==null?void 0:O.call(o,C,x,B)),j==null||j(B)}},[o,C,x,k,b,j]);h.useEffect(()=>{f&&w&&T(f)},[w,f]);const y=()=>_?i.jsxs(i.Fragment,{children:[i.jsx(xo,{containerClasses:V(s.inputContainerClass,u&&"order-3 mt-auto"),inputClasses:"mr-2",placeholder:(r==null?void 0:r.askAnything)??"Ask anything...",sendMessageIcon:s.sendMessageIcon,onSendMessage:T}),i.jsx("div",{className:"max-w-full overflow-x-auto no-scrollbar",children:i.jsx("div",{className:V("flex flex-wrap justify-center gap-2 sm:flex-nowrap","tags-container"),children:e.map(L=>{var O;return i.jsx(E.Tag,{title:L.title,text:(O=L[re.DialSchemaProperties.DialWidgetOptions])==null?void 0:O.populateText,onClick:T},L.title)})})})]}):i.jsx(E.InlineAlert,{type:E.InlineAlertType.Error,children:D.assistantUnavailable});return i.jsxs("div",{className:"flex flex-col h-full w-full",children:[f||v?i.jsx(E.Loader,{}):N?i.jsx(ei,{titles:r,messageContent:((I=(M=l==null?void 0:l.properties)==null?void 0:M.choice)==null?void 0:I.description)||"",choiceButtons:((H=(K=l==null?void 0:l.properties)==null?void 0:K.choice)==null?void 0:H.oneOf)||[],handleOnboardingSkip:S,onClick:T}):i.jsxs("div",{className:"flex flex-col h-full items-center justify-center sm:px-4",children:[i.jsxs("div",{className:V("flex items-center max-w-full sm-min:px-4",u?"mt-auto mb-8":"mb-6"),children:[t,i.jsx("h1",{className:"text-hues-800 text-center sm:h2",children:n??(r==null?void 0:r.welcomeTitle)??"How can I help you?"})]}),y()]}),N&&i.jsx(Ro,{titles:r,openNewConversation:()=>b(!1)}),!N&&i.jsx(Io,{firstLine:r.footerFirstLine,secondLine:r.footerSecondLine})]})},Nn=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("path",{d:"M11.3301 6.25L8.00008 9.75L4.67008 6.25L11.3301 6.25Z",fill:"currentColor"})),ti=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),oi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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 Po(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Je={exports:{}},ri=Je.exports,Ft;function ii(){return Ft||(Ft=1,(function(e,n){(function(t,o){o(n)})(ri,(function(t){/*! *****************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
15
15
 
16
16
  Permission to use, copy, modify, and/or distribute this software for any
@@ -23,7 +23,7 @@
23
23
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
24
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
25
  PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */var o=function(){return o=Object.assign||function(Ae){for(var Je,cn=1,jr=arguments.length;cn<jr;cn++){Je=arguments[cn];for(var un in Je)Object.prototype.hasOwnProperty.call(Je,un)&&(Ae[un]=Je[un])}return Ae},o.apply(this,arguments)},r=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},s={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};r.l10ns.ar=s,r.l10ns;var u=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};u.l10ns.at=f,u.l10ns;var l=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},c={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};l.l10ns.az=c,l.l10ns;var a=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},d={weekdays:{shorthand:["Нд","Пн","Аў","Ср","Чц","Пт","Сб"],longhand:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"]},months:{shorthand:["Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"],longhand:["Студзень","Люты","Сакавік","Красавік","Травень","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Тыд.",scrollTitle:"Пракруціце для павелічэння",toggleTitle:"Націсніце для пераключэння",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};a.l10ns.be=d,a.l10ns;var g=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},w={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};g.l10ns.bs=w,g.l10ns;var m=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},x={weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},months:{shorthand:["Яну","Фев","Март","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек"],longhand:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"]},time_24hr:!0,firstDayOfWeek:1};m.l10ns.bg=x,m.l10ns;var p=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},C={weekdays:{shorthand:["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],longhand:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},months:{shorthand:["জানু","ফেব্রু","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],longhand:["জানুয়ারী","ফেব্রুয়ারী","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"]}};p.l10ns.bn=C,p.l10ns;var k=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},v={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(Q){var Ae=Q%100;if(Ae>3&&Ae<21)return"è";switch(Ae%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};k.l10ns.cat=k.l10ns.ca=v,k.l10ns;var N=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},b={weekdays:{shorthand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"],longhand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"]},months:{shorthand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"],longhand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"]},firstDayOfWeek:6,ordinal:function(){return""}};N.l10ns.ckb=b,N.l10ns;var E=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},R={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};E.l10ns.cs=R,E.l10ns;var D=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},T={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(Q){return Q===1?"af":Q===2?"ail":Q===3||Q===4?"ydd":Q===5||Q===6?"ed":Q>=7&&Q<=10||Q==12||Q==15||Q==18||Q==20?"fed":Q==11||Q==13||Q==14||Q==16||Q==17||Q==19?"eg":Q>=21&&Q<=39?"ain":""},time_24hr:!0};D.l10ns.cy=T,D.l10ns;var S=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},M={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};S.l10ns.da=M,S.l10ns;var y=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},P={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};y.l10ns.de=P,y.l10ns;var K={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(Q){var Ae=Q%100;if(Ae>3&&Ae<21)return"th";switch(Ae%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},H=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},O={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};H.l10ns.eo=O,H.l10ns;var L=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},B={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};L.l10ns.es=B,L.l10ns;var J=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Y={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=Y,J.l10ns;var G=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},q={weekdays:{shorthand:["یک","دو","سه","چهار","پنج","جمعه","شنبه"],longhand:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنچ‌شنبه","جمعه","شنبه"]},months:{shorthand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],longhand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]},firstDayOfWeek:6,ordinal:function(){return""}};G.l10ns.fa=q,G.l10ns;var ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ue={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};ce.l10ns.fi=ue,ce.l10ns;var ie=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},me={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};ie.l10ns.fo=me,ie.l10ns;var de=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},he={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(Q){return Q>1?"":"er"},rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"Défiler pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};de.l10ns.fr=he,de.l10ns;var Ne=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},pe={weekdays:{shorthand:["Κυ","Δε","Τρ","Τε","Πέ","Πα","Σά"],longhand:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},months:{shorthand:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αύγ","Σεπ","Οκτ","Νοέ","Δεκ"],longhand:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"Εβδ",rangeSeparator:" έως ",scrollTitle:"Μετακυλήστε για προσαύξηση",toggleTitle:"Κάντε κλικ για αλλαγή",amPM:["ΠΜ","ΜΜ"],yearAriaLabel:"χρόνος",monthAriaLabel:"μήνας",hourAriaLabel:"ώρα",minuteAriaLabel:"λεπτό"};Ne.l10ns.gr=pe,Ne.l10ns;var be=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},fe={weekdays:{shorthand:["א","ב","ג","ד","ה","ו","ש"],longhand:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},months:{shorthand:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],longhand:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},rangeSeparator:" אל ",time_24hr:!0};be.l10ns.he=fe,be.l10ns;var Ee=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ge={weekdays:{shorthand:["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],longhand:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"]},months:{shorthand:["जन","फर","मार्च","अप्रेल","मई","जून","जूलाई","अग","सित","अक्ट","नव","दि"],longhand:["जनवरी ","फरवरी","मार्च","अप्रेल","मई","जून","जूलाई","अगस्त ","सितम्बर","अक्टूबर","नवम्बर","दिसम्बर"]}};Ee.l10ns.hi=ge,Ee.l10ns;var Me=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Te={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};Me.l10ns.hr=Te,Me.l10ns;var Oe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ce={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};Oe.l10ns.hu=Ce,Oe.l10ns;var je=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ke={weekdays:{shorthand:["Կիր","Երկ","Երք","Չրք","Հնգ","Ուրբ","Շբթ"],longhand:["Կիրակի","Եկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},months:{shorthand:["Հնվ","Փտր","Մար","Ապր","Մայ","Հնս","Հլս","Օգս","Սեպ","Հոկ","Նմբ","Դեկ"],longhand:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"ՇԲՏ",scrollTitle:"Ոլորեք՝ մեծացնելու համար",toggleTitle:"Սեղմեք՝ փոխելու համար",amPM:["ՄԿ","ԿՀ"],yearAriaLabel:"Տարի",monthAriaLabel:"Ամիս",hourAriaLabel:"Ժամ",minuteAriaLabel:"Րոպե",time_24hr:!0};je.l10ns.hy=ke,je.l10ns;var F=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},z={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:" - "};F.l10ns.id=z,F.l10ns;var W=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ee={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};W.l10ns.is=ee,W.l10ns;var _=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},I={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};_.l10ns.it=I,_.l10ns;var U=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月"]},time_24hr:!0,rangeSeparator:" から ",monthAriaLabel:"月",amPM:["午前","午後"],yearAriaLabel:"年",hourAriaLabel:"時間",minuteAriaLabel:"分"};U.l10ns.ja=$,U.l10ns;var ne=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},te={weekdays:{shorthand:["კვ","ორ","სა","ოთ","ხუ","პა","შა"],longhand:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]},months:{shorthand:["იან","თებ","მარ","აპრ","მაი","ივნ","ივლ","აგვ","სექ","ოქტ","ნოე","დეკ"],longhand:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"კვ.",scrollTitle:"დასქროლეთ გასადიდებლად",toggleTitle:"დააკლიკეთ გადართვისთვის",amPM:["AM","PM"],yearAriaLabel:"წელი",time_24hr:!0};ne.l10ns.ka=te,ne.l10ns;var xe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Le={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:["오전","오후"]};xe.l10ns.ko=Le,xe.l10ns;var Tn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},On={weekdays:{shorthand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស.","សុក្រ","សៅរ៍"],longhand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស្បតិ៍","សុក្រ","សៅរ៍"]},months:{shorthand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"],longhand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"]},ordinal:function(){return""},firstDayOfWeek:1,rangeSeparator:" ដល់ ",weekAbbreviation:"សប្តាហ៍",scrollTitle:"រំកិលដើម្បីបង្កើន",toggleTitle:"ចុចដើម្បីផ្លាស់ប្ដូរ",yearAriaLabel:"ឆ្នាំ",time_24hr:!0};Tn.l10ns.km=On,Tn.l10ns;var Ln=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_n={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:"Жыл"};Ln.l10ns.kz=_n,Ln.l10ns;var Rn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},In={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};Rn.l10ns.lt=In,Rn.l10ns;var Pn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Vn={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};Pn.l10ns.lv=Vn,Pn.l10ns;var Fn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Bn={weekdays:{shorthand:["Не","По","Вт","Ср","Че","Пе","Са"],longhand:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},months:{shorthand:["Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Ное","Дек"],longhand:["Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"]},firstDayOfWeek:1,weekAbbreviation:"Нед.",rangeSeparator:" до ",time_24hr:!0};Fn.l10ns.mk=Bn,Fn.l10ns;var Hn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gn={firstDayOfWeek:1,weekdays:{shorthand:["Да","Мя","Лх","Пү","Ба","Бя","Ня"],longhand:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},months:{shorthand:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],longhand:["Нэгдүгээр сар","Хоёрдугаар сар","Гуравдугаар сар","Дөрөвдүгээр сар","Тавдугаар сар","Зургаадугаар сар","Долдугаар сар","Наймдугаар сар","Есдүгээр сар","Аравдугаар сар","Арваннэгдүгээр сар","Арванхоёрдугаар сар"]},rangeSeparator:"-с ",time_24hr:!0};Hn.l10ns.mn=Gn,Hn.l10ns;var kr=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Sr={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""}};kr.l10ns;var zn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Un={weekdays:{shorthand:["နွေ","လာ","ဂါ","ဟူး","ကြာ","သော","နေ"],longhand:["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"]},months:{shorthand:["ဇန်","ဖေ","မတ်","ပြီ","မေ","ဇွန်","လိုင်","သြ","စက်","အောက်","နို","ဒီ"],longhand:["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","သြဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0};zn.l10ns.my=Un,zn.l10ns;var Wn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},$n={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(Q){return Q===1||Q===8||Q>=20?"ste":"de"}};Wn.l10ns.nl=$n,Wn.l10ns;var Jn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Yn={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"."}};Jn.l10ns.nn=Yn,Jn.l10ns;var Kn=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"."}};Kn.l10ns.no=Zn,Kn.l10ns;var qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Xn={weekdays:{shorthand:["ਐਤ","ਸੋਮ","ਮੰਗਲ","ਬੁੱਧ","ਵੀਰ","ਸ਼ੁੱਕਰ","ਸ਼ਨਿੱਚਰ"],longhand:["ਐਤਵਾਰ","ਸੋਮਵਾਰ","ਮੰਗਲਵਾਰ","ਬੁੱਧਵਾਰ","ਵੀਰਵਾਰ","ਸ਼ੁੱਕਰਵਾਰ","ਸ਼ਨਿੱਚਰਵਾਰ"]},months:{shorthand:["ਜਨ","ਫ਼ਰ","ਮਾਰ","ਅਪ੍ਰੈ","ਮਈ","ਜੂਨ","ਜੁਲਾ","ਅਗ","ਸਤੰ","ਅਕ","ਨਵੰ","ਦਸੰ"],longhand:["ਜਨਵਰੀ","ਫ਼ਰਵਰੀ","ਮਾਰਚ","ਅਪ੍ਰੈਲ","ਮਈ","ਜੂਨ","ਜੁਲਾਈ","ਅਗਸਤ","ਸਤੰਬਰ","ਅਕਤੂਬਰ","ਨਵੰਬਰ","ਦਸੰਬਰ"]},time_24hr:!0};qn.l10ns.pa=Xn,qn.l10ns;var Qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},et={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"."}};Qn.l10ns.pl=et,Qn.l10ns;var nt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},tt={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};nt.l10ns.pt=tt,nt.l10ns;var ot=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},rt={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""}};ot.l10ns.ro=rt,ot.l10ns;var it=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},st={weekdays:{shorthand:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},months:{shorthand:["Янв","Фев","Март","Апр","Май","Июнь","Июль","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Нед.",scrollTitle:"Прокрутите для увеличения",toggleTitle:"Нажмите для переключения",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};it.l10ns.ru=st,it.l10ns;var lt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},at={weekdays:{shorthand:["ඉ","ස","අ","බ","බ්‍ර","සි","සෙ"],longhand:["ඉරිදා","සඳුදා","අඟහරුවාදා","බදාදා","බ්‍රහස්පතින්දා","සිකුරාදා","සෙනසුරාදා"]},months:{shorthand:["ජන","පෙබ","මාර්","අප්‍රේ","මැයි","ජුනි","ජූලි","අගෝ","සැප්","ඔක්","නොවැ","දෙසැ"],longhand:["ජනවාරි","පෙබරවාරි","මාර්තු","අප්‍රේල්","මැයි","ජුනි","ජූලි","අගෝස්තු","සැප්තැම්බර්","ඔක්තෝබර්","නොවැම්බර්","දෙසැම්බර්"]},time_24hr:!0};lt.l10ns.si=at,lt.l10ns;var ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ut={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"."}};ct.l10ns.sk=ut,ct.l10ns;var dt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ht={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"."}};dt.l10ns.sl=ht,dt.l10ns;var ft=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},gt={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};ft.l10ns.sq=gt,ft.l10ns;var wt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},mt={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};wt.l10ns.sr=mt,wt.l10ns;var pt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},xt={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"."}};pt.l10ns.sv=xt,pt.l10ns;var vt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},bt={weekdays:{shorthand:["อา","จ","อ","พ","พฤ","ศ","ส"],longhand:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"]},months:{shorthand:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],longhand:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},firstDayOfWeek:1,rangeSeparator:" ถึง ",scrollTitle:"เลื่อนเพื่อเพิ่มหรือลด",toggleTitle:"คลิกเพื่อเปลี่ยน",time_24hr:!0,ordinal:function(){return""}};vt.l10ns.th=bt,vt.l10ns;var Ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},kt={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};Ct.l10ns.tr=kt,Ct.l10ns;var St=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Nt={firstDayOfWeek:1,weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},months:{shorthand:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],longhand:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"]},time_24hr:!0};St.l10ns.uk=Nt,St.l10ns;var jt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Et={weekdays:{shorthand:["Якш","Душ","Сеш","Чор","Пай","Жум","Шан"],longhand:["Якшанба","Душанба","Сешанба","Чоршанба","Пайшанба","Жума","Шанба"]},months:{shorthand:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январ","Феврал","Март","Апрел","Май","Июн","Июл","Август","Сентябр","Октябр","Ноябр","Декабр"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Ҳафта",scrollTitle:"Катталаштириш учун айлантиринг",toggleTitle:"Ўтиш учун босинг",amPM:["AM","PM"],yearAriaLabel:"Йил",time_24hr:!0};jt.l10ns.uz=Et,jt.l10ns;var At=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Dt={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};At.l10ns.uz_latn=Dt,At.l10ns;var yt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Mt={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 "};yt.l10ns.vn=Mt,yt.l10ns;var Tt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ot={weekdays:{shorthand:["周日","周一","周二","周三","周四","周五","周六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"周",scrollTitle:"滚动切换",toggleTitle:"点击切换 12/24 小时时制"};Tt.l10ns.zh=Ot,Tt.l10ns;var Lt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_t={weekdays:{shorthand:["週日","週一","週二","週三","週四","週五","週六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"週",scrollTitle:"滾動切換",toggleTitle:"點擊切換 12/24 小時時制"};Lt.l10ns.zh_tw=_t,Lt.l10ns;var Nr={ar:s,at:f,az:c,be:d,bg:x,bn:C,bs:w,ca:v,ckb:b,cat:v,cs:R,cy:T,da:M,de:P,default:o({},K),en:K,eo:O,es:B,et:Y,fa:q,fi:ue,fo:me,fr:he,gr:pe,he:fe,hi:ge,hr:Te,hu:Ce,hy:ke,id:z,is:ee,it:I,ja:$,ka:te,ko:Le,km:On,kz:_n,lt:In,lv:Vn,mk:Bn,mn:Gn,ms:Sr,my:Un,nl:$n,nn:Yn,no:Zn,pa:Xn,pl:et,pt:tt,ro:rt,ru:st,si:at,sk:ut,sl:ht,sq:gt,sr:mt,sv:xt,th:bt,tr:kt,uk:Nt,vn:Mt,zh:Ot,zh_tw:_t,uz:Et,uz_latn:Dt};t.default=Nr,Object.defineProperty(t,"__esModule",{value:!0})}))})(Ue,Ue.exports)),Ue.exports}var si=ii();const li=Po(si);var Ze={exports:{}},ai=Ze.exports,Bt;function ci(){return Bt||(Bt=1,(function(e,n){(function(t,o){e.exports=o()})(ai,(function(){/*! *****************************************************************************
26
+ ***************************************************************************** */var o=function(){return o=Object.assign||function(Te){for(var Ze,hn=1,Er=arguments.length;hn<Er;hn++){Ze=arguments[hn];for(var fn in Ze)Object.prototype.hasOwnProperty.call(Ze,fn)&&(Te[fn]=Ze[fn])}return Te},o.apply(this,arguments)},r=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},s={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};r.l10ns.ar=s,r.l10ns;var u=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};u.l10ns.at=f,u.l10ns;var l=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},c={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};l.l10ns.az=c,l.l10ns;var a=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},d={weekdays:{shorthand:["Нд","Пн","Аў","Ср","Чц","Пт","Сб"],longhand:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"]},months:{shorthand:["Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"],longhand:["Студзень","Люты","Сакавік","Красавік","Травень","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Тыд.",scrollTitle:"Пракруціце для павелічэння",toggleTitle:"Націсніце для пераключэння",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};a.l10ns.be=d,a.l10ns;var g=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},w={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};g.l10ns.bs=w,g.l10ns;var m=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},v={weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},months:{shorthand:["Яну","Фев","Март","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек"],longhand:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"]},time_24hr:!0,firstDayOfWeek:1};m.l10ns.bg=v,m.l10ns;var p=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},k={weekdays:{shorthand:["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],longhand:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},months:{shorthand:["জানু","ফেব্রু","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],longhand:["জানুয়ারী","ফেব্রুয়ারী","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"]}};p.l10ns.bn=k,p.l10ns;var C=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},x={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(ee){var Te=ee%100;if(Te>3&&Te<21)return"è";switch(Te%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};C.l10ns.cat=C.l10ns.ca=x,C.l10ns;var N=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},b={weekdays:{shorthand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"],longhand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"]},months:{shorthand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"],longhand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"]},firstDayOfWeek:6,ordinal:function(){return""}};N.l10ns.ckb=b,N.l10ns;var j=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_={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};j.l10ns.cs=_,j.l10ns;var D=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},T={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(ee){return ee===1?"af":ee===2?"ail":ee===3||ee===4?"ydd":ee===5||ee===6?"ed":ee>=7&&ee<=10||ee==12||ee==15||ee==18||ee==20?"fed":ee==11||ee==13||ee==14||ee==16||ee==17||ee==19?"eg":ee>=21&&ee<=39?"ain":""},time_24hr:!0};D.l10ns.cy=T,D.l10ns;var S=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},y={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};S.l10ns.da=y,S.l10ns;var M=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};M.l10ns.de=I,M.l10ns;var K={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(ee){var Te=ee%100;if(Te>3&&Te<21)return"th";switch(Te%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},H=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},L={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};H.l10ns.eo=L,H.l10ns;var O=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},B={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};O.l10ns.es=B,O.l10ns;var Y=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},U={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};Y.l10ns.et=U,Y.l10ns;var G=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},q={weekdays:{shorthand:["یک","دو","سه","چهار","پنج","جمعه","شنبه"],longhand:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنچ‌شنبه","جمعه","شنبه"]},months:{shorthand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],longhand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]},firstDayOfWeek:6,ordinal:function(){return""}};G.l10ns.fa=q,G.l10ns;var ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ue={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};ce.l10ns.fi=ue,ce.l10ns;var ie=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ve={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};ie.l10ns.fo=ve,ie.l10ns;var he=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},fe={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(ee){return ee>1?"":"er"},rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"Défiler pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};he.l10ns.fr=fe,he.l10ns;var je=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},be={weekdays:{shorthand:["Κυ","Δε","Τρ","Τε","Πέ","Πα","Σά"],longhand:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},months:{shorthand:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αύγ","Σεπ","Οκτ","Νοέ","Δεκ"],longhand:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"Εβδ",rangeSeparator:" έως ",scrollTitle:"Μετακυλήστε για προσαύξηση",toggleTitle:"Κάντε κλικ για αλλαγή",amPM:["ΠΜ","ΜΜ"],yearAriaLabel:"χρόνος",monthAriaLabel:"μήνας",hourAriaLabel:"ώρα",minuteAriaLabel:"λεπτό"};je.l10ns.gr=be,je.l10ns;var Ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ge={weekdays:{shorthand:["א","ב","ג","ד","ה","ו","ש"],longhand:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},months:{shorthand:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],longhand:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},rangeSeparator:" אל ",time_24hr:!0};Ce.l10ns.he=ge,Ce.l10ns;var De=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},we={weekdays:{shorthand:["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],longhand:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"]},months:{shorthand:["जन","फर","मार्च","अप्रेल","मई","जून","जूलाई","अग","सित","अक्ट","नव","दि"],longhand:["जनवरी ","फरवरी","मार्च","अप्रेल","मई","जून","जूलाई","अगस्त ","सितम्बर","अक्टूबर","नवम्बर","दिसम्बर"]}};De.l10ns.hi=we,De.l10ns;var Oe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_e={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};Oe.l10ns.hr=_e,Oe.l10ns;var Re=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Se={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};Re.l10ns.hu=Se,Re.l10ns;var Ae=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ne={weekdays:{shorthand:["Կիր","Երկ","Երք","Չրք","Հնգ","Ուրբ","Շբթ"],longhand:["Կիրակի","Եկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},months:{shorthand:["Հնվ","Փտր","Մար","Ապր","Մայ","Հնս","Հլս","Օգս","Սեպ","Հոկ","Նմբ","Դեկ"],longhand:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"ՇԲՏ",scrollTitle:"Ոլորեք՝ մեծացնելու համար",toggleTitle:"Սեղմեք՝ փոխելու համար",amPM:["ՄԿ","ԿՀ"],yearAriaLabel:"Տարի",monthAriaLabel:"Ամիս",hourAriaLabel:"Ժամ",minuteAriaLabel:"Րոպե",time_24hr:!0};Ae.l10ns.hy=Ne,Ae.l10ns;var P=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},W={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:" - "};P.l10ns.id=W,P.l10ns;var $=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ne={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};$.l10ns.is=ne,$.l10ns;var de=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},me={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};de.l10ns.it=me,de.l10ns;var R=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},F={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:"分"};R.l10ns.ja=F,R.l10ns;var J=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},z={weekdays:{shorthand:["კვ","ორ","სა","ოთ","ხუ","პა","შა"],longhand:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]},months:{shorthand:["იან","თებ","მარ","აპრ","მაი","ივნ","ივლ","აგვ","სექ","ოქტ","ნოე","დეკ"],longhand:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"კვ.",scrollTitle:"დასქროლეთ გასადიდებლად",toggleTitle:"დააკლიკეთ გადართვისთვის",amPM:["AM","PM"],yearAriaLabel:"წელი",time_24hr:!0};J.l10ns.ka=z,J.l10ns;var Q=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},te={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:["오전","오후"]};Q.l10ns.ko=te,Q.l10ns;var pe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Me={weekdays:{shorthand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស.","សុក្រ","សៅរ៍"],longhand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស្បតិ៍","សុក្រ","សៅរ៍"]},months:{shorthand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"],longhand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"]},ordinal:function(){return""},firstDayOfWeek:1,rangeSeparator:" ដល់ ",weekAbbreviation:"សប្តាហ៍",scrollTitle:"រំកិលដើម្បីបង្កើន",toggleTitle:"ចុចដើម្បីផ្លាស់ប្ដូរ",yearAriaLabel:"ឆ្នាំ",time_24hr:!0};pe.l10ns.km=Me,pe.l10ns;var Fe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_n={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:"Жыл"};Fe.l10ns.kz=_n,Fe.l10ns;var Rn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},In={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};Rn.l10ns.lt=In,Rn.l10ns;var Pn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Vn={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};Pn.l10ns.lv=Vn,Pn.l10ns;var Fn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Bn={weekdays:{shorthand:["Не","По","Вт","Ср","Че","Пе","Са"],longhand:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},months:{shorthand:["Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Ное","Дек"],longhand:["Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"]},firstDayOfWeek:1,weekAbbreviation:"Нед.",rangeSeparator:" до ",time_24hr:!0};Fn.l10ns.mk=Bn,Fn.l10ns;var Hn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gn={firstDayOfWeek:1,weekdays:{shorthand:["Да","Мя","Лх","Пү","Ба","Бя","Ня"],longhand:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},months:{shorthand:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],longhand:["Нэгдүгээр сар","Хоёрдугаар сар","Гуравдугаар сар","Дөрөвдүгээр сар","Тавдугаар сар","Зургаадугаар сар","Долдугаар сар","Наймдугаар сар","Есдүгээр сар","Аравдугаар сар","Арваннэгдүгээр сар","Арванхоёрдугаар сар"]},rangeSeparator:"-с ",time_24hr:!0};Hn.l10ns.mn=Gn,Hn.l10ns;var kr=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Sr={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""}};kr.l10ns;var zn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Un={weekdays:{shorthand:["နွေ","လာ","ဂါ","ဟူး","ကြာ","သော","နေ"],longhand:["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"]},months:{shorthand:["ဇန်","ဖေ","မတ်","ပြီ","မေ","ဇွန်","လိုင်","သြ","စက်","အောက်","နို","ဒီ"],longhand:["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","သြဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0};zn.l10ns.my=Un,zn.l10ns;var Wn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},$n={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(ee){return ee===1||ee===8||ee>=20?"ste":"de"}};Wn.l10ns.nl=$n,Wn.l10ns;var Jn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Yn={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"."}};Jn.l10ns.nn=Yn,Jn.l10ns;var Kn=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"."}};Kn.l10ns.no=Zn,Kn.l10ns;var qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Xn={weekdays:{shorthand:["ਐਤ","ਸੋਮ","ਮੰਗਲ","ਬੁੱਧ","ਵੀਰ","ਸ਼ੁੱਕਰ","ਸ਼ਨਿੱਚਰ"],longhand:["ਐਤਵਾਰ","ਸੋਮਵਾਰ","ਮੰਗਲਵਾਰ","ਬੁੱਧਵਾਰ","ਵੀਰਵਾਰ","ਸ਼ੁੱਕਰਵਾਰ","ਸ਼ਨਿੱਚਰਵਾਰ"]},months:{shorthand:["ਜਨ","ਫ਼ਰ","ਮਾਰ","ਅਪ੍ਰੈ","ਮਈ","ਜੂਨ","ਜੁਲਾ","ਅਗ","ਸਤੰ","ਅਕ","ਨਵੰ","ਦਸੰ"],longhand:["ਜਨਵਰੀ","ਫ਼ਰਵਰੀ","ਮਾਰਚ","ਅਪ੍ਰੈਲ","ਮਈ","ਜੂਨ","ਜੁਲਾਈ","ਅਗਸਤ","ਸਤੰਬਰ","ਅਕਤੂਬਰ","ਨਵੰਬਰ","ਦਸੰਬਰ"]},time_24hr:!0};qn.l10ns.pa=Xn,qn.l10ns;var Qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},et={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"."}};Qn.l10ns.pl=et,Qn.l10ns;var nt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},tt={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};nt.l10ns.pt=tt,nt.l10ns;var ot=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},rt={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""}};ot.l10ns.ro=rt,ot.l10ns;var it=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},st={weekdays:{shorthand:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},months:{shorthand:["Янв","Фев","Март","Апр","Май","Июнь","Июль","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Нед.",scrollTitle:"Прокрутите для увеличения",toggleTitle:"Нажмите для переключения",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};it.l10ns.ru=st,it.l10ns;var lt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},at={weekdays:{shorthand:["ඉ","ස","අ","බ","බ්‍ර","සි","සෙ"],longhand:["ඉරිදා","සඳුදා","අඟහරුවාදා","බදාදා","බ්‍රහස්පතින්දා","සිකුරාදා","සෙනසුරාදා"]},months:{shorthand:["ජන","පෙබ","මාර්","අප්‍රේ","මැයි","ජුනි","ජූලි","අගෝ","සැප්","ඔක්","නොවැ","දෙසැ"],longhand:["ජනවාරි","පෙබරවාරි","මාර්තු","අප්‍රේල්","මැයි","ජුනි","ජූලි","අගෝස්තු","සැප්තැම්බර්","ඔක්තෝබර්","නොවැම්බර්","දෙසැම්බර්"]},time_24hr:!0};lt.l10ns.si=at,lt.l10ns;var ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ut={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"."}};ct.l10ns.sk=ut,ct.l10ns;var dt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ht={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"."}};dt.l10ns.sl=ht,dt.l10ns;var ft=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},gt={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};ft.l10ns.sq=gt,ft.l10ns;var wt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},mt={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};wt.l10ns.sr=mt,wt.l10ns;var pt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},xt={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"."}};pt.l10ns.sv=xt,pt.l10ns;var vt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},bt={weekdays:{shorthand:["อา","จ","อ","พ","พฤ","ศ","ส"],longhand:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"]},months:{shorthand:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],longhand:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},firstDayOfWeek:1,rangeSeparator:" ถึง ",scrollTitle:"เลื่อนเพื่อเพิ่มหรือลด",toggleTitle:"คลิกเพื่อเปลี่ยน",time_24hr:!0,ordinal:function(){return""}};vt.l10ns.th=bt,vt.l10ns;var Ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},kt={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};Ct.l10ns.tr=kt,Ct.l10ns;var St=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Nt={firstDayOfWeek:1,weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},months:{shorthand:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],longhand:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"]},time_24hr:!0};St.l10ns.uk=Nt,St.l10ns;var Et=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},jt={weekdays:{shorthand:["Якш","Душ","Сеш","Чор","Пай","Жум","Шан"],longhand:["Якшанба","Душанба","Сешанба","Чоршанба","Пайшанба","Жума","Шанба"]},months:{shorthand:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январ","Феврал","Март","Апрел","Май","Июн","Июл","Август","Сентябр","Октябр","Ноябр","Декабр"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Ҳафта",scrollTitle:"Катталаштириш учун айлантиринг",toggleTitle:"Ўтиш учун босинг",amPM:["AM","PM"],yearAriaLabel:"Йил",time_24hr:!0};Et.l10ns.uz=jt,Et.l10ns;var At=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Dt={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};At.l10ns.uz_latn=Dt,At.l10ns;var Mt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},yt={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 "};Mt.l10ns.vn=yt,Mt.l10ns;var Tt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Lt={weekdays:{shorthand:["周日","周一","周二","周三","周四","周五","周六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"周",scrollTitle:"滚动切换",toggleTitle:"点击切换 12/24 小时时制"};Tt.l10ns.zh=Lt,Tt.l10ns;var Ot=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_t={weekdays:{shorthand:["週日","週一","週二","週三","週四","週五","週六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"週",scrollTitle:"滾動切換",toggleTitle:"點擊切換 12/24 小時時制"};Ot.l10ns.zh_tw=_t,Ot.l10ns;var Nr={ar:s,at:f,az:c,be:d,bg:v,bn:k,bs:w,ca:x,ckb:b,cat:x,cs:_,cy:T,da:y,de:I,default:o({},K),en:K,eo:L,es:B,et:U,fa:q,fi:ue,fo:ve,fr:fe,gr:be,he:ge,hi:we,hr:_e,hu:Se,hy:Ne,id:W,is:ne,it:me,ja:F,ka:z,ko:te,km:Me,kz:_n,lt:In,lv:Vn,mk:Bn,mn:Gn,ms:Sr,my:Un,nl:$n,nn:Yn,no:Zn,pa:Xn,pl:et,pt:tt,ro:rt,ru:st,si:at,sk:ut,sl:ht,sq:gt,sr:mt,sv:xt,th:bt,tr:kt,uk:Nt,vn:yt,zh:Lt,zh_tw:_t,uz:jt,uz_latn:Dt};t.default=Nr,Object.defineProperty(t,"__esModule",{value:!0})}))})(Je,Je.exports)),Je.exports}var si=ii();const li=Po(si);var Qe={exports:{}},ai=Qe.exports,Bt;function ci(){return Bt||(Bt=1,(function(e,n){(function(t,o){e.exports=o()})(ai,(function(){/*! *****************************************************************************
27
27
  Copyright (c) Microsoft Corporation.
28
28
 
29
29
  Permission to use, copy, modify, and/or distribute this software for any
@@ -36,5 +36,5 @@
36
36
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
37
37
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
38
  PERFORMANCE OF THIS SOFTWARE.
39
- ***************************************************************************** */var t=function(){return t=Object.assign||function(c){for(var a,d=1,g=arguments.length;d<g;d++){a=arguments[d];for(var w in a)Object.prototype.hasOwnProperty.call(a,w)&&(c[w]=a[w])}return c},t.apply(this,arguments)},o=function(l,c,a){return a.months[c?"shorthand":"longhand"][l]};function r(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function s(l){try{if(typeof l.composedPath=="function"){var c=l.composedPath();return c[0]}return l.target}catch{return l.target}}var u={shorthand:!1,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function f(l){var c=t(t({},u),l);return function(a){a.config.dateFormat=c.dateFormat,a.config.altFormat=c.altFormat;var d={monthsContainer:null};function g(){if(a.rContainer){r(a.rContainer);for(var S=0;S<a.monthElements.length;S++){var M=a.monthElements[S];M.parentNode&&M.parentNode.removeChild(M)}}}function w(){a.rContainer&&(d.monthsContainer=a._createElement("div","flatpickr-monthSelect-months"),d.monthsContainer.tabIndex=-1,m(),a.rContainer.appendChild(d.monthsContainer),a.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+c.theme))}function m(){if(d.monthsContainer){r(d.monthsContainer);for(var S=document.createDocumentFragment(),M=0;M<12;M++){var y=a.createDay("flatpickr-monthSelect-month",new Date(a.currentYear,M),0,M);y.dateObj.getMonth()===new Date().getMonth()&&y.dateObj.getFullYear()===new Date().getFullYear()&&y.classList.add("today"),y.textContent=o(M,c.shorthand,a.l10n),y.addEventListener("click",k),S.appendChild(y)}d.monthsContainer.appendChild(S),a.config.minDate&&a.currentYear===a.config.minDate.getFullYear()?a.prevMonthNav.classList.add("flatpickr-disabled"):a.prevMonthNav.classList.remove("flatpickr-disabled"),a.config.maxDate&&a.currentYear===a.config.maxDate.getFullYear()?a.nextMonthNav.classList.add("flatpickr-disabled"):a.nextMonthNav.classList.remove("flatpickr-disabled")}}function x(){a._bind(a.prevMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear-1),C(),m()}),a._bind(a.nextMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear+1),C(),m()}),a._bind(d.monthsContainer,"mouseover",function(S){a.config.mode==="range"&&a.onMouseOver(s(S),"flatpickr-monthSelect-month")})}function p(){if(a.rContainer&&a.selectedDates.length){for(var S=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"),M=0;M<S.length;M++)S[M].classList.remove("selected");var y=a.selectedDates[0].getMonth(),P=a.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(y+1)+")");P&&P.classList.add("selected")}}function C(){var S=a.selectedDates[0];if(S&&(S=new Date(S),S.setFullYear(a.currentYear),a.config.minDate&&S<a.config.minDate&&(S=a.config.minDate),a.config.maxDate&&S>a.config.maxDate&&(S=a.config.maxDate),a.currentYear=S.getFullYear()),a.currentYearElement.value=String(a.currentYear),a.rContainer){var M=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month");M.forEach(function(y){y.dateObj.setFullYear(a.currentYear),a.config.minDate&&y.dateObj<a.config.minDate||a.config.maxDate&&y.dateObj>a.config.maxDate?y.classList.add("flatpickr-disabled"):y.classList.remove("flatpickr-disabled")})}p()}function k(S){S.preventDefault(),S.stopPropagation();var M=s(S);if(M instanceof Element&&!M.classList.contains("flatpickr-disabled")&&!M.classList.contains("notAllowed")&&(v(M.dateObj),a.config.closeOnSelect)){var y=a.config.mode==="single",P=a.config.mode==="range"&&a.selectedDates.length===2;(y||P)&&a.close()}}function v(S){var M=new Date(a.currentYear,S.getMonth(),S.getDate()),y=[];switch(a.config.mode){case"single":y=[M];break;case"multiple":y.push(M);break;case"range":a.selectedDates.length===2?y=[M]:(y=a.selectedDates.concat([M]),y.sort(function(P,K){return P.getTime()-K.getTime()}));break}a.setDate(y,!0),p()}var N={37:-1,39:1,40:3,38:-3};function b(S,M,y,P){var K=N[P.keyCode]!==void 0;if(!(!K&&P.keyCode!==13)&&!(!a.rContainer||!d.monthsContainer)){var H=a.rContainer.querySelector(".flatpickr-monthSelect-month.selected"),O=Array.prototype.indexOf.call(d.monthsContainer.children,document.activeElement);if(O===-1){var L=H||d.monthsContainer.firstElementChild;L.focus(),O=L.$i}K?d.monthsContainer.children[(12+O+N[P.keyCode])%12].focus():P.keyCode===13&&d.monthsContainer.contains(document.activeElement)&&v(document.activeElement.dateObj)}}function E(){var S;((S=a.config)===null||S===void 0?void 0:S.mode)==="range"&&a.selectedDates.length===1&&a.clear(!1),a.selectedDates.length||m()}function R(){c._stubbedCurrentMonth=a._initialDate.getMonth(),a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth}function D(){c._stubbedCurrentMonth&&(a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth,delete c._stubbedCurrentMonth)}function T(){if(d.monthsContainer!==null)for(var S=d.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"),M=0;M<S.length;M++)S[M].removeEventListener("click",k)}return{onParseConfig:function(){a.config.enableTime=!1},onValueUpdate:p,onKeyDown:b,onReady:[R,g,w,x,p,function(){a.config.onClose.push(E),a.loadedPlugins.push("monthSelect")}],onDestroy:[D,T,function(){a.config.onClose=a.config.onClose.filter(function(S){return S!==E})}]}}}return f}))})(Ze)),Ze.exports}var ui=ci();const di=Po(ui),Ht=(e,n,t,o,r=!1,s)=>{const u={...li[o]},f=di;r&&(u.firstDayOfWeek=1);const l={minDate:t===X.CalendarResolution.MONTH?new Date(e.getFullYear(),e.getMonth()):e,maxDate:t===X.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n,locale:u};return t===X.CalendarResolution.MONTH?{...l,dateFormat:"M Y",plugins:[new f({shorthand:!0,dateFormat:"M Y"})]}:{...l,monthSelectorType:"static",dateFormat:s||"d.m.Y"}},Gt=e=>{e!=null&&e.setMinutes(e.getMinutes()-e.getTimezoneOffset())},hi={year:"numeric",month:"short",day:"numeric"},nn=(e,n)=>(e==null?void 0:e.toLocaleDateString(n,hi))||"",fi=(e,n)=>{const{startPeriod:t,endPeriod:o}=e;if(!n.startPeriod&&!n.endPeriod&&t&&o)return{startPeriod:new Date(t==null?void 0:t.getTime()),endPeriod:new Date(o==null?void 0:o.getTime())};const r=t?new Date(Math.max(t.getTime(),n.startPeriod.getTime())):n.startPeriod,s=o?new Date(Math.min(o.getTime(),n.endPeriod.getTime())):n.endPeriod;return{startPeriod:r,endPeriod:s}},gi=(e,n)=>{var l;const{endPeriod:t}=e,o=(t==null?void 0:t.getFullYear())||new Date().getFullYear(),r=o+ +n,s=new Date(+n<0?o:r,(t==null?void 0:t.getMonth())||0,(t==null?void 0:t.getDate())||1),u=new Date(+n<0?r:o,0,1);return{startPeriod:new Date(Math.max(u.getTime(),((l=e==null?void 0:e.startPeriod)==null?void 0:l.getTime())||0)),endPeriod:s}},wi=e=>({quarterly:(e==null?void 0:e.quarterly)||"Q",monthly:(e==null?void 0:e.monthly)||"M"}),mi=(e,n)=>{const t=wi(n);return A.isQuarterly(e)&&(t!=null&&t.quarterly)?e==null?void 0:e.replace(/Q/g,t==null?void 0:t.quarterly):A.isMonthly(e)&&(t!=null&&t.monthly)?e==null?void 0:e.replace(/M/g,t==null?void 0:t.monthly):e};var Fe=(e=>(e.FLAT_LIST="FLAT_LIST",e.HIERARCHY="HIERARCHY",e))(Fe||{});const pi=(e,n,t,o)=>(e==null?void 0:e.map(r=>{var l;const s=(l=A.findCodelistByDimension(n==null?void 0:n.codelists,n==null?void 0:n.conceptSchemes,r))==null?void 0:l.codes,u=A.getAvailableCodes(r,t,s,o),f=s==null?void 0:s.some(c=>c==null?void 0:c.parent);return{id:r==null?void 0:r.id,title:A.getDimensionTitle(n==null?void 0:n.conceptSchemes,r,o),dimensionValues:u,isTimeDimension:(r==null?void 0:r.type)===A.DimensionType.TIME_DIMENSION,isHierarchical:f,displayMode:f?Fe.HIERARCHY:Fe.FLAT_LIST}}))||[],zt=(e,n)=>e==null?void 0:e.map(t=>n&&(t==null?void 0:t.id)===(n==null?void 0:n.id)?{...n,isSelectedFilter:!0}:{...t,isSelectedFilter:!1}),xi=(e,n,t)=>e?e.map(o=>(o==null?void 0:o.id)===n?{...o,displayMode:t}:o):[],Vo=e=>(e==null?void 0:e.filter(n=>!!(n!=null&&n.isSelectedValue)))||[],Fo=e=>e==null?void 0:e.map(n=>({...n,dimensionValues:Vo(n==null?void 0:n.dimensionValues)})).filter(n=>{var t,o,r;return((t=n.dimensionValues)==null?void 0:t.length)||((o=n.timeRange)==null?void 0:o.startPeriod)||((r=n.timeRange)==null?void 0:r.endPeriod)}),vi=e=>(e==null?void 0:e.reduce((n,t)=>{var o;return(((o=t==null?void 0:t.dimensionValues)==null?void 0:o.length)??0)+n},0))||0,Bo=e=>{var n;return{...e,dimensionValues:(n=e==null?void 0:e.dimensionValues)==null?void 0:n.map(t=>({...t,isSelectedValue:!1})),timeRange:void 0}},bi=(e,n)=>e==null?void 0:e.map(t=>(t==null?void 0:t.id)===n?Bo(t):t),Ci=e=>e==null?void 0:e.map(n=>Bo(n)),ki=(e,n,t)=>e.map(o=>{var u,f;const r=n==null?void 0:n.filters.find(l=>l.componentCode===o.id);let s=[];if(r)if(o.isTimeDimension){const l=r.values.filter(w=>!!w),c=A.getAnnotationPeriod((u=t==null?void 0:t[0])==null?void 0:u.annotations),a=l[0]?X.getTimePeriod(l[0]):null,d=l[1]?X.getTimePeriod(l[1]):null;let g=c;return a&&d&&(g=c?fi({startPeriod:a,endPeriod:d},c):{startPeriod:a,endPeriod:d}),{...o,timeRange:g}}else s=(f=o==null?void 0:o.dimensionValues)==null?void 0:f.map(c=>{var a;return(a=r==null?void 0:r.values)!=null&&a.includes(c.id)?{...c,isSelectedValue:!0}:c});else s=o.dimensionValues;return{...o,dimensionValues:s}}),Ut=e=>e==null?void 0:e.map(n=>({...n,isDisabled:!0})),Si=e=>new Map(e==null?void 0:e.map(n=>[n.id,{...n,children:[]}])),Ni=e=>{if(!e)return[];const n=Si(e),t=[];return e.forEach(o=>{if(o&&o.parent){const r=n.get(o.parent),s=n.get(o.id);r&&r.children&&s&&(r.children=[...r.children,s])}else{const r=n.get(o.id);r&&t.push(r)}}),t},ji=(e,n=!1)=>n?`${e*j.TREE_NODE_PADDING-j.TREE_NODE_ARROW_SIZE}px`:`${e*j.TREE_NODE_PADDING}px`,We=e=>{var n;return((n=e==null?void 0:e.children)==null?void 0:n.reduce((t,o)=>[...t,o,...We(o)],[]))||[]},Ye=(e,n)=>e?e.map(t=>({...t,isSelectedValue:n})):[],Ei=e=>{var o,r;const n=(o=e.children)==null?void 0:o.every(s=>s.isSelectedValue),t=(r=e.children)==null?void 0:r.every(s=>!s.isSelectedValue);if(e.isSelectedValue){if(e.isSelectedValue&&n)return[{...e,isSelectedValue:!1},...Ye(We(e),!0)]}else{if(t)return[{...e,isSelectedValue:!0},...Ye(We(e),!0)];if(n)return[{...e,isSelectedValue:!0},...Ye(We(e),!1)]}return[{...e,isSelectedValue:!1},...Ye(We(e),!1)]},Ai=e=>[{key:Fe.HIERARCHY,title:(e==null?void 0:e.hierarchy)||"Hierarchy"},{key:Fe.FLAT_LIST,title:(e==null?void 0:e.flatList)||"Flat list"}],Di=({calendarResolution:e,timeRange:n,timeRangeOptions:t,calendarStartFromMonday:o=!0,locale:r=X.Locale.EN,radioIcon:s,initialConstraints:u,onValueChange:f,calendarIcon:l,dateFormat:c,titles:a,defaultTimeOption:d})=>{var R,D,T,S,M;const g=A.getAnnotationPeriod((R=u==null?void 0:u[0])==null?void 0:R.annotations),[w,m]=h.useState(n),x=!n||((D=n==null?void 0:n.startPeriod)==null?void 0:D.getTime())===((T=g==null?void 0:g.startPeriod)==null?void 0:T.getTime())&&((S=n==null?void 0:n.endPeriod)==null?void 0:S.getTime())===((M=g==null?void 0:g.endPeriod)==null?void 0:M.getTime())?0:X.CUSTOM_PERIOD,[p,C]=h.useState(d??x),k=h.useMemo(()=>{const{startPeriod:y,endPeriod:P}=g,K=y==null?void 0:y.getFullYear(),H=P==null?void 0:P.getFullYear(),O=new Date().getFullYear();return t.filter(L=>L.value===X.CUSTOM_PERIOD||L.value===0||+L.value>=0&&H-O>=+L.value||+L.value<0&&K-O<+L.value)},[g,t]);h.useEffect(()=>{f(w,p)},[w]);const v=y=>{y&&(Gt(y),m(P=>P?{...P,startPeriod:y||null}:{endPeriod:null,startPeriod:y||null}))},N=y=>{y&&(Gt(y),m(P=>P?{...P,endPeriod:y||null}:{startPeriod:null,endPeriod:y||null}))};if(g==null)return null;const b=Ht(g.startPeriod,(w==null?void 0:w.endPeriod)||g.endPeriod,e,r,o,c),E=Ht((w==null?void 0:w.startPeriod)||g.startPeriod,g.endPeriod,e,r,o,c);return i.jsxs("div",{className:"mt-3 overflow-auto flex flex-col pt-2 pb-2 pr-3 h-full flex-1 min-w-0",children:[i.jsx("div",{className:"w-full",children:k.map(y=>i.jsx(j.Radio,{id:y.value.toString(),checked:p===y.value,label:y.title,onChange:()=>{const{value:P}=y;C(P),P!==X.CUSTOM_PERIOD&&m(P===0?g:gi(g,P))},radioIcon:s},y.value.toString()))}),i.jsx("div",{className:"w-full",children:p===X.CUSTOM_PERIOD&&i.jsxs("div",{className:"flex filters-time-period gap-4 mt-3 caption text-neutral-700",children:[i.jsx(j.Calendar,{onChange:v,options:b,value:(w==null?void 0:w.startPeriod)||(g==null?void 0:g.startPeriod),label:(a==null?void 0:a.from)||"From",id:"time-options-start",icon:l}),i.jsx(j.Calendar,{onChange:N,options:E,value:(w==null?void 0:w.endPeriod)||(g==null?void 0:g.endPeriod),label:(a==null?void 0:a.to)||"To",id:"time-options-end",icon:l,isEndDate:!0})]})})]})},yi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("path",{d:"M6.25 4.66668L9.75 8.00001L6.25 11.3333L6.25 4.66668Z",fill:"currentColor"})),Ho=({node:e,level:n=1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:s})=>{var a;const[u,f]=h.useState(!1),l="cursor-pointer text-neutrals-1000 w-6 h-6 shrink-0";h.useEffect(()=>{var d;f(!!((d=e==null?void 0:e.children)!=null&&d.length))},[e]);const c=(d,g)=>{var w;(w=e==null?void 0:e.children)!=null&&w.length?r==null||r(Ei(e)):o==null||o(d,g)};return i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-center",style:{paddingLeft:ji(n,u)},children:[u&&(e!=null&&e.isExpanded?i.jsx(yi,{className:l,onClick:()=>s==null?void 0:s(e)}):i.jsx(Cn,{className:l,onClick:()=>s==null?void 0:s(e)})),i.jsx(j.Checkbox,{id:e==null?void 0:e.id,label:e==null?void 0:e.name,checked:!!e.isSelectedValue,checkboxIcon:t,onChange:c})]}),u&&(e==null?void 0:e.isExpanded)&&i.jsx(i.Fragment,{children:(a=e==null?void 0:e.children)==null?void 0:a.map(d=>i.jsx(Ho,{node:d,level:n+1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:s},d==null?void 0:d.id))})]},e==null?void 0:e.id)},Mi=({filterValues:e,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r})=>{const[s,u]=h.useState([]);return h.useEffect(()=>{u(Ni(e))},[e]),s==null?void 0:s.map(f=>i.jsx(Ho,{node:f,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r},f==null?void 0:f.id))},Ti=({style:e,filterValue:n,checkboxIcon:t,selectFilterValue:o})=>i.jsx("div",{style:e,children:i.jsx(j.Checkbox,{id:n.id,label:n.name,checked:!!n.isSelectedValue,checkboxIcon:t,onChange:o})}),Oi=Ar.FixedSizeList,Wt=24,$t=232,Li=({filterValues:e,checkboxIcon:n,isHierarchicalView:t,isDisableValues:o,selectFilterValue:r,selectHierarchicalNodes:s,expandHierarchicalValue:u})=>{const f=j.useIsMobile();if(!e)return null;const l=e.length*Wt,c=l>$t?$t:l;return i.jsx("div",{className:V(o&&"pointer-events-none opacity-[0.7]","h-full overflow-auto"),style:{height:f?c+"px":"100%"},children:t?i.jsx(Mi,{filterValues:e,checkboxIcon:n,selectFilterValue:r,selectHierarchicalNodes:s,expandHierarchicalValue:u}):i.jsx(Dr,{children:({width:a,height:d})=>i.jsx(Oi,{itemCount:e.length,itemSize:Wt,width:a,height:d,children:({index:g,style:w})=>i.jsx(Ti,{index:g,style:w,filterValue:e[g],checkboxIcon:n,selectFilterValue:r})})})})},Go=({selectedFilter:e,filterValuesProps:n,locale:t,isDisableValues:o,timeRangeOptions:r,onTimePeriodChange:s,selectFilterValue:u,titles:f,initialConstraints:l,selectHierarchicalNodes:c,expandHierarchicalValue:a,selectedTimeOption:d})=>{const[g,w]=h.useState(""),[m,x]=h.useState([]),p=(e==null?void 0:e.displayMode)===Fe.HIERARCHY;h.useEffect(()=>{var v;const k=((v=e==null?void 0:e.dimensionValues)==null?void 0:v.filter(N=>{var b,E;return(E=(b=N==null?void 0:N.name)==null?void 0:b.toLowerCase())==null?void 0:E.includes(g==null?void 0:g.toLowerCase())}))||[];x(p?A.getFilteredItemsWithParents(e==null?void 0:e.dimensionValues,k):k)},[p,g,e==null?void 0:e.dimensionValues]),h.useEffect(()=>{w("")},[e]);const C=h.useCallback(k=>{w(k)},[w]);return i.jsx(i.Fragment,{children:e!=null&&e.isTimeDimension&&l?i.jsx(Di,{titles:f,initialConstraints:l,calendarResolution:X.CalendarResolution.DAY,timeRange:(e==null?void 0:e.timeRange)||null,timeRangeOptions:r||[],calendarStartFromMonday:!0,locale:t,radioIcon:n==null?void 0:n.radioIcon,onValueChange:s,calendarIcon:n==null?void 0:n.calendarIcon,dateFormat:n==null?void 0:n.dateFormat,defaultTimeOption:d}):i.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:[i.jsx(j.InputWithIcon,{inputId:"filters-search-input",containerClasses:"gap-2 items-center filters-search-input",cssClass:"filters-search-input-text",placeholder:(f==null?void 0:f.searchPlaceholder)??"Search",value:g,onChange:C,iconBeforeInput:i.jsx(ye.IconSearch,{width:n==null?void 0:n.searchIconSize,height:n==null?void 0:n.searchIconSize,className:"text-primary"})}),i.jsx("div",{className:"flex flex-col mt-3 body-2 overflow-auto flex-1 min-h-0",children:i.jsx(Li,{filterValues:g?m:e==null?void 0:e.dimensionValues,checkboxIcon:n==null?void 0:n.checkboxIcon,isHierarchicalView:p,isDisableValues:o,selectFilterValue:u,selectHierarchicalNodes:c,expandHierarchicalValue:a})})]})})},_i=({filter:e,onSelectFilter:n,onSelectDisplayMode:t,onDeleteFilter:o,locale:r,titles:s,initialConstraints:u,hideFacetCounterByDefault:f,filterValuesProps:l,isDisableValues:c,timeRangeOptions:a,onTimePeriodChange:d,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m})=>{var T;const x=j.useIsMobile(),[p,C]=h.useState(0),[k,v]=h.useState(!1),N=(e==null?void 0:e.isTimeDimension)&&(e==null?void 0:e.timeRange),b=h.useMemo(()=>{var S,M,y,P;return(S=e==null?void 0:e.timeRange)!=null&&S.startPeriod&&((M=e==null?void 0:e.timeRange)!=null&&M.endPeriod)?`${nn((y=e==null?void 0:e.timeRange)==null?void 0:y.startPeriod,r)} -
40
- ${nn((P=e==null?void 0:e.timeRange)==null?void 0:P.endPeriod,r)}`:""},[r,e==null?void 0:e.timeRange]);h.useEffect(()=>{var S;C((S=Vo(e==null?void 0:e.dimensionValues))==null?void 0:S.length)},[e==null?void 0:e.dimensionValues]);const E=S=>{t==null||t(e==null?void 0:e.id,S)},R=f?p>0:!0;h.useEffect(()=>{e.isSelectedFilter||v(!1)},[e.isSelectedFilter]);const D=()=>{x&&v(S=>!S),n(e==null?void 0:e.id)};return i.jsxs("div",{className:"flex flex-col",children:[i.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",(e==null?void 0:e.isSelectedFilter)&&!x&&"bg-hues-100",(e==null?void 0:e.isDisabled)&&"cursor-default pointer-events-none opacity-[0.7]"),onClick:D,children:[i.jsxs("h3",{className:"w-full truncate flex-1 min-w-0 sm:flex sm:items-center",title:e==null?void 0:e.title,children:[i.jsx("span",{className:"truncate",children:e==null?void 0:e.title}),x&&i.jsx(Cn,{className:V("chevron-icon w-6 h-6 shrink-0",k&&"rotate-180")})]}),i.jsxs("div",{className:"ml-2 flex gap-2 items-center text-neutrals-800",children:[N&&i.jsx("span",{className:"filters-facet-item-counter border-none",children:b}),!N&&R&&i.jsx("span",{className:V("px-2 text-center","filters-facet-item-counter"),children:p?`${p}/${((T=e==null?void 0:e.dimensionValues)==null?void 0:T.length)||0}`:(s==null?void 0:s.all)||"All"}),N?null:i.jsxs("div",{className:"flex items-center gap-2 filters-facet-item-settings",children:[i.jsx(j.Dropdown,{triggerButton:i.jsx(j.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(oi,{width:16,height:16}),title:(s==null?void 0:s.displayOrder)||"Display Order",disabled:!(e!=null&&e.isHierarchical)}),options:Ai(s),selectedOption:e==null?void 0:e.displayMode,disabled:!(e!=null&&e.isHierarchical),onOptionSelect:E}),p>0&&i.jsx(j.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(ti,{width:16,height:16}),title:(s==null?void 0:s.reset)||"Reset",onClick:S=>{S.stopPropagation(),o==null||o(e==null?void 0:e.id)}})]})]})]}),k&&i.jsx(Go,{titles:s,selectedFilter:e,locale:r,isDisableValues:c,timeRangeOptions:a,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m,onTimePeriodChange:d,filterValuesProps:l,initialConstraints:u})]})},Ri=({filtersList:e,hideFacetCounterByDefault:n,locale:t,onSelectFilter:o,onDeleteFilter:r,onSelectDisplayMode:s,filterValuesProps:u,isDisableValues:f,timeRangeOptions:l,initialConstraints:c,onTimePeriodChange:a,selectFilterValue:d,selectHierarchicalNodes:g,titles:w,expandHierarchicalValue:m})=>i.jsx("div",{className:V("overflow-y-auto advanced-view-filters-list min-w-[320px] pr-3 h-full sm:w-full"),children:e==null?void 0:e.map(x=>i.jsx(_i,{titles:w,locale:t,filter:x,onSelectFilter:o,onSelectDisplayMode:s,onDeleteFilter:r,hideFacetCounterByDefault:n,isDisableValues:f,timeRangeOptions:l,selectFilterValue:d,selectHierarchicalNodes:g,expandHierarchicalValue:m,onTimePeriodChange:a,filterValuesProps:u,initialConstraints:c},x==null?void 0:x.id))}),Ii=({filtersList:e,titles:n,selectedFilter:t,modalProps:o,locale:r,isDisableValues:s,timeSeriesCount:u,timeRangeOptions:f,initialConstraints:l,setSelectedFilter:c,onSelectDisplayMode:a,onDeleteFilter:d,updateSelectedFilterValues:g,onTimePeriodChange:w,selectedTimeOption:m})=>{const x=j.useIsMobile(),p=h.useCallback(b=>{c({...e==null?void 0:e.find(E=>(E==null?void 0:E.id)===b),isSelectedFilter:!0})},[e,c]),C=(b,E)=>{var D;const R={...t,dimensionValues:(D=t==null?void 0:t.dimensionValues)==null?void 0:D.map(T=>(T==null?void 0:T.id)===b?{...T,isSelectedValue:E}:T)};c(R),g&&g(R)},k=b=>{var R;const E={...t,dimensionValues:(R=t==null?void 0:t.dimensionValues)==null?void 0:R.map(D=>(b==null?void 0:b.find(S=>(S==null?void 0:S.id)===(D==null?void 0:D.id)))||D)};c(E),g&&g(E)},v=b=>{var E;c({...t,dimensionValues:(E=t==null?void 0:t.dimensionValues)==null?void 0:E.map(R=>(R==null?void 0:R.id)===(b==null?void 0:b.id)?{...R,isExpanded:!(b!=null&&b.isExpanded)}:R)})},N=(b,E)=>{const R={...t,timeRange:b||void 0};w==null||w(E),c(R),g&&g(R)};return i.jsxs("div",{className:V("flex flex-row gap-5 flex-1 min-h-0 sm:p-0","filters-settings"),children:[i.jsxs("div",{className:V("h-full sm:w-full",(o==null?void 0:o.isShowTimeSeriesCount)&&"flex flex-col justify-between"),children:[i.jsx(Ri,{filtersList:e,hideFacetCounterByDefault:o==null?void 0:o.isHideFacetCounterByDefault,locale:r,titles:n,onSelectFilter:p,onSelectDisplayMode:a,onDeleteFilter:d,isDisableValues:s,initialConstraints:l,timeRangeOptions:f,selectFilterValue:C,selectHierarchicalNodes:k,expandHierarchicalValue:v,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps}),o!=null&&o.isShowTimeSeriesCount&&u?i.jsxs("h4",{className:"text-neutrals-800 my-4",children:[(n==null?void 0:n.timeSeries)??"Timeseries",": ",u]}):null]}),!x&&i.jsx(Go,{selectedFilter:t,locale:r,titles:n,isDisableValues:s,timeRangeOptions:f,selectFilterValue:C,selectHierarchicalNodes:k,expandHierarchicalValue:v,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps,initialConstraints:l,selectedTimeOption:m})]})},dn=(e,n,t,o,r=X.Locale.EN)=>{const s=n==null?void 0:n.map(u=>{const f=A.findCodelistByDimension(t==null?void 0:t.codelists,t==null?void 0:t.conceptSchemes,u),l=A.getAvailableCodesFromConstrains(f==null?void 0:f.codes,u.id,o,r);return{...u,dimensionValues:l}});return(e==null?void 0:e.map(u=>{var c;const l=(((c=s==null?void 0:s.find(a=>a.id===u.id))==null?void 0:c.dimensionValues)||[]).map(a=>{var g,w;const d=(w=(g=u.dimensionValues)==null?void 0:g.find(m=>(m==null?void 0:m.id)===(a==null?void 0:a.id)))==null?void 0:w.isSelectedValue;return{...a,isSelectedValue:d}});return{...u,isDisabled:!1,dimensionValues:l}}))||[]},Jt=e=>{let n=[];return e.filter(t=>{var o;return t.timeRange||((o=t.dimensionValues)==null?void 0:o.some(r=>r.isSelectedValue))}).forEach(t=>{var s;const{id:o,dimensionValues:r}=t;t.isTimeDimension?n=[...n,...Pi(t.timeRange,o)]:n.push({componentCode:o,operator:A.SeriesFilterOperator.EQUALS,value:((s=r==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:s.map(u=>u.id).join(A.GET_v3_FILTER_AND))||""})}),n},Pi=(e,n)=>e==null||e.startPeriod==null||e.endPeriod==null?[]:[{componentCode:n,operator:A.SeriesFilterOperator.GREATER_OR_EQUAL,value:Yt(new Date(e.startPeriod))},{componentCode:n,operator:A.SeriesFilterOperator.LESS_OR_EQUAL,value:Yt(new Date(e.endPeriod),1)}],Vi=1e3*60*60*24,Yt=(e,n=0)=>{e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());let t=e.getTime();return t+=n?Vi-1:0,e=new Date(t),t.toString()},Fi=e=>e.map(n=>{var t;return{componentCode:n.id||"",operator:X.QueryFilterType.IN,values:((t=n.dimensionValues)==null?void 0:t.map(o=>o.id))||[]}}),Bi=(e,n)=>{var s;const t=(s=n==null?void 0:n.timeDimensions)==null?void 0:s[0],o=A.getTimeRangeFromAttachment(e,t)||null;return o?A.getQueryTimePeriodFilters(o,t==null?void 0:t.id):null},Hi=(e,n)=>{const t=Fo(e),o=t.find(r=>(r==null?void 0:r.isTimeDimension)&&(r==null?void 0:r.timeRange));return{filterKey:A.getTimeSeriesFilterKey(n||[],Fi(t)),timeFilter:A.getQueryTimePeriodFilters(o==null?void 0:o.timeRange,o==null?void 0:o.id)}},Gi=e=>e==null?void 0:e.filter(n=>{var t;return n.timeRange||((t=n.dimensionValues)==null?void 0:t.some(o=>o.isSelectedValue))}).map(n=>{var t,o,r,s;return n!=null&&n.isTimeDimension?{componentCode:n==null?void 0:n.id,operator:X.QueryFilterType.BETWEEN,values:[Kt(((t=n==null?void 0:n.timeRange)==null?void 0:t.startPeriod)||void 0)||"",Kt(((o=n==null?void 0:n.timeRange)==null?void 0:o.endPeriod)||void 0)||""]}:{componentCode:n==null?void 0:n.id,operator:X.QueryFilterType.IN,values:((s=(r=n==null?void 0:n.dimensionValues)==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:s.map(u=>u.id))||[]}}),Kt=e=>{if(!e)return"";const n=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),o=e.getFullYear();return`${t}-${n}-${o}`},zi=({timeseriesLength:e=0,limitMessages:n})=>{var o,r;const t=!e||j.SERIES_LIMIT>e;return i.jsx("div",{className:"body-3 text-neutrals-800 sm:text-center flex gap-x-[4px] sm:justify-center items-center",children:t?i.jsx("span",{children:(o=n==null?void 0:n.seriesCount)==null?void 0:o.call(n,e)}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:n==null?void 0:n.warningIcon}),i.jsx("span",{children:(r=n==null?void 0:n.counterLimit)==null?void 0:r.call(n,e,j.SERIES_LIMIT)})]})})},Ui=({modalProps:e,onApply:n,onClearAllFilters:t,onClose:o,titles:r,applyDisabled:s,timeseriesLength:u,limitMessages:f})=>{const l=j.useIsMobile();return i.jsxs("div",{className:V("flex py-4 px-6","modal-footer-wrapper",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse items-center justify-between sm:flex-col sm:gap-y-4 items-center"),children:[!(e!=null&&e.isShowCancelButton)&&i.jsx(zi,{timeseriesLength:u,limitMessages:f}),i.jsxs("div",{className:V("flex",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse justify-end sm:flex-col-reverse sm:gap-y-4 items-center"),children:[i.jsx(j.Button,{iconBefore:l?e==null?void 0:e.resetIcon:void 0,buttonClassName:"text-button-tertiary p-0",title:e!=null&&e.isShowClearIcon?(r==null?void 0:r.clearAllFilters)??"Clear All Filters":(r==null?void 0:r.clearAll)??"Clear All",onClick:()=>t(),isSmallButton:l}),i.jsxs("div",{className:"flex items-center gap-x-3",children:[e!=null&&e.isShowCancelButton?i.jsx(j.Button,{buttonClassName:"text-button-tertiary sm:h8",title:(r==null?void 0:r.cancel)??"Cancel",onClick:o,isSmallButton:l}):null,i.jsx(j.Button,{buttonClassName:"advanced-view-filters-modal-apply-button",title:(r==null?void 0:r.apply)??"Apply",onClick:n,isSmallButton:l,disabled:s})]})]})]})},Wi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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 ae=(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))(ae||{});const kn=["charts","chartsNavigation"],Zt=["dataGrid","metadataPerSeries",...kn,"openAdvancedView"],zo=["filters","chartPerSeries","metadataPerDataset","exitAdvancedView"],Re=(e,n)=>({title:(n==null?void 0:n[`${e}Title`])||"",description:(n==null?void 0:n[`${e}Description`])||""}),wn=(e,n)=>e.find(t=>{var o;return!((o=n.infoElements)!=null&&o[t])})||"",$i=(e,n)=>{if(!e||!n)return"";if(Zt.includes(n)){const o=wn(Zt,e);if(o)return o}const t=wn(zo,e);return t||""},Uo=(e,n)=>{const t=wn(e,n);return{...n,infoElements:{...n==null?void 0:n.infoElements,[n.lastDisplayedElement]:!1,...t?{[t]:!0}:{}},lastDisplayedElement:t}},Wo=e=>Uo(zo,e),Ji=e=>Uo(kn,e),Yi=e=>{var n,t;return(!((n=e==null?void 0:e.infoElements)!=null&&n.charts)||!((t=e==null?void 0:e.infoElements)!=null&&t.chartsNavigation))&&!kn.includes(e.lastDisplayedElement)},De=5,Ki=({targetPosition:e,overlayClasses:n,onClose:t})=>i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overlay overlay-top",style:{height:e.top,top:0-De,bottom:e.top+De}}),i.jsx("div",{className:"overlay overlay-bottom",style:{top:e.bottom+De,bottom:0}}),i.jsx("div",{className:"overlay overlay-left",style:{top:e.top-De,height:e.height+De*2,width:e.left,left:0-De,right:e.left-De*2}}),i.jsx("div",{className:"overlay overlay-right",style:{top:e.top-De,left:e.right+De,height:e.height+De*2,right:0}}),i.jsx("div",{className:V("outline-block z-10",n),onClick:t,style:{top:e.top,left:e.left,height:e.height,width:e.width}})]}),Ie=({reference:e,title:n,description:t,onReferenceClick:o,shouldCloseTooltip:r,shouldMoveToNextStep:s,supressReferenceClick:u})=>{var T;const[f,l]=h.useState(!0),[c,a]=h.useState(!1),d=h.useRef(null),{isShowOnboarding:g,onboardingFileSchema:w,setOnboardingFileSchema:m}=ve(),{refs:x,floatingStyles:p,context:C,placement:k}=Se.useFloating({open:f,onOpenChange:l,placement:"right-start",elements:{reference:e==null?void 0:e.current},middleware:[Se.offset({mainAxis:12,crossAxis:-4}),Se.flip(),Se.shift(),Se.arrow({element:d})],whileElementsMounted:Se.autoUpdate}),v=Se.useClick(C),{getFloatingProps:N}=Se.useInteractions([v]),b=h.useCallback(()=>{if(g){const S=$i(w,w==null?void 0:w.lastDisplayedElement);m==null||m({...w,infoElements:{...w==null?void 0:w.infoElements,...S?{[S]:!0}:{}},lastDisplayedElement:S})}l==null||l(!1)},[g,w,m]);h.useEffect(()=>{x.setReference((e==null?void 0:e.current)??null)},[e,x]);const E=()=>b(),R=(T=e==null?void 0:e.current)==null?void 0:T.getBoundingClientRect();h.useEffect(()=>{r&&!c&&(b(),a(!0))},[r,b,c]);const D=()=>{var S;o?(o==null||o(),s?b():l(!1)):u||(b(),(S=e==null?void 0:e.current)==null||S.click())};return i.jsx(i.Fragment,{children:f&&i.jsxs(Se.FloatingPortal,{children:[R&&i.jsx(Ki,{overlayClasses:u?"cursor-default":"cursor-pointer",targetPosition:R,onClose:D}),i.jsxs("div",{ref:x.setFloating,style:p,...N(),className:"tooltip z-tooltip max-w-[350px]",children:[i.jsxs("div",{className:"tooltip-header",children:[i.jsx("h3",{children:n}),i.jsx(j.CloseButton,{btnClassNames:"w-4 h-4",onClick:E})]}),i.jsx("div",{className:"tooltip-description",children:i.jsx("p",{children:t})}),i.jsx("div",{ref:d,className:V("tooltip-arrow absolute w-3 h-3 rotate-45",k!=null&&k.includes("right")?"left-[-4px]":"right-[-6px]",k!=null&&k.includes("end")?"bottom-2 tooltip-arrow-white":"top-3")})]})]})})},Zi=({buttonProps:e,selectedFiltersCount:n=0,isLoading:t,setModalState:o,titles:r,isModalClosed:s,warningIcon:u,filterIconClassName:f,timeSeriesCount:l})=>{const c=h.useRef(null),[a,d]=h.useState(""),[g,w]=h.useState(""),[m,x]=h.useState(!1),{onboardingFileSchema:p,isShowOnboarding:C}=ve(),k=j.SERIES_LIMIT<(l??0),v=h.useMemo(()=>e!=null&&e.isShowBadge?e==null?void 0:e.title:`${e==null?void 0:e.title}: ${n}`,[e==null?void 0:e.isShowBadge,e==null?void 0:e.title,n]);return h.useEffect(()=>{if(C){const{title:N,description:b}=Re(ae.FILTERS,r);d(N),w(b)}},[r,C]),h.useEffect(()=>{C&&x((p==null?void 0:p.lastDisplayedElement)===ae.FILTERS)},[p==null?void 0:p.lastDisplayedElement,C]),i.jsx("div",{className:"relative filter-button-container",ref:c,children:t?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(j.Button,{iconBefore:i.jsx(Wi,{className:V("size-4",f)}),iconAfter:k?u:void 0,title:v,buttonClassName:"text-button-secondary filter-button",isSmallButton:!0,onClick:()=>o(j.PopUpState.Opened)}),(e==null?void 0:e.isShowBadge)&&i.jsx("div",{className:"filter-count-badge",children:i.jsx("h5",{children:n})}),m&&i.jsx(Ie,{reference:c,title:a,description:g,onReferenceClick:()=>o(j.PopUpState.Opened),shouldCloseTooltip:s})]})})},qt=e=>{var t;const n=[];return(t=e.custom_content)!=null&&t.attachments&&n.push(...e.custom_content.attachments),n};function Sn(e){var n;return e.type===se.AttachmentType.MARKDOWN&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("URL Query"))}function $o(e){var n;return e.type===se.AttachmentType.JSON&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("Query (JSON)"))}function Jo(e){return e.type===se.AttachmentType.MARKDOWN&&!Sn(e)}function qi(e){return e.type===se.AttachmentType.CSV}function mn(e){return e.type===se.AttachmentType.TABLE}function $e(e){return e.type===se.AttachmentType.CUSTOM_DATA_GRID}function qe(e){return e.type===se.AttachmentType.CUSTOM_CHART}function Xi(e){return e.type===se.AttachmentType.PLOTLY}const Qi=(e,n)=>{var t;return(t=e==null?void 0:e.filter((o,r)=>{var s;return((s=o==null?void 0:o.custom_content)==null?void 0:s.attachments)&&r<n}))==null?void 0:t.at(-1)},es=e=>e==null?void 0:e.reduce((n,t,o)=>{var r,s;return(s=(r=t==null?void 0:t.custom_content)==null?void 0:r.attachments)!=null&&s.some(u=>$o(u))?o:n},-1),ns=e=>e==null?void 0:e.reduce((n,t)=>(t==null?void 0:t.role)===re.Role.Assistant?t:n,{}),ts=(e,n,t,o)=>{var r;return{role:re.Role.System,content:"",custom_content:{attachments:(t==null?void 0:t.map(s=>({type:se.AttachmentType.JSON,title:s==null?void 0:s.title,data:JSON.stringify({urn:s==null?void 0:s.urn,metadata:s==null?void 0:s.metadata,filters:(n==null?void 0:n.urn)===(s==null?void 0:s.urn)?e:s==null?void 0:s.filters})})))||[],form_schema:(r=o==null?void 0:o.custom_content)==null?void 0:r.form_schema}}},os=(e,n,t,o)=>{if(!e)return[];const r=e==null?void 0:e.at(-1);return r&&r.role===re.Role.System&&(e==null||e.pop()),[...e,ts(n,t,o,ns(e))]},rs=(e,n,t)=>(t==null?void 0:t.map(o=>({...o,filters:(n==null?void 0:n.urn)===(o==null?void 0:o.urn)?e:o==null?void 0:o.filters})))||[],is=({actions:e,dimensions:n,structureDimensions:t,structures:o,buttonProps:r,modalProps:s,attachmentsDataQuery:u,dataQueries:f,initialConstraints:l,onFiltersChange:c,locale:a,timeRangeOptions:d,titles:g,conversationKey:w,conversation:m,setConversation:x,updateConversation:p,updateDataQueries:C,limitMessages:k,filterIconClassName:v})=>{var je,ke;const[N,b]=h.useState(j.PopUpState.Closed),[E,R]=h.useState([]),[D,T]=h.useState([]),[S,M]=h.useState(),[y,P]=h.useState([]),[K,H]=h.useState(void 0),O=h.useRef(l||[]),[L,B]=h.useState([]),[J,Y]=h.useState(),[G,q]=h.useState(),ce=h.useRef(!1),[ue,ie]=h.useState(!1),me=F=>{const z=F?E.map(W=>W.id===F.id?F:W):E;q(!0),R(Ut(z)),Y==null||Y(!0),de(F!=null&&F.isTimeDimension?zt(z,F):z,R,Y)};h.useEffect(()=>{N===j.PopUpState.Closed&&B(O.current)},[N]);const de=h.useCallback((F,z,W)=>{e==null||e.getConstraints(u==null?void 0:u.urn,Jt(F).filter(ee=>ee.componentCode!==A.TIME_PERIOD)).then(ee=>{var I;const _=((I=ee==null?void 0:ee.data)==null?void 0:I.dataConstraints)||[];O.current=_,W==null||W(!1),z(dn(F,n,o,_,a))}).catch(()=>{O.current=[],W==null||W(!1),z(dn(F,n,o,[],a))}).finally(()=>{q(!1)})},[e,u==null?void 0:u.urn,n,a,o]);h.useEffect(()=>{const F=pi(n,o,t,a),z=n==null?void 0:n.map(ee=>{const _=A.findCodelistByDimension(o==null?void 0:o.codelists,o==null?void 0:o.conceptSchemes,ee),I=A.getAvailableCodesFromConstrains(_==null?void 0:_.codes,ee.id,O.current,a);return{...ee,dimensionValues:I}}),W=F.map(ee=>{var I;const _=((I=z==null?void 0:z.find(U=>U.id===ee.id))==null?void 0:I.dimensionValues)||[];return{...ee,dimensionValues:_}});if(!ce.current){const ee=ki(W,u,O.current);Y==null||Y(!0),de(ee,T,Y),ce.current=!0}},[n,t,o,u,a,l,de]),h.useEffect(()=>{D!=null&&D.length&&P(Fo(D))},[D]),h.useEffect(()=>{R(F=>zt(F,S))},[S]),h.useEffect(()=>{N===j.PopUpState.Opened&&(M({...D==null?void 0:D[0],isSelectedFilter:!0}),R(D)),N===j.PopUpState.Closed&&M(void 0)},[D,N]);const he=h.useCallback(async F=>{const z=Gi(F),W=m?{...m,messages:os(m==null?void 0:m.messages,z,u,f)}:null;x==null||x(W),C==null||C(rs(z,u,f)),await p(decodeURI(w),{name:W==null?void 0:W.name,messages:(W==null?void 0:W.messages)||[]})},[u,m,w,f,x,p,C]),Ne=h.useCallback((F,z)=>{R(W=>xi(W,F,z)),(S==null?void 0:S.id)===F&&M(W=>({...W,displayMode:z}))},[S==null?void 0:S.id]),pe=h.useCallback(F=>Hi(F,n),[n]),be=h.useCallback((F,z)=>{const W=dn(z,n,o,F,a);O.current=F,M(ee=>(W==null?void 0:W.find(_=>(_==null?void 0:_.id)===(ee==null?void 0:ee.id)))||ee),R(W),q(!1)},[n,a,o]),fe=h.useCallback(F=>{q(!0),R(Ut(F)),e==null||e.getConstraints((u==null?void 0:u.urn)||"",Jt(F).filter(z=>z.componentCode!==A.TIME_PERIOD)).then(z=>{var W;be(((W=z==null?void 0:z.data)==null?void 0:W.dataConstraints)||[],F)}).catch(()=>{be([],F)})},[e,u==null?void 0:u.urn,be]),Ee=h.useCallback(F=>{const z=bi(E,F);fe(z)},[fe,E]),ge=h.useCallback(()=>{O.current=L,b(j.PopUpState.Closed),ie(!0)},[L]),Me=h.useCallback(()=>{const F=Ci(E);fe(F)},[fe,E]),Te=h.useCallback(()=>{const F=pe(E);c==null||c(F,O.current,E),T(E),b(j.PopUpState.Closed),ie(!0),h.startTransition(()=>{he(E)})},[pe,E,c,he,O]),Oe=F=>{H(F)},Ce=Number(A.getTimeSeriesCount((ke=(je=O==null?void 0:O.current)==null?void 0:je[0])==null?void 0:ke.annotations));return i.jsxs("div",{className:"filters-container",children:[i.jsx(Zi,{buttonProps:r,selectedFiltersCount:vi(y),isLoading:J,setModalState:b,titles:g,isModalClosed:ue,warningIcon:k==null?void 0:k.warningIcon,filterIconClassName:v,timeSeriesCount:Ce}),i.jsx(i.Fragment,{children:N===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:(g==null?void 0:g.settings)||"Settings",portalId:"filters",size:j.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:s==null?void 0:s.isShowDividers,onClose:ge,closeButtonTitle:(g==null?void 0:g.close)||"Close",children:[i.jsx(Ii,{locale:a,titles:g,timeRangeOptions:d,filtersList:E,selectedFilter:S,isDisableValues:G,modalProps:s,initialConstraints:l,timeSeriesCount:`${Ce}`,setSelectedFilter:M,onSelectDisplayMode:Ne,onDeleteFilter:Ee,updateSelectedFilterValues:me,onTimePeriodChange:Oe,selectedTimeOption:K}),i.jsx(Ui,{titles:g,onApply:Te,onClose:ge,onClearAllFilters:Me,modalProps:s,applyDisabled:J||G,timeseriesLength:Ce,limitMessages:k})]})})]})},ss=({downloadTitles:e,attachment:n,actions:t,className:o=""})=>{const r=n.url,[s,u]=h.useState(null);async function f(l){if(l==null)return;const c=await t.getFile(l);u(c)}return i.jsxs("div",{className:`border rounded-lg p-3 bg-white transition-colors ${o}`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"body-2 text-neutrals-800 truncate",title:n.title,children:n.title})})}),r&&i.jsx("div",{className:"flex-shrink-0",children:i.jsx(j.Button,{title:e??"Download",onClick:()=>f(n.url),buttonClassName:"text-button-tertiary"})})]}),s&&i.jsx("div",{className:"mt-3",children:i.jsx("pre",{className:"bg-white p-3 rounded-md overflow-x-auto",children:i.jsx("code",{children:JSON.stringify(s,null,2)})})})]})},Yo="json";function ls(e){return cs(e)?as(e==null?void 0:e.slice(Yo.length)):e}function as(e){let n="";if(e)try{n=JSON.stringify(JSON.parse(e),null,2)}catch{n=e.toString()}return n}function cs(e){return(e==null?void 0:e.startsWith(Yo))||!1}const us=({attachment:e,className:n=""})=>{const t=ls(e.data);return t?i.jsxs("div",{className:`attachment-json border rounded-lg bg-white ${n}`,children:[i.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-neutrals-200 bg-neutrals-100 rounded-t-lg",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),i.jsx("div",{className:"p-3",children:i.jsx("pre",{className:"text-neutrals-800 overflow-x-auto whitespace-pre-wrap break-words max-h-96 overflow-y-auto",children:i.jsx("code",{children:t})})})]}):null},ds=e=>{try{const n=new URL(e);return["http:","https:","data:"].includes(n.protocol)}catch{return!1}},hs=e=>ds(e)?e:"",fs=e=>oe.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),gs=({attachment:e,openLinkTitle:n,className:t=""})=>{const o=hs(e.data||"");if(!o)return null;const r=s=>{const u=window.open(s,"_blank");u==null||u.focus()};return i.jsx("div",{className:`border rounded-lg bg-white pl-4 py-3 pr-3 max-w-[500px] ${t}`,children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-hues-800 flex-shrink-0 mt-1",role:"img","aria-label":"Link",children:i.jsx(fs,{width:16,height:16})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"mb-1",children:i.jsx(j.Link,{url:o,title:e.title})}),i.jsx("div",{className:"text-neutrals-600 break-all truncate",children:o})]}),i.jsx("div",{className:"flex-shrink-0",children:i.jsx(j.Button,{title:n??"Open link",onClick:()=>r(o),buttonClassName:"text-button-tertiary"})})]})})},Ko=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ws=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ms=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ps=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),xs=({attachment:e,index:n,selectedAttachmentIndex:t,onSelectedAttachmentChange:o,showTabIcon:r,dataGridTitle:s,titles:u})=>{const f=h.useRef(null),[l,c]=h.useState(""),[a,d]=h.useState(""),[g,w]=h.useState(!1),{onboardingFileSchema:m,isShowOnboarding:x}=ve(),p=h.useCallback((k,v="")=>r?Xi(k)||qe(k)?i.jsx(Ko,{className:v}):$e(k)?i.jsx(ms,{className:v}):Sn(k)?i.jsx(ps,{className:v}):Jo(k)?i.jsx(ws,{className:v}):null:null,[r]),C=h.useCallback(k=>$e(k)?s||"Data Grid":k.title,[s]);return h.useEffect(()=>{if(x&&qe(e)){const{title:k,description:v}=Re(ae.CHARTS,u);c(k),d(v)}},[e,u,x]),h.useEffect(()=>{var k;if(qe(e)&&x){const v=(m==null?void 0:m.lastDisplayedElement)===ae.CHARTS;w(v),v&&((k=f==null?void 0:f.current)==null||k.scrollIntoView({block:"end",behavior:"smooth"}))}},[m==null?void 0:m.lastDisplayedElement,e,x]),i.jsxs("div",{ref:f,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",t===n?"attachment-tab-active text-primary":""),onClick:()=>o(n),children:[p(e,"w-4 h-4"),i.jsx("h4",{className:"truncate max-w-[130px]",title:C(e),children:C(e)}),g&&i.jsx(Ie,{reference:f,title:l,description:a})]},e.index||n)},vs=({attachments:e,...n})=>i.jsx("div",{className:"flex items-center w-full flex-wrap attachments-tabs",children:e.map((t,o)=>i.jsx(xs,{attachment:t,index:o,...n},o))}),bs=({setToTitle:e,datasetName:n,datasetIcon:t,isShowDatasetDetails:o,queryFilterDetails:r})=>i.jsxs("div",{children:[n&&o&&i.jsxs("p",{className:"caption mt-4 inline-flex items-center attachment-dataset-name",children:[i.jsx("span",{className:"mr-1 attachment-dataset-icon",children:t}),n]}),r==null?void 0:r.map(s=>{var u;return i.jsxs("p",{className:"body-1 mb-2 last:mb-0",children:[s==null?void 0:s.title,i.jsx("span",{children:e??" set to "}),i.jsx("span",{className:"font-bold",children:(u=s==null?void 0:s.valuesTitles)==null?void 0:u.join(", ")})]},s==null?void 0:s.title)})]}),Cs=({titles:e,attachmentInfoList:n,datasetIcon:t})=>i.jsxs("div",{className:"attachment-details flex flex-col",children:[i.jsx("p",{className:V("body-1",n&&n.length<=1&&"mb-2"),children:(e==null?void 0:e.queryUpdatedManuallyTitle)??"Query has been updated manually."}),n==null?void 0:n.map(o=>{var r;return!!((r=o==null?void 0:o.queryFiltersDetails)!=null&&r.length)&&i.jsx(bs,{setToTitle:e==null?void 0:e.setToTitle,datasetName:o==null?void 0:o.datasetName,datasetIcon:t,isShowDatasetDetails:(n==null?void 0:n.length)>1,queryFilterDetails:o==null?void 0:o.queryFiltersDetails},o==null?void 0:o.datasetName)})]}),Zo=({dimensionsInfo:e})=>i.jsx("div",{className:"sidebar flex flex-col w-[176px] gap-3 min-h-0 overflow-auto",children:e.map(n=>i.jsxs("div",{className:"flex flex-col",children:[i.jsx("h5",{className:"text-neutrals-800",children:n.title}),i.jsx("h5",{className:"font-bold",children:n.value})]},n.title))}),ks=({titles:e,chart:n,isOpen:t,onClose:o})=>{const[r,s]=h.useState(j.PopUpState.Closed);h.useEffect(()=>{s(t?j.PopUpState.Opened:j.PopUpState.Closed)},[t]);const u=h.useCallback(()=>{s(j.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:r===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:i.jsx("h1",{className:"single-chart-popup-heading",children:(e==null?void 0:e.chart)??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:j.PopUpSize.LG,dividers:!1,onClose:u,closeButtonTitle:(e==null?void 0:e.close)??"Close",children:[i.jsxs("div",{className:"single-chart-popup-content flex flex-row flex-1 gap-4 min-h-0 h-full",children:[i.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:i.jsx(co,{option:n.config,className:"w-full h-full",style:{width:"100%",height:"100%"}})}),i.jsx(Zo,{dimensionsInfo:n.dimensions})]}),i.jsx("div",{})]})})},qo=e=>{var p;const[n,t]=h.useState(!1),o=h.useRef(null),[r,s]=h.useState(""),[u,f]=h.useState(""),[l,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=ve(),[g,w]=h.useState(!1),m=h.useCallback(()=>{t(!0)},[]),x=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:C,description:k}=Re(ae.CHART_PER_SERIES,e.titles);s(C),f(k)}},[e.titles,d]),h.useEffect(()=>{d&&c((a==null?void 0:a.lastDisplayedElement)===ae.CHART_PER_SERIES&&e.node.rowIndex===0)},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(j.IconButton,{title:((p=e.titles)==null?void 0:p.chart)??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(Ko,{className:"w-5 h-5"}),onClick:m})}),l&&i.jsx(Ie,{reference:o,title:r,description:u,onReferenceClick:m,shouldCloseTooltip:g}),n&&i.jsx(ks,{chart:e.value,isOpen:n,onClose:x,titles:e.titles})]})},sn=32,Nn=32,Ss=16,jn="padding-0",ln=200,pn={flex:1,minWidth:ln},Ns=sn,Xo="observationValueCell",Qo="metadataCell",js="chartCell",tn="Chart_column",Es=(e,n,t,o,r,s)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:jn,cellRenderer:Qo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,metadataSettings:o,titles:r,action:s}});function As(e,n,t,o=Ns,r,s){return{headerName:"",field:tn,colId:tn,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:o,maxWidth:o,minWidth:o,cellClass:jn,suppressColumnsToolPanel:!0,cellRenderer:qo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,titles:r,action:s}}}const xn=["index","value"],Ds=e=>({columns:Ts(e),data:ys(e)}),ys=e=>{const n=e.metadata.time_column,t={};for(const o of e.data.data){const{value:r,...s}=o,u=Ms(o,n);t[u]={...t[u]||{},...s,[o[n]]:r}}return Object.values(t)},Ms=(e,n)=>Object.keys(e).filter(t=>!xn.includes(t)&&t!==n).map(t=>e[t]).join("."),Ts=e=>{const{metadata:n,data:t}=e,o=n.time_column,r=n.pinned_columns||[],s=t.schema.fields,u=[],f=t.data.map(g=>g[o]),c=Array.from(new Set(f)).filter(g=>g!=null).map(g=>({field:g,colId:g,headerName:g,cellClass:"text-right",width:ln})),a=r.map(g=>s.find(w=>w.name===g)).filter(g=>g!=null),d=s.filter(g=>!r.includes(g.name)).filter(g=>g!=null);if(a.length>0)for(const g of[...a])g.name===o||xn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:"left",...pn,tooltipValueGetter:w=>w.value});for(const g of[...d])g.name===o||xn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:!1,...pn,tooltipValueGetter:w=>w.value});return u.push(...c),u},er=e=>e*Nn+sn+Ss,Os=({attachment:e,actions:n,className:t="",showLimitMessage:o})=>{const[r,s]=h.useState(!1),[u,f]=h.useState([]),[l,c]=h.useState(),[a,d]=h.useState(400);h.useEffect(()=>{e.url!=null&&(s(!0),n.getFile(e.url).then(w=>{if(w==null){f([]),c([]),s(!1);return}const{columns:m,data:x}=Ds(w);f(x),c(m),s(!1)}))},[e.url,n]),h.useEffect(()=>{u?(d(er(u.length)),o==null||o(u.length>=j.SERIES_LIMIT)):o==null||o(!1)},[u,o]);const g=h.useMemo(()=>i.jsx(uo.AgGridReact,{headerHeight:sn,rowHeight:Nn,rowData:u,columnDefs:l,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:l&&(l==null?void 0:l.length)>5?"fitCellContents":"fitGridWidth"}}),[u,l]);return r?i.jsx(j.Loader,{}):i.jsx("div",{className:`w-full ${t}`,children:i.jsx("div",{className:"ag-theme-quartz w-full min-h-[80px] max-h-[400px]",style:{height:a},children:g})})},Ls=({icon:e,title:n})=>i.jsx("div",{className:V("px-3 py-4 rounded border mt-3","attachment-collapsed"),children:i.jsxs("p",{className:V("flex body-3 items-center"),children:[e,i.jsxs("span",{className:"ml-2",children:[" ",n]})]})}),nr=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),_s=({title:e,value:n})=>{const t=h.useCallback(()=>Array.isArray(n)?n.join(", "):n,[n]);return i.jsxs("div",{className:"flex gap-x-3 body-3",children:[i.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),i.jsx("p",{title:t(),className:"font-semibold truncate pr-3",children:t()})]})},Rs=({title:e,value:n,attachedKeysTitles:t,locale:o})=>{const[r,s]=h.useState(!1),[u,f]=h.useState(!1),l=h.useRef(null),c=h.useCallback(()=>{u&&s(d=>!d)},[s,u]),a=h.useCallback(()=>{var d;return Array.isArray(n)?(d=n==null?void 0:n.map(g=>typeof g=="object"?g==null?void 0:g[o]:g))==null?void 0:d.join(", "):n},[o,n]);return h.useEffect(()=>{var d,g;l!=null&&l.current&&f(((d=l==null?void 0:l.current)==null?void 0:d.scrollHeight)>((g=l==null?void 0:l.current)==null?void 0:g.offsetHeight))},[l]),i.jsxs("div",{className:"metadata-item",children:[t==null?void 0:t.map(d=>i.jsx("div",{title:d,className:"metadata-item-key pr-3 mb-1 text-neutrals-800",children:d},d)),i.jsxs("div",{className:V("flex items-center",u&&"justify-between"),children:[i.jsx("h2",{title:e,className:"metadata-item-title",children:e}),u&&i.jsx(j.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",r?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:i.jsx(Cn,{width:24,height:24}),onClick:c})]}),i.jsx("p",{title:a(),className:V("metadata-item-value pr-3",!r&&"line-clamp-4"),ref:l,children:a()})]})},En=({metadata:e,metadataDescription:n=[],isOpenMetadata:t,onCloseMetadata:o,titles:r,locale:s})=>{const[u,f]=h.useState(j.PopUpState.Closed);h.useEffect(()=>{f(t?j.PopUpState.Opened:j.PopUpState.Closed)},[t]);const l=h.useCallback(()=>{f(j.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:u===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:i.jsx("h1",{className:"metadata-heading",children:(r==null?void 0:r.metadata)||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:j.PopUpSize.LG,dividers:!1,onClose:l,closeButtonTitle:(r==null?void 0:r.close)||"Close",children:[i.jsxs("div",{className:"metadata-content overflow-hidden h-full",children:[(n==null?void 0:n.length)>0&&i.jsx("div",{className:"metadata-description",children:n==null?void 0:n.map(c=>i.jsx(_s,{title:c==null?void 0:c.title,value:c==null?void 0:c.value},c==null?void 0:c.title))}),i.jsx("div",{className:"h-full overflow-y-auto metadata-list",children:e&&(e==null?void 0:e.length)>0?e==null?void 0:e.map(c=>i.jsx(Rs,{title:c==null?void 0:c.title,value:c==null?void 0:c.value,locale:s,attachedKeysTitles:c==null?void 0:c.attachedKeysTitles},(c==null?void 0:c.id)||(c==null?void 0:c.title))):i.jsx("div",{className:"metadata-empty text-neutrals-700 flex h-full justify-center items-center",children:(r==null?void 0:r.noMetadata)||"No metadata"})})]}),i.jsx("div",{})]})})},Is=e=>{var n,t;return(t=e==null?void 0:e.data[((n=e==null?void 0:e.colDef)==null?void 0:n.field)||0])==null?void 0:t.obsAttributes},Ps=e=>{var n;return(n=e==null?void 0:e.data)==null?void 0:n.attributes},tr=(e,n)=>Object.entries(e==null?void 0:e.data).filter(([t])=>n==null?void 0:n.get(t)).map(([t,o])=>({name:t,value:String(o)})),Xt=(e,n,t)=>{var r;const o=typeof e=="object"?e==null?void 0:e[n]:e;return t?A.getLocalizedName((r=t==null?void 0:t.codes)==null?void 0:r.find(s=>(s==null?void 0:s.id)===e),n)||"":o},on=(e,n,t)=>(e==null?void 0:e.map(o=>{var l;const r=(o==null?void 0:o.name)||"",s=n==null?void 0:n.get(r),u=(l=s==null?void 0:s.codes)!=null&&l.length?s:void 0,f=Array.isArray(o==null?void 0:o.value)?o==null?void 0:o.value.map(c=>Xt(c,t,u)):Xt(o==null?void 0:o.value,t,u);return{id:A.getLocalizedName(u,t)||(o==null?void 0:o.name),title:A.getLocalizedName(u||s,t),value:f||(o==null?void 0:o.value)}}))||[],an=(e,n,t)=>({title:(t==null?void 0:t.dataset)||"Dataset",value:A.getLocalizedName(e,n)}),Vs=(e,n,t,o)=>[an(e,t,o),{title:(o==null?void 0:o.agency)??"Agency",value:e==null?void 0:e.agencyID},{title:(o==null?void 0:o.lastUpdated)??"Last updated",value:n}],or=(e,n,t)=>{var o,r;return{title:A.getDimensionTitle(e==null?void 0:e.conceptSchemes,(r=(o=A.getDimensions(e))==null?void 0:o.timeDimensions)==null?void 0:r[0],n),value:(t==null?void 0:t.colId)||""}},rr=(e,n)=>({title:(n==null?void 0:n.observation)||"Observation",value:e}),ir=(e,n,t,o,r,s)=>{var f;const u={title:(o==null?void 0:o.timeSeries)||"Time Series",value:(f=s==null?void 0:s.originalData)==null?void 0:f.name};return t?[or(e,n,r),u,rr(t,o)]:[u]},Fs=e=>{var o,r,s,u,f;const n=((r=(o=e==null?void 0:e.dataSets)==null?void 0:o[0])==null?void 0:r.attributes)||[],t=((f=(u=(s=e==null?void 0:e.structures)==null?void 0:s[0])==null?void 0:u.attributes)==null?void 0:f.dataSet)||[];return n!=null&&n.length?t.map((l,c)=>{var a;return((a=l==null?void 0:l.values)==null?void 0:a.length)>0?{...l}:{...l,values:[{value:n==null?void 0:n[c]}]}}):t},Bs=(e,n,t)=>(e==null?void 0:e.map(o=>{var d,g,w,m,x,p,C,k;const r=o==null?void 0:o.id,s=((g=(d=o==null?void 0:o.values)==null?void 0:d[0])==null?void 0:g.value)||((m=(w=o==null?void 0:o.values)==null?void 0:w[0])==null?void 0:m.id),u=(p=(x=o==null?void 0:o.values)==null?void 0:x[0])==null?void 0:p.ids,f=n==null?void 0:n.get(r),l=(C=f==null?void 0:f.codes)!=null&&C.length?f:void 0,c=A.getLocalizedName((k=l==null?void 0:l.codes)==null?void 0:k.find(v=>(v==null?void 0:v.id)===s),t)||s,a=u&&u.map(v=>{var N;return A.getLocalizedName((N=l==null?void 0:l.codes)==null?void 0:N.find(b=>(b==null?void 0:b.id)===v),t)||v});return{id:r,title:A.getLocalizedName(f,t)||r,value:u?a:c}}).filter(({value:o})=>!!o))||[],Hs=(e,n)=>{var u,f,l;const t=(u=e==null?void 0:e.dataSets)==null?void 0:u[0],o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=((l=o==null?void 0:o.attributes)==null?void 0:l.dimensionGroup)||[],s=t==null?void 0:t.dimensionGroupAttributes;return new Map(r.map(c=>{var w;const a=(w=c==null?void 0:c.relationship)==null?void 0:w.dimensions,{codedSeriesKey:d,decodedSeriesKey:g}=Gs(e,n,a);return[c.id,{values:(s==null?void 0:s[d])||[],decodedSeriesKey:g,codedSeriesKey:d}]}))},Gs=(e,n,t)=>{var f,l,c;const o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=[...(o==null?void 0:o.dimensions.series)||[],...(o==null?void 0:o.dimensions.observation)||[]],s=(l=new Array(r==null?void 0:r.length))==null?void 0:l.fill(""),u=(c=new Array(r==null?void 0:r.length))==null?void 0:c.fill("");return t&&(t==null||t.forEach(a=>{var m,x;const d=(r==null?void 0:r.findIndex(p=>(p==null?void 0:p.id)===a))||0,g=n[d],w=((x=(m=r[d])==null?void 0:m.values)==null?void 0:x.findIndex(p=>(p==null?void 0:p.id)===g||(p==null?void 0:p.value)===g))||0;s[d]=w>=0?w:g,u[d]=g})),{codedSeriesKey:s==null?void 0:s.join(":"),decodedSeriesKey:u==null?void 0:u.join(":")}},zs=(e,n)=>{var s;if(n==null)return;const t=(s=e==null?void 0:e.values)==null?void 0:s[n],o=typeof n=="object"&&!Array.isArray(n),r=Array.isArray(n);return t||(o||r?{values:n}:{value:n==null?void 0:n.toString()})},Us=e=>{const n=(e==null?void 0:e.value)||(e==null?void 0:e.id),t=(e==null?void 0:e.values)||(e==null?void 0:e.ids);return n!=null?[n]:t||[null]},sr=(e,n,t)=>{var r,s;if(n==null)return n;const o=(s=(r=t==null?void 0:t.get(e||""))==null?void 0:r.codes)==null?void 0:s.find(u=>(u==null?void 0:u.id)===n);return(o==null?void 0:o.name)||n},Ws=(e,n,t,o=X.Locale.EN)=>{var l;const r=(l=t==null?void 0:t.dataStructureComponents)==null?void 0:l.dimensionList,s=[...(r==null?void 0:r.dimensions)||[],...(r==null?void 0:r.timeDimensions)||[]],u=[],f=(e==null?void 0:e.split(":"))||[];return f==null||f.forEach((c,a)=>{var d;if(c!==""){const g=((d=s==null?void 0:s[a])==null?void 0:d.id)||"",w=A.getLocalizedName(n==null?void 0:n.get(g),o),m=sr(g,c,n);u.push(`${w}: ${m}`)}}),u},$s=(e,n,t,o,r=X.Locale.EN)=>{var f,l,c,a;if(!e||!n||!o)return[];const s=((c=(l=(f=e==null?void 0:e.structures)==null?void 0:f[0])==null?void 0:l.attributes)==null?void 0:c.dimensionGroup)||[],u=Hs(e,o);return((a=s==null?void 0:s.map((d,g)=>{var p;const w=u==null?void 0:u.get(d==null?void 0:d.id),m=t==null?void 0:t.get(d==null?void 0:d.id),x=Us(zs(d,(p=w==null?void 0:w.values)==null?void 0:p[g]));return{id:d==null?void 0:d.id,title:A.getLocalizedName(m,r),value:Array.isArray(x)?x==null?void 0:x.map(C=>sr(d==null?void 0:d.id,C,t)||""):x,attachedKeysTitles:Ws(w==null?void 0:w.decodedSeriesKey,t,n)}}))==null?void 0:a.filter(({value:d})=>d==null?void 0:d.some(g=>!!g)))||[]},Js=e=>{var v,N;const[n,t]=h.useState(!1),o=h.useRef(null),[r,s]=h.useState(""),[u,f]=h.useState(""),[l,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=ve(),[g,w]=h.useState(!1),m=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),x=h.useMemo(()=>{var b,E,R,D,T,S;return[an((E=(b=e==null?void 0:e.dataSetData)==null?void 0:b.dataflows)==null?void 0:E[0],e==null?void 0:e.locale,e.titles),...on(tr(e,m),m,e==null?void 0:e.locale),...on(Ps(e),m,e==null?void 0:e.locale),...$s(e==null?void 0:e.attributesData,(D=(R=e==null?void 0:e.dataSetData)==null?void 0:R.dataStructures)==null?void 0:D[0],m,(S=(T=e==null?void 0:e.data)==null?void 0:T.originalData)==null?void 0:S.parsedTimeSeriesValue,e==null?void 0:e.locale)]},[e,m]),p=h.useMemo(()=>ir(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),C=h.useCallback(()=>{t(!0)},[]),k=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:b,description:E}=Re(ae.METADATA_PER_SERIES,e.titles);s(b),f(E)}},[e.titles,d]),h.useEffect(()=>{if(d){const b=(a==null?void 0:a.lastDisplayedElement)===ae.METADATA_PER_SERIES&&e.node.rowIndex===0;c(b),b&&setTimeout(()=>{var E;(E=o==null?void 0:o.current)==null||E.scrollIntoView({block:"end",behavior:"smooth"})})}},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(j.IconButton,{title:((v=e.titles)==null?void 0:v.metadata)||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(nr,{className:"w-5 h-5"}),onClick:C})}),l&&i.jsx(Ie,{reference:o,title:r,description:u,onReferenceClick:C,shouldCloseTooltip:g}),n&&i.jsx(En,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:x,metadataDescription:(N=e==null?void 0:e.metadataSettings)!=null&&N.isMetadataDescription?p:[],isOpenMetadata:n,onCloseMetadata:k})]})},Ys=e=>{var c,a;const[n,t]=h.useState(!1),o=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),r=h.useMemo(()=>on(Is(e),o,e==null?void 0:e.locale),[e,o]),s=h.useMemo(()=>{var d,g,w;return[an((g=(d=e==null?void 0:e.dataSetData)==null?void 0:d.dataflows)==null?void 0:g[0],e==null?void 0:e.locale,e==null?void 0:e.titles),...on(tr(e,o),o,e==null?void 0:e.locale),...(w=e==null?void 0:e.metadataSettings)!=null&&w.isMetadataDescription?[]:[or(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,e==null?void 0:e.colDef),rr((e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles)],...r]},[e,o,r]),u=h.useMemo(()=>ir(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),f=h.useCallback(()=>{t(!0)},[]),l=h.useCallback(()=>{t(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-full h-full p-2 text-end relative",children:[(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),(r==null?void 0:r.length)>0&&i.jsx("div",{className:"metadata-indicator",title:((c=e.titles)==null?void 0:c.metadata)||"View details",onClick:f})]}),n&&i.jsx(En,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:s,metadataDescription:(a=e==null?void 0:e.metadataSettings)!=null&&a.isMetadataDescription?u:[],isOpenMetadata:n,onCloseMetadata:l})]})},Ks=({attachment:e,isDataLoading:n,chartColumn:t,fixHeight:o,titles:r,showLimitMessage:s})=>{const[u,f]=h.useState(!1),[l,c]=h.useState([]),[a,d]=h.useState(),[g,w]=h.useState(400),m=h.useRef(null),[x,p]=h.useState(""),[C,k]=h.useState(""),[v,N]=h.useState(!1),{isShowOnboarding:b,onboardingFileSchema:E,setOnboardingFileSchema:R}=ve();h.useEffect(()=>{if(e.grid_data==null)f(!0);else{const T=e.grid_data.columns.map(S=>S.colId===tn?{...S,hide:!t}:S);c(e.grid_data.data),d(T),f(!1)}},[e.grid_data,t]),h.useEffect(()=>{l?(w(er(l.length)),s==null||s(l.length>=j.SERIES_LIMIT)):s==null||s(!1)},[l,s]),h.useEffect(()=>{if(b){const{title:T,description:S}=Re(ae.DATA_GRID,r);p(T),k(S)}},[r,b]),h.useEffect(()=>{var T;E&&!((T=E==null?void 0:E.infoElements)!=null&&T.dataGrid)&&(R==null||R({...E,infoElements:{...E==null?void 0:E.infoElements,dataGrid:!0},lastDisplayedElement:ae.DATA_GRID}))},[E,R]),h.useEffect(()=>{if(b){const T=(E==null?void 0:E.lastDisplayedElement)===ae.DATA_GRID;N(T),!u&&!n&&T&&setTimeout(()=>{var S;(S=m==null?void 0:m.current)==null||S.scrollIntoView({block:"end",behavior:"smooth"})})}},[E==null?void 0:E.lastDisplayedElement,b,n,u]);const D=h.useMemo(()=>i.jsx(uo.AgGridReact,{headerHeight:sn,rowHeight:Nn,rowData:l,enableCellTextSelection:!0,columnDefs:a,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Qo]:Js,[Xo]:Ys,[js]:qo}}),[l,a]);return u||n?i.jsx(j.Loader,{}):i.jsxs("div",{className:"w-full h-full",children:[i.jsx("div",{ref:m,className:V("ag-theme-quartz w-full min-h-[80px]",o?"max-h-[400px]":"max-h-full"),style:{height:g},children:D}),v&&i.jsx(Ie,{reference:m,title:x,description:C,supressReferenceClick:!0})]})},Zs=200,qs=8,Xs=2,Qs=({currentIndex:e,totalCount:n,icons:t,titles:o,onPrev:r,onNext:s})=>{const u=h.useRef(null),[f,l]=h.useState(""),[c,a]=h.useState(""),[d,g]=h.useState(!1),{onboardingFileSchema:w,isShowOnboarding:m}=ve();h.useEffect(()=>{if(m){const{title:k,description:v}=Re(ae.CHARTS_NAVIGATION,o);l(k),a(v)}},[o,m]),h.useEffect(()=>{var k;if(m){const v=(w==null?void 0:w.lastDisplayedElement)===ae.CHARTS_NAVIGATION;g(v),v&&((k=u==null?void 0:u.current)==null||k.scrollIntoView({block:"center",behavior:"smooth"}))}},[w==null?void 0:w.lastDisplayedElement,m]);const x=n>0?e/n*100:0,p=n>0?Math.min(qs*n,Zs):0,C=n>0?Math.max(p/n,Xs):0;return i.jsxs("div",{className:"w-full flex flex-row items-center gap-2 justify-center",children:[i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:r,children:t==null?void 0:t[Qe.PREVIOUS]}),i.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[i.jsx("div",{className:"h-[4px] rounded-full bg-neutral-300 relative",style:{width:`${p}px`},children:i.jsx("div",{className:"h-full rounded-full bg-primary absolute",style:{left:`${x}%`,width:`${C}px`}})}),i.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",n]})]}),i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===n?"text-neutrals-700":"text-primary"),onClick:s,ref:u,children:t==null?void 0:t[Qe.NEXT]}),d&&i.jsx(Ie,{reference:u,title:f,description:c})]})},el=({limitAmount:e,titles:n,openAdvancedView:t})=>{const[o,r]=h.useState(!1),{refs:s,floatingStyles:u,context:f}=Se.useFloating({open:o,onOpenChange:r,placement:"top-start"}),l=Se.useHover(f,{handleClose:Se.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:c,getFloatingProps:a}=Se.useInteractions([l]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex w-fit",ref:s.setReference,...c(),children:i.jsxs("div",{className:"flex bg-hues-100 w-fit px-4 mt-1 py-2 gap-1",children:[i.jsx("h5",{className:"font-bold",children:(n==null?void 0:n.limits)||"Limited to"}),i.jsxs("h5",{children:[e," ",(n==null?void 0:n.timeseriesLimit)||"Timeseries"]})]})}),o&&i.jsx("div",{className:"floating",ref:s.setFloating,style:u,...a(),children:i.jsxs("div",{className:"flex flex-col bg-white z-10 p-4 rounded shadow w-[300px] mb-2 gap-2",children:[i.jsxs("div",{children:[i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP1_1)||"The number of timeseries displayed in a single chart i"}),i.jsxs("span",{className:"font-bold pr-0.5",children:[(n==null?void 0:n.limitLinkInfoP1_2)||"limited to"," ",e]}),(n==null?void 0:n.limitLinkInfoP1_3)||"for better clarity and performance."]}),i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_1)||"To visualize specific timeseries"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_2)||"filter"}),i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_3)||"your request, or"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_4)||"refine"}),(n==null?void 0:n.limitLinkInfoP2_5)||"it in the chat."]})]}),t&&i.jsx("h4",{className:"cursor-pointer text-primary",onClick:t,children:(n==null?void 0:n.limitLinkInfoLink)||"Open Advanced View"})]})})]})};function nl(e,n,t){var c,a,d,g;const o=(a=((c=e.getZr())==null?void 0:c.painter).getRenderedCanvas())==null?void 0:a.getContext("2d");if(!o)return 0;const r=((d=t.textStyle)==null?void 0:d.fontSize)??12,s=((g=t.textStyle)==null?void 0:g.fontFamily)??"sans-serif";o.font=`${r}px ${s}`;const u=o.measureText(n).width,f=t.itemWidth??25,l=t.itemGap??10;return u+f+l}const tl=({option:e,style:n})=>{const t=h.useRef(null),[o,r]=h.useState(e);h.useEffect(()=>{r(vn.cloneDeep(e))},[e]);const s=h.useCallback(()=>{var C,k,v,N,b;const u=(k=(C=t.current)==null?void 0:C.getEchartsInstance)==null?void 0:k.call(C);if(!u)return;const l=u.getDom().clientWidth,c=e.legend||{},a=c.itemHeight??14,d=((v=c.textStyle)==null?void 0:v.fontSize)??12,g=((b=(N=u.getModel())==null?void 0:N.getComponent("legend"))==null?void 0:b.getData())||[];let w=0;g.forEach(E=>{const R=E.option.name||"";w+=nl(u,R,c)});const x=Math.max(1,Math.ceil(w/l))*(+a+ +d+6),p=20;r(E=>({...E,grid:{...E.grid||{},bottom:x+p}}))},[e.legend]);return h.useEffect(()=>{s();const u=()=>{s()};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[e,s]),i.jsx(co,{notMerge:!0,lazyUpdate:!1,ref:t,option:o,style:n})},ol=({attachment:e,icons:n,isDataLoading:t,openAdvancedView:o,fixHeight:r=!0,titles:s})=>{const[u,f]=h.useState(!0),[l,c]=h.useState([]),[a,d]=h.useState(0),[g,w]=h.useState(void 0),{onboardingFileSchema:m,isShowOnboarding:x,setOnboardingFileSchema:p}=ve(),C=h.useRef(null);h.useEffect(()=>{var N;f(e.charting_data==null),c(((N=e.charting_data)==null?void 0:N.units)||[])},[e.charting_data]),h.useEffect(()=>{const N=(l==null?void 0:l.length)>=a;w(!u&&N?l[a]:l[0]),N||d(0)},[u,l,a]),h.useEffect(()=>{var N;m&&x&&!u&&(Yi(m)&&(p==null||p(Ji(m)),(N=C==null?void 0:C.current)==null||N.scrollIntoView({block:"center",behavior:"smooth"})),m.lastDisplayedElement===ae.CHART_PER_SERIES&&(p==null||p(Wo(m))))},[u,p,m,x]);const k=h.useCallback(()=>{d(N=>Math.min(N+1,l.length-1))},[l]),v=h.useCallback(()=>{d(N=>Math.max(N-1,0))},[]);return u||t?i.jsx(j.Loader,{}):i.jsx("div",{className:"chart-attachment w-full h-full",ref:C,children:e.charting_data&&i.jsx("div",{className:"flex flex-col w-full h-full gap-4",children:l.length==0||g==null?i.jsx("h4",{className:"ml-1",children:(s==null?void 0:s.chartInfo)||"No data"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("h3",{className:"chart-attachment-title",children:[(s==null?void 0:s.chart)||"Chart"," ",a+1,"/",l.length]}),i.jsx("span",{className:"text-neutrals-700 h4 chart-attachment-info",children:(s==null?void 0:s.chartInfo)||"Chart Information"})]}),i.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",r&&"max-h-[400px] min-h-[400px]",!r&&"min-h-[300px]"),children:[i.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 gap-4",children:[i.jsx(tl,{option:g.config,style:{width:"100%",height:"100%",minHeight:0}}),g.limitedByRowsAmountTo&&i.jsx(el,{limitAmount:g.limitedByRowsAmountTo,openAdvancedView:o,titles:s}),l.length>1&&i.jsx(Qs,{icons:n,currentIndex:a,totalCount:l.length,titles:s,onNext:k,onPrev:v})]}),i.jsx(Zo,{dimensionsInfo:g.dimensions})]})]})})})},rl=e=>oe.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),oe.createElement("circle",{cx:32,cy:12,r:10,fill:"white"})),il=e=>oe.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),oe.createElement("circle",{cx:12,cy:12,r:10,fill:"white"})),Qt=[{value:A.SdmxDataFormat.JSON,title:"SDMX-JSON"},{value:A.SdmxDataFormat.XML,title:"SDMX-ML (XML)"},{value:A.SdmxDataFormat.CSV,title:"SDMX-CSV"}],sl=e=>[{value:A.FileColumnsAttribute.ID,title:(e==null?void 0:e.idOptions)||"ID",description:e==null?void 0:e.idOptionsDescription},{value:A.FileColumnsAttribute.NAME,title:(e==null?void 0:e.nameOptions)||"Name",description:e==null?void 0:e.nameOptionsDescription},{value:A.FileColumnsAttribute.ID_NAME,title:(e==null?void 0:e.idAndNameOptions)||"Combined ID and Name",description:e==null?void 0:e.idAndNameOptionsDescription}],eo=({title:e,items:n,selectedValue:t,setSelectedValue:o,infoMessage:r})=>i.jsxs(j.CollapsibleBlock,{title:e,value:t.title,children:[i.jsx("div",{className:"flex flex-col gap-y-1",children:n.map(s=>i.jsx("div",{className:"flex flex-col",children:i.jsx(j.Radio,{id:s.value,checked:t.value===s.value,label:s.title,description:s.description,onChange:()=>{o(s)},radioIcon:i.jsx(ye.IconCircleFilled,{className:"w-3 h-3"})},s.value)},s.value))}),r]}),ll=(e,n,t,o)=>{if(o!=null&&o.filterKey&&e===A.DownloadType.DATA_IN_TABLE)return o;let r=null,s=null;return n&&t&&e===A.DownloadType.DATA_IN_TABLE&&(r=t==null?null:A.getTimeSeriesFilterKey(t,n.filters),s=A.getTimeQueryFilter(n,A.getTimeDimension(t))),{filterKey:r,timeFilter:s}},al=({actions:e,dataQuery:n,datasetIcon:t,isDisplayDatasetIcon:o=!0,datasetName:r,onCloseModal:s,type:u=A.DownloadType.FULL_DATASET,locale:f=X.Locale.EN,dimensions:l,filters:c,urn:a,titles:d,limitMessages:g,showLimitMessage:w,externalLink:m})=>{const x=sl(d),[p,C]=h.useState(Qt[0]),[k,v]=h.useState(x[0]),[N,b]=h.useState(!0),E=h.useCallback(()=>{const R=ll(u,n,l,c),D=(n==null?void 0:n.urn)||a||"",T=k.value,S=p.value,M=`${r}.${S}`;e.downloadDataSet(D,S,f,T,R,M,N),s()},[u,n,l,c,a,k.value,p.value,e,f,N,s,r]);return i.jsxs(j.Popup,{heading:i.jsx("p",{className:"download-heading h2",children:(d==null?void 0:d.download)||"Download"}),portalId:"filters",size:j.PopUpSize.LG,containerClassName:"download-popup h-[80%]",dividers:!1,onClose:s,closeButtonTitle:(d==null?void 0:d.close)||"Close",children:[i.jsxs("div",{className:"download-info flex flex-col gap-1 px-6",children:[i.jsxs("div",{className:"download-info-text flex gap-1",children:[i.jsxs("p",{className:"text-neutrals-800 body-3",children:[(d==null?void 0:d.dataset)||"Dataset",":"]}),i.jsxs("span",{className:"h4 flex flex-row gap-x-1 flex-1 min-w-0",children:[o&&t,i.jsx("p",{className:"flex-1 min-w-0 truncate",children:r})]})]}),w&&i.jsx(j.RequestLimitMessage,{limitMessages:g,isDownload:!0,query:m})]}),i.jsxs("div",{className:"download-settings flex flex-col overflow-auto p-6",children:[i.jsx(eo,{title:(d==null?void 0:d.dataFormat)||"Data Format",selectedValue:p,setSelectedValue:C,items:Qt,infoMessage:i.jsx(j.DownloadFormatMessage,{limitMessages:g,query:m})}),i.jsx(eo,{title:(d==null?void 0:d.attributes)||"Attributes",selectedValue:k,setSelectedValue:v,items:x}),i.jsx(j.CollapsibleBlock,{title:(d==null?void 0:d.metadata)||"Metadata",value:N?(d==null?void 0:d.all)||"Included":(d==null?void 0:d.none)||"Not included",children:i.jsxs("div",{className:`flex gap-4 cursor-pointer download-metadata ${N?"download-metadata-active":""}`,children:[N?i.jsx(rl,{width:44,height:24,className:"text-primary",onClick:()=>{b(!N)}}):i.jsx(il,{width:44,height:24,className:"text-neutrals-500",onClick:()=>{b(!N)}}),i.jsx("div",{children:(d==null?void 0:d.includeMetadata)||"Include Metadata"})]})})]}),i.jsx("div",{className:"download-button flex p-6 mt-auto",children:i.jsx(j.Button,{buttonClassName:"text-button-primary",title:(d==null?void 0:d.download)||"Download",onClick:E})})]})},cl=({id:e,title:n,version:t,agency:o,isActive:r,isSingleTab:s,onSelectDataset:u})=>i.jsx("div",{className:V("dataset-tab truncate last:mr-4",r?"dataset-tab-active":"border-b-transparent",s?"dataset-tab-single cursor-default":"cursor-pointer"),title:n,onClick:()=>{s||u(A.generateShortUrn(e,t,o))},children:i.jsx("h3",{className:"dataset-tab-title truncate",title:n,children:n})}),lr=({datasets:e,locale:n,isHideAdvancedViewButton:t,openAdvancedViewIcon:o,initialSelectedDatasetUrn:r,selectDataset:s,onOpenAdvancedView:u,titles:f})=>{const{isOpenedAdvancedView:l}=_e(),[c,a]=h.useState(),d=h.useRef(null),[g,w]=h.useState(""),[m,x]=h.useState(""),[p,C]=h.useState(!1),{onboardingFileSchema:k,isShowOnboarding:v}=ve();h.useEffect(()=>{if(v){const{title:b,description:E}=Re(ae.OPEN_ADVANCED_VIEW,f);w(b),x(E)}},[f,v]),h.useEffect(()=>{var b;if(v){const E=(k==null?void 0:k.lastDisplayedElement)===ae.OPEN_ADVANCED_VIEW;C(E),E&&((b=d==null?void 0:d.current)==null||b.scrollIntoView({block:"center",behavior:"smooth"}))}},[k==null?void 0:k.lastDisplayedElement,v]),h.useEffect(()=>{if(!r&&!c&&(e!=null&&e[0])){const b=A.generateShortUrn(e[0].id,e[0].version,e[0].agencyID);a(b),s==null||s(b)}else r&&r!==c&&(a(r),s==null||s(r))},[e,s,r,c]);const N=h.useCallback(b=>{a(b),s==null||s(b)},[s]);return i.jsxs("div",{className:V("dataset-tabs flex justify-between items-center w-full",t&&l&&"hide-advance-button"),children:[i.jsx("div",{className:"flex items-center w-full overflow-y-auto gap-4 sm:w-[calc(100%-30px)]",children:e==null?void 0:e.map(b=>i.jsx(cl,{id:b==null?void 0:b.id,title:A.getLocalizedName(b,n||X.Locale.EN),version:b==null?void 0:b.version,agency:b==null?void 0:b.agencyID,isActive:(e==null?void 0:e.length)>1&&c===A.generateShortUrn(b==null?void 0:b.id,b==null?void 0:b.version,b==null?void 0:b.agencyID),isSingleTab:(e==null?void 0:e.length)===1,onSelectDataset:N},b==null?void 0:b.id))}),!t&&i.jsx("div",{ref:d,children:i.jsx(j.IconButton,{buttonClassName:"advanced-view-button",icon:o,onClick:u})}),p&&i.jsx(Ie,{reference:d,title:g,description:m,onReferenceClick:u,shouldCloseTooltip:l})]})},ul=(e,n,t,o)=>n==null?void 0:n.map(r=>{var d;const s=e==null?void 0:e.find(g=>(g==null?void 0:g.urn)===(r==null?void 0:r.urn)),u=t==null?void 0:t.get(r==null?void 0:r.urn),f=(u==null?void 0:u.conceptSchemes)||[],l=(u==null?void 0:u.codelists)||[],c=A.getDimensions(u),a=[...(c==null?void 0:c.dimensions)||[],...(c==null?void 0:c.timeDimensions)||[]];return{datasetName:A.getLocalizedName((d=u==null?void 0:u.dataflows)==null?void 0:d[0],o),queryFiltersDetails:dl(no((s==null?void 0:s.filters)||[],a,f,l,o),no(r==null?void 0:r.filters,a,f,l,o))}}),dl=(e,n)=>{const t=new Map(e==null?void 0:e.map(o=>[o==null?void 0:o.id,o]));return(n==null?void 0:n.filter(o=>{var r,s,u;return!vn.isEqual((s=(r=t==null?void 0:t.get(o==null?void 0:o.id))==null?void 0:r.valuesTitles)==null?void 0:s.sort(),(u=o==null?void 0:o.valuesTitles)==null?void 0:u.sort())}))||[]},no=(e,n,t,o,r)=>e==null?void 0:e.map(s=>{var c,a,d;const u=n.find(g=>(g==null?void 0:g.id)===(s==null?void 0:s.componentCode)),f=A.getConcept((u==null?void 0:u.conceptIdentity)||"",t),l=A.findCodelistByDimension(o,t,u);return{id:s==null?void 0:s.componentCode,title:A.getLocalizedName(f,r),valuesTitles:(s==null?void 0:s.operator)===X.QueryFilterType.BETWEEN?[`${nn(X.getTimePeriod((c=s==null?void 0:s.values)==null?void 0:c[0]),r)} - ${nn(X.getTimePeriod((a=s==null?void 0:s.values)==null?void 0:a[1]),r)}`]:(d=s==null?void 0:s.values)==null?void 0:d.map(g=>{var w;return A.getLocalizedName((w=l==null?void 0:l.codes)==null?void 0:w.find(m=>(m==null?void 0:m.id)===g),r)||g})}}),hl=(e,n,t)=>{var u,f,l;let o="",r="";if(e!=null&&e.timeFilter){const c=(u=decodeURIComponent(e.timeFilter||""))==null?void 0:u.split(":");o=c[1]||"",r=c[3]||""}else if(n){const c=n==null?void 0:n.filters.find(a=>a.componentCode===A.TIME_PERIOD);o=((f=c==null?void 0:c.values)==null?void 0:f[0])||"",r=((l=c==null?void 0:c.values)==null?void 0:l[1])||""}return`&filter=${(e==null?void 0:e.filterKey)||A.getTimeSeriesFilterKey(t||[],(n==null?void 0:n.filters)||[])}&startPeriod=${o}&endPeriod=${r}`},ar=(e,n,t,o)=>{var s;const r=e?hl(n,t,o):"";return((s=t==null?void 0:t.metadata)==null?void 0:s.datasetUrl)+r};Rt.ModuleRegistry.registerModules([Rt.AllCommunityModule]);const cr=({attachments:e,actions:n,titles:t,messageStyles:o,attachmentsStyles:r,isSystemAttachments:s,isShowAttachments:u,showAdvancedView:f,currentDataQuery:l,dataQueries:c,attachmentInfoList:a,datasets:d,initialSelectedDatasetUrn:g,isDataLoading:w,isDataSetAttachments:m,locale:x,dimensions:p,filters:C,selectDataset:k,onAdvancedViewOpen:v,limitMessages:N,attachmentsConfig:b})=>{const[E,R]=h.useState(0),[D,T]=h.useState(null),{isOpenedAdvancedView:S,setIsOpenedAdvancedView:M}=_e(),[y,P]=h.useState(j.PopUpState.Closed),[K,H]=h.useState(!1),[O,L]=h.useState(),[B,J]=h.useState(),[Y,G]=h.useState(!1),q={downloadDataSet:n.downloadDataSet,getConstraints:n.getConstraints},ce=A.DownloadType.DATA_IN_TABLE,ue=Ne=>{R(Ne)},ie=h.useCallback(()=>{v==null||v(),M(!0),n.updateCurrentDataQuery(l||(c==null?void 0:c[0])),n.updateDataQueries(c),n.updateDatasets(d)},[n,l,c,d,M,v]);h.useEffect(()=>{T(e[E]||null)},[e,E]),h.useEffect(()=>{H(m&&(d==null||(d==null?void 0:d.length)==0))},[d,m]);const me=h.useCallback(()=>{P(j.PopUpState.Closed)},[P]),de=b==null?void 0:b.isExternaLinkIncludeFilters,he=ar(de,C,l||(c==null?void 0:c[0]),p);return!e||e.length===0?null:i.jsx(i.Fragment,{children:S&&!u?i.jsx(Ls,{icon:o==null?void 0:o.advanceViewIcon,title:(o==null?void 0:o.openAdvanceViewTitle)??"Opened in Advanced view"}):i.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!S&&!s?"pt-5":"pt-0"),children:[!S&&K?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[s&&!S&&i.jsx(Cs,{titles:{queryUpdatedManuallyTitle:t==null?void 0:t.queryUpdatedManually,setToTitle:t==null?void 0:t.setTo},datasetIcon:r==null?void 0:r.datasetIcon,attachmentInfoList:a}),!S&&(d==null?void 0:d.length)!=null&&(d==null?void 0:d.length)>0&&i.jsx(lr,{datasets:d,initialSelectedDatasetUrn:g,locale:x,titles:t,isHideAdvancedViewButton:!f,openAdvancedViewIcon:r==null?void 0:r.openAdvancedViewIcon,selectDataset:k,onOpenAdvancedView:ie}),Y&&i.jsx(j.RequestLimitMessage,{limitMessages:N,showAdvancedViewButton:!!D&&mn(D)&&f,onAdvancedViewClick:ie,query:he}),i.jsx("div",{className:V(!S&&(d==null?void 0:d.length)&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:i.jsxs("div",{className:"flex flex-col max-w-full items-center gap-4 h-full",children:[i.jsxs("div",{className:"flex min-w-0 w-full justify-between items-center",children:[i.jsx(vs,{dataGridTitle:r==null?void 0:r.dataGridTitle,attachments:e,selectedAttachmentIndex:E,showTabIcon:r==null?void 0:r.showTabIcon,onSelectedAttachmentChange:ue,titles:t}),i.jsxs("div",{className:"flex gap-x-3 items-center flex-wrap w-full justify-end",children:[D&&$e(D)&&de&&i.jsx("a",{href:he,target:"_blank",children:i.jsx(j.Button,{title:(N==null?void 0:N.dataExplorer)||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:N==null?void 0:N.dataExplorerIcon})}),D&&$e(D)&&i.jsx(j.Button,{title:(r==null?void 0:r.downloadTitle)||"Download",buttonClassName:"text-button-tertiary small-icon-button",onClick:()=>P(j.PopUpState.Opened),iconBefore:r==null?void 0:r.downloadIcon})]})]}),D!=null&&i.jsxs("div",{className:"flex flex-1 w-full justify-center min-h-0",children:[qi(D)&&i.jsx(ss,{actions:n,downloadTitles:r==null?void 0:r.downloadTitle,attachment:D}),mn(D)&&i.jsx(Os,{actions:n,attachment:D,showLimitMessage:G}),$e(D)&&i.jsx(Ks,{attachment:D,isDataLoading:w,chartColumn:S,fixHeight:!S,titles:t,showLimitMessage:G}),qe(D)&&i.jsx(ol,{titles:t,isDataLoading:w,attachment:D,icons:r==null?void 0:r.chartingIcons,openAdvancedView:S?void 0:ie,fixHeight:!S}),Sn(D)&&i.jsx(gs,{attachment:D,openLinkTitle:r==null?void 0:r.openLinkTitle}),Jo(D)&&i.jsx(us,{attachment:D})]})]})})]}),i.jsxs(i.Fragment,{children:[y===j.PopUpState.Opened&&i.jsx(al,{actions:q,onCloseModal:me,dataQuery:l,datasetName:(D==null?void 0:D.title)||"",locale:x,type:ce,dimensions:p,filters:C,urn:l==null?void 0:l.urn,datasetIcon:r==null?void 0:r.datasetIcon,isDisplayDatasetIcon:r==null?void 0:r.isDisplayDatasetIcon,titles:r==null?void 0:r.downloadTitles,setIsShowDownloadAlert:L,setDownloadAlertDetails:J,limitMessages:N,showLimitMessage:Y,externalLink:he}),O&&i.jsx(j.Alert,{alertDetails:B,successIcon:r==null?void 0:r.successDownloadIcon,errorIcon:r==null?void 0:r.errorDownloadIcon,onClose:()=>L(!1),closeButtonTitle:(r==null?void 0:r.closeTitle)||"Close"})]})]})})},fl=({filtersProps:e,actions:n,attachments:t,attachmentsDataQuery:o,dataQueries:r,dimensions:s,locale:u,attachmentsStyles:f,isDataLoading:l,setIsFiltering:c,titles:a,limitMessages:d,attachmentsConfig:g,filters:w,onFiltersChange:m})=>{const x={getConstraints:n.getConstraints};return h.useEffect(()=>{l||c==null||c(!1)},[l,c]),i.jsx("div",{className:"bg-white rounded h-full min-h-0",children:i.jsxs("div",{className:"flex flex-col gap-4 h-full overflow-x-hidden",children:[i.jsxs("div",{className:"data-details-header flex justify-between items-center",children:[i.jsx("h2",{children:(a==null?void 0:a.content)??"Content"}),i.jsx(is,{attachmentsDataQuery:o,dataQueries:r,updateDataQueries:n==null?void 0:n.updateDataQueries,locale:u,actions:x,dimensions:s,titles:a,...e,onFiltersChange:m,limitMessages:d})]}),i.jsx("div",{className:"advanced-view-attachments-container flex-1 min-h-0",children:i.jsx(cr,{titles:a,attachments:t,attachmentsStyles:f,currentDataQuery:o,dimensions:s,actions:n,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:l,locale:u,filters:w,limitMessages:d,attachmentsConfig:g})})]})})};function hn(e){return(n={})=>{const t=n.width?String(n.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}function Be(e){return(n,t)=>{const o=t!=null&&t.context?String(t.context):"standalone";let r;if(o==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,f=t!=null&&t.width?String(t.width):u;r=e.formattingValues[f]||e.formattingValues[u]}else{const u=e.defaultWidth,f=t!=null&&t.width?String(t.width):e.defaultWidth;r=e.values[f]||e.values[u]}const s=e.argumentCallback?e.argumentCallback(n):n;return r[s]}}function He(e){return(n,t={})=>{const o=t.width,r=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],s=n.match(r);if(!s)return null;const u=s[0],f=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(f)?wl(f,d=>d.test(u)):gl(f,d=>d.test(u));let c;c=e.valueCallback?e.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const a=n.slice(u.length);return{value:c,rest:a}}}function gl(e,n){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n(e[t]))return t}function wl(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return t}function ml(e){return(n,t={})=>{const o=n.match(e.matchPattern);if(!o)return null;const r=o[0],s=n.match(e.parsePattern);if(!s)return null;let u=e.valueCallback?e.valueCallback(s[0]):s[0];u=t.valueCallback?t.valueCallback(u):u;const f=n.slice(r.length);return{value:u,rest:f}}}const to=Symbol.for("constructDateFrom");function ur(e,n){return typeof e=="function"?e(n):e&&typeof e=="object"&&to in e?e[to](n):e instanceof Date?new e.constructor(n):new Date(n)}function pl(e,...n){const t=ur.bind(null,e||n.find(o=>typeof o=="object"));return n.map(t)}let xl={};function vl(){return xl}function An(e,n){return ur(n||e,e)}function oo(e,n){var f,l,c,a;const t=vl(),o=(n==null?void 0:n.weekStartsOn)??((l=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((a=(c=t.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??0,r=An(e,n==null?void 0:n.in),s=r.getDay(),u=(s<o?7:0)+s-o;return r.setDate(r.getDate()-u),r.setHours(0,0,0,0),r}function dr(e,n,t){const[o,r]=pl(t==null?void 0:t.in,e,n);return+oo(o,t)==+oo(r,t)}function Ge(e,n){if(e.one!==void 0&&n===1)return e.one;const t=n%10,o=n%100;return t===1&&o!==11?e.singularNominative.replace("{{count}}",String(n)):t>=2&&t<=4&&(o<10||o>20)?e.singularGenitive.replace("{{count}}",String(n)):e.pluralGenitive.replace("{{count}}",String(n))}function we(e){return(n,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?e.future?Ge(e.future,n):"за "+Ge(e.regular,n):e.past?Ge(e.past,n):Ge(e.regular,n)+" тому":Ge(e.regular,n)}const bl=(e,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",Cl={lessThanXSeconds:we({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:we({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:bl,lessThanXMinutes:we({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:we({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:we({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:we({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:we({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:we({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:we({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:we({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:we({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:we({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:we({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:we({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:we({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},kl=(e,n,t)=>(t=t||{},Cl[e](n,t)),Sl={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},Nl={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},jl={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},El={date:hn({formats:Sl,defaultWidth:"full"}),time:hn({formats:Nl,defaultWidth:"full"}),dateTime:hn({formats:jl,defaultWidth:"full"})},Dn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function Al(e){const n=Dn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+n+" о' p";case 1:case 2:case 4:return"'у минулий "+n+" о' p"}}function hr(e){return"'у "+Dn[e]+" о' p"}function Dl(e){const n=Dn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+n+" о' p";case 1:case 2:case 4:return"'у наступний "+n+" о' p"}}const yl=(e,n,t)=>{const o=An(e),r=o.getDay();return dr(o,n,t)?hr(r):Al(r)},Ml=(e,n,t)=>{const o=An(e),r=o.getDay();return dr(o,n,t)?hr(r):Dl(r)},Tl={lastWeek:yl,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:Ml,other:"P"},Ol=(e,n,t,o)=>{const r=Tl[e];return typeof r=="function"?r(n,t,o):r},Ll={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},_l={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Rl={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},Il={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},Pl={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Vl={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:"ніч"}},Fl={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:"ночі"}},Bl=(e,n)=>{const t=String(n==null?void 0:n.unit),o=Number(e);let r;return t==="date"?o===3||o===23?r="-є":r="-е":t==="minute"||t==="second"||t==="hour"?r="-а":r="-й",o+r},Hl={ordinalNumber:Bl,era:Be({values:Ll,defaultWidth:"wide"}),quarter:Be({values:_l,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Be({values:Rl,defaultWidth:"wide",formattingValues:Il,defaultFormattingWidth:"wide"}),day:Be({values:Pl,defaultWidth:"wide"}),dayPeriod:Be({values:Vl,defaultWidth:"any",formattingValues:Fl,defaultFormattingWidth:"wide"})},Gl=/^(\d+)(-?(е|й|є|а|я))?/i,zl=/\d+/i,Ul={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Wl={any:[/^д/i,/^н/i]},$l={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},Jl={any:[/1/i,/2/i,/3/i,/4/i]},Yl={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},Kl={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]},Zl={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},ql={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},Xl={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Ql={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},ea={ordinalNumber:ml({matchPattern:Gl,parsePattern:zl,valueCallback:e=>parseInt(e,10)}),era:He({matchPatterns:Ul,defaultMatchWidth:"wide",parsePatterns:Wl,defaultParseWidth:"any"}),quarter:He({matchPatterns:$l,defaultMatchWidth:"wide",parsePatterns:Jl,defaultParseWidth:"any",valueCallback:e=>e+1}),month:He({matchPatterns:Yl,defaultMatchWidth:"wide",parsePatterns:Kl,defaultParseWidth:"any"}),day:He({matchPatterns:Zl,defaultMatchWidth:"wide",parsePatterns:ql,defaultParseWidth:"any"}),dayPeriod:He({matchPatterns:Xl,defaultMatchWidth:"wide",parsePatterns:Ql,defaultParseWidth:"any"})},na={code:"uk",formatDistance:kl,formatLong:El,formatRelative:Ol,localize:Hl,match:ea,options:{weekStartsOn:1,firstWeekContainsDate:1}},ta=e=>e===X.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",oa=(e,n)=>{const t=ta(n);return e!=null&&e!==""&&t&&It.isValid(new Date(e))?It.format(new Date(e),t,n===X.Locale.UK?{locale:na}:void 0):""},ra=yr.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function ze(...e){return ra(V(...e))}const ia=({isShowAgency:e,isShowDatasetBadge:n,dataset:t,data:o,structures:r,metadataSettings:s,locale:u,titles:f,getDatasetUpdatedTime:l,externalLink:c,datasetIcon:a,externalLinkIcon:d,metadataButtonClassName:g,metadataIconClassName:w,infoSegmentContainerClassName:m,infoSegmentHeaderClassName:x,nameAndMetadataContainerClassName:p})=>{const[C,k]=h.useState(""),[v,N]=h.useState(!1),b=h.useRef(null),[E,R]=h.useState(""),[D,T]=h.useState(""),[S,M]=h.useState(!1),{onboardingFileSchema:y,isShowOnboarding:P}=ve(),[K,H]=h.useState(!1),O=h.useMemo(()=>s!=null&&s.isMetadataDescription?Vs(t,C,u,f):[],[t,C,u,s==null?void 0:s.isMetadataDescription,f]),L=h.useMemo(()=>[...s!=null&&s.isMetadataDescription?[]:[an(t,u,f)],...Bs(Fs(o),A.getStructureComponentsMap(r),u)],[o,t,u,s==null?void 0:s.isMetadataDescription,r,f]),B=h.useCallback(()=>{N(!0)},[]),J=h.useCallback(()=>{N(!1),H(!0)},[]);h.useEffect(()=>{const q=l&&l(L)||oa(A.getLastUpdatedTime(t),u);k(q)},[t,u,L,l]),h.useEffect(()=>{if(P){const{title:G,description:q}=Re(ae.METADATA_PER_DATASET,f);R(G),T(q)}},[f,P]),h.useEffect(()=>{P&&M((y==null?void 0:y.lastDisplayedElement)===ae.METADATA_PER_DATASET)},[y==null?void 0:y.lastDisplayedElement,P]);const Y=(G,q)=>i.jsxs("div",{className:ze("flex gap-1 text-neutrals-1000",m),children:[i.jsxs("span",{className:ze("text-neutral-800",x),children:[G,":"]}),i.jsx("span",{children:q})]});return i.jsxs("div",{className:"flex flex-col bg-white gap-3 dataset-info",children:[n&&i.jsxs("div",{className:"flex gap-1 items-center py-1 px-2 rounded-[20px] bg-accent-500 body-2 w-fit",children:[a,(f==null?void 0:f.dataset)??"Dataset"]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex gap-1 items-center",children:[i.jsxs("div",{role:"heading","aria-level":4,className:ze("flex gap-1 items-center h4",p),children:[i.jsx("div",{ref:b,children:i.jsx(j.IconButton,{title:(f==null?void 0:f.metadata)??"View details",buttonClassName:ze("!text-neutrals-1000 !border-none !w-4 !h-4 !p-0 shrink-0",g),icon:i.jsx(nr,{className:ze("size-4",w)}),onClick:B})}),i.jsx("span",{children:A.getLocalizedName(t,u)})]}),c&&i.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:d||i.jsx(ye.IconExternalLink,{className:"text-primary cursor-pointer w-4 h-4 shrink-0"})})]}),i.jsxs("div",{className:"flex gap-2 body-3 items-center",children:[e&&i.jsxs(i.Fragment,{children:[Y((f==null?void 0:f.agency)??"Agency",(t==null?void 0:t.agencyID)??""),i.jsx("div",{"aria-hidden":"true",className:"border-l border-l-neutral-500 h-[14px]"})]}),Y((f==null?void 0:f.lastUpdated)??"Last updated",C)]})]}),S&&i.jsx(Ie,{reference:b,title:E,description:D,onReferenceClick:B,shouldCloseTooltip:K}),v&&i.jsx(En,{titles:f,locale:u,metadata:L,metadataDescription:O,isOpenMetadata:v,onCloseMetadata:J})]})},sa=({titles:e,locale:n,isShowShare:t,shareConversationProps:o})=>{const{setIsOpenedAdvancedView:r}=_e(),s=h.useRef(null),[u,f]=h.useState(""),[l,c]=h.useState(""),[a,d]=h.useState(!1),{onboardingFileSchema:g,isShowOnboarding:w}=ve();return h.useEffect(()=>{if(w){const{title:m,description:x}=Re(ae.EXIT_ADVANCED_VIEW,e);f(m),c(x)}},[e,w]),h.useEffect(()=>{w&&d((g==null?void 0:g.lastDisplayedElement)===ae.EXIT_ADVANCED_VIEW)},[g==null?void 0:g.lastDisplayedElement,w]),i.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[i.jsxs("div",{className:V("flex gap-3 items-center",!t&&"justify-between w-full","advanced-view-header-title"),children:[i.jsx("div",{ref:s,className:V(!t&&"order-2","flex"),children:i.jsx(j.CloseButton,{btnClassNames:"button-close",onClick:()=>r(!1),title:(e==null?void 0:e.close)||"Close"})}),a&&i.jsx(Ie,{reference:s,title:u,description:l,onReferenceClick:()=>r(!1),shouldMoveToNextStep:!0}),i.jsx("h2",{className:"sm:h-3",children:(e==null?void 0:e.advanceViewTitle)??"Advanced view"})]}),t&&i.jsx(To,{locale:n,...o})]})};function yn(e,n,t){var s;const o=A.getConcept(e.conceptIdentity,n),r=A.getArtifactByUrnWithWildCard((s=o==null?void 0:o.coreRepresentation)==null?void 0:s.enumeration,t);return{concept:o,codeList:r||void 0}}function fr(e,n,t){const o=e.findIndex(r=>r.id===n);return t.originalData.parsedTimeSeriesValue[o]}function gr(e,n,t,o,r){var f;const s=fr(e,n,o),u=(f=t==null?void 0:t.codes)==null?void 0:f.find(l=>l.id===s);return A.getLocalizedName(u,r)}function la(e,n,t,o,r,s,u,f,l){const c=aa(e,t),a=l!=null&&l.startPeriod&&l.endPeriod?A.getAdditionalColumns(f,l):[],d=ca(e,n,t,o,r,s,a);return[Es(e,n==null?void 0:n.data,t,r,s,u),...c,...d,As(e,n==null?void 0:n.data,t,void 0,s,u)]}function aa(e,n){var s;const t=e.conceptSchemes||[],o=e.codelists||[],r=((s=A.getDimensions(e))==null?void 0:s.dimensions)||[];return r.map(u=>{const{codeList:f,concept:l}=yn(u,t,o),c=a=>{const{data:d,colDef:g}=a,w=g.field;return gr(r,w,f,d,n)};return{headerName:A.getLocalizedName(l,n),field:u.id,colId:u.id,valueGetter:c,...pn,tooltipValueGetter:a=>a.value}})}function ca(e,n,t,o,r,s,u){const f=u!=null&&u.length?u:A.getTimePeriods(n);return da(f,(c,a)=>ua(c,a||c,o,s),e,t,r,s)}const ua=(e,n,t=X.defaultFormatNumbers,o)=>({headerName:mi(n,o),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:ln,cellClass:["justify-end","cell-with-meta"],valueFormatter:r=>X.formatNumberBySign(r.value,t)}),da=(e,n,t,o,r,s)=>{const u=[];return e.sort((l,c)=>A.sortPeriods(l,c)).forEach(l=>{u.push({headerName:l.toString(),field:l.toString(),...n(l.toString()),valueGetter:c=>{var a,d,g;return((g=(d=(a=c.data[c.column.getColId()])==null?void 0:a.value)==null?void 0:d[0])==null?void 0:g.value)||null},cellClass:jn,cellRenderer:Xo,width:ln,cellRendererParams:{dataSetData:t,locale:o,metadataSettings:r,titles:s}})}),u};function ha(e,n,t){const o=n.map(s=>s.id).filter(s=>s!=null),r=t.map(s=>s.id).filter(s=>s!=null);return fa(e,o,r,o)}const fa=(e,n,t,o)=>{const r=wa(e,n),s={};for(const u of r){const f=u.rowTime,l=wr(f,o);if(s[l]==null){s[l]={};for(const c of o)s[l][c]=f[c]}s[l]={attributes:u.attributes.filter(({value:c})=>c),...s[l],id:l,originalData:u.originalData,...ga(f,t)}}return Object.values(s)},wr=(e,n)=>n.map(t=>e[t]).join("_"),ga=(e,n)=>{const t=wr(e,n),{OBS_VALUE:o,obsAttributes:r}=e,s={};return s[t]={value:o,obsAttributes:r},s},wa=(e,n)=>{const t=[];for(const o of e){const r={},s=o.name.split(".");for(let u=0;u<n.length;u+=1)r[n[u]]=s[u];if(!o.values.length){const u={...r};u.TIME_PERIOD=void 0,u.OBS_VALUE=void 0,t.push({rowTime:u,attributes:o.attributes,id:o.name,originalData:o})}o.values.forEach(u=>{var c;const f={...r};f.TIME_PERIOD=u.dimensionAtObservation;const l=ma(o,u);f.OBS_VALUE=l,f.obsAttributes=((c=u==null?void 0:u.obsAttributes)==null?void 0:c.filter(({value:a})=>a))||[],t.push({rowTime:f,attributes:o.attributes,id:o.name,originalData:o})})}return t},ma=(e,n)=>{const o=[...e.attributes,...n.obsAttributes].find(({name:r})=>r==="OBS_VALUE");return o?[o]:n.values},pa="#EEEEEE",xa="#777777";function va(e,n,t){const o={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:r=>{let s=r[0].axisValueLabel+"<br/>";return r.forEach(u=>{u.value!==null&&u.value!==void 0&&(s+=u.marker+" "+u.seriesName+": "+u.value+"<br/>")}),s}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...ro(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...ro(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"value"},series:n};return(t==null?void 0:t.colors)!=null&&(o.color=t.colors),o}function ro(e=pa,n=xa){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:n},axisLine:{lineStyle:{color:e}}}}function mr(e,n,t,o){return n.map(s=>{var c;const u=((c=A.getDimensions(t))==null?void 0:c.dimensions)||[],f=u==null?void 0:u.find(a=>a.id===s);if(f==null)return e[s]||"";const{codeList:l}=yn(f,t.conceptSchemes||[],t.codelists||[]);return gr(u,s,l,e,o)}).join(" - ")}function ba(e,n){var s,u;const t=[...((s=n==null?void 0:n.metadata)==null?void 0:s.indicatorDimensions)||[]].filter(f=>f!=null),o=(u=A.getDimensions(e))==null?void 0:u.dimensions,r=(o==null?void 0:o.filter(f=>{var l;return f.id!=null&&!t.includes(f.id)&&((l=n==null?void 0:n.metadata)==null?void 0:l.countryDimension)!==f.id}).map(f=>f.id).filter(f=>f!=null))||[];return[...t,...r]}function Ca(e,n,t){const o={};return e.forEach(r=>{const s=ka(r,n,t);o[s]||(o[s]={rows:[]}),o[s].rows.push(r)}),Object.keys(o).map(r=>o[r])}function ka(e,n,t){var s,u,f,l;const o=((l=(f=(u=(s=t.dataStructures)==null?void 0:s[0])==null?void 0:u.dataStructureComponents)==null?void 0:f.dimensionList)==null?void 0:l.dimensions)||[];return n.map(c=>(o==null?void 0:o.find(d=>d.id===c))==null?e[c]||"":fr(o,c,e)).join(" - ")}function Sa(e,n){const t={};return e.forEach(o=>t[o]=Na(o,n)),{nonUniqDimensions:e.filter(o=>!t[o])}}function Na(e,n){const t=n.map(r=>ja(e,r));return new Set(t).size===1}function ja(e,n){return n[e]}const Ea="line",Ke=10;function Aa(e,n,t,o,r){const s=xr(n,e,t,o,r),f=A.getTimePeriods(n).sort((d,g)=>A.sortPeriods(d,g)),l=ba(e,t),{nonUniqDimensions:c}=Sa(l,s);return{units:Ca(s,c,e).map(d=>pr(d,e,t,f,o,r))}}function Da(e,n,t,o,r,s){return pr({rows:[e]},t,o,n,r,s)}function pr(e,n,t,o,r,s){var c,a,d;const u=Ta(e.rows,n,r),f=(c=u==null?void 0:u.find(g=>A.FREQUENCY_DIMENSION_ID.includes(g==null?void 0:g.id)))==null?void 0:c.id,l=ya(e.rows.length>Ke?e.rows.slice(0,Ke):e.rows,n,t,r,io(o,(a=e==null?void 0:e.rows)==null?void 0:a[0],f));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>Ke?Ke:void 0,dimensions:u,config:va(io(o,(d=e==null?void 0:e.rows)==null?void 0:d[0],f),l,s)}}function io(e,n,t){if(t){const o=n==null?void 0:n[t];if(o===A.Periods.MONTHLY)return e==null?void 0:e.filter(r=>A.isMonthly(r));if(o===A.Periods.QUARTERLY)return e==null?void 0:e.filter(r=>A.isQuarterly(r));if(o===A.Periods.ANNUAL)return e==null?void 0:e.filter(r=>A.isYearly(r))}return e}function ya(e,n,t,o,r){return e.map(s=>{var u,f;return{name:((u=t==null?void 0:t.metadata)==null?void 0:u.countryDimension)==null?"":mr(s,[(f=t==null?void 0:t.metadata)==null?void 0:f.countryDimension],n,o),type:Ea,data:r.map(l=>Ma(l,s))}})}function Ma(e,n){var t,o,r;return((r=(o=(t=n[e])==null?void 0:t.value)==null?void 0:o[0])==null?void 0:r.value)||null}function Ta(e,n,t){var o;return(((o=A.getDimensions(n))==null?void 0:o.dimensions)||[]).map(r=>{if(r.id!=null)return{id:r.id,title:Oa(r,n,t),value:mr(e[0],[r.id],n,t)}}).filter(r=>r!=null)}function Oa(e,n,t){const o=n.conceptSchemes||[],r=n.codelists||[],{concept:s}=yn(e,o,r);return A.getLocalizedName(s,t)||e.id}function xr(e,n,t,o,r){var c,a;const s=e==null?[]:A.getParsedResponse(e),u=((c=A.getDimensions(n))==null?void 0:c.dimensions)||[],f=((a=A.getDimensions(n))==null?void 0:a.timeDimensions)||[],l=ha(s,u,f);return La(l,e,n,t,o,r)}function La(e,n,t,o,r,s){const f=A.getTimePeriods(n).sort((l,c)=>A.sortPeriods(l,c));return e.map(l=>({...l,[tn]:Da(l,f,t,o,r,s)}))}function _a(e,n,t,o,r,s,u,f,l,c,a){return{columns:la(e,n,o,r,s,f,l,c,a),data:xr(n,e,t,o,u)}}function vr(e,n,t,o,r,s,u){const[f,l]=h.useState(),[c,a]=h.useState(),[d,g]=h.useState(),[w,m]=h.useState(),[x,p]=h.useState({title:(u==null?void 0:u.dataGrid)||"Data Grid",type:se.AttachmentType.CUSTOM_DATA_GRID}),[C,k]=h.useState({title:(u==null?void 0:u.chart)||"Chart",type:se.AttachmentType.CUSTOM_CHART}),[v,N]=h.useState([]),[b,E]=h.useState([]),[R,D]=h.useState(!1),[T,S]=h.useState({startPeriod:null,endPeriod:null}),M=h.useCallback(async H=>{var L;const O=A.getFiltersDtoFromDataQuery(H);try{const B=await e.getConstraints(H.urn,O),J=((L=B==null?void 0:B.data)==null?void 0:L.dataConstraints)||[];g(J)}catch{g([])}},[e,g]),y=h.useCallback(async H=>{e.getDataSet(H.urn).then(O=>{var L;if(O!=null&&O.data){const B=A.getDimensions(O.data);a(((L=O.data.dataflows)==null?void 0:L[0])||void 0),m(O.data||void 0),N([...(B==null?void 0:B.dimensions)||[],...(B==null?void 0:B.timeDimensions)||[]]);const J=(B==null?void 0:B.dimensions)==null?null:A.getTimeSeriesFilterKey(B==null?void 0:B.dimensions,H.filters),Y=Bi(H,B);e.getDataSetData(H.urn,{filterKey:J,timeFilter:Y}).then(G=>{l(G||void 0),E(A.getStructureDimensions(G))}).finally(()=>D(!1))}})},[e]);h.useEffect(()=>{async function H(O){D(!0);try{await Promise.all([M(O),y(O)])}catch(L){console.error("Error loading dataset details",L)}}t!=null&&H(t)},[e,t,M,y]);const P=h.useCallback((H,O,L)=>{var B;try{D(!0),g(O);const J=(B=L==null?void 0:L.find(Y=>Y.id===A.TIME_PERIOD))==null?void 0:B.timeRange;J&&S(J),e.getDataSetData((t==null?void 0:t.urn)||"",H).then(Y=>{l(Y||void 0),E(A.getStructureDimensions(Y))}).finally(()=>D(!1))}catch(J){console.error("Error loading dataset data",J)}},[e,t]);h.useEffect(()=>{var H,O,L;if(w!=null&&f!=null&&(d!=null&&d.length)){const B=(L=(O=(H=w.dataflows)==null?void 0:H[0])==null?void 0:O.names)==null?void 0:L[n],J=_a(w,f,t,n,o,s,r,u,e==null?void 0:e.putOnboardingFile,d,T);p(Y=>({...Y,title:B||(u==null?void 0:u.dataGrid)||"Data Grid",grid_data:J}))}},[w,f,u,n,o,t,s,r,d,T,e==null?void 0:e.putOnboardingFile]),h.useEffect(()=>{w!=null&&f!=null&&k(H=>{const O=Aa(w,f,t,n,r);return{...H,charting_data:O}})},[w,f,t,n,r]);const K=h.useMemo(()=>[x,C],[x,C]);return{dataMessage:f,structures:w,dataset:c,dimensions:v,structureDimensions:b,onFiltersChange:P,constraints:d,isLoadingGridData:R,dataSetAttachments:K}}const Ra=({attachmentsProps:e,actions:n,titles:t,shareConversationProps:o,metadataSettings:r,formattingSettings:s,locale:u,advanceViewStyles:f,getDatasetUpdatedTime:l,attachmentsConfig:c,datasetInfoOptions:a,...d})=>{var y,P,K,H,O;const{dataMessage:g,dataset:w,dimensions:m,structureDimensions:x,structures:p,dataSetAttachments:C,onFiltersChange:k,isLoadingGridData:v,constraints:N}=vr(n,u,e.currentDataQuery,s,(y=e.styles)==null?void 0:y.chartingStyles,r,t),[b,E]=h.useState(),[R,D]=h.useState({filterKey:null,timeFilter:null}),T=h.useCallback((L,B,J)=>{D(L),E(!0),k(L,B,J)},[k]),S=h.useCallback(L=>{var B;L&&(n==null||n.updateCurrentDataQuery(((B=e==null?void 0:e.dataQueries)==null?void 0:B.find(J=>(J==null?void 0:J.urn)===L))||e.currentDataQuery))},[n,e.currentDataQuery,e==null?void 0:e.dataQueries]),M=ar(c==null?void 0:c.isExternaLinkIncludeFilters,R,e.currentDataQuery||((P=e.dataQueries)==null?void 0:P[0]),m);return i.jsxs("div",{className:"advanced-view flex flex-col flex-1 h-full min-w-0",children:[i.jsx(sa,{titles:t,locale:u,shareConversationProps:o,isShowShare:f==null?void 0:f.isShowShare}),(K=e==null?void 0:e.datasets)!=null&&K.length?i.jsxs(i.Fragment,{children:[((H=e==null?void 0:e.datasets)==null?void 0:H.length)>1&&i.jsx(lr,{datasets:e==null?void 0:e.datasets,initialSelectedDatasetUrn:(O=e==null?void 0:e.currentDataQuery)==null?void 0:O.urn,locale:u,isHideAdvancedViewButton:!0,selectDataset:S}),v&&!b?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(ia,{...a,titles:t,locale:u,dataset:w,data:g==null?void 0:g.data,structures:p,metadataSettings:r,getDatasetUpdatedTime:l,externalLink:M}),i.jsx("div",{className:V("flex-1 min-h-0 overflow-auto","advanced-view-filters"),children:i.jsx(fl,{...d,titles:t,actions:n,attachments:C,attachmentsDataQuery:e.currentDataQuery,dataQueries:e==null?void 0:e.dataQueries,dimensions:m,attachmentsStyles:e.styles,isDataLoading:v,locale:u,filtersProps:{...d==null?void 0:d.filtersProps,structureDimensions:x,structures:p,onFiltersChange:k,initialConstraints:N},setIsFiltering:E,attachmentsConfig:c,filters:R,onFiltersChange:T})})]})]}):i.jsx(j.Loader,{})]})};function Ia(e,n,t,o,r){const[s,u]=h.useState([]),[f,l]=h.useState();return h.useEffect(()=>{function c(a){try{Promise.all(a.map(d=>e(d.urn))).then(d=>{var w;const g=((w=d==null?void 0:d.map(m=>{var x,p;return(p=(x=m==null?void 0:m.data)==null?void 0:x.dataflows)==null?void 0:p[0]}))==null?void 0:w.filter(m=>!!m))||[];u(g),n(g),t(a),o(a==null?void 0:a[0]),l(new Map(d==null?void 0:d.map(m=>{var x,p,C,k,v,N,b,E,R;return[A.generateShortUrn((C=(p=(x=m==null?void 0:m.data)==null?void 0:x.dataflows)==null?void 0:p[0])==null?void 0:C.id,(N=(v=(k=m==null?void 0:m.data)==null?void 0:k.dataflows)==null?void 0:v[0])==null?void 0:N.version,(R=(E=(b=m==null?void 0:m.data)==null?void 0:b.dataflows)==null?void 0:E[0])==null?void 0:R.agencyID),m==null?void 0:m.data]})))})}catch(d){console.error("Error loading datasets",d)}}r&&r.length&&c(r)},[r,e,o,t,n]),{datasets:s,datasetStructuresMap:f}}function so(e){const n=e==null?void 0:e.filter(t=>$o(t));if(n!=null&&n.every(t=>!!(t!=null&&t.data)))return n==null?void 0:n.map(t=>({title:t==null?void 0:t.title,...Va(Pa(t==null?void 0:t.data))}))}function Pa(e){if(e)try{return JSON.parse(e)}catch(n){console.error("Invalid JSON:",n)}return null}function Va(e){var n,t,o,r,s,u;return{...e,filters:(n=e==null?void 0:e.filters)==null?void 0:n.map(f=>({...f,componentCode:(f==null?void 0:f.component_code)||(f==null?void 0:f.componentCode)})),metadata:{datasetUrl:(t=e==null?void 0:e.metadata)==null?void 0:t.datasetUrl,countryDimension:((o=e==null?void 0:e.metadata)==null?void 0:o.country_dimension)||((r=e==null?void 0:e.metadata)==null?void 0:r.countryDimension),indicatorDimensions:((s=e==null?void 0:e.metadata)==null?void 0:s.indicator_dimensions)||((u=e==null?void 0:e.metadata)==null?void 0:u.indicatorDimensions)}}}var br=(e=>(e.COMPLETED="completed",e))(br||{});const Fa=({stage:e,stageRef:n,isCurrentStage:t})=>i.jsxs("div",{ref:n,className:"message-stage flex relative pb-8 last:pb-0 last:mb-8",children:[i.jsx("span",{className:"message-stage-line absolute border-l h-full"}),i.jsx(ye.IconPointFilled,{className:"message-stage-indicator flex shrink-0 z-10"}),i.jsxs("div",{className:"ml-2 w-full",children:[i.jsxs("div",{className:V("flex gap-2 items-center",(e==null?void 0:e.content)&&"mb-4"),children:[t&&i.jsx(j.Loader,{}),i.jsx("h3",{className:"message-stage-name",children:e==null?void 0:e.name})]}),i.jsx("div",{className:"prose max-w-full break-words",children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:"text-neutrals-1000",...o}),a:({href:o,children:r,...s})=>i.jsx("a",{href:o,target:"_blank",...s,children:r}),h1:o=>i.jsx("h1",{className:"h1 text-neutrals-1000",...o}),h2:o=>i.jsx("h2",{className:"h2 text-neutrals-1000",...o}),h3:o=>i.jsx("h3",{className:"h3 text-neutrals-1000",...o}),h4:o=>i.jsx("h4",{className:"h4 text-neutrals-1000",...o}),h5:o=>i.jsx("h5",{className:"h5 text-neutrals-1000",...o}),code:o=>i.jsx("code",{className:"text-neutrals-900",...o}),pre:o=>i.jsx("pre",{className:"bg-neutrals-100 border border-neutrals-600",...o})},children:e==null?void 0:e.content})})]})]}),Ba=({stages:e,expandIcon:n,processingTitle:t})=>{const[o,r]=h.useState(),[s,u]=h.useState(),f=h.useRef(null),l=h.useRef(null);h.useEffect(()=>{var a;u((a=e==null?void 0:e.filter(d=>(d==null?void 0:d.status)!==br.COMPLETED))==null?void 0:a.at(-1))},[e]),h.useEffect(()=>{var a;o&&((a=l==null?void 0:l.current)==null||a.scrollIntoView({block:"nearest",behavior:"smooth"}))},[o]),h.useEffect(()=>{const a=f.current;let d;if(!a)return;const g=new IntersectionObserver(([w])=>{var x;const m=(x=w==null?void 0:w.boundingClientRect)==null?void 0:x.top;d&&!(w!=null&&w.isIntersecting)&&m<d&&r(!1),d=m},{threshold:0});return g.observe(a),()=>g.disconnect()},[]);const c=()=>{r(a=>!a)};return i.jsxs("div",{className:"message-stages",ref:f,children:[i.jsxs("div",{className:V("message-stages-header inline-flex max-w-full items-center cursor-pointer",!(s!=null&&s.name)&&"default-header"),onClick:c,children:[i.jsx("p",{className:"message-stages-title truncate",children:(s==null?void 0:s.name)||t||"Processing..."}),i.jsx("i",{className:V("message-stages-expand-icon",o&&"rotated"),children:n})]}),o&&e&&i.jsx("div",{className:"flex flex-col",children:e==null?void 0:e.map(a=>i.jsx(Fa,{stage:a,stageRef:s?l:null,isCurrentStage:(a==null?void 0:a.index)===(s==null?void 0:s.index)},a.index))})]})},Ha=({message:e,regenerateMessage:n,messageActionsIcons:t,rateResponse:o,isStreaming:r=!1,isReadOnly:s=!1})=>{const u=t==null?void 0:t.copy,f=t==null?void 0:t.regenerate,l=t==null?void 0:t.thumbUp,c=t==null?void 0:t.thumbDown,a=t==null?void 0:t.thumbPressed,[d,g]=h.useState(e.like??re.LikeState.NoState),{isAgentAvailable:w}=j.useAgentAvailability(),m=x=>{e.responseId&&(g(x),o(e.responseId||"",x))};return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2"),children:[u&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:u}),f&&!s&&!r&&i.jsx("p",{onClick:w?()=>n==null?void 0:n(e):void 0,"aria-disabled":!w,className:V(!w&&"opacity-50 !cursor-not-allowed pointer-events-none"),children:f}),l&&!s&&d!==re.LikeState.Disliked&&(d===re.LikeState.NoState?i.jsx("p",{onClick:()=>m(re.LikeState.Liked),children:l}):i.jsx("p",{children:a})),c&&!s&&d!==re.LikeState.Liked&&(d===re.LikeState.NoState?i.jsx("p",{onClick:()=>m(re.LikeState.Disliked),children:c}):i.jsx("p",{className:"rotate-180",children:a}))]})},Ga=({message:e,onEditClick:n,messageActionsIcons:t,isStreaming:o=!1,isReadOnly:r=!1})=>{const s=t==null?void 0:t.copy,u=t==null?void 0:t.edit,{isAgentAvailable:f}=j.useAgentAvailability();return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2 ml-12"),children:[s&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:s}),u&&!o&&!r&&i.jsx("p",{onClick:f?n:void 0,className:V(!f&&"opacity-50 !cursor-not-allowed pointer-events-none"),"aria-disabled":!f,children:u})]})},za=({content:e,textColorClass:n,onCancel:t,onEditApply:o,editMessageTitles:r})=>{const{isOpenedAdvancedView:s}=_e(),u=h.useRef(null);h.useEffect(()=>{const l=u.current;f(),l&&(l.focus(),l.setSelectionRange(l.value.length,l.value.length))},[]);const f=()=>{const l=u.current;l&&(l.style.height="auto",l.style.height=l.scrollHeight+"px")};return i.jsxs("div",{className:V("max-w-none break-words",s?"body-2":"body-1",n),children:[i.jsx("textarea",{ref:u,className:"resize-none overflow-hidden outline-none bg-neutrals-300 w-full",defaultValue:e,onInput:f}),i.jsxs("div",{className:V("flex gap-x-2 items-center","edit-buttons-wrapper"),children:[i.jsx(j.Button,{buttonClassName:"text-button-secondary small-icon-button",title:r==null?void 0:r.cancel,isSmallButton:!0,onClick:t}),i.jsx(j.Button,{buttonClassName:"text-button-primary small-icon-button",title:r==null?void 0:r.send,isSmallButton:!0,onClick:()=>{var l;return o(((l=u.current)==null?void 0:l.value)||"")}})]})]})},Ua=({message:e,previousMessage:n,titles:t,actions:o,dataQuery:r,isStreaming:s=!1,isCurrentMessageStreaming:u=!1,messageStyles:f,attachmentsStyles:l,showAdvancedView:c,formattingSettings:a,locale:d,metadataSettings:g,expandStagesIcon:w,onAdvancedViewOpen:m,regenerateMessage:x,selectMessageToSend:p,messageActionsIcons:C,rateResponse:k,editMessage:v,editMessageTitles:N,isReadOnlyConversation:b,isNotLastUserMessage:E,limitMessages:R,attachmentsConfig:D})=>{var je,ke;const[T,S]=h.useState(),[M,y]=h.useState(),[P,K]=h.useState([]),[H,O]=h.useState([]),[L,B]=h.useState(),[J,Y]=h.useState(!1),G=e.role===re.Role.User,q=e.role===re.Role.System,{datasets:ce,datasetStructuresMap:ue}=Ia(o.getDataSet,o.updateDatasets,o.updateDataQueries,o.updateCurrentDataQuery,T),[ie,me]=h.useState(!1),[de,he]=h.useState([]);h.useEffect(()=>{y(T==null?void 0:T[0])},[T]);const{dataSetAttachments:Ne,dimensions:pe,isLoadingGridData:be}=vr(o,d,M,a,l==null?void 0:l.chartingStyles,g,t),{isOpenedAdvancedView:fe}=_e(),Ee=()=>{G&&me(!0)},ge=()=>{me(!1)},Me=F=>{ge(),v==null||v({...e,content:F})},Te=h.useCallback(F=>{F&&(y(T==null?void 0:T.find(z=>(z==null?void 0:z.urn)===F)),B(void 0))},[T]);h.useEffect(()=>{var W,ee,_,I;const F=(ee=(W=e.custom_content)==null?void 0:W.form_schema)==null?void 0:ee.properties,z=E?((_=F==null?void 0:F.choice)==null?void 0:_.oneOf)||((I=F==null?void 0:F.completion)==null?void 0:I.oneOf):[];he(z||[])},[e,E]),h.useEffect(()=>{const F=qt(e),z=so(F),W=F.filter(ee=>mn(ee));S(z),O(W)},[e]),h.useEffect(()=>{Y(T!=null&&T.length>0)},[T]),h.useEffect(()=>{r&&r.urn&&B(r.urn)},[r]),h.useEffect(()=>{if((e==null?void 0:e.role)===re.Role.System&&n){const F=qt(n),z=so(F)||[];T&&z&&ue&&K(ul(z,T,ue,d))}},[T,M,ue,pe,d,e==null?void 0:e.role,n]);const Oe=h.useCallback(()=>!G&&(f!=null&&f.systemMessageIcon)&&!(fe&&!u)?i.jsx("div",{className:V("flex-shrink-0 rounded-full flex items-center justify-center w-[44px] h-[44px]",u?"text-white absolute":"text-neutrals-400"),children:f.systemMessageIcon}):null,[G,f==null?void 0:f.systemMessageIcon,fe,u]),Ce=h.useMemo(()=>i.jsx(cr,{actions:o,titles:t,attachments:J?Ne:H,onAdvancedViewOpen:m,isDataSetAttachments:J,datasets:ce,initialSelectedDatasetUrn:L,messageStyles:f,attachmentsStyles:l,showAdvancedView:c,isSystemAttachments:q,isDataLoading:be,currentDataQuery:M,dataQueries:T,attachmentInfoList:P,locale:d,dimensions:pe,selectDataset:Te,limitMessages:R,attachmentsConfig:D}),[o,t,J,Ne,H,ce,L,f,l,c,q,be,M,T,P,d,pe,Te,m,R,D]);return i.jsx(i.Fragment,{children:!(q&&fe)&&i.jsx("div",{className:V("max-w-full flex",G?"justify-end":"justify-start","message-wrapper"),children:i.jsxs("div",{className:V("flex items-start max-w-full",(q||ie)&&"w-full"),children:[i.jsxs("div",{className:"mr-2 relative",children:[Oe(),u&&i.jsx(j.Loader,{})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:V(G?"bg-neutrals-300 px-6":"pt-0",G?"user-message":"system-message",G&&(ie?"w-[100%] ml-0":"ml-12")),children:[!G&&!fe&&((je=e==null?void 0:e.custom_content)!=null&&je.stages)?i.jsx(Ba,{stages:(ke=e==null?void 0:e.custom_content)==null?void 0:ke.stages,expandIcon:w,processingTitle:f==null?void 0:f.processingTitle}):u&&i.jsx("p",{className:"body-1 text-neutrals-700 loading-message",children:t==null?void 0:t.loading}),ie?i.jsx(za,{content:e.content,onCancel:ge,onEditApply:Me,editMessageTitles:N}):i.jsx(Lo,{content:e.content})]}),Ce,!u&&(G?!ie&&i.jsx(Ga,{messageActionsIcons:C,message:e,isStreaming:s,onEditClick:Ee,isReadOnly:b}):i.jsx(Ha,{messageActionsIcons:C,message:e,isStreaming:s,regenerateMessage:x,rateResponse:k,isReadOnly:b})),!fe&&!be&&i.jsx(_o,{choiceButtons:de,onClick:p})]})]})})})},Wa=({messages:e,isStreaming:n=!1,isReadOnly:t,scrollBottomIcon:o,...r})=>{const s=h.useRef(null),u=h.useRef(null),{isOpenedAdvancedView:f}=_e(),[l,c]=h.useState(null),[a,d]=h.useState(!1),g=()=>{var k;const p=(k=u.current)==null?void 0:k.parentElement,C=s.current;if(p&&C){const v=C.offsetTop-p.offsetTop;p.scrollTo({top:v,behavior:"smooth"})}};h.useEffect(()=>{g()},[e,n]),h.useEffect(()=>{!f&&l!==null&&setTimeout(()=>{var p,C;(C=(p=u==null?void 0:u.current)==null?void 0:p.parentElement)==null||C.scrollTo({top:l,behavior:"smooth"})})},[f,l]);const w=()=>{var C,k;const p=((k=(C=u.current)==null?void 0:C.parentElement)==null?void 0:k.scrollTop)||null;c(p)},m=()=>{var C;const p=(C=u.current)==null?void 0:C.parentElement;if(p){const{scrollTop:k,scrollHeight:v,clientHeight:N}=p;k+N>=v?d(!1):!a&&!f&&d(!0)}};h.useEffect(()=>{f&&d(!1)},[f]);const x=j.useDebounce(m,300);return h.useEffect(()=>{var C;const p=(C=u.current)==null?void 0:C.parentElement;return p==null||p.addEventListener("scroll",x),()=>p==null?void 0:p.removeEventListener("scroll",x)},[x]),i.jsxs("div",{ref:u,className:"h-full w-full",children:[i.jsxs("div",{className:"flex flex-col gap-y-6 max-w-full",children:[e.map((p,C)=>i.jsx(Ua,{message:p,previousMessage:Qi(e,C),onAdvancedViewOpen:w,isStreaming:n,isCurrentMessageStreaming:n&&C===e.length-1&&p.role===re.Role.Assistant,showAdvancedView:C===es(e)&&!t,isNotLastUserMessage:C===e.length-1&&p.role!==re.Role.User,...r},p.id||C)),i.jsx("div",{ref:s,className:"h-4"})]}),i.jsx("div",{onClick:g,className:V("fixed right-10 lg:right-6 sm:hidden bottom-[88px] rounded-[50%] border-[2px] w-[40px] h-[40px] border-primary cursor-pointer text-primary bg-white","scroll-button-wrapper",a?"block":"hidden"),children:i.jsx("div",{className:"flex justify-center items-center w-full h-full",children:o})})]})},$a=e=>{var t,o,r,s,u,f,l,c,a;const n={};return(r=(o=(t=e.choices)==null?void 0:t[0])==null?void 0:o.delta)!=null&&r.content&&(n.content=e.choices[0].delta.content),(f=(u=(s=e.choices)==null?void 0:s[0])==null?void 0:u.delta)!=null&&f.custom_content&&(n.custom_content=e.choices[0].delta.custom_content),(a=(c=(l=e.choices)==null?void 0:l[0])==null?void 0:c.delta)!=null&&a.role&&(n.role=e.choices[0].delta.role),e.id&&(n.responseId=e.id),n},Ja="local",Ya=e=>{var n;return!((n=e.permissions)!=null&&n.includes(re.SharePermission.WRITE))&&!Za(e)},Ka=(e,n)=>Cr(e)!==n,Za=e=>Cr(e)===Ja,Cr=e=>e.id.split("/")[0],qa=(e,n)=>Mn([...(n==null?void 0:n.messages)||[],e]),Mn=e=>[...e].map(n=>{const t={role:n.role,content:n.content};return(n.role===re.Role.Assistant||n.role===re.Role.System)&&n.custom_content!=null&&(n.custom_content.state!=null||n.custom_content.attachments!=null||n.custom_content.form_schema!=null)&&(t.custom_content={},n.custom_content.state!=null&&(t.custom_content.state=n.custom_content.state),n.custom_content.attachments!=null&&(t.custom_content.attachments=ec(n.custom_content.attachments)),n.custom_content.form_schema!=null&&(t.custom_content.form_schema=n.custom_content.form_schema)),n.role===re.Role.User&&n.custom_content&&(t.custom_content=n.custom_content),t}),Xa=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return Mn((t==null?void 0:t.slice(0,o))||[])},Qa=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return Mn([...(t==null?void 0:t.slice(0,o))||[],e])};function ec(e){return e.map(n=>({type:n.type,title:n.title,data:n.data,url:n.url,reference_type:n.reference_type,reference_url:n.reference_url}))}const nc=(e,n,t,o)=>{if(!t||n)return null;const r={id:`msg-${Date.now()}`,role:re.Role.User,content:e,timestamp:Date.now()};if(o){const s=o===rn.COMPLETE?Xe.COMPLETION:Xe.CHOICE;r.custom_content={form_value:{[s]:o}}}return r},tc=(e,n,t)=>`/${n}${t}/${X.getConversationNavPath(e==null?void 0:e.folderId,e==null?void 0:e.id)}`,oc=(e,n,t)=>{const o=`${n}/${t}`,r=se.generateConversationId({folderId:o,name:e==null?void 0:e.name});return{...e,folderId:o,id:r}},rc="AbortError",ic=({conversationKey:e,conversation:n,actions:t,messageStyles:o,attachmentsStyles:r,inputMessageStyles:s,shareConversationProps:u,showConversationHeaderAdvancedView:f=!0,formattingSettings:l,metadataSettings:c,expandStagesIcon:a,locale:d,conversationsRoute:g,token:w,titles:m,dataQuery:x,handleInvalidStreaming:p,setConversation:C,setConversations:k,openUrl:v,messageActionsIcons:N,editMessageTitles:b,scrollBottomIcon:E,isFinalMessage:R,limitMessages:D,attachmentsConfig:T})=>{const[S,M]=h.useState(null),[y,P]=h.useState(!1),[K,H]=h.useState(!0),{isStreaming:O,setIsStreaming:L}=go(),{isOpenedAdvancedView:B}=_e(),{isAgentAvailable:J}=j.useAgentAvailability(),{statusMessages:Y}=bn(),{onboardingFileSchema:G,onboardingFilePath:q,onboardingFileName:ce,isShowOnboarding:ue,setOnboardingFileSchema:ie}=ve();h.useEffect(()=>{var _;G&&((_=t.putOnboardingFile)==null||_.call(t,ce,q,G))},[t,G,ce,q]),h.useEffect(()=>{B&&(G==null?void 0:G.lastDisplayedElement)===ae.OPEN_ADVANCED_VIEW&&(ie==null||ie(Wo(G)))},[t,B,ie,G]);const me=h.useCallback(()=>{v(`/${d}${g}`)},[d,g,v]),de=h.useCallback(async()=>{try{const{bucket:_}=await t.getBucket(),I=oc(n,_,d);await t.createConversation(I,d);const U=await t.getConversations(d);k(X.cleanConversationNames(U)),v(tc(I,d,g))}catch(_){console.error("Failed to save conversation:",_)}},[t,n,g,d,v,k]),he=h.useCallback(async _=>{try{await t.updateConversation(decodeURI(e),{name:_.name,messages:_.messages})}catch(I){console.error("Failed to save conversation:",I)}},[t,e]),Ne=h.useCallback(_=>{C(I=>I?{...I,messages:[...(I==null?void 0:I.messages)||[],_]}:null)},[C]),pe=h.useCallback(()=>{const _={id:`msg-${Date.now()+1}`,role:re.Role.Assistant,content:"",timestamp:Date.now()};return C(I=>I?{...I,messages:[...I.messages,_]}:null),_},[C]),be=h.useCallback((_,I)=>{var $;const U=($=se.mergeMessages)==null?void 0:$.call(se,_,[I]);if(U)return C(ne=>ne?{...ne,messages:ne.messages.map(te=>te.id===_.id?{...U}:te)}:null),U},[C]),fe=h.useCallback((_,I)=>{var U;(U=n==null?void 0:n.model)!=null&&U.id&&(t.rateResponse(_,I===re.LikeState.Liked,n.model.id),n.messages=n.messages.map($=>$.responseId===_?vn.merge($,{like:I}):$),he(n))},[t,n,he]),Ee=h.useCallback(async(_,I,U)=>{var te;const $=new AbortController;M($);let ne=_;if(U)return await((te=se.streamChatResponse)==null?void 0:te.call(se,encodeURI(U.id),I,{model:U.model,signal:$==null?void 0:$.signal,onMessage:xe=>{const Le=$a(xe);(Le.content||Le.role||Le.responseId)&&(ne=be(ne,Le))},onError:xe=>{if(!Oe(xe))throw console.error("Streaming error:",xe),xe}},w,U==null?void 0:U.custom_fields).catch(xe=>{const Le=xe.message;p==null||p(Le)})),ne},[be,p,w]),ge=h.useCallback(async(_,I,U)=>{if(I){const $={...I,messages:[...I.messages],updatedAt:Date.now()};U&&$.messages.push(U),$.messages.push(_),await he($)}},[he]),Me=h.useCallback((_,I)=>{C(U=>U?{...U,messages:U.messages.filter($=>$.id!==I.id)}:null)},[C]),Te=h.useCallback(()=>{S&&!S.signal.aborted&&S.abort()},[S]),Oe=_=>(_==null?void 0:_.name)===rc,Ce=h.useCallback(async(_,I,U,$,ne,te=!0)=>{Oe(ne)?await ge($??U,_,te?I:void 0):Me(ne,I)},[ge,Me]),je=h.useCallback(async(_,I,U)=>{if(!I||!_)return;const $=nc(_,O,I,U);let ne,te;if($){Ne($);try{L(!0),ne=pe();const xe=qa($,I);te=await Ee(ne,xe,I),await ge(te,I,$)}catch(xe){Ce(I,$,ne,te,xe)}finally{L(!1)}}},[O,L,Ne,pe,Ee,ge,Ce]),ke=h.useCallback(async(_,I,U)=>{let $,ne;try{L(!0),$=pe(),ne=await Ee($,_,I),await ge(ne,I)}catch(te){Ce(I,U,$,ne,te,!1)}finally{L(!1)}},[L,ge,Ce,Ee,pe]),F=h.useCallback(async(_,I)=>{if(!I||!_)return;const U=Xa(_,I),$={...I,messages:I.messages.slice(0,U.length)};C(ne=>ne?{...ne,...$}:null),ke(U,$,_)},[C,ke]),z=h.useCallback(async(_,I)=>{if(!I||!_)return;const U=Qa(_,I),$={...I,messages:[...I.messages.slice(0,U.length-1),_]};C(ne=>ne?{...ne,...$}:null),ke(U,$,_)},[C,ke]);h.useEffect(()=>{async function _(){var I,U,$;try{H(!0);const{bucket:ne}=await t.getBucket(),te=await t.getConversation(decodeURI(e));C(te),P(Ya(te)&&Ka(te,ne)),(te.messages.length===0||((U=(I=te==null?void 0:te.messages)==null?void 0:I[0])==null?void 0:U.role)===re.Role.Assistant&&(($=te==null?void 0:te.messages)==null?void 0:$.length)===1)&&je(te.prompt,te)}catch{P(!0)}finally{H(!1)}}e&&_()},[e]);const W=h.useMemo(()=>({getFile:t.getFile,putOnboardingFile:t.putOnboardingFile,getDataSet:t.getDataSet,getDataSetData:t.getDataSetData,getConstraints:t.getConstraints,updateCurrentDataQuery:t.updateCurrentDataQuery,updateDataQueries:t.updateDataQueries,updateDatasets:t.updateDatasets,downloadDataSet:t.downloadDataSet}),[t]);if(K)return i.jsx(j.Loader,{});const ee=()=>J?i.jsx(xo,{onSendMessage:_=>je(_,n),onStopStreaming:Te,inProcess:O,sendMessageIcon:s.sendMessageIcon,placeholder:(m==null?void 0:m.askAnything)??"Ask anything...",containerClasses:"mt-4",inputClasses:"border-neutrals-600 mr-2"}):i.jsx(j.InlineAlert,{type:j.InlineAlertType.Error,children:Y.assistantUnavailable});return i.jsxs("div",{className:V("h-full flex flex-col bg-white",B&&!f?"p-4":"pr-2"),children:[B&&!f?null:i.jsx(Oo,{conversation:n,locale:d,isOpenedAdvancedView:B,isShowShareButton:!y&&!ue,shareConversationProps:u}),i.jsx("div",{className:V("flex-1 min-h-0 flex flex-col items-end overflow-y-auto",o==null?void 0:o.messagesWrapperClass),children:i.jsx(Wa,{messages:(n==null?void 0:n.messages)||[],actions:W,isStreaming:O,isReadOnly:y,messageStyles:o,attachmentsStyles:r,formattingSettings:l,metadataSettings:c,expandStagesIcon:a,dataQuery:x,locale:d,titles:m,regenerateMessage:_=>F(_,n),selectMessageToSend:(_,I)=>je(_,n,I),messageActionsIcons:N,rateResponse:fe,editMessage:_=>z(_,n),editMessageTitles:b,scrollBottomIcon:E,isReadOnlyConversation:y||ue,limitMessages:D,attachmentsConfig:T})}),ue?null:y?i.jsx("div",{className:"flex items-center justify-center mt-4",children:i.jsx(j.Button,{iconBefore:i.jsx(ye.IconCopy,{width:20,height:20}),title:(m==null?void 0:m.duplicate)??"Duplicate Chat",isSmallButton:!0,onClick:de,buttonClassName:V("text-button-secondary")})}):i.jsx("div",{className:V(s.inputContainerClass),children:ee()}),ue&&R&&i.jsx(j.Button,{iconBefore:i.jsx(ye.IconPlus,{width:24,height:24}),title:m==null?void 0:m.onboardingFooterLink,onClick:me,isSmallButton:!0,buttonClassName:"text-button-secondary self-center mb-3"})]})};exports.AdvancedView=Ra;exports.AdvancedViewProvider=Tr;exports.CUSTOM_CHOICE_ID=rn;exports.ChartingIcon=Qe;exports.ChatFooter=Io;exports.ChatMessagesProvider=Or;exports.ChatOnboardingFooter=Ro;exports.ConversationView=ic;exports.ConversationViewMessagesProvider=Lr;exports.ConversationWelcome=ni;exports.CustomContentProperties=Xe;exports.OnboardingProvider=_r;exports.STAGE_STATUS=po;exports.useAdvancedView=_e;exports.useChatMessages=go;exports.useConversationViewMessages=bn;exports.useOnboarding=ve;
39
+ ***************************************************************************** */var t=function(){return t=Object.assign||function(c){for(var a,d=1,g=arguments.length;d<g;d++){a=arguments[d];for(var w in a)Object.prototype.hasOwnProperty.call(a,w)&&(c[w]=a[w])}return c},t.apply(this,arguments)},o=function(l,c,a){return a.months[c?"shorthand":"longhand"][l]};function r(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function s(l){try{if(typeof l.composedPath=="function"){var c=l.composedPath();return c[0]}return l.target}catch{return l.target}}var u={shorthand:!1,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function f(l){var c=t(t({},u),l);return function(a){a.config.dateFormat=c.dateFormat,a.config.altFormat=c.altFormat;var d={monthsContainer:null};function g(){if(a.rContainer){r(a.rContainer);for(var S=0;S<a.monthElements.length;S++){var y=a.monthElements[S];y.parentNode&&y.parentNode.removeChild(y)}}}function w(){a.rContainer&&(d.monthsContainer=a._createElement("div","flatpickr-monthSelect-months"),d.monthsContainer.tabIndex=-1,m(),a.rContainer.appendChild(d.monthsContainer),a.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+c.theme))}function m(){if(d.monthsContainer){r(d.monthsContainer);for(var S=document.createDocumentFragment(),y=0;y<12;y++){var M=a.createDay("flatpickr-monthSelect-month",new Date(a.currentYear,y),0,y);M.dateObj.getMonth()===new Date().getMonth()&&M.dateObj.getFullYear()===new Date().getFullYear()&&M.classList.add("today"),M.textContent=o(y,c.shorthand,a.l10n),M.addEventListener("click",C),S.appendChild(M)}d.monthsContainer.appendChild(S),a.config.minDate&&a.currentYear===a.config.minDate.getFullYear()?a.prevMonthNav.classList.add("flatpickr-disabled"):a.prevMonthNav.classList.remove("flatpickr-disabled"),a.config.maxDate&&a.currentYear===a.config.maxDate.getFullYear()?a.nextMonthNav.classList.add("flatpickr-disabled"):a.nextMonthNav.classList.remove("flatpickr-disabled")}}function v(){a._bind(a.prevMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear-1),k(),m()}),a._bind(a.nextMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear+1),k(),m()}),a._bind(d.monthsContainer,"mouseover",function(S){a.config.mode==="range"&&a.onMouseOver(s(S),"flatpickr-monthSelect-month")})}function p(){if(a.rContainer&&a.selectedDates.length){for(var S=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"),y=0;y<S.length;y++)S[y].classList.remove("selected");var M=a.selectedDates[0].getMonth(),I=a.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(M+1)+")");I&&I.classList.add("selected")}}function k(){var S=a.selectedDates[0];if(S&&(S=new Date(S),S.setFullYear(a.currentYear),a.config.minDate&&S<a.config.minDate&&(S=a.config.minDate),a.config.maxDate&&S>a.config.maxDate&&(S=a.config.maxDate),a.currentYear=S.getFullYear()),a.currentYearElement.value=String(a.currentYear),a.rContainer){var y=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month");y.forEach(function(M){M.dateObj.setFullYear(a.currentYear),a.config.minDate&&M.dateObj<a.config.minDate||a.config.maxDate&&M.dateObj>a.config.maxDate?M.classList.add("flatpickr-disabled"):M.classList.remove("flatpickr-disabled")})}p()}function C(S){S.preventDefault(),S.stopPropagation();var y=s(S);if(y instanceof Element&&!y.classList.contains("flatpickr-disabled")&&!y.classList.contains("notAllowed")&&(x(y.dateObj),a.config.closeOnSelect)){var M=a.config.mode==="single",I=a.config.mode==="range"&&a.selectedDates.length===2;(M||I)&&a.close()}}function x(S){var y=new Date(a.currentYear,S.getMonth(),S.getDate()),M=[];switch(a.config.mode){case"single":M=[y];break;case"multiple":M.push(y);break;case"range":a.selectedDates.length===2?M=[y]:(M=a.selectedDates.concat([y]),M.sort(function(I,K){return I.getTime()-K.getTime()}));break}a.setDate(M,!0),p()}var N={37:-1,39:1,40:3,38:-3};function b(S,y,M,I){var K=N[I.keyCode]!==void 0;if(!(!K&&I.keyCode!==13)&&!(!a.rContainer||!d.monthsContainer)){var H=a.rContainer.querySelector(".flatpickr-monthSelect-month.selected"),L=Array.prototype.indexOf.call(d.monthsContainer.children,document.activeElement);if(L===-1){var O=H||d.monthsContainer.firstElementChild;O.focus(),L=O.$i}K?d.monthsContainer.children[(12+L+N[I.keyCode])%12].focus():I.keyCode===13&&d.monthsContainer.contains(document.activeElement)&&x(document.activeElement.dateObj)}}function j(){var S;((S=a.config)===null||S===void 0?void 0:S.mode)==="range"&&a.selectedDates.length===1&&a.clear(!1),a.selectedDates.length||m()}function _(){c._stubbedCurrentMonth=a._initialDate.getMonth(),a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth}function D(){c._stubbedCurrentMonth&&(a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth,delete c._stubbedCurrentMonth)}function T(){if(d.monthsContainer!==null)for(var S=d.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"),y=0;y<S.length;y++)S[y].removeEventListener("click",C)}return{onParseConfig:function(){a.config.enableTime=!1},onValueUpdate:p,onKeyDown:b,onReady:[_,g,w,v,p,function(){a.config.onClose.push(j),a.loadedPlugins.push("monthSelect")}],onDestroy:[D,T,function(){a.config.onClose=a.config.onClose.filter(function(S){return S!==j})}]}}}return f}))})(Qe)),Qe.exports}var ui=ci();const di=Po(ui),Ht=(e,n,t,o,r=!1,s)=>{const u={...li[o]},f=di;r&&(u.firstDayOfWeek=1);const l={minDate:t===X.CalendarResolution.MONTH?new Date(e.getFullYear(),e.getMonth()):e,maxDate:t===X.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n,locale:u};return t===X.CalendarResolution.MONTH?{...l,dateFormat:"M Y",plugins:[new f({shorthand:!0,dateFormat:"M Y"})]}:{...l,monthSelectorType:"static",dateFormat:s||"d.m.Y"}},Gt=e=>{e!=null&&e.setMinutes(e.getMinutes()-e.getTimezoneOffset())},hi={year:"numeric",month:"short",day:"numeric"},rn=(e,n)=>(e==null?void 0:e.toLocaleDateString(n,hi))||"",fi=(e,n)=>{const{startPeriod:t,endPeriod:o}=e;if(!n.startPeriod&&!n.endPeriod&&t&&o)return{startPeriod:new Date(t==null?void 0:t.getTime()),endPeriod:new Date(o==null?void 0:o.getTime())};const r=t?new Date(Math.max(t.getTime(),n.startPeriod.getTime())):n.startPeriod,s=o?new Date(Math.min(o.getTime(),n.endPeriod.getTime())):n.endPeriod;return{startPeriod:r,endPeriod:s}},gi=(e,n)=>{var l;const{endPeriod:t}=e,o=(t==null?void 0:t.getFullYear())||new Date().getFullYear(),r=o+ +n,s=new Date(+n<0?o:r,(t==null?void 0:t.getMonth())||0,(t==null?void 0:t.getDate())||1),u=new Date(+n<0?r:o,0,1);return{startPeriod:new Date(Math.max(u.getTime(),((l=e==null?void 0:e.startPeriod)==null?void 0:l.getTime())||0)),endPeriod:s}},wi=e=>({quarterly:(e==null?void 0:e.quarterly)||"Q",monthly:(e==null?void 0:e.monthly)||"M"}),mi=(e,n)=>{const t=wi(n);return A.isQuarterly(e)&&(t!=null&&t.quarterly)?e==null?void 0:e.replace(/Q/g,t==null?void 0:t.quarterly):A.isMonthly(e)&&(t!=null&&t.monthly)?e==null?void 0:e.replace(/M/g,t==null?void 0:t.monthly):e};var Ge=(e=>(e.FLAT_LIST="FLAT_LIST",e.HIERARCHY="HIERARCHY",e))(Ge||{});const pi=(e,n,t,o)=>(e==null?void 0:e.map(r=>{var l;const s=(l=A.findCodelistByDimension(n==null?void 0:n.codelists,n==null?void 0:n.conceptSchemes,r))==null?void 0:l.codes,u=A.getAvailableCodes(r,t,s,o),f=s==null?void 0:s.some(c=>c==null?void 0:c.parent);return{id:r==null?void 0:r.id,title:A.getDimensionTitle(n==null?void 0:n.conceptSchemes,r,o),dimensionValues:u,isTimeDimension:(r==null?void 0:r.type)===A.DimensionType.TIME_DIMENSION,isHierarchical:f,displayMode:f?Ge.HIERARCHY:Ge.FLAT_LIST}}))||[],zt=(e,n)=>e==null?void 0:e.map(t=>n&&(t==null?void 0:t.id)===(n==null?void 0:n.id)?{...n,isSelectedFilter:!0}:{...t,isSelectedFilter:!1}),xi=(e,n,t)=>e?e.map(o=>(o==null?void 0:o.id)===n?{...o,displayMode:t}:o):[],Vo=e=>(e==null?void 0:e.filter(n=>!!(n!=null&&n.isSelectedValue)))||[],Fo=e=>e==null?void 0:e.map(n=>({...n,dimensionValues:Vo(n==null?void 0:n.dimensionValues)})).filter(n=>{var t,o,r;return((t=n.dimensionValues)==null?void 0:t.length)||((o=n.timeRange)==null?void 0:o.startPeriod)||((r=n.timeRange)==null?void 0:r.endPeriod)}),vi=e=>(e==null?void 0:e.reduce((n,t)=>{var o;return(((o=t==null?void 0:t.dimensionValues)==null?void 0:o.length)??0)+n},0))||0,Bo=e=>{var n;return{...e,dimensionValues:(n=e==null?void 0:e.dimensionValues)==null?void 0:n.map(t=>({...t,isSelectedValue:!1})),timeRange:void 0}},bi=(e,n)=>e==null?void 0:e.map(t=>(t==null?void 0:t.id)===n?Bo(t):t),Ci=e=>e==null?void 0:e.map(n=>Bo(n)),ki=(e,n,t)=>e.map(o=>{var u,f;const r=n==null?void 0:n.filters.find(l=>l.componentCode===o.id);let s=[];if(r)if(o.isTimeDimension){const l=r.values.filter(w=>!!w),c=A.getAnnotationPeriod((u=t==null?void 0:t[0])==null?void 0:u.annotations),a=l[0]?X.getTimePeriod(l[0]):null,d=l[1]?X.getTimePeriod(l[1]):null;let g=c;return a&&d&&(g=c?fi({startPeriod:a,endPeriod:d},c):{startPeriod:a,endPeriod:d}),{...o,timeRange:g}}else s=(f=o==null?void 0:o.dimensionValues)==null?void 0:f.map(c=>{var a;return(a=r==null?void 0:r.values)!=null&&a.includes(c.id)?{...c,isSelectedValue:!0}:c});else s=o.dimensionValues;return{...o,dimensionValues:s}}),Ut=e=>e==null?void 0:e.map(n=>({...n,isDisabled:!0})),Si=e=>new Map(e==null?void 0:e.map(n=>[n.id,{...n,children:[]}])),Ni=e=>{if(!e)return[];const n=Si(e),t=[];return e.forEach(o=>{if(o&&o.parent){const r=n.get(o.parent),s=n.get(o.id);r&&r.children&&s&&(r.children=[...r.children,s])}else{const r=n.get(o.id);r&&t.push(r)}}),t},Ei=(e,n=!1)=>n?`${e*E.TREE_NODE_PADDING-E.TREE_NODE_ARROW_SIZE}px`:`${e*E.TREE_NODE_PADDING}px`,Ye=e=>{var n;return((n=e==null?void 0:e.children)==null?void 0:n.reduce((t,o)=>[...t,o,...Ye(o)],[]))||[]},qe=(e,n)=>e?e.map(t=>({...t,isSelectedValue:n})):[],ji=e=>{var o,r;const n=(o=e.children)==null?void 0:o.every(s=>s.isSelectedValue),t=(r=e.children)==null?void 0:r.every(s=>!s.isSelectedValue);if(e.isSelectedValue){if(e.isSelectedValue&&n)return[{...e,isSelectedValue:!1},...qe(Ye(e),!0)]}else{if(t)return[{...e,isSelectedValue:!0},...qe(Ye(e),!0)];if(n)return[{...e,isSelectedValue:!0},...qe(Ye(e),!1)]}return[{...e,isSelectedValue:!1},...qe(Ye(e),!1)]},Ai=e=>[{key:Ge.HIERARCHY,title:(e==null?void 0:e.hierarchy)||"Hierarchy"},{key:Ge.FLAT_LIST,title:(e==null?void 0:e.flatList)||"Flat list"}],Di=({calendarResolution:e,timeRange:n,timeRangeOptions:t,calendarStartFromMonday:o=!0,locale:r=X.Locale.EN,radioIcon:s,initialConstraints:u,onValueChange:f,calendarIcon:l,dateFormat:c,titles:a,defaultTimeOption:d})=>{var _,D,T,S,y;const g=A.getAnnotationPeriod((_=u==null?void 0:u[0])==null?void 0:_.annotations),[w,m]=h.useState(n),v=!n||((D=n==null?void 0:n.startPeriod)==null?void 0:D.getTime())===((T=g==null?void 0:g.startPeriod)==null?void 0:T.getTime())&&((S=n==null?void 0:n.endPeriod)==null?void 0:S.getTime())===((y=g==null?void 0:g.endPeriod)==null?void 0:y.getTime())?0:X.CUSTOM_PERIOD,[p,k]=h.useState(d??v),C=h.useMemo(()=>{const{startPeriod:M,endPeriod:I}=g,K=M==null?void 0:M.getFullYear(),H=I==null?void 0:I.getFullYear(),L=new Date().getFullYear();return t.filter(O=>O.value===X.CUSTOM_PERIOD||O.value===0||+O.value>=0&&H-L>=+O.value||+O.value<0&&K-L<+O.value)},[g,t]);h.useEffect(()=>{f(w,p)},[w]);const x=M=>{M&&(Gt(M),m(I=>I?{...I,startPeriod:M||null}:{endPeriod:null,startPeriod:M||null}))},N=M=>{M&&(Gt(M),m(I=>I?{...I,endPeriod:M||null}:{startPeriod:null,endPeriod:M||null}))};if(g==null)return null;const b=Ht(g.startPeriod,(w==null?void 0:w.endPeriod)||g.endPeriod,e,r,o,c),j=Ht((w==null?void 0:w.startPeriod)||g.startPeriod,g.endPeriod,e,r,o,c);return i.jsxs("div",{className:"mt-3 overflow-auto flex flex-col pt-2 pb-2 pr-3 h-full flex-1 min-w-0",children:[i.jsx("div",{className:"w-full",children:C.map(M=>i.jsx(E.Radio,{id:M.value.toString(),checked:p===M.value,label:M.title,onChange:()=>{const{value:I}=M;k(I),I!==X.CUSTOM_PERIOD&&m(I===0?g:gi(g,I))},radioIcon:s},M.value.toString()))}),i.jsx("div",{className:"w-full",children:p===X.CUSTOM_PERIOD&&i.jsxs("div",{className:"flex filters-time-period gap-4 mt-3 caption text-neutral-700",children:[i.jsx(E.Calendar,{onChange:x,options:b,value:(w==null?void 0:w.startPeriod)||(g==null?void 0:g.startPeriod),label:(a==null?void 0:a.from)||"From",id:"time-options-start",icon:l}),i.jsx(E.Calendar,{onChange:N,options:j,value:(w==null?void 0:w.endPeriod)||(g==null?void 0:g.endPeriod),label:(a==null?void 0:a.to)||"To",id:"time-options-end",icon:l,isEndDate:!0})]})})]})},Mi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("path",{d:"M6.25 4.66668L9.75 8.00001L6.25 11.3333L6.25 4.66668Z",fill:"currentColor"})),Ho=({node:e,level:n=1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:s})=>{var a;const[u,f]=h.useState(!1),l="cursor-pointer text-neutrals-1000 w-6 h-6 shrink-0";h.useEffect(()=>{var d;f(!!((d=e==null?void 0:e.children)!=null&&d.length))},[e]);const c=(d,g)=>{var w;(w=e==null?void 0:e.children)!=null&&w.length?r==null||r(ji(e)):o==null||o(d,g)};return i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-center",style:{paddingLeft:Ei(n,u)},children:[u&&(e!=null&&e.isExpanded?i.jsx(Mi,{className:l,onClick:()=>s==null?void 0:s(e)}):i.jsx(Nn,{className:l,onClick:()=>s==null?void 0:s(e)})),i.jsx(E.Checkbox,{id:e==null?void 0:e.id,label:e==null?void 0:e.name,checked:!!e.isSelectedValue,checkboxIcon:t,onChange:c})]}),u&&(e==null?void 0:e.isExpanded)&&i.jsx(i.Fragment,{children:(a=e==null?void 0:e.children)==null?void 0:a.map(d=>i.jsx(Ho,{node:d,level:n+1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:s},d==null?void 0:d.id))})]},e==null?void 0:e.id)},yi=({filterValues:e,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r})=>{const[s,u]=h.useState([]);return h.useEffect(()=>{u(Ni(e))},[e]),s==null?void 0:s.map(f=>i.jsx(Ho,{node:f,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r},f==null?void 0:f.id))},Ti=({style:e,filterValue:n,checkboxIcon:t,selectFilterValue:o})=>i.jsx("div",{style:e,children:i.jsx(E.Checkbox,{id:n.id,label:n.name,checked:!!n.isSelectedValue,checkboxIcon:t,onChange:o})}),Li=Ar.FixedSizeList,Wt=24,$t=232,Oi=({filterValues:e,checkboxIcon:n,isHierarchicalView:t,isDisableValues:o,selectFilterValue:r,selectHierarchicalNodes:s,expandHierarchicalValue:u})=>{const f=E.useIsMobile();if(!e)return null;const l=e.length*Wt,c=l>$t?$t:l;return i.jsx("div",{className:V(o&&"pointer-events-none opacity-[0.7]","h-full overflow-auto"),style:{height:f?c+"px":"100%"},children:t?i.jsx(yi,{filterValues:e,checkboxIcon:n,selectFilterValue:r,selectHierarchicalNodes:s,expandHierarchicalValue:u}):i.jsx(Dr,{children:({width:a,height:d})=>i.jsx(Li,{itemCount:e.length,itemSize:Wt,width:a,height:d,children:({index:g,style:w})=>i.jsx(Ti,{index:g,style:w,filterValue:e[g],checkboxIcon:n,selectFilterValue:r})})})})},Go=({selectedFilter:e,filterValuesProps:n,locale:t,isDisableValues:o,timeRangeOptions:r,onTimePeriodChange:s,selectFilterValue:u,titles:f,initialConstraints:l,selectHierarchicalNodes:c,expandHierarchicalValue:a,selectedTimeOption:d})=>{const[g,w]=h.useState(""),[m,v]=h.useState([]),p=(e==null?void 0:e.displayMode)===Ge.HIERARCHY;h.useEffect(()=>{var x;const C=((x=e==null?void 0:e.dimensionValues)==null?void 0:x.filter(N=>{var b,j;return(j=(b=N==null?void 0:N.name)==null?void 0:b.toLowerCase())==null?void 0:j.includes(g==null?void 0:g.toLowerCase())}))||[];v(p?A.getFilteredItemsWithParents(e==null?void 0:e.dimensionValues,C):C)},[p,g,e==null?void 0:e.dimensionValues]),h.useEffect(()=>{w("")},[e]);const k=h.useCallback(C=>{w(C)},[w]);return i.jsx(i.Fragment,{children:e!=null&&e.isTimeDimension&&l?i.jsx(Di,{titles:f,initialConstraints:l,calendarResolution:X.CalendarResolution.DAY,timeRange:(e==null?void 0:e.timeRange)||null,timeRangeOptions:r||[],calendarStartFromMonday:!0,locale:t,radioIcon:n==null?void 0:n.radioIcon,onValueChange:s,calendarIcon:n==null?void 0:n.calendarIcon,dateFormat:n==null?void 0:n.dateFormat,defaultTimeOption:d}):i.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:[i.jsx(E.InputWithIcon,{inputId:"filters-search-input",containerClasses:"gap-2 items-center filters-search-input",cssClass:"filters-search-input-text",placeholder:(f==null?void 0:f.searchPlaceholder)??"Search",value:g,onChange:k,iconBeforeInput:i.jsx(ye.IconSearch,{width:n==null?void 0:n.searchIconSize,height:n==null?void 0:n.searchIconSize,className:"text-primary"})}),i.jsx("div",{className:"flex flex-col mt-3 body-2 overflow-auto flex-1 min-h-0",children:i.jsx(Oi,{filterValues:g?m:e==null?void 0:e.dimensionValues,checkboxIcon:n==null?void 0:n.checkboxIcon,isHierarchicalView:p,isDisableValues:o,selectFilterValue:u,selectHierarchicalNodes:c,expandHierarchicalValue:a})})]})})},_i=({filter:e,onSelectFilter:n,onSelectDisplayMode:t,onDeleteFilter:o,locale:r,titles:s,initialConstraints:u,hideFacetCounterByDefault:f,filterValuesProps:l,isDisableValues:c,timeRangeOptions:a,onTimePeriodChange:d,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m})=>{var T;const v=E.useIsMobile(),[p,k]=h.useState(0),[C,x]=h.useState(!1),N=(e==null?void 0:e.isTimeDimension)&&(e==null?void 0:e.timeRange),b=h.useMemo(()=>{var S,y,M,I;return(S=e==null?void 0:e.timeRange)!=null&&S.startPeriod&&((y=e==null?void 0:e.timeRange)!=null&&y.endPeriod)?`${rn((M=e==null?void 0:e.timeRange)==null?void 0:M.startPeriod,r)} -
40
+ ${rn((I=e==null?void 0:e.timeRange)==null?void 0:I.endPeriod,r)}`:""},[r,e==null?void 0:e.timeRange]);h.useEffect(()=>{var S;k((S=Vo(e==null?void 0:e.dimensionValues))==null?void 0:S.length)},[e==null?void 0:e.dimensionValues]);const j=S=>{t==null||t(e==null?void 0:e.id,S)},_=f?p>0:!0;h.useEffect(()=>{e.isSelectedFilter||x(!1)},[e.isSelectedFilter]);const D=()=>{v&&x(S=>!S),n(e==null?void 0:e.id)};return i.jsxs("div",{className:"flex flex-col",children:[i.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",(e==null?void 0:e.isSelectedFilter)&&!v&&"bg-hues-100",(e==null?void 0:e.isDisabled)&&"cursor-default pointer-events-none opacity-[0.7]"),onClick:D,children:[i.jsxs("h3",{className:"w-full truncate flex-1 min-w-0 sm:flex sm:items-center",title:e==null?void 0:e.title,children:[i.jsx("span",{className:"truncate",children:e==null?void 0:e.title}),v&&i.jsx(Nn,{className:V("chevron-icon w-6 h-6 shrink-0",C&&"rotate-180")})]}),i.jsxs("div",{className:"ml-2 flex gap-2 items-center text-neutrals-800",children:[N&&i.jsx("span",{className:"filters-facet-item-counter border-none",children:b}),!N&&_&&i.jsx("span",{className:V("px-2 text-center","filters-facet-item-counter"),children:p?`${p}/${((T=e==null?void 0:e.dimensionValues)==null?void 0:T.length)||0}`:(s==null?void 0:s.all)||"All"}),N?null:i.jsxs("div",{className:"flex items-center gap-2 filters-facet-item-settings",children:[i.jsx(E.Dropdown,{triggerButton:i.jsx(E.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(oi,{width:16,height:16}),title:(s==null?void 0:s.displayOrder)||"Display Order",disabled:!(e!=null&&e.isHierarchical)}),options:Ai(s),selectedOption:e==null?void 0:e.displayMode,disabled:!(e!=null&&e.isHierarchical),onOptionSelect:j}),p>0&&i.jsx(E.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(ti,{width:16,height:16}),title:(s==null?void 0:s.reset)||"Reset",onClick:S=>{S.stopPropagation(),o==null||o(e==null?void 0:e.id)}})]})]})]}),C&&i.jsx(Go,{titles:s,selectedFilter:e,locale:r,isDisableValues:c,timeRangeOptions:a,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m,onTimePeriodChange:d,filterValuesProps:l,initialConstraints:u})]})},Ri=({filtersList:e,hideFacetCounterByDefault:n,locale:t,onSelectFilter:o,onDeleteFilter:r,onSelectDisplayMode:s,filterValuesProps:u,isDisableValues:f,timeRangeOptions:l,initialConstraints:c,onTimePeriodChange:a,selectFilterValue:d,selectHierarchicalNodes:g,titles:w,expandHierarchicalValue:m})=>i.jsx("div",{className:V("overflow-y-auto advanced-view-filters-list min-w-[320px] pr-3 h-full sm:w-full"),children:e==null?void 0:e.map(v=>i.jsx(_i,{titles:w,locale:t,filter:v,onSelectFilter:o,onSelectDisplayMode:s,onDeleteFilter:r,hideFacetCounterByDefault:n,isDisableValues:f,timeRangeOptions:l,selectFilterValue:d,selectHierarchicalNodes:g,expandHierarchicalValue:m,onTimePeriodChange:a,filterValuesProps:u,initialConstraints:c},v==null?void 0:v.id))}),Ii=({filtersList:e,titles:n,selectedFilter:t,modalProps:o,locale:r,isDisableValues:s,timeSeriesCount:u,timeRangeOptions:f,initialConstraints:l,setSelectedFilter:c,onSelectDisplayMode:a,onDeleteFilter:d,updateSelectedFilterValues:g,onTimePeriodChange:w,selectedTimeOption:m})=>{const v=E.useIsMobile(),p=h.useCallback(b=>{c({...e==null?void 0:e.find(j=>(j==null?void 0:j.id)===b),isSelectedFilter:!0})},[e,c]),k=(b,j)=>{var D;const _={...t,dimensionValues:(D=t==null?void 0:t.dimensionValues)==null?void 0:D.map(T=>(T==null?void 0:T.id)===b?{...T,isSelectedValue:j}:T)};c(_),g&&g(_)},C=b=>{var _;const j={...t,dimensionValues:(_=t==null?void 0:t.dimensionValues)==null?void 0:_.map(D=>(b==null?void 0:b.find(S=>(S==null?void 0:S.id)===(D==null?void 0:D.id)))||D)};c(j),g&&g(j)},x=b=>{var j;c({...t,dimensionValues:(j=t==null?void 0:t.dimensionValues)==null?void 0:j.map(_=>(_==null?void 0:_.id)===(b==null?void 0:b.id)?{..._,isExpanded:!(b!=null&&b.isExpanded)}:_)})},N=(b,j)=>{const _={...t,timeRange:b||void 0};w==null||w(j),c(_),g&&g(_)};return i.jsxs("div",{className:V("flex flex-row gap-5 flex-1 min-h-0 sm:p-0","filters-settings"),children:[i.jsxs("div",{className:V("h-full sm:w-full",(o==null?void 0:o.isShowTimeSeriesCount)&&"flex flex-col justify-between"),children:[i.jsx(Ri,{filtersList:e,hideFacetCounterByDefault:o==null?void 0:o.isHideFacetCounterByDefault,locale:r,titles:n,onSelectFilter:p,onSelectDisplayMode:a,onDeleteFilter:d,isDisableValues:s,initialConstraints:l,timeRangeOptions:f,selectFilterValue:k,selectHierarchicalNodes:C,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps}),o!=null&&o.isShowTimeSeriesCount&&u?i.jsxs("h4",{className:"text-neutrals-800 my-4",children:[(n==null?void 0:n.timeSeries)??"Timeseries",": ",u]}):null]}),!v&&i.jsx(Go,{selectedFilter:t,locale:r,titles:n,isDisableValues:s,timeRangeOptions:f,selectFilterValue:k,selectHierarchicalNodes:C,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps,initialConstraints:l,selectedTimeOption:m})]})},gn=(e,n,t,o,r=X.Locale.EN)=>{const s=n==null?void 0:n.map(u=>{const f=A.findCodelistByDimension(t==null?void 0:t.codelists,t==null?void 0:t.conceptSchemes,u),l=A.getAvailableCodesFromConstrains(f==null?void 0:f.codes,u.id,o,r);return{...u,dimensionValues:l}});return(e==null?void 0:e.map(u=>{var c;const l=(((c=s==null?void 0:s.find(a=>a.id===u.id))==null?void 0:c.dimensionValues)||[]).map(a=>{var g,w;const d=(w=(g=u.dimensionValues)==null?void 0:g.find(m=>(m==null?void 0:m.id)===(a==null?void 0:a.id)))==null?void 0:w.isSelectedValue;return{...a,isSelectedValue:d}});return{...u,isDisabled:!1,dimensionValues:l}}))||[]},Jt=e=>{let n=[];return e.filter(t=>{var o;return t.timeRange||((o=t.dimensionValues)==null?void 0:o.some(r=>r.isSelectedValue))}).forEach(t=>{var s;const{id:o,dimensionValues:r}=t;t.isTimeDimension?n=[...n,...Pi(t.timeRange,o)]:n.push({componentCode:o,operator:A.SeriesFilterOperator.EQUALS,value:((s=r==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:s.map(u=>u.id).join(A.GET_v3_FILTER_AND))||""})}),n},Pi=(e,n)=>e==null||e.startPeriod==null||e.endPeriod==null?[]:[{componentCode:n,operator:A.SeriesFilterOperator.GREATER_OR_EQUAL,value:Yt(new Date(e.startPeriod))},{componentCode:n,operator:A.SeriesFilterOperator.LESS_OR_EQUAL,value:Yt(new Date(e.endPeriod),1)}],Vi=1e3*60*60*24,Yt=(e,n=0)=>{e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());let t=e.getTime();return t+=n?Vi-1:0,e=new Date(t),t.toString()},Fi=e=>e.map(n=>{var t;return{componentCode:n.id||"",operator:X.QueryFilterType.IN,values:((t=n.dimensionValues)==null?void 0:t.map(o=>o.id))||[]}}),Bi=(e,n)=>{var s;const t=(s=n==null?void 0:n.timeDimensions)==null?void 0:s[0],o=A.getTimeRangeFromAttachment(e,t)||null;return o?A.getQueryTimePeriodFilters(o,t==null?void 0:t.id):null},Hi=(e,n)=>{const t=Fo(e),o=t.find(r=>(r==null?void 0:r.isTimeDimension)&&(r==null?void 0:r.timeRange));return{filterKey:A.getTimeSeriesFilterKey(n||[],Fi(t)),timeFilter:A.getQueryTimePeriodFilters(o==null?void 0:o.timeRange,o==null?void 0:o.id)}},Gi=e=>e==null?void 0:e.filter(n=>{var t;return n.timeRange||((t=n.dimensionValues)==null?void 0:t.some(o=>o.isSelectedValue))}).map(n=>{var t,o,r,s;return n!=null&&n.isTimeDimension?{componentCode:n==null?void 0:n.id,operator:X.QueryFilterType.BETWEEN,values:[Kt(((t=n==null?void 0:n.timeRange)==null?void 0:t.startPeriod)||void 0)||"",Kt(((o=n==null?void 0:n.timeRange)==null?void 0:o.endPeriod)||void 0)||""]}:{componentCode:n==null?void 0:n.id,operator:X.QueryFilterType.IN,values:((s=(r=n==null?void 0:n.dimensionValues)==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:s.map(u=>u.id))||[]}}),Kt=e=>{if(!e)return"";const n=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),o=e.getFullYear();return`${t}-${n}-${o}`},zi=({timeseriesLength:e=0,limitMessages:n})=>{var o,r;const t=!e||E.SERIES_LIMIT>e;return i.jsx("div",{className:"body-3 text-neutrals-800 sm:text-center flex gap-x-[4px] sm:justify-center items-center",children:t?i.jsx("span",{children:(o=n==null?void 0:n.seriesCount)==null?void 0:o.call(n,e)}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:n==null?void 0:n.warningIcon}),i.jsx("span",{children:(r=n==null?void 0:n.counterLimit)==null?void 0:r.call(n,e,E.SERIES_LIMIT)})]})})},Ui=({modalProps:e,onApply:n,onClearAllFilters:t,onClose:o,titles:r,applyDisabled:s,timeseriesLength:u,limitMessages:f})=>{const l=E.useIsMobile();return i.jsxs("div",{className:V("flex py-4 px-6","modal-footer-wrapper",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse items-center justify-between sm:flex-col sm:gap-y-4 items-center"),children:[!(e!=null&&e.isShowCancelButton)&&i.jsx(zi,{timeseriesLength:u,limitMessages:f}),i.jsxs("div",{className:V("flex",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse justify-end sm:flex-col-reverse sm:gap-y-4 items-center"),children:[i.jsx(E.Button,{iconBefore:l?e==null?void 0:e.resetIcon:void 0,buttonClassName:"text-button-tertiary p-0",title:e!=null&&e.isShowClearIcon?(r==null?void 0:r.clearAllFilters)??"Clear All Filters":(r==null?void 0:r.clearAll)??"Clear All",onClick:()=>t(),isSmallButton:l}),i.jsxs("div",{className:"flex items-center gap-x-3",children:[e!=null&&e.isShowCancelButton?i.jsx(E.Button,{buttonClassName:"text-button-tertiary sm:h8",title:(r==null?void 0:r.cancel)??"Cancel",onClick:o,isSmallButton:l}):null,i.jsx(E.Button,{buttonClassName:"advanced-view-filters-modal-apply-button",title:(r==null?void 0:r.apply)??"Apply",onClick:n,isSmallButton:l,disabled:s})]})]})]})},Wi=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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 ae=(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))(ae||{});const En=["charts","chartsNavigation"],Zt=["dataGrid","metadataPerSeries",...En,"openAdvancedView"],zo=["filters","chartPerSeries","metadataPerDataset","exitAdvancedView"],Pe=(e,n)=>({title:(n==null?void 0:n[`${e}Title`])||"",description:(n==null?void 0:n[`${e}Description`])||""}),xn=(e,n)=>e.find(t=>{var o;return!((o=n.infoElements)!=null&&o[t])})||"",$i=(e,n)=>{if(!e||!n)return"";if(Zt.includes(n)){const o=xn(Zt,e);if(o)return o}const t=xn(zo,e);return t||""},Uo=(e,n)=>{const t=xn(e,n);return{...n,infoElements:{...n==null?void 0:n.infoElements,[n.lastDisplayedElement]:!1,...t?{[t]:!0}:{}},lastDisplayedElement:t}},Wo=e=>Uo(zo,e),Ji=e=>Uo(En,e),Yi=e=>{var n,t;return(!((n=e==null?void 0:e.infoElements)!=null&&n.charts)||!((t=e==null?void 0:e.infoElements)!=null&&t.chartsNavigation))&&!En.includes(e.lastDisplayedElement)},Le=5,Ki=({targetPosition:e,overlayClasses:n,onClose:t})=>i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overlay overlay-top",style:{height:e.top,top:0-Le,bottom:e.top+Le}}),i.jsx("div",{className:"overlay overlay-bottom",style:{top:e.bottom+Le,bottom:0}}),i.jsx("div",{className:"overlay overlay-left",style:{top:e.top-Le,height:e.height+Le*2,width:e.left,left:0-Le,right:e.left-Le*2}}),i.jsx("div",{className:"overlay overlay-right",style:{top:e.top-Le,left:e.right+Le,height:e.height+Le*2,right:0}}),i.jsx("div",{className:V("outline-block z-10",n),onClick:t,style:{top:e.top,left:e.left,height:e.height,width:e.width}})]}),Ve=({reference:e,title:n,description:t,onReferenceClick:o,shouldCloseTooltip:r,shouldMoveToNextStep:s,supressReferenceClick:u})=>{var T;const[f,l]=h.useState(!0),[c,a]=h.useState(!1),d=h.useRef(null),{isShowOnboarding:g,onboardingFileSchema:w,setOnboardingFileSchema:m}=ke(),{refs:v,floatingStyles:p,context:k,placement:C}=Ee.useFloating({open:f,onOpenChange:l,placement:"right-start",elements:{reference:e==null?void 0:e.current},middleware:[Ee.offset({mainAxis:12,crossAxis:-4}),Ee.flip(),Ee.shift(),Ee.arrow({element:d})],whileElementsMounted:Ee.autoUpdate}),x=Ee.useClick(k),{getFloatingProps:N}=Ee.useInteractions([x]),b=h.useCallback(()=>{if(g){const S=$i(w,w==null?void 0:w.lastDisplayedElement);m==null||m({...w,infoElements:{...w==null?void 0:w.infoElements,...S?{[S]:!0}:{}},lastDisplayedElement:S})}l==null||l(!1)},[g,w,m]);h.useEffect(()=>{v.setReference((e==null?void 0:e.current)??null)},[e,v]);const j=()=>b(),_=(T=e==null?void 0:e.current)==null?void 0:T.getBoundingClientRect();h.useEffect(()=>{r&&!c&&(b(),a(!0))},[r,b,c]);const D=()=>{var S;o?(o==null||o(),s?b():l(!1)):u||(b(),(S=e==null?void 0:e.current)==null||S.click())};return i.jsx(i.Fragment,{children:f&&i.jsxs(Ee.FloatingPortal,{children:[_&&i.jsx(Ki,{overlayClasses:u?"cursor-default":"cursor-pointer",targetPosition:_,onClose:D}),i.jsxs("div",{ref:v.setFloating,style:p,...N(),className:"tooltip z-tooltip max-w-[350px]",children:[i.jsxs("div",{className:"tooltip-header",children:[i.jsx("h3",{children:n}),i.jsx(E.CloseButton,{btnClassNames:"w-4 h-4",onClick:j})]}),i.jsx("div",{className:"tooltip-description",children:i.jsx("p",{children:t})}),i.jsx("div",{ref:d,className:V("tooltip-arrow absolute w-3 h-3 rotate-45",C!=null&&C.includes("right")?"left-[-4px]":"right-[-6px]",C!=null&&C.includes("end")?"bottom-2 tooltip-arrow-white":"top-3")})]})]})})},Zi=({buttonProps:e,selectedFiltersCount:n=0,isLoading:t,setModalState:o,titles:r,isModalClosed:s,warningIcon:u,filterIconClassName:f,timeSeriesCount:l})=>{const c=h.useRef(null),[a,d]=h.useState(""),[g,w]=h.useState(""),[m,v]=h.useState(!1),{onboardingFileSchema:p,isShowOnboarding:k}=ke(),C=E.SERIES_LIMIT<(l??0),x=h.useMemo(()=>e!=null&&e.isShowBadge?e==null?void 0:e.title:`${e==null?void 0:e.title}: ${n}`,[e==null?void 0:e.isShowBadge,e==null?void 0:e.title,n]);return h.useEffect(()=>{if(k){const{title:N,description:b}=Pe(ae.FILTERS,r);d(N),w(b)}},[r,k]),h.useEffect(()=>{k&&v((p==null?void 0:p.lastDisplayedElement)===ae.FILTERS)},[p==null?void 0:p.lastDisplayedElement,k]),i.jsx("div",{className:"relative filter-button-container",ref:c,children:t?i.jsx(E.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(E.Button,{iconBefore:i.jsx(Wi,{className:V("size-4",f)}),iconAfter:C?u:void 0,title:x,buttonClassName:"text-button-secondary filter-button",isSmallButton:!0,onClick:()=>o(E.PopUpState.Opened)}),(e==null?void 0:e.isShowBadge)&&i.jsx("div",{className:"filter-count-badge",children:i.jsx("h5",{children:n})}),m&&i.jsx(Ve,{reference:c,title:a,description:g,onReferenceClick:()=>o(E.PopUpState.Opened),shouldCloseTooltip:s})]})})},qt=e=>{var t;const n=[];return(t=e.custom_content)!=null&&t.attachments&&n.push(...e.custom_content.attachments),n};function jn(e){var n;return e.type===se.AttachmentType.MARKDOWN&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("URL Query"))}function $o(e){var n;return e.type===se.AttachmentType.JSON&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("Query (JSON)"))}function Jo(e){return e.type===se.AttachmentType.MARKDOWN&&!jn(e)}function qi(e){return e.type===se.AttachmentType.CSV}function vn(e){return e.type===se.AttachmentType.TABLE}function Ke(e){return e.type===se.AttachmentType.CUSTOM_DATA_GRID}function en(e){return e.type===se.AttachmentType.CUSTOM_CHART}function Xi(e){return e.type===se.AttachmentType.PLOTLY}const Qi=(e,n)=>{var t;return(t=e==null?void 0:e.filter((o,r)=>{var s;return((s=o==null?void 0:o.custom_content)==null?void 0:s.attachments)&&r<n}))==null?void 0:t.at(-1)},es=e=>e==null?void 0:e.reduce((n,t,o)=>{var r,s;return(s=(r=t==null?void 0:t.custom_content)==null?void 0:r.attachments)!=null&&s.some(u=>$o(u))?o:n},-1),ns=e=>e==null?void 0:e.reduce((n,t)=>(t==null?void 0:t.role)===re.Role.Assistant?t:n,{}),ts=(e,n,t,o)=>{var r;return{role:re.Role.System,content:"",custom_content:{attachments:(t==null?void 0:t.map(s=>({type:se.AttachmentType.JSON,title:s==null?void 0:s.title,data:JSON.stringify({urn:s==null?void 0:s.urn,metadata:s==null?void 0:s.metadata,filters:(n==null?void 0:n.urn)===(s==null?void 0:s.urn)?e:s==null?void 0:s.filters})})))||[],form_schema:(r=o==null?void 0:o.custom_content)==null?void 0:r.form_schema}}},os=(e,n,t,o)=>{if(!e)return[];const r=e==null?void 0:e.at(-1);return r&&r.role===re.Role.System&&(e==null||e.pop()),[...e,ts(n,t,o,ns(e))]},rs=(e,n,t)=>(t==null?void 0:t.map(o=>({...o,filters:(n==null?void 0:n.urn)===(o==null?void 0:o.urn)?e:o==null?void 0:o.filters})))||[],is=({actions:e,dimensions:n,structureDimensions:t,structures:o,buttonProps:r,modalProps:s,attachmentsDataQuery:u,dataQueries:f,initialConstraints:l,onFiltersChange:c,locale:a,timeRangeOptions:d,titles:g,conversationKey:w,conversation:m,setConversation:v,updateConversation:p,updateDataQueries:k,limitMessages:C,filterIconClassName:x})=>{var Ae,Ne;const[N,b]=h.useState(E.PopUpState.Closed),[j,_]=h.useState([]),[D,T]=h.useState([]),[S,y]=h.useState(),[M,I]=h.useState([]),[K,H]=h.useState(void 0),L=h.useRef(l||[]),[O,B]=h.useState([]),[Y,U]=h.useState(),[G,q]=h.useState(),ce=h.useRef(!1),[ue,ie]=h.useState(!1),ve=P=>{const W=P?j.map($=>$.id===P.id?P:$):j;q(!0),_(Ut(W)),U==null||U(!0),he(P!=null&&P.isTimeDimension?zt(W,P):W,_,U)};h.useEffect(()=>{N===E.PopUpState.Closed&&B(L.current)},[N]);const he=h.useCallback((P,W,$)=>{e==null||e.getConstraints(u==null?void 0:u.urn,Jt(P).filter(ne=>ne.componentCode!==A.TIME_PERIOD)).then(ne=>{var me;const de=((me=ne==null?void 0:ne.data)==null?void 0:me.dataConstraints)||[];L.current=de,$==null||$(!1),W(gn(P,n,o,de,a))}).catch(()=>{L.current=[],$==null||$(!1),W(gn(P,n,o,[],a))}).finally(()=>{q(!1)})},[e,u==null?void 0:u.urn,n,a,o]);h.useEffect(()=>{const P=pi(n,o,t,a),W=n==null?void 0:n.map(ne=>{const de=A.findCodelistByDimension(o==null?void 0:o.codelists,o==null?void 0:o.conceptSchemes,ne),me=A.getAvailableCodesFromConstrains(de==null?void 0:de.codes,ne.id,L.current,a);return{...ne,dimensionValues:me}}),$=P.map(ne=>{var me;const de=((me=W==null?void 0:W.find(R=>R.id===ne.id))==null?void 0:me.dimensionValues)||[];return{...ne,dimensionValues:de}});if(!ce.current){const ne=ki($,u,L.current);U==null||U(!0),he(ne,T,U),ce.current=!0}},[n,t,o,u,a,l,he]),h.useEffect(()=>{D!=null&&D.length&&I(Fo(D))},[D]),h.useEffect(()=>{_(P=>zt(P,S))},[S]),h.useEffect(()=>{N===E.PopUpState.Opened&&(y({...D==null?void 0:D[0],isSelectedFilter:!0}),_(D)),N===E.PopUpState.Closed&&y(void 0)},[D,N]);const fe=h.useCallback(async P=>{const W=Gi(P),$=m?{...m,messages:os(m==null?void 0:m.messages,W,u,f)}:null;v==null||v($),k==null||k(rs(W,u,f)),await p(decodeURI(w),{name:$==null?void 0:$.name,messages:($==null?void 0:$.messages)||[]})},[u,m,w,f,v,p,k]),je=h.useCallback((P,W)=>{_($=>xi($,P,W)),(S==null?void 0:S.id)===P&&y($=>({...$,displayMode:W}))},[S==null?void 0:S.id]),be=h.useCallback(P=>Hi(P,n),[n]),Ce=h.useCallback((P,W)=>{const $=gn(W,n,o,P,a);L.current=P,y(ne=>($==null?void 0:$.find(de=>(de==null?void 0:de.id)===(ne==null?void 0:ne.id)))||ne),_($),q(!1)},[n,a,o]),ge=h.useCallback(P=>{q(!0),_(Ut(P)),e==null||e.getConstraints((u==null?void 0:u.urn)||"",Jt(P).filter(W=>W.componentCode!==A.TIME_PERIOD)).then(W=>{var $;Ce((($=W==null?void 0:W.data)==null?void 0:$.dataConstraints)||[],P)}).catch(()=>{Ce([],P)})},[e,u==null?void 0:u.urn,Ce]),De=h.useCallback(P=>{const W=bi(j,P);ge(W)},[ge,j]),we=h.useCallback(()=>{L.current=O,b(E.PopUpState.Closed),ie(!0)},[O]),Oe=h.useCallback(()=>{const P=Ci(j);ge(P)},[ge,j]),_e=h.useCallback(()=>{const P=be(j);c==null||c(P,L.current,j),T(j),b(E.PopUpState.Closed),ie(!0),h.startTransition(()=>{fe(j)})},[be,j,c,fe,L]),Re=P=>{H(P)},Se=Number(A.getTimeSeriesCount((Ne=(Ae=L==null?void 0:L.current)==null?void 0:Ae[0])==null?void 0:Ne.annotations));return i.jsxs("div",{className:"filters-container",children:[i.jsx(Zi,{buttonProps:r,selectedFiltersCount:vi(M),isLoading:Y,setModalState:b,titles:g,isModalClosed:ue,warningIcon:C==null?void 0:C.warningIcon,filterIconClassName:x,timeSeriesCount:Se}),i.jsx(i.Fragment,{children:N===E.PopUpState.Opened&&i.jsxs(E.Popup,{heading:(g==null?void 0:g.settings)||"Settings",portalId:"filters",size:E.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:s==null?void 0:s.isShowDividers,onClose:we,closeButtonTitle:(g==null?void 0:g.close)||"Close",children:[i.jsx(Ii,{locale:a,titles:g,timeRangeOptions:d,filtersList:j,selectedFilter:S,isDisableValues:G,modalProps:s,initialConstraints:l,timeSeriesCount:`${Se}`,setSelectedFilter:y,onSelectDisplayMode:je,onDeleteFilter:De,updateSelectedFilterValues:ve,onTimePeriodChange:Re,selectedTimeOption:K}),i.jsx(Ui,{titles:g,onApply:_e,onClose:we,onClearAllFilters:Oe,modalProps:s,applyDisabled:Y||G,timeseriesLength:Se,limitMessages:C})]})})]})},ss=({downloadTitles:e,attachment:n,actions:t,className:o=""})=>{const r=n.url,[s,u]=h.useState(null);async function f(l){if(l==null)return;const c=await t.getFile(l);u(c)}return i.jsxs("div",{className:`border rounded-lg p-3 bg-white transition-colors ${o}`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"body-2 text-neutrals-800 truncate",title:n.title,children:n.title})})}),r&&i.jsx("div",{className:"flex-shrink-0",children:i.jsx(E.Button,{title:e??"Download",onClick:()=>f(n.url),buttonClassName:"text-button-tertiary"})})]}),s&&i.jsx("div",{className:"mt-3",children:i.jsx("pre",{className:"bg-white p-3 rounded-md overflow-x-auto",children:i.jsx("code",{children:JSON.stringify(s,null,2)})})})]})},Yo="json";function ls(e){return cs(e)?as(e==null?void 0:e.slice(Yo.length)):e}function as(e){let n="";if(e)try{n=JSON.stringify(JSON.parse(e),null,2)}catch{n=e.toString()}return n}function cs(e){return(e==null?void 0:e.startsWith(Yo))||!1}const us=({attachment:e,className:n=""})=>{const t=ls(e.data);return t?i.jsxs("div",{className:`attachment-json border rounded-lg bg-white ${n}`,children:[i.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-neutrals-200 bg-neutrals-100 rounded-t-lg",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),i.jsx("div",{className:"p-3",children:i.jsx("pre",{className:"text-neutrals-800 overflow-x-auto whitespace-pre-wrap break-words max-h-96 overflow-y-auto",children:i.jsx("code",{children:t})})})]}):null},ds=e=>{try{const n=new URL(e);return["http:","https:","data:"].includes(n.protocol)}catch{return!1}},hs=e=>ds(e)?e:"",fs=e=>oe.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),gs=({attachment:e,openLinkTitle:n,className:t=""})=>{const o=hs(e.data||"");if(!o)return null;const r=s=>{const u=window.open(s,"_blank");u==null||u.focus()};return i.jsx("div",{className:`border rounded-lg bg-white pl-4 py-3 pr-3 max-w-[500px] ${t}`,children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-hues-800 flex-shrink-0 mt-1",role:"img","aria-label":"Link",children:i.jsx(fs,{width:16,height:16})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"mb-1",children:i.jsx(E.Link,{url:o,title:e.title})}),i.jsx("div",{className:"text-neutrals-600 break-all truncate",children:o})]}),i.jsx("div",{className:"flex-shrink-0",children:i.jsx(E.Button,{title:n??"Open link",onClick:()=>r(o),buttonClassName:"text-button-tertiary"})})]})})},Ko=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ws=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ms=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),ps=e=>oe.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),xs=({attachment:e,index:n,selectedAttachmentIndex:t,onSelectedAttachmentChange:o,showTabIcon:r,dataGridTitle:s,titles:u})=>{const f=h.useRef(null),[l,c]=h.useState(""),[a,d]=h.useState(""),[g,w]=h.useState(!1),{onboardingFileSchema:m,isShowOnboarding:v}=ke(),p=h.useCallback((C,x="")=>r?Xi(C)||en(C)?i.jsx(Ko,{className:x}):Ke(C)?i.jsx(ms,{className:x}):jn(C)?i.jsx(ps,{className:x}):Jo(C)?i.jsx(ws,{className:x}):null:null,[r]),k=h.useCallback(C=>Ke(C)?s||"Data Grid":C.title,[s]);return h.useEffect(()=>{if(v&&en(e)){const{title:C,description:x}=Pe(ae.CHARTS,u);c(C),d(x)}},[e,u,v]),h.useEffect(()=>{var C;if(en(e)&&v){const x=(m==null?void 0:m.lastDisplayedElement)===ae.CHARTS;w(x),x&&((C=f==null?void 0:f.current)==null||C.scrollIntoView({block:"end",behavior:"smooth"}))}},[m==null?void 0:m.lastDisplayedElement,e,v]),i.jsxs("div",{ref:f,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",t===n?"attachment-tab-active text-primary":""),onClick:()=>o(n),children:[p(e,"w-4 h-4"),i.jsx("h4",{className:"truncate max-w-[130px]",title:k(e),children:k(e)}),g&&i.jsx(Ve,{reference:f,title:l,description:a})]},e.index||n)},vs=({attachments:e,...n})=>i.jsx("div",{className:"flex items-center w-full flex-wrap attachments-tabs",children:e.map((t,o)=>i.jsx(xs,{attachment:t,index:o,...n},o))}),bs=({setToTitle:e,datasetName:n,datasetIcon:t,isShowDatasetDetails:o,queryFilterDetails:r})=>i.jsxs("div",{children:[n&&o&&i.jsxs("p",{className:"caption mt-4 inline-flex items-center attachment-dataset-name",children:[i.jsx("span",{className:"mr-1 attachment-dataset-icon",children:t}),n]}),r==null?void 0:r.map(s=>{var u;return i.jsxs("p",{className:"body-1 mb-2 last:mb-0",children:[s==null?void 0:s.title,i.jsx("span",{children:e??" set to "}),i.jsx("span",{className:"font-bold",children:(u=s==null?void 0:s.valuesTitles)==null?void 0:u.join(", ")})]},s==null?void 0:s.title)})]}),Cs=({titles:e,attachmentInfoList:n,datasetIcon:t})=>i.jsxs("div",{className:"attachment-details flex flex-col",children:[i.jsx("p",{className:V("body-1",n&&n.length<=1&&"mb-2"),children:(e==null?void 0:e.queryUpdatedManuallyTitle)??"Query has been updated manually."}),n==null?void 0:n.map(o=>{var r;return!!((r=o==null?void 0:o.queryFiltersDetails)!=null&&r.length)&&i.jsx(bs,{setToTitle:e==null?void 0:e.setToTitle,datasetName:o==null?void 0:o.datasetName,datasetIcon:t,isShowDatasetDetails:(n==null?void 0:n.length)>1,queryFilterDetails:o==null?void 0:o.queryFiltersDetails},o==null?void 0:o.datasetName)})]}),Zo=({dimensionsInfo:e})=>i.jsx("div",{className:"sidebar flex flex-col w-[176px] gap-3 min-h-0 overflow-auto",children:e.map(n=>i.jsxs("div",{className:"flex flex-col",children:[i.jsx("h5",{className:"text-neutrals-800",children:n.title}),i.jsx("h5",{className:"font-bold",children:n.value})]},n.title))}),ks=({titles:e,chart:n,isOpen:t,onClose:o})=>{const[r,s]=h.useState(E.PopUpState.Closed);h.useEffect(()=>{s(t?E.PopUpState.Opened:E.PopUpState.Closed)},[t]);const u=h.useCallback(()=>{s(E.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:r===E.PopUpState.Opened&&i.jsxs(E.Popup,{heading:i.jsx("h1",{className:"single-chart-popup-heading",children:(e==null?void 0:e.chart)??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:E.PopUpSize.LG,dividers:!1,onClose:u,closeButtonTitle:(e==null?void 0:e.close)??"Close",children:[i.jsxs("div",{className:"single-chart-popup-content flex flex-row flex-1 gap-4 min-h-0 h-full",children:[i.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:i.jsx(co,{option:n.config,className:"w-full h-full",style:{width:"100%",height:"100%"}})}),i.jsx(Zo,{dimensionsInfo:n.dimensions})]}),i.jsx("div",{})]})})},qo=e=>{var p;const[n,t]=h.useState(!1),o=h.useRef(null),[r,s]=h.useState(""),[u,f]=h.useState(""),[l,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=ke(),[g,w]=h.useState(!1),m=h.useCallback(()=>{t(!0)},[]),v=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:k,description:C}=Pe(ae.CHART_PER_SERIES,e.titles);s(k),f(C)}},[e.titles,d]),h.useEffect(()=>{d&&c((a==null?void 0:a.lastDisplayedElement)===ae.CHART_PER_SERIES&&e.node.rowIndex===0)},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(E.IconButton,{title:((p=e.titles)==null?void 0:p.chart)??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(Ko,{className:"w-5 h-5"}),onClick:m})}),l&&i.jsx(Ve,{reference:o,title:r,description:u,onReferenceClick:m,shouldCloseTooltip:g}),n&&i.jsx(ks,{chart:e.value,isOpen:n,onClose:v,titles:e.titles})]})},cn=32,An=32,Ss=16,Dn="padding-0",un=200,bn={flex:1,minWidth:un},Ns=cn,Xo="observationValueCell",Qo="metadataCell",Es="chartCell",sn="Chart_column",js=(e,n,t,o,r,s)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Dn,cellRenderer:Qo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,metadataSettings:o,titles:r,action:s}});function As(e,n,t,o=Ns,r,s){return{headerName:"",field:sn,colId:sn,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:o,maxWidth:o,minWidth:o,cellClass:Dn,suppressColumnsToolPanel:!0,cellRenderer:qo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,titles:r,action:s}}}const Cn=["index","value"],Ds=e=>({columns:Ts(e),data:Ms(e)}),Ms=e=>{const n=e.metadata.time_column,t={};for(const o of e.data.data){const{value:r,...s}=o,u=ys(o,n);t[u]={...t[u]||{},...s,[o[n]]:r}}return Object.values(t)},ys=(e,n)=>Object.keys(e).filter(t=>!Cn.includes(t)&&t!==n).map(t=>e[t]).join("."),Ts=e=>{const{metadata:n,data:t}=e,o=n.time_column,r=n.pinned_columns||[],s=t.schema.fields,u=[],f=t.data.map(g=>g[o]),c=Array.from(new Set(f)).filter(g=>g!=null).map(g=>({field:g,colId:g,headerName:g,cellClass:"text-right",width:un})),a=r.map(g=>s.find(w=>w.name===g)).filter(g=>g!=null),d=s.filter(g=>!r.includes(g.name)).filter(g=>g!=null);if(a.length>0)for(const g of[...a])g.name===o||Cn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:"left",...bn,tooltipValueGetter:w=>w.value});for(const g of[...d])g.name===o||Cn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:!1,...bn,tooltipValueGetter:w=>w.value});return u.push(...c),u},er=e=>e*An+cn+Ss,Ls=({attachment:e,actions:n,className:t="",showLimitMessage:o})=>{const[r,s]=h.useState(!1),[u,f]=h.useState([]),[l,c]=h.useState(),[a,d]=h.useState(400);h.useEffect(()=>{e.url!=null&&(s(!0),n.getFile(e.url).then(w=>{if(w==null){f([]),c([]),s(!1);return}const{columns:m,data:v}=Ds(w);f(v),c(m),s(!1)}))},[e.url,n]),h.useEffect(()=>{u?(d(er(u.length)),o==null||o(u.length>=E.SERIES_LIMIT)):o==null||o(!1)},[u,o]);const g=h.useMemo(()=>i.jsx(uo.AgGridReact,{headerHeight:cn,rowHeight:An,rowData:u,columnDefs:l,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:l&&(l==null?void 0:l.length)>5?"fitCellContents":"fitGridWidth"}}),[u,l]);return r?i.jsx(E.Loader,{}):i.jsx("div",{className:`w-full ${t}`,children:i.jsx("div",{className:"ag-theme-quartz w-full min-h-[80px] max-h-[400px]",style:{height:a},children:g})})},Os=({icon:e,title:n})=>i.jsx("div",{className:V("px-3 py-4 rounded border mt-3","attachment-collapsed"),children:i.jsxs("p",{className:V("flex body-3 items-center"),children:[e,i.jsxs("span",{className:"ml-2",children:[" ",n]})]})}),nr=e=>oe.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.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"})),_s=({title:e,value:n})=>{const t=h.useCallback(()=>Array.isArray(n)?n.join(", "):n,[n]);return i.jsxs("div",{className:"flex gap-x-3 body-3",children:[i.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),i.jsx("p",{title:t(),className:"font-semibold truncate pr-3",children:t()})]})},Rs=({title:e,value:n,attachedKeysTitles:t,locale:o})=>{const[r,s]=h.useState(!1),[u,f]=h.useState(!1),l=h.useRef(null),c=h.useCallback(()=>{u&&s(d=>!d)},[s,u]),a=h.useCallback(()=>{var d;return Array.isArray(n)?(d=n==null?void 0:n.map(g=>typeof g=="object"?g==null?void 0:g[o]:g))==null?void 0:d.join(", "):n},[o,n]);return h.useEffect(()=>{var d,g;l!=null&&l.current&&f(((d=l==null?void 0:l.current)==null?void 0:d.scrollHeight)>((g=l==null?void 0:l.current)==null?void 0:g.offsetHeight))},[l]),i.jsxs("div",{className:"metadata-item",children:[t==null?void 0:t.map(d=>i.jsx("div",{title:d,className:"metadata-item-key pr-3 mb-1 text-neutrals-800",children:d},d)),i.jsxs("div",{className:V("flex items-center",u&&"justify-between"),children:[i.jsx("h2",{title:e,className:"metadata-item-title",children:e}),u&&i.jsx(E.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",r?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:i.jsx(Nn,{width:24,height:24}),onClick:c})]}),i.jsx("p",{title:a(),className:V("metadata-item-value pr-3",!r&&"line-clamp-4"),ref:l,children:a()})]})},Mn=({metadata:e,metadataDescription:n=[],isOpenMetadata:t,onCloseMetadata:o,titles:r,locale:s})=>{const[u,f]=h.useState(E.PopUpState.Closed);h.useEffect(()=>{f(t?E.PopUpState.Opened:E.PopUpState.Closed)},[t]);const l=h.useCallback(()=>{f(E.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:u===E.PopUpState.Opened&&i.jsxs(E.Popup,{heading:i.jsx("h1",{className:"metadata-heading",children:(r==null?void 0:r.metadata)||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:E.PopUpSize.LG,dividers:!1,onClose:l,closeButtonTitle:(r==null?void 0:r.close)||"Close",children:[i.jsxs("div",{className:"metadata-content overflow-hidden h-full",children:[(n==null?void 0:n.length)>0&&i.jsx("div",{className:"metadata-description",children:n==null?void 0:n.map(c=>i.jsx(_s,{title:c==null?void 0:c.title,value:c==null?void 0:c.value},c==null?void 0:c.title))}),i.jsx("div",{className:"h-full overflow-y-auto metadata-list",children:e&&(e==null?void 0:e.length)>0?e==null?void 0:e.map(c=>i.jsx(Rs,{title:c==null?void 0:c.title,value:c==null?void 0:c.value,locale:s,attachedKeysTitles:c==null?void 0:c.attachedKeysTitles},(c==null?void 0:c.id)||(c==null?void 0:c.title))):i.jsx("div",{className:"metadata-empty text-neutrals-700 flex h-full justify-center items-center",children:(r==null?void 0:r.noMetadata)||"No metadata"})})]}),i.jsx("div",{})]})})},Is=e=>{var n,t;return(t=e==null?void 0:e.data[((n=e==null?void 0:e.colDef)==null?void 0:n.field)||0])==null?void 0:t.obsAttributes},Ps=e=>{var n;return(n=e==null?void 0:e.data)==null?void 0:n.attributes},tr=(e,n)=>Object.entries(e==null?void 0:e.data).filter(([t])=>n==null?void 0:n.get(t)).map(([t,o])=>({name:t,value:String(o)})),Xt=(e,n,t)=>{var r;const o=typeof e=="object"?e==null?void 0:e[n]:e;return t?A.getLocalizedName((r=t==null?void 0:t.codes)==null?void 0:r.find(s=>(s==null?void 0:s.id)===e),n)||"":o},ln=(e,n,t)=>(e==null?void 0:e.map(o=>{var l;const r=(o==null?void 0:o.name)||"",s=n==null?void 0:n.get(r),u=(l=s==null?void 0:s.codes)!=null&&l.length?s:void 0,f=Array.isArray(o==null?void 0:o.value)?o==null?void 0:o.value.map(c=>Xt(c,t,u)):Xt(o==null?void 0:o.value,t,u);return{id:A.getLocalizedName(u,t)||(o==null?void 0:o.name),title:A.getLocalizedName(u||s,t),value:f||(o==null?void 0:o.value)}}))||[],dn=(e,n,t)=>({title:(t==null?void 0:t.dataset)||"Dataset",value:A.getLocalizedName(e,n)}),Vs=(e,n,t,o)=>[dn(e,t,o),{title:(o==null?void 0:o.agency)??"Agency",value:e==null?void 0:e.agencyID},{title:(o==null?void 0:o.lastUpdated)??"Last updated",value:n}],or=(e,n,t)=>{var o,r;return{title:A.getDimensionTitle(e==null?void 0:e.conceptSchemes,(r=(o=A.getDimensions(e))==null?void 0:o.timeDimensions)==null?void 0:r[0],n),value:(t==null?void 0:t.colId)||""}},rr=(e,n)=>({title:(n==null?void 0:n.observation)||"Observation",value:e}),ir=(e,n,t,o,r,s)=>{var f;const u={title:(o==null?void 0:o.timeSeries)||"Time Series",value:(f=s==null?void 0:s.originalData)==null?void 0:f.name};return t?[or(e,n,r),u,rr(t,o)]:[u]},Fs=e=>{var o,r,s,u,f;const n=((r=(o=e==null?void 0:e.dataSets)==null?void 0:o[0])==null?void 0:r.attributes)||[],t=((f=(u=(s=e==null?void 0:e.structures)==null?void 0:s[0])==null?void 0:u.attributes)==null?void 0:f.dataSet)||[];return n!=null&&n.length?t.map((l,c)=>{var a;return((a=l==null?void 0:l.values)==null?void 0:a.length)>0?{...l}:{...l,values:[{value:n==null?void 0:n[c]}]}}):t},Bs=(e,n,t)=>(e==null?void 0:e.map(o=>{var d,g,w,m,v,p,k,C;const r=o==null?void 0:o.id,s=((g=(d=o==null?void 0:o.values)==null?void 0:d[0])==null?void 0:g.value)||((m=(w=o==null?void 0:o.values)==null?void 0:w[0])==null?void 0:m.id),u=(p=(v=o==null?void 0:o.values)==null?void 0:v[0])==null?void 0:p.ids,f=n==null?void 0:n.get(r),l=(k=f==null?void 0:f.codes)!=null&&k.length?f:void 0,c=A.getLocalizedName((C=l==null?void 0:l.codes)==null?void 0:C.find(x=>(x==null?void 0:x.id)===s),t)||s,a=u&&u.map(x=>{var N;return A.getLocalizedName((N=l==null?void 0:l.codes)==null?void 0:N.find(b=>(b==null?void 0:b.id)===x),t)||x});return{id:r,title:A.getLocalizedName(f,t)||r,value:u?a:c}}).filter(({value:o})=>!!o))||[],Hs=(e,n)=>{var u,f,l;const t=(u=e==null?void 0:e.dataSets)==null?void 0:u[0],o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=((l=o==null?void 0:o.attributes)==null?void 0:l.dimensionGroup)||[],s=t==null?void 0:t.dimensionGroupAttributes;return new Map(r.map(c=>{var w;const a=(w=c==null?void 0:c.relationship)==null?void 0:w.dimensions,{codedSeriesKey:d,decodedSeriesKey:g}=Gs(e,n,a);return[c.id,{values:(s==null?void 0:s[d])||[],decodedSeriesKey:g,codedSeriesKey:d}]}))},Gs=(e,n,t)=>{var f,l,c;const o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=[...(o==null?void 0:o.dimensions.series)||[],...(o==null?void 0:o.dimensions.observation)||[]],s=(l=new Array(r==null?void 0:r.length))==null?void 0:l.fill(""),u=(c=new Array(r==null?void 0:r.length))==null?void 0:c.fill("");return t&&(t==null||t.forEach(a=>{var m,v;const d=(r==null?void 0:r.findIndex(p=>(p==null?void 0:p.id)===a))||0,g=n[d],w=((v=(m=r[d])==null?void 0:m.values)==null?void 0:v.findIndex(p=>(p==null?void 0:p.id)===g||(p==null?void 0:p.value)===g))||0;s[d]=w>=0?w:g,u[d]=g})),{codedSeriesKey:s==null?void 0:s.join(":"),decodedSeriesKey:u==null?void 0:u.join(":")}},zs=(e,n)=>{var s;if(n==null)return;const t=(s=e==null?void 0:e.values)==null?void 0:s[n],o=typeof n=="object"&&!Array.isArray(n),r=Array.isArray(n);return t||(o||r?{values:n}:{value:n==null?void 0:n.toString()})},Us=e=>{const n=(e==null?void 0:e.value)||(e==null?void 0:e.id),t=(e==null?void 0:e.values)||(e==null?void 0:e.ids);return n!=null?[n]:t||[null]},sr=(e,n,t)=>{var r,s;if(n==null)return n;const o=(s=(r=t==null?void 0:t.get(e||""))==null?void 0:r.codes)==null?void 0:s.find(u=>(u==null?void 0:u.id)===n);return(o==null?void 0:o.name)||n},Ws=(e,n,t,o=X.Locale.EN)=>{var l;const r=(l=t==null?void 0:t.dataStructureComponents)==null?void 0:l.dimensionList,s=[...(r==null?void 0:r.dimensions)||[],...(r==null?void 0:r.timeDimensions)||[]],u=[],f=(e==null?void 0:e.split(":"))||[];return f==null||f.forEach((c,a)=>{var d;if(c!==""){const g=((d=s==null?void 0:s[a])==null?void 0:d.id)||"",w=A.getLocalizedName(n==null?void 0:n.get(g),o),m=sr(g,c,n);u.push(`${w}: ${m}`)}}),u},$s=(e,n,t,o,r=X.Locale.EN)=>{var f,l,c,a;if(!e||!n||!o)return[];const s=((c=(l=(f=e==null?void 0:e.structures)==null?void 0:f[0])==null?void 0:l.attributes)==null?void 0:c.dimensionGroup)||[],u=Hs(e,o);return((a=s==null?void 0:s.map((d,g)=>{var p;const w=u==null?void 0:u.get(d==null?void 0:d.id),m=t==null?void 0:t.get(d==null?void 0:d.id),v=Us(zs(d,(p=w==null?void 0:w.values)==null?void 0:p[g]));return{id:d==null?void 0:d.id,title:A.getLocalizedName(m,r),value:Array.isArray(v)?v==null?void 0:v.map(k=>sr(d==null?void 0:d.id,k,t)||""):v,attachedKeysTitles:Ws(w==null?void 0:w.decodedSeriesKey,t,n)}}))==null?void 0:a.filter(({value:d})=>d==null?void 0:d.some(g=>!!g)))||[]},Js=e=>{var x,N;const[n,t]=h.useState(!1),o=h.useRef(null),[r,s]=h.useState(""),[u,f]=h.useState(""),[l,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=ke(),[g,w]=h.useState(!1),m=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),v=h.useMemo(()=>{var b,j,_,D,T,S;return[dn((j=(b=e==null?void 0:e.dataSetData)==null?void 0:b.dataflows)==null?void 0:j[0],e==null?void 0:e.locale,e.titles),...ln(tr(e,m),m,e==null?void 0:e.locale),...ln(Ps(e),m,e==null?void 0:e.locale),...$s(e==null?void 0:e.attributesData,(D=(_=e==null?void 0:e.dataSetData)==null?void 0:_.dataStructures)==null?void 0:D[0],m,(S=(T=e==null?void 0:e.data)==null?void 0:T.originalData)==null?void 0:S.parsedTimeSeriesValue,e==null?void 0:e.locale)]},[e,m]),p=h.useMemo(()=>ir(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),k=h.useCallback(()=>{t(!0)},[]),C=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:b,description:j}=Pe(ae.METADATA_PER_SERIES,e.titles);s(b),f(j)}},[e.titles,d]),h.useEffect(()=>{if(d){const b=(a==null?void 0:a.lastDisplayedElement)===ae.METADATA_PER_SERIES&&e.node.rowIndex===0;c(b),b&&setTimeout(()=>{var j;(j=o==null?void 0:o.current)==null||j.scrollIntoView({block:"end",behavior:"smooth"})})}},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(E.IconButton,{title:((x=e.titles)==null?void 0:x.metadata)||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(nr,{className:"w-5 h-5"}),onClick:k})}),l&&i.jsx(Ve,{reference:o,title:r,description:u,onReferenceClick:k,shouldCloseTooltip:g}),n&&i.jsx(Mn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:v,metadataDescription:(N=e==null?void 0:e.metadataSettings)!=null&&N.isMetadataDescription?p:[],isOpenMetadata:n,onCloseMetadata:C})]})},Ys=e=>{var c,a;const[n,t]=h.useState(!1),o=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),r=h.useMemo(()=>ln(Is(e),o,e==null?void 0:e.locale),[e,o]),s=h.useMemo(()=>{var d,g,w;return[dn((g=(d=e==null?void 0:e.dataSetData)==null?void 0:d.dataflows)==null?void 0:g[0],e==null?void 0:e.locale,e==null?void 0:e.titles),...ln(tr(e,o),o,e==null?void 0:e.locale),...(w=e==null?void 0:e.metadataSettings)!=null&&w.isMetadataDescription?[]:[or(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,e==null?void 0:e.colDef),rr((e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles)],...r]},[e,o,r]),u=h.useMemo(()=>ir(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),f=h.useCallback(()=>{t(!0)},[]),l=h.useCallback(()=>{t(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-full h-full p-2 text-end relative",children:[(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),(r==null?void 0:r.length)>0&&i.jsx("div",{className:"metadata-indicator",title:((c=e.titles)==null?void 0:c.metadata)||"View details",onClick:f})]}),n&&i.jsx(Mn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:s,metadataDescription:(a=e==null?void 0:e.metadataSettings)!=null&&a.isMetadataDescription?u:[],isOpenMetadata:n,onCloseMetadata:l})]})},Ks=({attachment:e,isDataLoading:n,chartColumn:t,fixHeight:o,titles:r,showLimitMessage:s})=>{const[u,f]=h.useState(!1),[l,c]=h.useState([]),[a,d]=h.useState(),[g,w]=h.useState(400),m=h.useRef(null),[v,p]=h.useState(""),[k,C]=h.useState(""),[x,N]=h.useState(!1),{isShowOnboarding:b,onboardingFileSchema:j,setOnboardingFileSchema:_}=ke();h.useEffect(()=>{if(e.grid_data==null)f(!0);else{const T=e.grid_data.columns.map(S=>S.colId===sn?{...S,hide:!t}:S);c(e.grid_data.data),d(T),f(!1)}},[e.grid_data,t]),h.useEffect(()=>{l?(w(er(l.length)),s==null||s(l.length>=E.SERIES_LIMIT)):s==null||s(!1)},[l,s]),h.useEffect(()=>{if(b){const{title:T,description:S}=Pe(ae.DATA_GRID,r);p(T),C(S)}},[r,b]),h.useEffect(()=>{var T;j&&!((T=j==null?void 0:j.infoElements)!=null&&T.dataGrid)&&(_==null||_({...j,infoElements:{...j==null?void 0:j.infoElements,dataGrid:!0},lastDisplayedElement:ae.DATA_GRID}))},[j,_]),h.useEffect(()=>{if(b){const T=(j==null?void 0:j.lastDisplayedElement)===ae.DATA_GRID;N(T),!u&&!n&&T&&setTimeout(()=>{var S;(S=m==null?void 0:m.current)==null||S.scrollIntoView({block:"end",behavior:"smooth"})})}},[j==null?void 0:j.lastDisplayedElement,b,n,u]);const D=h.useMemo(()=>i.jsx(uo.AgGridReact,{headerHeight:cn,rowHeight:An,rowData:l,enableCellTextSelection:!0,columnDefs:a,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Qo]:Js,[Xo]:Ys,[Es]:qo}}),[l,a]);return u||n?i.jsx(E.Loader,{}):i.jsxs("div",{className:"w-full h-full",children:[i.jsx("div",{ref:m,className:V("ag-theme-quartz w-full min-h-[80px]",o?"max-h-[400px]":"max-h-full"),style:{height:g},children:D}),x&&i.jsx(Ve,{reference:m,title:v,description:k,supressReferenceClick:!0})]})},Zs=200,qs=8,Xs=2,Qs=({currentIndex:e,totalCount:n,icons:t,titles:o,onPrev:r,onNext:s})=>{const u=h.useRef(null),[f,l]=h.useState(""),[c,a]=h.useState(""),[d,g]=h.useState(!1),{onboardingFileSchema:w,isShowOnboarding:m}=ke();h.useEffect(()=>{if(m){const{title:C,description:x}=Pe(ae.CHARTS_NAVIGATION,o);l(C),a(x)}},[o,m]),h.useEffect(()=>{var C;if(m){const x=(w==null?void 0:w.lastDisplayedElement)===ae.CHARTS_NAVIGATION;g(x),x&&((C=u==null?void 0:u.current)==null||C.scrollIntoView({block:"center",behavior:"smooth"}))}},[w==null?void 0:w.lastDisplayedElement,m]);const v=n>0?e/n*100:0,p=n>0?Math.min(qs*n,Zs):0,k=n>0?Math.max(p/n,Xs):0;return i.jsxs("div",{className:"w-full flex flex-row items-center gap-2 justify-center",children:[i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:r,children:t==null?void 0:t[tn.PREVIOUS]}),i.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[i.jsx("div",{className:"h-[4px] rounded-full bg-neutral-300 relative",style:{width:`${p}px`},children:i.jsx("div",{className:"h-full rounded-full bg-primary absolute",style:{left:`${v}%`,width:`${k}px`}})}),i.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",n]})]}),i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===n?"text-neutrals-700":"text-primary"),onClick:s,ref:u,children:t==null?void 0:t[tn.NEXT]}),d&&i.jsx(Ve,{reference:u,title:f,description:c})]})},el=({limitAmount:e,titles:n,openAdvancedView:t})=>{const[o,r]=h.useState(!1),{refs:s,floatingStyles:u,context:f}=Ee.useFloating({open:o,onOpenChange:r,placement:"top-start"}),l=Ee.useHover(f,{handleClose:Ee.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:c,getFloatingProps:a}=Ee.useInteractions([l]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex w-fit",ref:s.setReference,...c(),children:i.jsxs("div",{className:"flex bg-hues-100 w-fit px-4 mt-1 py-2 gap-1",children:[i.jsx("h5",{className:"font-bold",children:(n==null?void 0:n.limits)||"Limited to"}),i.jsxs("h5",{children:[e," ",(n==null?void 0:n.timeseriesLimit)||"Timeseries"]})]})}),o&&i.jsx("div",{className:"floating",ref:s.setFloating,style:u,...a(),children:i.jsxs("div",{className:"flex flex-col bg-white z-10 p-4 rounded shadow w-[300px] mb-2 gap-2",children:[i.jsxs("div",{children:[i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP1_1)||"The number of timeseries displayed in a single chart i"}),i.jsxs("span",{className:"font-bold pr-0.5",children:[(n==null?void 0:n.limitLinkInfoP1_2)||"limited to"," ",e]}),(n==null?void 0:n.limitLinkInfoP1_3)||"for better clarity and performance."]}),i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_1)||"To visualize specific timeseries"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_2)||"filter"}),i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_3)||"your request, or"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_4)||"refine"}),(n==null?void 0:n.limitLinkInfoP2_5)||"it in the chat."]})]}),t&&i.jsx("h4",{className:"cursor-pointer text-primary",onClick:t,children:(n==null?void 0:n.limitLinkInfoLink)||"Open Advanced View"})]})})]})};function nl(e,n,t){var c,a,d,g;const o=(a=((c=e.getZr())==null?void 0:c.painter).getRenderedCanvas())==null?void 0:a.getContext("2d");if(!o)return 0;const r=((d=t.textStyle)==null?void 0:d.fontSize)??12,s=((g=t.textStyle)==null?void 0:g.fontFamily)??"sans-serif";o.font=`${r}px ${s}`;const u=o.measureText(n).width,f=t.itemWidth??25,l=t.itemGap??10;return u+f+l}const tl=({option:e,style:n})=>{const t=h.useRef(null),[o,r]=h.useState(e);h.useEffect(()=>{r(kn.cloneDeep(e))},[e]);const s=h.useCallback(()=>{var k,C,x,N,b;const u=(C=(k=t.current)==null?void 0:k.getEchartsInstance)==null?void 0:C.call(k);if(!u)return;const l=u.getDom().clientWidth,c=e.legend||{},a=c.itemHeight??14,d=((x=c.textStyle)==null?void 0:x.fontSize)??12,g=((b=(N=u.getModel())==null?void 0:N.getComponent("legend"))==null?void 0:b.getData())||[];let w=0;g.forEach(j=>{const _=j.option.name||"";w+=nl(u,_,c)});const v=Math.max(1,Math.ceil(w/l))*(+a+ +d+6),p=20;r(j=>({...j,grid:{...j.grid||{},bottom:v+p}}))},[e.legend]);return h.useEffect(()=>{s();const u=()=>{s()};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[e,s]),i.jsx(co,{notMerge:!0,lazyUpdate:!1,ref:t,option:o,style:n})},ol=({attachment:e,icons:n,isDataLoading:t,openAdvancedView:o,fixHeight:r=!0,titles:s})=>{const[u,f]=h.useState(!0),[l,c]=h.useState([]),[a,d]=h.useState(0),[g,w]=h.useState(void 0),{onboardingFileSchema:m,isShowOnboarding:v,setOnboardingFileSchema:p}=ke(),k=h.useRef(null);h.useEffect(()=>{var N;f(e.charting_data==null),c(((N=e.charting_data)==null?void 0:N.units)||[])},[e.charting_data]),h.useEffect(()=>{const N=(l==null?void 0:l.length)>=a;w(!u&&N?l[a]:l[0]),N||d(0)},[u,l,a]),h.useEffect(()=>{var N;m&&v&&!u&&(Yi(m)&&(p==null||p(Ji(m)),(N=k==null?void 0:k.current)==null||N.scrollIntoView({block:"center",behavior:"smooth"})),m.lastDisplayedElement===ae.CHART_PER_SERIES&&(p==null||p(Wo(m))))},[u,p,m,v]);const C=h.useCallback(()=>{d(N=>Math.min(N+1,l.length-1))},[l]),x=h.useCallback(()=>{d(N=>Math.max(N-1,0))},[]);return u||t?i.jsx(E.Loader,{}):i.jsx("div",{className:"chart-attachment w-full h-full",ref:k,children:e.charting_data&&i.jsx("div",{className:"flex flex-col w-full h-full gap-4",children:l.length==0||g==null?i.jsx("h4",{className:"ml-1",children:(s==null?void 0:s.chartInfo)||"No data"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("h3",{className:"chart-attachment-title",children:[(s==null?void 0:s.chart)||"Chart"," ",a+1,"/",l.length]}),i.jsx("span",{className:"text-neutrals-700 h4 chart-attachment-info",children:(s==null?void 0:s.chartInfo)||"Chart Information"})]}),i.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",r&&"max-h-[400px] min-h-[400px]",!r&&"min-h-[300px]"),children:[i.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 gap-4",children:[i.jsx(tl,{option:g.config,style:{width:"100%",height:"100%",minHeight:0}}),g.limitedByRowsAmountTo&&i.jsx(el,{limitAmount:g.limitedByRowsAmountTo,openAdvancedView:o,titles:s}),l.length>1&&i.jsx(Qs,{icons:n,currentIndex:a,totalCount:l.length,titles:s,onNext:C,onPrev:x})]}),i.jsx(Zo,{dimensionsInfo:g.dimensions})]})]})})})},rl=e=>oe.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),oe.createElement("circle",{cx:32,cy:12,r:10,fill:"white"})),il=e=>oe.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},oe.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),oe.createElement("circle",{cx:12,cy:12,r:10,fill:"white"})),Qt=[{value:A.SdmxDataFormat.JSON,title:"SDMX-JSON"},{value:A.SdmxDataFormat.XML,title:"SDMX-ML (XML)"},{value:A.SdmxDataFormat.CSV,title:"SDMX-CSV"}],sl=e=>[{value:A.FileColumnsAttribute.ID,title:(e==null?void 0:e.idOptions)||"ID",description:e==null?void 0:e.idOptionsDescription},{value:A.FileColumnsAttribute.NAME,title:(e==null?void 0:e.nameOptions)||"Name",description:e==null?void 0:e.nameOptionsDescription},{value:A.FileColumnsAttribute.ID_NAME,title:(e==null?void 0:e.idAndNameOptions)||"Combined ID and Name",description:e==null?void 0:e.idAndNameOptionsDescription}],eo=({title:e,items:n,selectedValue:t,setSelectedValue:o,infoMessage:r})=>i.jsxs(E.CollapsibleBlock,{title:e,value:t.title,children:[i.jsx("div",{className:"flex flex-col gap-y-1",children:n.map(s=>i.jsx("div",{className:"flex flex-col",children:i.jsx(E.Radio,{id:s.value,checked:t.value===s.value,label:s.title,description:s.description,onChange:()=>{o(s)},radioIcon:i.jsx(ye.IconCircleFilled,{className:"w-3 h-3"})},s.value)},s.value))}),r]}),ll=(e,n,t,o)=>{if(o!=null&&o.filterKey&&e===A.DownloadType.DATA_IN_TABLE)return o;let r=null,s=null;return n&&t&&e===A.DownloadType.DATA_IN_TABLE&&(r=t==null?null:A.getTimeSeriesFilterKey(t,n.filters),s=A.getTimeQueryFilter(n,A.getTimeDimension(t))),{filterKey:r,timeFilter:s}},al=({actions:e,dataQuery:n,datasetIcon:t,isDisplayDatasetIcon:o=!0,datasetName:r,onCloseModal:s,type:u=A.DownloadType.FULL_DATASET,locale:f=X.Locale.EN,dimensions:l,filters:c,urn:a,titles:d,limitMessages:g,showLimitMessage:w,externalLink:m})=>{const v=sl(d),[p,k]=h.useState(Qt[0]),[C,x]=h.useState(v[0]),[N,b]=h.useState(!0),j=h.useCallback(()=>{const _=ll(u,n,l,c),D=(n==null?void 0:n.urn)||a||"",T=C.value,S=p.value,y=`${r}.${S}`;e.downloadDataSet(D,S,f,T,_,y,N),s()},[u,n,l,c,a,C.value,p.value,e,f,N,s,r]);return i.jsxs(E.Popup,{heading:i.jsx("p",{className:"download-heading h2",children:(d==null?void 0:d.download)||"Download"}),portalId:"filters",size:E.PopUpSize.LG,containerClassName:"download-popup h-[80%]",dividers:!1,onClose:s,closeButtonTitle:(d==null?void 0:d.close)||"Close",children:[i.jsxs("div",{className:"download-info flex flex-col gap-1 px-6",children:[i.jsxs("div",{className:"download-info-text flex gap-1",children:[i.jsxs("p",{className:"text-neutrals-800 body-3",children:[(d==null?void 0:d.dataset)||"Dataset",":"]}),i.jsxs("span",{className:"h4 flex flex-row gap-x-1 flex-1 min-w-0",children:[o&&t,i.jsx("p",{className:"flex-1 min-w-0 truncate",children:r})]})]}),w&&i.jsx(E.RequestLimitMessage,{limitMessages:g,isDownload:!0,query:m})]}),i.jsxs("div",{className:"download-settings flex flex-col overflow-auto p-6",children:[i.jsx(eo,{title:(d==null?void 0:d.dataFormat)||"Data Format",selectedValue:p,setSelectedValue:k,items:Qt,infoMessage:i.jsx(E.DownloadFormatMessage,{limitMessages:g,query:m})}),i.jsx(eo,{title:(d==null?void 0:d.attributes)||"Attributes",selectedValue:C,setSelectedValue:x,items:v}),i.jsx(E.CollapsibleBlock,{title:(d==null?void 0:d.metadata)||"Metadata",value:N?(d==null?void 0:d.all)||"Included":(d==null?void 0:d.none)||"Not included",children:i.jsxs("div",{className:`flex gap-4 cursor-pointer download-metadata ${N?"download-metadata-active":""}`,children:[N?i.jsx(rl,{width:44,height:24,className:"text-primary",onClick:()=>{b(!N)}}):i.jsx(il,{width:44,height:24,className:"text-neutrals-500",onClick:()=>{b(!N)}}),i.jsx("div",{children:(d==null?void 0:d.includeMetadata)||"Include Metadata"})]})})]}),i.jsx("div",{className:"download-button flex p-6 mt-auto",children:i.jsx(E.Button,{buttonClassName:"text-button-primary",title:(d==null?void 0:d.download)||"Download",onClick:j})})]})},cl=({id:e,title:n,version:t,agency:o,isActive:r,isSingleTab:s,onSelectDataset:u})=>i.jsx("div",{className:V("dataset-tab truncate last:mr-4",r?"dataset-tab-active":"border-b-transparent",s?"dataset-tab-single cursor-default":"cursor-pointer"),title:n,onClick:()=>{s||u(A.generateShortUrn(e,t,o))},children:i.jsx("h3",{className:"dataset-tab-title truncate",title:n,children:n})}),lr=({datasets:e,locale:n,isHideAdvancedViewButton:t,openAdvancedViewIcon:o,initialSelectedDatasetUrn:r,selectDataset:s,onOpenAdvancedView:u,titles:f})=>{const{isOpenedAdvancedView:l}=Ie(),[c,a]=h.useState(),d=h.useRef(null),[g,w]=h.useState(""),[m,v]=h.useState(""),[p,k]=h.useState(!1),{onboardingFileSchema:C,isShowOnboarding:x}=ke();h.useEffect(()=>{if(x){const{title:b,description:j}=Pe(ae.OPEN_ADVANCED_VIEW,f);w(b),v(j)}},[f,x]),h.useEffect(()=>{var b;if(x){const j=(C==null?void 0:C.lastDisplayedElement)===ae.OPEN_ADVANCED_VIEW;k(j),j&&((b=d==null?void 0:d.current)==null||b.scrollIntoView({block:"center",behavior:"smooth"}))}},[C==null?void 0:C.lastDisplayedElement,x]),h.useEffect(()=>{if(!r&&!c&&(e!=null&&e[0])){const b=A.generateShortUrn(e[0].id,e[0].version,e[0].agencyID);a(b),s==null||s(b)}else r&&r!==c&&(a(r),s==null||s(r))},[e,s,r,c]);const N=h.useCallback(b=>{a(b),s==null||s(b)},[s]);return i.jsxs("div",{className:V("dataset-tabs flex justify-between items-center w-full",t&&l&&"hide-advance-button"),children:[i.jsx("div",{className:"flex items-center w-full overflow-y-auto gap-4 sm:w-[calc(100%-30px)]",children:e==null?void 0:e.map(b=>i.jsx(cl,{id:b==null?void 0:b.id,title:A.getLocalizedName(b,n||X.Locale.EN),version:b==null?void 0:b.version,agency:b==null?void 0:b.agencyID,isActive:(e==null?void 0:e.length)>1&&c===A.generateShortUrn(b==null?void 0:b.id,b==null?void 0:b.version,b==null?void 0:b.agencyID),isSingleTab:(e==null?void 0:e.length)===1,onSelectDataset:N},b==null?void 0:b.id))}),!t&&i.jsx("div",{ref:d,children:i.jsx(E.IconButton,{buttonClassName:"advanced-view-button",icon:o,onClick:u})}),p&&i.jsx(Ve,{reference:d,title:g,description:m,onReferenceClick:u,shouldCloseTooltip:l})]})},ul=(e,n,t,o)=>n==null?void 0:n.map(r=>{var d;const s=e==null?void 0:e.find(g=>(g==null?void 0:g.urn)===(r==null?void 0:r.urn)),u=t==null?void 0:t.get(r==null?void 0:r.urn),f=(u==null?void 0:u.conceptSchemes)||[],l=(u==null?void 0:u.codelists)||[],c=A.getDimensions(u),a=[...(c==null?void 0:c.dimensions)||[],...(c==null?void 0:c.timeDimensions)||[]];return{datasetName:A.getLocalizedName((d=u==null?void 0:u.dataflows)==null?void 0:d[0],o),queryFiltersDetails:dl(no((s==null?void 0:s.filters)||[],a,f,l,o),no(r==null?void 0:r.filters,a,f,l,o))}}),dl=(e,n)=>{const t=new Map(e==null?void 0:e.map(o=>[o==null?void 0:o.id,o]));return(n==null?void 0:n.filter(o=>{var r,s,u;return!kn.isEqual((s=(r=t==null?void 0:t.get(o==null?void 0:o.id))==null?void 0:r.valuesTitles)==null?void 0:s.sort(),(u=o==null?void 0:o.valuesTitles)==null?void 0:u.sort())}))||[]},no=(e,n,t,o,r)=>e==null?void 0:e.map(s=>{var c,a,d;const u=n.find(g=>(g==null?void 0:g.id)===(s==null?void 0:s.componentCode)),f=A.getConcept((u==null?void 0:u.conceptIdentity)||"",t),l=A.findCodelistByDimension(o,t,u);return{id:s==null?void 0:s.componentCode,title:A.getLocalizedName(f,r),valuesTitles:(s==null?void 0:s.operator)===X.QueryFilterType.BETWEEN?[`${rn(X.getTimePeriod((c=s==null?void 0:s.values)==null?void 0:c[0]),r)} - ${rn(X.getTimePeriod((a=s==null?void 0:s.values)==null?void 0:a[1]),r)}`]:(d=s==null?void 0:s.values)==null?void 0:d.map(g=>{var w;return A.getLocalizedName((w=l==null?void 0:l.codes)==null?void 0:w.find(m=>(m==null?void 0:m.id)===g),r)||g})}}),hl=(e,n,t)=>{var u,f,l;let o="",r="";if(e!=null&&e.timeFilter){const c=(u=decodeURIComponent(e.timeFilter||""))==null?void 0:u.split(":");o=c[1]||"",r=c[3]||""}else if(n){const c=n==null?void 0:n.filters.find(a=>a.componentCode===A.TIME_PERIOD);o=((f=c==null?void 0:c.values)==null?void 0:f[0])||"",r=((l=c==null?void 0:c.values)==null?void 0:l[1])||""}return`&filter=${(e==null?void 0:e.filterKey)||A.getTimeSeriesFilterKey(t||[],(n==null?void 0:n.filters)||[])}&startPeriod=${o}&endPeriod=${r}`},ar=(e,n,t,o)=>{var s;const r=e?hl(n,t,o):"";return((s=t==null?void 0:t.metadata)==null?void 0:s.datasetUrl)+r};Rt.ModuleRegistry.registerModules([Rt.AllCommunityModule]);const cr=({attachments:e,actions:n,titles:t,messageStyles:o,attachmentsStyles:r,isSystemAttachments:s,isShowAttachments:u,showAdvancedView:f,currentDataQuery:l,dataQueries:c,attachmentInfoList:a,datasets:d,initialSelectedDatasetUrn:g,isDataLoading:w,isDataSetAttachments:m,locale:v,dimensions:p,filters:k,selectDataset:C,onAdvancedViewOpen:x,limitMessages:N,attachmentsConfig:b})=>{const[j,_]=h.useState(0),[D,T]=h.useState(null),{isOpenedAdvancedView:S,setIsOpenedAdvancedView:y}=Ie(),[M,I]=h.useState(E.PopUpState.Closed),[K,H]=h.useState(!1),[L,O]=h.useState(),[B,Y]=h.useState(),[U,G]=h.useState(!1),q={downloadDataSet:n.downloadDataSet,getConstraints:n.getConstraints},ce=A.DownloadType.DATA_IN_TABLE,ue=je=>{_(je)},ie=h.useCallback(()=>{x==null||x(),y(!0),n.updateCurrentDataQuery(l||(c==null?void 0:c[0])),n.updateDataQueries(c),n.updateDatasets(d)},[n,l,c,d,y,x]);h.useEffect(()=>{T(e[j]||null)},[e,j]),h.useEffect(()=>{H(m&&(d==null||(d==null?void 0:d.length)==0))},[d,m]);const ve=h.useCallback(()=>{I(E.PopUpState.Closed)},[I]),he=b==null?void 0:b.isExternaLinkIncludeFilters,fe=ar(he,k,l||(c==null?void 0:c[0]),p);return!e||e.length===0?null:i.jsx(i.Fragment,{children:S&&!u?i.jsx(Os,{icon:o==null?void 0:o.advanceViewIcon,title:(o==null?void 0:o.openAdvanceViewTitle)??"Opened in Advanced view"}):i.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!S&&!s?"pt-5":"pt-0"),children:[!S&&K?i.jsx(E.Loader,{}):i.jsxs(i.Fragment,{children:[s&&!S&&i.jsx(Cs,{titles:{queryUpdatedManuallyTitle:t==null?void 0:t.queryUpdatedManually,setToTitle:t==null?void 0:t.setTo},datasetIcon:r==null?void 0:r.datasetIcon,attachmentInfoList:a}),!S&&(d==null?void 0:d.length)!=null&&(d==null?void 0:d.length)>0&&i.jsx(lr,{datasets:d,initialSelectedDatasetUrn:g,locale:v,titles:t,isHideAdvancedViewButton:!f,openAdvancedViewIcon:r==null?void 0:r.openAdvancedViewIcon,selectDataset:C,onOpenAdvancedView:ie}),U&&i.jsx(E.RequestLimitMessage,{limitMessages:N,showAdvancedViewButton:!!D&&vn(D)&&f,onAdvancedViewClick:ie,query:fe}),i.jsx("div",{className:V(!S&&(d==null?void 0:d.length)&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:i.jsxs("div",{className:"flex flex-col max-w-full items-center gap-4 h-full",children:[i.jsxs("div",{className:"flex min-w-0 w-full justify-between items-center",children:[i.jsx(vs,{dataGridTitle:r==null?void 0:r.dataGridTitle,attachments:e,selectedAttachmentIndex:j,showTabIcon:r==null?void 0:r.showTabIcon,onSelectedAttachmentChange:ue,titles:t}),i.jsxs("div",{className:"flex gap-x-3 items-center flex-wrap w-full justify-end",children:[D&&Ke(D)&&he&&i.jsx("a",{href:fe,target:"_blank",children:i.jsx(E.Button,{title:(N==null?void 0:N.dataExplorer)||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:N==null?void 0:N.dataExplorerIcon})}),D&&Ke(D)&&i.jsx(E.Button,{title:(r==null?void 0:r.downloadTitle)||"Download",buttonClassName:"text-button-tertiary small-icon-button",onClick:()=>I(E.PopUpState.Opened),iconBefore:r==null?void 0:r.downloadIcon})]})]}),D!=null&&i.jsxs("div",{className:"flex flex-1 w-full justify-center min-h-0",children:[qi(D)&&i.jsx(ss,{actions:n,downloadTitles:r==null?void 0:r.downloadTitle,attachment:D}),vn(D)&&i.jsx(Ls,{actions:n,attachment:D,showLimitMessage:G}),Ke(D)&&i.jsx(Ks,{attachment:D,isDataLoading:w,chartColumn:S,fixHeight:!S,titles:t,showLimitMessage:G}),en(D)&&i.jsx(ol,{titles:t,isDataLoading:w,attachment:D,icons:r==null?void 0:r.chartingIcons,openAdvancedView:S?void 0:ie,fixHeight:!S}),jn(D)&&i.jsx(gs,{attachment:D,openLinkTitle:r==null?void 0:r.openLinkTitle}),Jo(D)&&i.jsx(us,{attachment:D})]})]})})]}),i.jsxs(i.Fragment,{children:[M===E.PopUpState.Opened&&i.jsx(al,{actions:q,onCloseModal:ve,dataQuery:l,datasetName:(D==null?void 0:D.title)||"",locale:v,type:ce,dimensions:p,filters:k,urn:l==null?void 0:l.urn,datasetIcon:r==null?void 0:r.datasetIcon,isDisplayDatasetIcon:r==null?void 0:r.isDisplayDatasetIcon,titles:r==null?void 0:r.downloadTitles,setIsShowDownloadAlert:O,setDownloadAlertDetails:Y,limitMessages:N,showLimitMessage:U,externalLink:fe}),L&&i.jsx(E.Alert,{alertDetails:B,successIcon:r==null?void 0:r.successDownloadIcon,errorIcon:r==null?void 0:r.errorDownloadIcon,onClose:()=>O(!1),closeButtonTitle:(r==null?void 0:r.closeTitle)||"Close"})]})]})})},fl=({filtersProps:e,actions:n,attachments:t,attachmentsDataQuery:o,dataQueries:r,dimensions:s,locale:u,attachmentsStyles:f,isDataLoading:l,setIsFiltering:c,titles:a,limitMessages:d,attachmentsConfig:g,filters:w,onFiltersChange:m})=>{const v={getConstraints:n.getConstraints};return h.useEffect(()=>{l||c==null||c(!1)},[l,c]),i.jsx("div",{className:"bg-white rounded h-full min-h-0",children:i.jsxs("div",{className:"flex flex-col gap-4 h-full overflow-x-hidden",children:[i.jsxs("div",{className:"data-details-header flex justify-between items-center",children:[i.jsx("h2",{children:(a==null?void 0:a.content)??"Content"}),i.jsx(is,{attachmentsDataQuery:o,dataQueries:r,updateDataQueries:n==null?void 0:n.updateDataQueries,locale:u,actions:v,dimensions:s,titles:a,...e,onFiltersChange:m,limitMessages:d})]}),i.jsx("div",{className:"advanced-view-attachments-container flex-1 min-h-0",children:i.jsx(cr,{titles:a,attachments:t,attachmentsStyles:f,currentDataQuery:o,dimensions:s,actions:n,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:l,locale:u,filters:w,limitMessages:d,attachmentsConfig:g})})]})})};function wn(e){return(n={})=>{const t=n.width?String(n.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}function ze(e){return(n,t)=>{const o=t!=null&&t.context?String(t.context):"standalone";let r;if(o==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,f=t!=null&&t.width?String(t.width):u;r=e.formattingValues[f]||e.formattingValues[u]}else{const u=e.defaultWidth,f=t!=null&&t.width?String(t.width):e.defaultWidth;r=e.values[f]||e.values[u]}const s=e.argumentCallback?e.argumentCallback(n):n;return r[s]}}function Ue(e){return(n,t={})=>{const o=t.width,r=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],s=n.match(r);if(!s)return null;const u=s[0],f=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(f)?wl(f,d=>d.test(u)):gl(f,d=>d.test(u));let c;c=e.valueCallback?e.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const a=n.slice(u.length);return{value:c,rest:a}}}function gl(e,n){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n(e[t]))return t}function wl(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return t}function ml(e){return(n,t={})=>{const o=n.match(e.matchPattern);if(!o)return null;const r=o[0],s=n.match(e.parsePattern);if(!s)return null;let u=e.valueCallback?e.valueCallback(s[0]):s[0];u=t.valueCallback?t.valueCallback(u):u;const f=n.slice(r.length);return{value:u,rest:f}}}const to=Symbol.for("constructDateFrom");function ur(e,n){return typeof e=="function"?e(n):e&&typeof e=="object"&&to in e?e[to](n):e instanceof Date?new e.constructor(n):new Date(n)}function pl(e,...n){const t=ur.bind(null,e||n.find(o=>typeof o=="object"));return n.map(t)}let xl={};function vl(){return xl}function yn(e,n){return ur(n||e,e)}function oo(e,n){var f,l,c,a;const t=vl(),o=(n==null?void 0:n.weekStartsOn)??((l=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((a=(c=t.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??0,r=yn(e,n==null?void 0:n.in),s=r.getDay(),u=(s<o?7:0)+s-o;return r.setDate(r.getDate()-u),r.setHours(0,0,0,0),r}function dr(e,n,t){const[o,r]=pl(t==null?void 0:t.in,e,n);return+oo(o,t)==+oo(r,t)}function We(e,n){if(e.one!==void 0&&n===1)return e.one;const t=n%10,o=n%100;return t===1&&o!==11?e.singularNominative.replace("{{count}}",String(n)):t>=2&&t<=4&&(o<10||o>20)?e.singularGenitive.replace("{{count}}",String(n)):e.pluralGenitive.replace("{{count}}",String(n))}function xe(e){return(n,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?e.future?We(e.future,n):"за "+We(e.regular,n):e.past?We(e.past,n):We(e.regular,n)+" тому":We(e.regular,n)}const bl=(e,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",Cl={lessThanXSeconds:xe({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:xe({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:bl,lessThanXMinutes:xe({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:xe({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:xe({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:xe({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:xe({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:xe({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:xe({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:xe({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:xe({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:xe({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:xe({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:xe({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:xe({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},kl=(e,n,t)=>(t=t||{},Cl[e](n,t)),Sl={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},Nl={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},El={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jl={date:wn({formats:Sl,defaultWidth:"full"}),time:wn({formats:Nl,defaultWidth:"full"}),dateTime:wn({formats:El,defaultWidth:"full"})},Tn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function Al(e){const n=Tn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+n+" о' p";case 1:case 2:case 4:return"'у минулий "+n+" о' p"}}function hr(e){return"'у "+Tn[e]+" о' p"}function Dl(e){const n=Tn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+n+" о' p";case 1:case 2:case 4:return"'у наступний "+n+" о' p"}}const Ml=(e,n,t)=>{const o=yn(e),r=o.getDay();return dr(o,n,t)?hr(r):Al(r)},yl=(e,n,t)=>{const o=yn(e),r=o.getDay();return dr(o,n,t)?hr(r):Dl(r)},Tl={lastWeek:Ml,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:yl,other:"P"},Ll=(e,n,t,o)=>{const r=Tl[e];return typeof r=="function"?r(n,t,o):r},Ol={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},_l={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Rl={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},Il={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},Pl={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Vl={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:"ніч"}},Fl={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:"ночі"}},Bl=(e,n)=>{const t=String(n==null?void 0:n.unit),o=Number(e);let r;return t==="date"?o===3||o===23?r="-є":r="-е":t==="minute"||t==="second"||t==="hour"?r="-а":r="-й",o+r},Hl={ordinalNumber:Bl,era:ze({values:Ol,defaultWidth:"wide"}),quarter:ze({values:_l,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ze({values:Rl,defaultWidth:"wide",formattingValues:Il,defaultFormattingWidth:"wide"}),day:ze({values:Pl,defaultWidth:"wide"}),dayPeriod:ze({values:Vl,defaultWidth:"any",formattingValues:Fl,defaultFormattingWidth:"wide"})},Gl=/^(\d+)(-?(е|й|є|а|я))?/i,zl=/\d+/i,Ul={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Wl={any:[/^д/i,/^н/i]},$l={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},Jl={any:[/1/i,/2/i,/3/i,/4/i]},Yl={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},Kl={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]},Zl={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},ql={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},Xl={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Ql={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},ea={ordinalNumber:ml({matchPattern:Gl,parsePattern:zl,valueCallback:e=>parseInt(e,10)}),era:Ue({matchPatterns:Ul,defaultMatchWidth:"wide",parsePatterns:Wl,defaultParseWidth:"any"}),quarter:Ue({matchPatterns:$l,defaultMatchWidth:"wide",parsePatterns:Jl,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ue({matchPatterns:Yl,defaultMatchWidth:"wide",parsePatterns:Kl,defaultParseWidth:"any"}),day:Ue({matchPatterns:Zl,defaultMatchWidth:"wide",parsePatterns:ql,defaultParseWidth:"any"}),dayPeriod:Ue({matchPatterns:Xl,defaultMatchWidth:"wide",parsePatterns:Ql,defaultParseWidth:"any"})},na={code:"uk",formatDistance:kl,formatLong:jl,formatRelative:Ll,localize:Hl,match:ea,options:{weekStartsOn:1,firstWeekContainsDate:1}},ta=e=>e===X.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",oa=(e,n)=>{const t=ta(n);return e!=null&&e!==""&&t&&It.isValid(new Date(e))?It.format(new Date(e),t,n===X.Locale.UK?{locale:na}:void 0):""},ra=Mr.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function $e(...e){return ra(V(...e))}const ia=({isShowAgency:e,isShowDatasetBadge:n,dataset:t,data:o,structures:r,metadataSettings:s,locale:u,titles:f,getDatasetUpdatedTime:l,externalLink:c,datasetIcon:a,externalLinkIcon:d,metadataButtonClassName:g,metadataIconClassName:w,infoSegmentContainerClassName:m,infoSegmentHeaderClassName:v,nameAndMetadataContainerClassName:p})=>{const[k,C]=h.useState(""),[x,N]=h.useState(!1),b=h.useRef(null),[j,_]=h.useState(""),[D,T]=h.useState(""),[S,y]=h.useState(!1),{onboardingFileSchema:M,isShowOnboarding:I}=ke(),[K,H]=h.useState(!1),L=h.useMemo(()=>s!=null&&s.isMetadataDescription?Vs(t,k,u,f):[],[t,k,u,s==null?void 0:s.isMetadataDescription,f]),O=h.useMemo(()=>[...s!=null&&s.isMetadataDescription?[]:[dn(t,u,f)],...Bs(Fs(o),A.getStructureComponentsMap(r),u)],[o,t,u,s==null?void 0:s.isMetadataDescription,r,f]),B=h.useCallback(()=>{N(!0)},[]),Y=h.useCallback(()=>{N(!1),H(!0)},[]);h.useEffect(()=>{const q=l&&l(O)||oa(A.getLastUpdatedTime(t),u);C(q)},[t,u,O,l]),h.useEffect(()=>{if(I){const{title:G,description:q}=Pe(ae.METADATA_PER_DATASET,f);_(G),T(q)}},[f,I]),h.useEffect(()=>{I&&y((M==null?void 0:M.lastDisplayedElement)===ae.METADATA_PER_DATASET)},[M==null?void 0:M.lastDisplayedElement,I]);const U=(G,q)=>i.jsxs("div",{className:$e("flex gap-1 text-neutrals-1000",m),children:[i.jsxs("span",{className:$e("text-neutral-800",v),children:[G,":"]}),i.jsx("span",{children:q})]});return i.jsxs("div",{className:"flex flex-col bg-white gap-3 dataset-info",children:[n&&i.jsxs("div",{className:"flex gap-1 items-center py-1 px-2 rounded-[20px] bg-accent-500 body-2 w-fit",children:[a,(f==null?void 0:f.dataset)??"Dataset"]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex gap-1 items-center",children:[i.jsxs("div",{role:"heading","aria-level":4,className:$e("flex gap-1 items-center h4",p),children:[i.jsx("div",{ref:b,children:i.jsx(E.IconButton,{title:(f==null?void 0:f.metadata)??"View details",buttonClassName:$e("!text-neutrals-1000 !border-none !w-4 !h-4 !p-0 shrink-0",g),icon:i.jsx(nr,{className:$e("size-4",w)}),onClick:B})}),i.jsx("span",{children:A.getLocalizedName(t,u)})]}),c&&i.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:d||i.jsx(ye.IconExternalLink,{className:"text-primary cursor-pointer w-4 h-4 shrink-0"})})]}),i.jsxs("div",{className:"flex gap-2 body-3 items-center",children:[e&&i.jsxs(i.Fragment,{children:[U((f==null?void 0:f.agency)??"Agency",(t==null?void 0:t.agencyID)??""),i.jsx("div",{"aria-hidden":"true",className:"border-l border-l-neutral-500 h-[14px]"})]}),U((f==null?void 0:f.lastUpdated)??"Last updated",k)]})]}),S&&i.jsx(Ve,{reference:b,title:j,description:D,onReferenceClick:B,shouldCloseTooltip:K}),x&&i.jsx(Mn,{titles:f,locale:u,metadata:O,metadataDescription:L,isOpenMetadata:x,onCloseMetadata:Y})]})},sa=({titles:e,locale:n,isShowShare:t,shareConversationProps:o})=>{const{setIsOpenedAdvancedView:r}=Ie(),s=h.useRef(null),[u,f]=h.useState(""),[l,c]=h.useState(""),[a,d]=h.useState(!1),{onboardingFileSchema:g,isShowOnboarding:w}=ke();return h.useEffect(()=>{if(w){const{title:m,description:v}=Pe(ae.EXIT_ADVANCED_VIEW,e);f(m),c(v)}},[e,w]),h.useEffect(()=>{w&&d((g==null?void 0:g.lastDisplayedElement)===ae.EXIT_ADVANCED_VIEW)},[g==null?void 0:g.lastDisplayedElement,w]),i.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[i.jsxs("div",{className:V("flex gap-3 items-center",!t&&"justify-between w-full","advanced-view-header-title"),children:[i.jsx("div",{ref:s,className:V(!t&&"order-2","flex"),children:i.jsx(E.CloseButton,{btnClassNames:"button-close",onClick:()=>r(!1),title:(e==null?void 0:e.close)||"Close"})}),a&&i.jsx(Ve,{reference:s,title:u,description:l,onReferenceClick:()=>r(!1),shouldMoveToNextStep:!0}),i.jsx("h2",{className:"sm:h-3",children:(e==null?void 0:e.advanceViewTitle)??"Advanced view"})]}),t&&i.jsx(To,{locale:n,...o})]})};function Ln(e,n,t){var s;const o=A.getConcept(e.conceptIdentity,n),r=A.getArtifactByUrnWithWildCard((s=o==null?void 0:o.coreRepresentation)==null?void 0:s.enumeration,t);return{concept:o,codeList:r||void 0}}function fr(e,n,t){const o=e.findIndex(r=>r.id===n);return t.originalData.parsedTimeSeriesValue[o]}function gr(e,n,t,o,r){var f;const s=fr(e,n,o),u=(f=t==null?void 0:t.codes)==null?void 0:f.find(l=>l.id===s);return A.getLocalizedName(u,r)}function la(e,n,t,o,r,s,u,f,l){const c=aa(e,t),a=l!=null&&l.startPeriod&&l.endPeriod?A.getAdditionalColumns(f,l):[],d=ca(e,n,t,o,r,s,a);return[js(e,n==null?void 0:n.data,t,r,s,u),...c,...d,As(e,n==null?void 0:n.data,t,void 0,s,u)]}function aa(e,n){var s;const t=e.conceptSchemes||[],o=e.codelists||[],r=((s=A.getDimensions(e))==null?void 0:s.dimensions)||[];return r.map(u=>{const{codeList:f,concept:l}=Ln(u,t,o),c=a=>{const{data:d,colDef:g}=a,w=g.field;return gr(r,w,f,d,n)};return{headerName:A.getLocalizedName(l,n),field:u.id,colId:u.id,valueGetter:c,...bn,tooltipValueGetter:a=>a.value}})}function ca(e,n,t,o,r,s,u){const f=u!=null&&u.length?u:A.getTimePeriods(n);return da(f,(c,a)=>ua(c,a||c,o,s),e,t,r,s)}const ua=(e,n,t=X.defaultFormatNumbers,o)=>({headerName:mi(n,o),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:un,cellClass:["justify-end","cell-with-meta"],valueFormatter:r=>X.formatNumberBySign(r.value,t)}),da=(e,n,t,o,r,s)=>{const u=[];return e.sort((l,c)=>A.sortPeriods(l,c)).forEach(l=>{u.push({headerName:l.toString(),field:l.toString(),...n(l.toString()),valueGetter:c=>{var a,d,g;return((g=(d=(a=c.data[c.column.getColId()])==null?void 0:a.value)==null?void 0:d[0])==null?void 0:g.value)||null},cellClass:Dn,cellRenderer:Xo,width:un,cellRendererParams:{dataSetData:t,locale:o,metadataSettings:r,titles:s}})}),u};function ha(e,n,t){const o=n.map(s=>s.id).filter(s=>s!=null),r=t.map(s=>s.id).filter(s=>s!=null);return fa(e,o,r,o)}const fa=(e,n,t,o)=>{const r=wa(e,n),s={};for(const u of r){const f=u.rowTime,l=wr(f,o);if(s[l]==null){s[l]={};for(const c of o)s[l][c]=f[c]}s[l]={attributes:u.attributes.filter(({value:c})=>c),...s[l],id:l,originalData:u.originalData,...ga(f,t)}}return Object.values(s)},wr=(e,n)=>n.map(t=>e[t]).join("_"),ga=(e,n)=>{const t=wr(e,n),{OBS_VALUE:o,obsAttributes:r}=e,s={};return s[t]={value:o,obsAttributes:r},s},wa=(e,n)=>{const t=[];for(const o of e){const r={},s=o.name.split(".");for(let u=0;u<n.length;u+=1)r[n[u]]=s[u];if(!o.values.length){const u={...r};u.TIME_PERIOD=void 0,u.OBS_VALUE=void 0,t.push({rowTime:u,attributes:o.attributes,id:o.name,originalData:o})}o.values.forEach(u=>{var c;const f={...r};f.TIME_PERIOD=u.dimensionAtObservation;const l=ma(o,u);f.OBS_VALUE=l,f.obsAttributes=((c=u==null?void 0:u.obsAttributes)==null?void 0:c.filter(({value:a})=>a))||[],t.push({rowTime:f,attributes:o.attributes,id:o.name,originalData:o})})}return t},ma=(e,n)=>{const o=[...e.attributes,...n.obsAttributes].find(({name:r})=>r==="OBS_VALUE");return o?[o]:n.values},pa="#EEEEEE",xa="#777777";function va(e,n,t){const o={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:r=>{let s=r[0].axisValueLabel+"<br/>";return r.forEach(u=>{u.value!==null&&u.value!==void 0&&(s+=u.marker+" "+u.seriesName+": "+u.value+"<br/>")}),s}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...ro(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...ro(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"value"},series:n};return(t==null?void 0:t.colors)!=null&&(o.color=t.colors),o}function ro(e=pa,n=xa){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:n},axisLine:{lineStyle:{color:e}}}}function mr(e,n,t,o){return n.map(s=>{var c;const u=((c=A.getDimensions(t))==null?void 0:c.dimensions)||[],f=u==null?void 0:u.find(a=>a.id===s);if(f==null)return e[s]||"";const{codeList:l}=Ln(f,t.conceptSchemes||[],t.codelists||[]);return gr(u,s,l,e,o)}).join(" - ")}function ba(e,n){var s,u;const t=[...((s=n==null?void 0:n.metadata)==null?void 0:s.indicatorDimensions)||[]].filter(f=>f!=null),o=(u=A.getDimensions(e))==null?void 0:u.dimensions,r=(o==null?void 0:o.filter(f=>{var l;return f.id!=null&&!t.includes(f.id)&&((l=n==null?void 0:n.metadata)==null?void 0:l.countryDimension)!==f.id}).map(f=>f.id).filter(f=>f!=null))||[];return[...t,...r]}function Ca(e,n,t){const o={};return e.forEach(r=>{const s=ka(r,n,t);o[s]||(o[s]={rows:[]}),o[s].rows.push(r)}),Object.keys(o).map(r=>o[r])}function ka(e,n,t){var s,u,f,l;const o=((l=(f=(u=(s=t.dataStructures)==null?void 0:s[0])==null?void 0:u.dataStructureComponents)==null?void 0:f.dimensionList)==null?void 0:l.dimensions)||[];return n.map(c=>(o==null?void 0:o.find(d=>d.id===c))==null?e[c]||"":fr(o,c,e)).join(" - ")}function Sa(e,n){const t={};return e.forEach(o=>t[o]=Na(o,n)),{nonUniqDimensions:e.filter(o=>!t[o])}}function Na(e,n){const t=n.map(r=>Ea(e,r));return new Set(t).size===1}function Ea(e,n){return n[e]}const ja="line",Xe=10;function Aa(e,n,t,o,r){const s=xr(n,e,t,o,r),f=A.getTimePeriods(n).sort((d,g)=>A.sortPeriods(d,g)),l=ba(e,t),{nonUniqDimensions:c}=Sa(l,s);return{units:Ca(s,c,e).map(d=>pr(d,e,t,f,o,r))}}function Da(e,n,t,o,r,s){return pr({rows:[e]},t,o,n,r,s)}function pr(e,n,t,o,r,s){var c,a,d;const u=Ta(e.rows,n,r),f=(c=u==null?void 0:u.find(g=>A.FREQUENCY_DIMENSION_ID.includes(g==null?void 0:g.id)))==null?void 0:c.id,l=Ma(e.rows.length>Xe?e.rows.slice(0,Xe):e.rows,n,t,r,io(o,(a=e==null?void 0:e.rows)==null?void 0:a[0],f));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>Xe?Xe:void 0,dimensions:u,config:va(io(o,(d=e==null?void 0:e.rows)==null?void 0:d[0],f),l,s)}}function io(e,n,t){if(t){const o=n==null?void 0:n[t];if(o===A.Periods.MONTHLY)return e==null?void 0:e.filter(r=>A.isMonthly(r));if(o===A.Periods.QUARTERLY)return e==null?void 0:e.filter(r=>A.isQuarterly(r));if(o===A.Periods.ANNUAL)return e==null?void 0:e.filter(r=>A.isYearly(r))}return e}function Ma(e,n,t,o,r){return e.map(s=>{var u,f;return{name:((u=t==null?void 0:t.metadata)==null?void 0:u.countryDimension)==null?"":mr(s,[(f=t==null?void 0:t.metadata)==null?void 0:f.countryDimension],n,o),type:ja,data:r.map(l=>ya(l,s))}})}function ya(e,n){var t,o,r;return((r=(o=(t=n[e])==null?void 0:t.value)==null?void 0:o[0])==null?void 0:r.value)||null}function Ta(e,n,t){var o;return(((o=A.getDimensions(n))==null?void 0:o.dimensions)||[]).map(r=>{if(r.id!=null)return{id:r.id,title:La(r,n,t),value:mr(e[0],[r.id],n,t)}}).filter(r=>r!=null)}function La(e,n,t){const o=n.conceptSchemes||[],r=n.codelists||[],{concept:s}=Ln(e,o,r);return A.getLocalizedName(s,t)||e.id}function xr(e,n,t,o,r){var c,a;const s=e==null?[]:A.getParsedResponse(e),u=((c=A.getDimensions(n))==null?void 0:c.dimensions)||[],f=((a=A.getDimensions(n))==null?void 0:a.timeDimensions)||[],l=ha(s,u,f);return Oa(l,e,n,t,o,r)}function Oa(e,n,t,o,r,s){const f=A.getTimePeriods(n).sort((l,c)=>A.sortPeriods(l,c));return e.map(l=>({...l,[sn]:Da(l,f,t,o,r,s)}))}function _a(e,n,t,o,r,s,u,f,l,c,a){return{columns:la(e,n,o,r,s,f,l,c,a),data:xr(n,e,t,o,u)}}function vr(e,n,t,o,r,s,u){const[f,l]=h.useState(),[c,a]=h.useState(),[d,g]=h.useState(),[w,m]=h.useState(),[v,p]=h.useState({title:(u==null?void 0:u.dataGrid)||"Data Grid",type:se.AttachmentType.CUSTOM_DATA_GRID}),[k,C]=h.useState({title:(u==null?void 0:u.chart)||"Chart",type:se.AttachmentType.CUSTOM_CHART}),[x,N]=h.useState([]),[b,j]=h.useState([]),[_,D]=h.useState(!1),[T,S]=h.useState({startPeriod:null,endPeriod:null}),y=h.useCallback(async H=>{var O;const L=A.getFiltersDtoFromDataQuery(H);try{const B=await e.getConstraints(H.urn,L),Y=((O=B==null?void 0:B.data)==null?void 0:O.dataConstraints)||[];g(Y)}catch{g([])}},[e,g]),M=h.useCallback(async H=>{e.getDataSet(H.urn).then(L=>{var O;if(L!=null&&L.data){const B=A.getDimensions(L.data);a(((O=L.data.dataflows)==null?void 0:O[0])||void 0),m(L.data||void 0),N([...(B==null?void 0:B.dimensions)||[],...(B==null?void 0:B.timeDimensions)||[]]);const Y=(B==null?void 0:B.dimensions)==null?null:A.getTimeSeriesFilterKey(B==null?void 0:B.dimensions,H.filters),U=Bi(H,B);e.getDataSetData(H.urn,{filterKey:Y,timeFilter:U}).then(G=>{l(G||void 0),j(A.getStructureDimensions(G))}).finally(()=>D(!1))}})},[e]);h.useEffect(()=>{async function H(L){D(!0);try{await Promise.all([y(L),M(L)])}catch(O){console.error("Error loading dataset details",O)}}t!=null&&H(t)},[e,t,y,M]);const I=h.useCallback((H,L,O)=>{var B;try{D(!0),g(L);const Y=(B=O==null?void 0:O.find(U=>U.id===A.TIME_PERIOD))==null?void 0:B.timeRange;Y&&S(Y),e.getDataSetData((t==null?void 0:t.urn)||"",H).then(U=>{l(U||void 0),j(A.getStructureDimensions(U))}).finally(()=>D(!1))}catch(Y){console.error("Error loading dataset data",Y)}},[e,t]);h.useEffect(()=>{var H,L,O;if(w!=null&&f!=null&&(d!=null&&d.length)){const B=(O=(L=(H=w.dataflows)==null?void 0:H[0])==null?void 0:L.names)==null?void 0:O[n],Y=_a(w,f,t,n,o,s,r,u,e==null?void 0:e.putOnboardingFile,d,T);p(U=>({...U,title:B||(u==null?void 0:u.dataGrid)||"Data Grid",grid_data:Y}))}},[w,f,u,n,o,t,s,r,d,T,e==null?void 0:e.putOnboardingFile]),h.useEffect(()=>{w!=null&&f!=null&&C(H=>{const L=Aa(w,f,t,n,r);return{...H,charting_data:L}})},[w,f,t,n,r]);const K=h.useMemo(()=>[v,k],[v,k]);return{dataMessage:f,structures:w,dataset:c,dimensions:x,structureDimensions:b,onFiltersChange:I,constraints:d,isLoadingGridData:_,dataSetAttachments:K}}const Ra=({attachmentsProps:e,actions:n,titles:t,shareConversationProps:o,metadataSettings:r,formattingSettings:s,locale:u,advanceViewStyles:f,getDatasetUpdatedTime:l,attachmentsConfig:c,datasetInfoOptions:a,...d})=>{var M,I,K,H,L;const{dataMessage:g,dataset:w,dimensions:m,structureDimensions:v,structures:p,dataSetAttachments:k,onFiltersChange:C,isLoadingGridData:x,constraints:N}=vr(n,u,e.currentDataQuery,s,(M=e.styles)==null?void 0:M.chartingStyles,r,t),[b,j]=h.useState(),[_,D]=h.useState({filterKey:null,timeFilter:null}),T=h.useCallback((O,B,Y)=>{D(O),j(!0),C(O,B,Y)},[C]),S=h.useCallback(O=>{var B;O&&(n==null||n.updateCurrentDataQuery(((B=e==null?void 0:e.dataQueries)==null?void 0:B.find(Y=>(Y==null?void 0:Y.urn)===O))||e.currentDataQuery))},[n,e.currentDataQuery,e==null?void 0:e.dataQueries]),y=ar(c==null?void 0:c.isExternaLinkIncludeFilters,_,e.currentDataQuery||((I=e.dataQueries)==null?void 0:I[0]),m);return i.jsxs("div",{className:"advanced-view flex flex-col flex-1 h-full min-w-0",children:[i.jsx(sa,{titles:t,locale:u,shareConversationProps:o,isShowShare:f==null?void 0:f.isShowShare}),(K=e==null?void 0:e.datasets)!=null&&K.length?i.jsxs(i.Fragment,{children:[((H=e==null?void 0:e.datasets)==null?void 0:H.length)>1&&i.jsx(lr,{datasets:e==null?void 0:e.datasets,initialSelectedDatasetUrn:(L=e==null?void 0:e.currentDataQuery)==null?void 0:L.urn,locale:u,isHideAdvancedViewButton:!0,selectDataset:S}),x&&!b?i.jsx(E.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(ia,{...a,titles:t,locale:u,dataset:w,data:g==null?void 0:g.data,structures:p,metadataSettings:r,getDatasetUpdatedTime:l,externalLink:y}),i.jsx("div",{className:V("flex-1 min-h-0 overflow-auto","advanced-view-filters"),children:i.jsx(fl,{...d,titles:t,actions:n,attachments:k,attachmentsDataQuery:e.currentDataQuery,dataQueries:e==null?void 0:e.dataQueries,dimensions:m,attachmentsStyles:e.styles,isDataLoading:x,locale:u,filtersProps:{...d==null?void 0:d.filtersProps,structureDimensions:v,structures:p,onFiltersChange:C,initialConstraints:N},setIsFiltering:j,attachmentsConfig:c,filters:_,onFiltersChange:T})})]})]}):i.jsx(E.Loader,{})]})};function Ia(e,n,t,o,r){const[s,u]=h.useState([]),[f,l]=h.useState();return h.useEffect(()=>{function c(a){try{Promise.all(a.map(d=>e(d.urn))).then(d=>{var w;const g=((w=d==null?void 0:d.map(m=>{var v,p;return(p=(v=m==null?void 0:m.data)==null?void 0:v.dataflows)==null?void 0:p[0]}))==null?void 0:w.filter(m=>!!m))||[];u(g),n(g),t(a),o(a==null?void 0:a[0]),l(new Map(d==null?void 0:d.map(m=>{var v,p,k,C,x,N,b,j,_;return[A.generateShortUrn((k=(p=(v=m==null?void 0:m.data)==null?void 0:v.dataflows)==null?void 0:p[0])==null?void 0:k.id,(N=(x=(C=m==null?void 0:m.data)==null?void 0:C.dataflows)==null?void 0:x[0])==null?void 0:N.version,(_=(j=(b=m==null?void 0:m.data)==null?void 0:b.dataflows)==null?void 0:j[0])==null?void 0:_.agencyID),m==null?void 0:m.data]})))})}catch(d){console.error("Error loading datasets",d)}}r&&r.length&&c(r)},[r,e,o,t,n]),{datasets:s,datasetStructuresMap:f}}function so(e){const n=e==null?void 0:e.filter(t=>$o(t));if(n!=null&&n.every(t=>!!(t!=null&&t.data)))return n==null?void 0:n.map(t=>({title:t==null?void 0:t.title,...Va(Pa(t==null?void 0:t.data))}))}function Pa(e){if(e)try{return JSON.parse(e)}catch(n){console.error("Invalid JSON:",n)}return null}function Va(e){var n,t,o,r,s,u;return{...e,filters:(n=e==null?void 0:e.filters)==null?void 0:n.map(f=>({...f,componentCode:(f==null?void 0:f.component_code)||(f==null?void 0:f.componentCode)})),metadata:{datasetUrl:(t=e==null?void 0:e.metadata)==null?void 0:t.datasetUrl,countryDimension:((o=e==null?void 0:e.metadata)==null?void 0:o.country_dimension)||((r=e==null?void 0:e.metadata)==null?void 0:r.countryDimension),indicatorDimensions:((s=e==null?void 0:e.metadata)==null?void 0:s.indicator_dimensions)||((u=e==null?void 0:e.metadata)==null?void 0:u.indicatorDimensions)}}}var br=(e=>(e.COMPLETED="completed",e))(br||{});const Fa=({stage:e,stageRef:n,isCurrentStage:t})=>i.jsxs("div",{ref:n,className:"message-stage flex relative pb-8 last:pb-0 last:mb-8",children:[i.jsx("span",{className:"message-stage-line absolute border-l h-full"}),i.jsx(ye.IconPointFilled,{className:"message-stage-indicator flex shrink-0 z-10"}),i.jsxs("div",{className:"ml-2 w-full",children:[i.jsxs("div",{className:V("flex gap-2 items-center",(e==null?void 0:e.content)&&"mb-4"),children:[t&&i.jsx(E.Loader,{}),i.jsx("h3",{className:"message-stage-name",children:e==null?void 0:e.name})]}),i.jsx("div",{className:"prose max-w-full break-words",children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:"text-neutrals-1000",...o}),a:({href:o,children:r,...s})=>i.jsx("a",{href:o,target:"_blank",...s,children:r}),h1:o=>i.jsx("h1",{className:"h1 text-neutrals-1000",...o}),h2:o=>i.jsx("h2",{className:"h2 text-neutrals-1000",...o}),h3:o=>i.jsx("h3",{className:"h3 text-neutrals-1000",...o}),h4:o=>i.jsx("h4",{className:"h4 text-neutrals-1000",...o}),h5:o=>i.jsx("h5",{className:"h5 text-neutrals-1000",...o}),code:o=>i.jsx("code",{className:"text-neutrals-900",...o}),pre:o=>i.jsx("pre",{className:"bg-neutrals-100 border border-neutrals-600",...o})},children:e==null?void 0:e.content})})]})]}),Ba=({stages:e,expandIcon:n,processingTitle:t})=>{const[o,r]=h.useState(),[s,u]=h.useState(),f=h.useRef(null),l=h.useRef(null);h.useEffect(()=>{var a;u((a=e==null?void 0:e.filter(d=>(d==null?void 0:d.status)!==br.COMPLETED))==null?void 0:a.at(-1))},[e]),h.useEffect(()=>{var a;o&&((a=l==null?void 0:l.current)==null||a.scrollIntoView({block:"nearest",behavior:"smooth"}))},[o]),h.useEffect(()=>{const a=f.current;let d;if(!a)return;const g=new IntersectionObserver(([w])=>{var v;const m=(v=w==null?void 0:w.boundingClientRect)==null?void 0:v.top;d&&!(w!=null&&w.isIntersecting)&&m<d&&r(!1),d=m},{threshold:0});return g.observe(a),()=>g.disconnect()},[]);const c=()=>{r(a=>!a)};return i.jsxs("div",{className:"message-stages",ref:f,children:[i.jsxs("div",{className:V("message-stages-header inline-flex max-w-full items-center cursor-pointer",!(s!=null&&s.name)&&"default-header"),onClick:c,children:[i.jsx("p",{className:"message-stages-title truncate",children:(s==null?void 0:s.name)||t||"Processing..."}),i.jsx("i",{className:V("message-stages-expand-icon",o&&"rotated"),children:n})]}),o&&e&&i.jsx("div",{className:"flex flex-col",children:e==null?void 0:e.map(a=>i.jsx(Fa,{stage:a,stageRef:s?l:null,isCurrentStage:(a==null?void 0:a.index)===(s==null?void 0:s.index)},a.index))})]})},Ha=({message:e,regenerateMessage:n,messageActionsIcons:t,rateResponse:o,isStreaming:r=!1,isReadOnly:s=!1,isRegenerateAvailable:u=!1})=>{const f=t==null?void 0:t.copy,l=t==null?void 0:t.regenerate,c=t==null?void 0:t.thumbUp,a=t==null?void 0:t.thumbDown,d=t==null?void 0:t.thumbPressed,[g,w]=h.useState(e.like??re.LikeState.NoState),{isAgentAvailable:m}=E.useAgentAvailability(),v=p=>{e.responseId&&(w(p),o(e.responseId||"",p))};return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2"),children:[f&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:f}),u&&l&&!s&&!r&&i.jsx("p",{onClick:m?()=>n==null?void 0:n(e):void 0,"aria-disabled":!m,className:V(!m&&"opacity-50 !cursor-not-allowed pointer-events-none"),children:l}),c&&!s&&g!==re.LikeState.Disliked&&(g===re.LikeState.NoState?i.jsx("p",{onClick:()=>v(re.LikeState.Liked),children:c}):i.jsx("p",{children:d})),a&&!s&&g!==re.LikeState.Liked&&(g===re.LikeState.NoState?i.jsx("p",{onClick:()=>v(re.LikeState.Disliked),children:a}):i.jsx("p",{className:"rotate-180",children:d}))]})},Ga=({message:e,onEditClick:n,messageActionsIcons:t,isStreaming:o=!1,isReadOnly:r=!1})=>{const s=t==null?void 0:t.copy,u=t==null?void 0:t.edit,{isAgentAvailable:f}=E.useAgentAvailability();return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2 ml-12"),children:[s&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:s}),u&&!o&&!r&&i.jsx("p",{onClick:f?n:void 0,className:V(!f&&"opacity-50 !cursor-not-allowed pointer-events-none"),"aria-disabled":!f,children:u})]})},za=({content:e,textColorClass:n,onCancel:t,onEditApply:o,editMessageTitles:r})=>{const{isOpenedAdvancedView:s}=Ie(),u=h.useRef(null);h.useEffect(()=>{const l=u.current;f(),l&&(l.focus(),l.setSelectionRange(l.value.length,l.value.length))},[]);const f=()=>{const l=u.current;l&&(l.style.height="auto",l.style.height=l.scrollHeight+"px")};return i.jsxs("div",{className:V("max-w-none break-words",s?"body-2":"body-1",n),children:[i.jsx("textarea",{ref:u,className:"resize-none overflow-hidden outline-none bg-neutrals-300 w-full",defaultValue:e,onInput:f}),i.jsxs("div",{className:V("flex gap-x-2 items-center","edit-buttons-wrapper"),children:[i.jsx(E.Button,{buttonClassName:"text-button-secondary small-icon-button",title:r==null?void 0:r.cancel,isSmallButton:!0,onClick:t}),i.jsx(E.Button,{buttonClassName:"text-button-primary small-icon-button",title:r==null?void 0:r.send,isSmallButton:!0,onClick:()=>{var l;return o(((l=u.current)==null?void 0:l.value)||"")}})]})]})},Ua=({message:e,previousMessage:n,titles:t,actions:o,dataQuery:r,isStreaming:s=!1,isCurrentMessageStreaming:u=!1,messageStyles:f,attachmentsStyles:l,showAdvancedView:c,formattingSettings:a,locale:d,metadataSettings:g,expandStagesIcon:w,onAdvancedViewOpen:m,regenerateMessage:v,selectMessageToSend:p,messageActionsIcons:k,rateResponse:C,editMessage:x,editMessageTitles:N,isReadOnlyConversation:b,isLastNotUserMessage:j,limitMessages:_,attachmentsConfig:D})=>{var Ae,Ne;const[T,S]=h.useState(),[y,M]=h.useState(),[I,K]=h.useState([]),[H,L]=h.useState([]),[O,B]=h.useState(),[Y,U]=h.useState(!1),G=e.role===re.Role.User,q=e.role===re.Role.System,{datasets:ce,datasetStructuresMap:ue}=Ia(o.getDataSet,o.updateDatasets,o.updateDataQueries,o.updateCurrentDataQuery,T),[ie,ve]=h.useState(!1),[he,fe]=h.useState([]);h.useEffect(()=>{M(T==null?void 0:T[0])},[T]);const{dataSetAttachments:je,dimensions:be,isLoadingGridData:Ce}=vr(o,d,y,a,l==null?void 0:l.chartingStyles,g,t),{isOpenedAdvancedView:ge}=Ie(),De=()=>{G&&ve(!0)},we=()=>{ve(!1)},Oe=P=>{we(),x==null||x({...e,content:P})},_e=h.useCallback(P=>{P&&(M(T==null?void 0:T.find(W=>(W==null?void 0:W.urn)===P)),B(void 0))},[T]);h.useEffect(()=>{var $,ne,de,me;const P=(ne=($=e.custom_content)==null?void 0:$.form_schema)==null?void 0:ne.properties,W=j?((de=P==null?void 0:P.choice)==null?void 0:de.oneOf)||((me=P==null?void 0:P.completion)==null?void 0:me.oneOf):[];fe(W||[])},[e,j]),h.useEffect(()=>{const P=qt(e),W=so(P),$=P.filter(ne=>vn(ne));S(W),L($)},[e]),h.useEffect(()=>{U(T!=null&&T.length>0)},[T]),h.useEffect(()=>{r&&r.urn&&B(r.urn)},[r]),h.useEffect(()=>{if((e==null?void 0:e.role)===re.Role.System&&n){const P=qt(n),W=so(P)||[];T&&W&&ue&&K(ul(W,T,ue,d))}},[T,y,ue,be,d,e==null?void 0:e.role,n]);const Re=h.useCallback(()=>!G&&(f!=null&&f.systemMessageIcon)&&!(ge&&!u)?i.jsx("div",{className:V("flex-shrink-0 rounded-full flex items-center justify-center w-[44px] h-[44px]",u?"text-white absolute":"text-neutrals-400"),children:f.systemMessageIcon}):null,[G,f==null?void 0:f.systemMessageIcon,ge,u]),Se=h.useMemo(()=>i.jsx(cr,{actions:o,titles:t,attachments:Y?je:H,onAdvancedViewOpen:m,isDataSetAttachments:Y,datasets:ce,initialSelectedDatasetUrn:O,messageStyles:f,attachmentsStyles:l,showAdvancedView:c,isSystemAttachments:q,isDataLoading:Ce,currentDataQuery:y,dataQueries:T,attachmentInfoList:I,locale:d,dimensions:be,selectDataset:_e,limitMessages:_,attachmentsConfig:D}),[o,t,Y,je,H,ce,O,f,l,c,q,Ce,y,T,I,d,be,_e,m,_,D]);return i.jsx(i.Fragment,{children:!(q&&ge)&&i.jsx("div",{className:V("max-w-full flex",G?"justify-end":"justify-start","message-wrapper"),children:i.jsxs("div",{className:V("flex items-start max-w-full",(q||ie)&&"w-full"),children:[i.jsxs("div",{className:"mr-2 relative",children:[Re(),u&&i.jsx(E.Loader,{})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:V(G?"bg-neutrals-300 px-6":"pt-0",G?"user-message":"system-message",G&&(ie?"w-[100%] ml-0":"ml-12")),children:[!G&&!ge&&((Ae=e==null?void 0:e.custom_content)!=null&&Ae.stages)?i.jsx(Ba,{stages:(Ne=e==null?void 0:e.custom_content)==null?void 0:Ne.stages,expandIcon:w,processingTitle:f==null?void 0:f.processingTitle}):u&&i.jsx("p",{className:"body-1 text-neutrals-700 loading-message",children:t==null?void 0:t.loading}),ie?i.jsx(za,{content:e.content,onCancel:we,onEditApply:Oe,editMessageTitles:N}):i.jsx(Oo,{content:e.content})]}),Se,!u&&(G?!ie&&i.jsx(Ga,{messageActionsIcons:k,message:e,isStreaming:s,onEditClick:De,isReadOnly:b}):i.jsx(Ha,{messageActionsIcons:k,message:e,isStreaming:s,regenerateMessage:v,rateResponse:C,isReadOnly:b,isRegenerateAvailable:j})),!ge&&!Ce&&i.jsx(_o,{choiceButtons:he,onClick:p})]})]})})})},Wa=({messages:e,isStreaming:n=!1,isReadOnly:t,scrollBottomIcon:o,...r})=>{const s=h.useRef(null),u=h.useRef(null),{isOpenedAdvancedView:f}=Ie(),[l,c]=h.useState(null),[a,d]=h.useState(!1),g=()=>{var C;const p=(C=u.current)==null?void 0:C.parentElement,k=s.current;if(p&&k){const x=k.offsetTop-p.offsetTop;p.scrollTo({top:x,behavior:"smooth"})}};h.useEffect(()=>{g()},[e,n]),h.useEffect(()=>{!f&&l!==null&&setTimeout(()=>{var p,k;(k=(p=u==null?void 0:u.current)==null?void 0:p.parentElement)==null||k.scrollTo({top:l,behavior:"smooth"})})},[f,l]);const w=()=>{var k,C;const p=((C=(k=u.current)==null?void 0:k.parentElement)==null?void 0:C.scrollTop)||null;c(p)},m=()=>{var k;const p=(k=u.current)==null?void 0:k.parentElement;if(p){const{scrollTop:C,scrollHeight:x,clientHeight:N}=p;C+N>=x?d(!1):!a&&!f&&d(!0)}};h.useEffect(()=>{f&&d(!1)},[f]);const v=E.useDebounce(m,300);return h.useEffect(()=>{var k;const p=(k=u.current)==null?void 0:k.parentElement;return p==null||p.addEventListener("scroll",v),()=>p==null?void 0:p.removeEventListener("scroll",v)},[v]),i.jsxs("div",{ref:u,className:"h-full w-full",children:[i.jsxs("div",{className:"flex flex-col gap-y-6 max-w-full",children:[e.map((p,k)=>{const C=p.id??k;if(p.errorMessage)return i.jsx(E.InlineAlert,{type:E.InlineAlertType.Error,children:i.jsx("div",{className:"flex flex-col",children:p.errorMessage})},C);const x=k===e.length-1,N=Qi(e,k),b=es(e);return i.jsx(Ua,{message:p,previousMessage:N,onAdvancedViewOpen:w,isStreaming:n,isCurrentMessageStreaming:n&&x&&p.role===re.Role.Assistant,showAdvancedView:k===b&&!t,isLastNotUserMessage:x&&p.role!==re.Role.User,...r},C)}),i.jsx("div",{ref:s,className:"h-4"})]}),i.jsx("div",{onClick:g,className:V("fixed right-10 lg:right-6 sm:hidden bottom-[88px] rounded-[50%] border-[2px] w-[40px] h-[40px] border-primary cursor-pointer text-primary bg-white","scroll-button-wrapper",a?"block":"hidden"),children:i.jsx("div",{className:"flex justify-center items-center w-full h-full",children:o})})]})},$a=e=>{var t,o,r,s,u,f,l,c,a;const n={};return(r=(o=(t=e.choices)==null?void 0:t[0])==null?void 0:o.delta)!=null&&r.content&&(n.content=e.choices[0].delta.content),(f=(u=(s=e.choices)==null?void 0:s[0])==null?void 0:u.delta)!=null&&f.custom_content&&(n.custom_content=e.choices[0].delta.custom_content),(a=(c=(l=e.choices)==null?void 0:l[0])==null?void 0:c.delta)!=null&&a.role&&(n.role=e.choices[0].delta.role),e.id&&(n.responseId=e.id),n},Ja="local",Ya=e=>{var n;return!((n=e.permissions)!=null&&n.includes(re.SharePermission.WRITE))&&!Za(e)},Ka=(e,n)=>Cr(e)!==n,Za=e=>Cr(e)===Ja,Cr=e=>e.id.split("/")[0],qa=(e,n)=>On([...(n==null?void 0:n.messages)||[],e]),On=e=>[...e].map(n=>{const t={role:n.role,content:n.content};return(n.role===re.Role.Assistant||n.role===re.Role.System)&&n.custom_content!=null&&(n.custom_content.state!=null||n.custom_content.attachments!=null||n.custom_content.form_schema!=null)&&(t.custom_content={},n.custom_content.state!=null&&(t.custom_content.state=n.custom_content.state),n.custom_content.attachments!=null&&(t.custom_content.attachments=ec(n.custom_content.attachments)),n.custom_content.form_schema!=null&&(t.custom_content.form_schema=n.custom_content.form_schema)),n.role===re.Role.User&&n.custom_content&&(t.custom_content=n.custom_content),t}),Xa=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return On((t==null?void 0:t.slice(0,o))||[])},Qa=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return On([...(t==null?void 0:t.slice(0,o))||[],e])};function ec(e){return e.map(n=>({type:n.type,title:n.title,data:n.data,url:n.url,reference_type:n.reference_type,reference_url:n.reference_url}))}const nc=(e,n,t,o)=>{if(!t||n)return null;const r={id:`msg-${Date.now()}`,role:re.Role.User,content:e,timestamp:Date.now()};if(o){const s=o===an.COMPLETE?nn.COMPLETION:nn.CHOICE;r.custom_content={form_value:{[s]:o}}}return r},tc=(e,n,t)=>`/${n}${t}/${X.getConversationNavPath(e==null?void 0:e.folderId,e==null?void 0:e.id)}`,oc=(e,n,t)=>{const o=`${n}/${t}`,r=se.generateConversationId({folderId:o,name:e==null?void 0:e.name});return{...e,folderId:o,id:r}},rc="AbortError",ic=({conversationKey:e,conversation:n,actions:t,messageStyles:o,attachmentsStyles:r,inputMessageStyles:s,shareConversationProps:u,showConversationHeaderAdvancedView:f=!0,formattingSettings:l,metadataSettings:c,expandStagesIcon:a,locale:d,conversationsRoute:g,token:w,titles:m,dataQuery:v,handleInvalidStreaming:p,setConversation:k,setConversations:C,openUrl:x,messageActionsIcons:N,editMessageTitles:b,scrollBottomIcon:j,isFinalMessage:_,limitMessages:D,attachmentsConfig:T})=>{const[S,y]=h.useState(null),[M,I]=h.useState(!1),[K,H]=h.useState(!0),{isStreaming:L,setIsStreaming:O}=go(),{isOpenedAdvancedView:B}=Ie(),{isAgentAvailable:Y}=E.useAgentAvailability(),{statusMessages:U}=Sn(),{onboardingFileSchema:G,onboardingFilePath:q,onboardingFileName:ce,isShowOnboarding:ue,setOnboardingFileSchema:ie}=ke();h.useEffect(()=>{var R;G&&((R=t.putOnboardingFile)==null||R.call(t,ce,q,G))},[t,G,ce,q]),h.useEffect(()=>{B&&(G==null?void 0:G.lastDisplayedElement)===ae.OPEN_ADVANCED_VIEW&&(ie==null||ie(Wo(G)))},[t,B,ie,G]);const ve=h.useCallback(()=>{x(`/${d}${g}`)},[d,g,x]),he=h.useCallback(async()=>{try{const{bucket:R}=await t.getBucket(),F=oc(n,R,d);await t.createConversation(F,d);const J=await t.getConversations(d);C(X.cleanConversationNames(J)),x(tc(F,d,g))}catch(R){console.error("Failed to save conversation:",R)}},[t,n,g,d,x,C]),fe=h.useCallback(async R=>{try{await t.updateConversation(decodeURI(e),{name:R.name,messages:R.messages})}catch(F){console.error("Failed to save conversation:",F)}},[t,e]),je=h.useCallback(R=>{k(F=>F?{...F,messages:[...(F==null?void 0:F.messages)||[],R]}:null)},[k]),be=h.useCallback(()=>{const R={id:`msg-${Date.now()+1}`,role:re.Role.Assistant,content:"",timestamp:Date.now()};return k(F=>F?{...F,messages:[...F.messages,R]}:null),R},[k]),Ce=h.useCallback((R,F)=>{var z;const J=(z=se.mergeMessages)==null?void 0:z.call(se,R,[F]);if(J)return k(Q=>Q?{...Q,messages:Q.messages.map(te=>te.id===R.id?{...J}:te)}:null),J},[k]),ge=h.useCallback((R,F)=>{var J;(J=n==null?void 0:n.model)!=null&&J.id&&(t.rateResponse(R,F===re.LikeState.Liked,n.model.id),n.messages=n.messages.map(z=>z.responseId===R?kn.merge(z,{like:F}):z),fe(n))},[t,n,fe]),De=h.useCallback(async(R,F,J)=>{var te;const z=new AbortController;y(z);let Q=R;if(J)return await((te=se.streamChatResponse)==null?void 0:te.call(se,encodeURI(J.id),F,{model:J.model,signal:z==null?void 0:z.signal,onMessage:pe=>{const Me=$a(pe);(Me.content||Me.role||Me.responseId)&&(Q=Ce(Q,Me))},onError:pe=>{if(!Re(pe))throw console.error("Streaming error:",pe),pe}},w,J==null?void 0:J.custom_fields).catch(pe=>{let Me=U.serverError,Fe;pe instanceof X.HttpError?(Fe=pe,Me=Fe.status===X.HTTP_ERROR_CODES.SERVICE_UNAVAILABLE?U.serverOverloaded:U.serverError):Fe=new X.HttpError({status:X.HTTP_ERROR_CODES.INTERNAL_SERVER_ERROR,message:Me}),Q&&(Q=Ce(Q,{errorMessage:Me})),p==null||p(Fe)})),Q},[w,Ce,p,U.serverOverloaded,U.serverError]),we=h.useCallback(async(R,F,J)=>{if(F){const z={...F,messages:[...F.messages],updatedAt:Date.now()};J&&z.messages.push(J),z.messages.push(R),await fe(z)}},[fe]),Oe=h.useCallback((R,F)=>{k(J=>J?{...J,messages:J.messages.filter(z=>z.id!==F.id)}:null)},[k]),_e=h.useCallback(()=>{S&&!S.signal.aborted&&S.abort()},[S]),Re=R=>(R==null?void 0:R.name)===rc,Se=h.useCallback(async(R,F,J,z,Q,te=!0)=>{Re(Q)?await we(z??J,R,te?F:void 0):Oe(Q,F)},[we,Oe]),Ae=h.useCallback(async(R,F,J)=>{if(!F||!R)return;const z=nc(R,L,F,J);let Q,te;if(z){je(z);try{O(!0),Q=be();const pe=qa(z,F);te=await De(Q,pe,F),await we(te,F,z)}catch(pe){Se(F,z,Q,te,pe)}finally{O(!1)}}},[L,O,je,be,De,we,Se]),Ne=h.useCallback(async(R,F,J)=>{let z,Q;try{O(!0),z=be(),Q=await De(z,R,F),await we(Q,F)}catch(te){Se(F,J,z,Q,te,!1)}finally{O(!1)}},[O,we,Se,De,be]),P=h.useCallback(async(R,F)=>{if(!F||!R)return;const J=Xa(R,F),z={...F,messages:F.messages.slice(0,J.length)};k(Q=>Q?{...Q,...z}:null),Ne(J,z,R)},[k,Ne]),{isLastMessageFailed:W,regenerateLastMessage:$}=h.useMemo(()=>{var z;const R=(z=n==null?void 0:n.messages)==null?void 0:z.at(-1);return{isLastMessageFailed:!!(R!=null&&R.errorMessage),regenerateLastMessage:R&&(()=>P(R,n))}},[n,P]),ne=h.useCallback(async(R,F)=>{if(!F||!R)return;const J=Qa(R,F),z={...F,messages:[...F.messages.slice(0,J.length-1),R]};k(Q=>Q?{...Q,...z}:null),Ne(J,z,R)},[k,Ne]);h.useEffect(()=>{async function R(){var F,J,z;try{H(!0);const{bucket:Q}=await t.getBucket(),te=await t.getConversation(decodeURI(e));k(te),I(Ya(te)&&Ka(te,Q)),(te.messages.length===0||((J=(F=te==null?void 0:te.messages)==null?void 0:F[0])==null?void 0:J.role)===re.Role.Assistant&&((z=te==null?void 0:te.messages)==null?void 0:z.length)===1)&&Ae(te.prompt,te)}catch{I(!0)}finally{H(!1)}}e&&R()},[e]);const de=h.useMemo(()=>({getFile:t.getFile,putOnboardingFile:t.putOnboardingFile,getDataSet:t.getDataSet,getDataSetData:t.getDataSetData,getConstraints:t.getConstraints,updateCurrentDataQuery:t.updateCurrentDataQuery,updateDataQueries:t.updateDataQueries,updateDatasets:t.updateDatasets,downloadDataSet:t.downloadDataSet}),[t]);if(K)return i.jsx(E.Loader,{});const me=()=>Y?i.jsx(xo,{onSendMessage:R=>Ae(R,n),onStopStreaming:_e,inProcess:L,sendMessageIcon:s.sendMessageIcon,retryIcon:s.retryIcon,placeholder:(m==null?void 0:m.askAnything)??"Ask anything...",containerClasses:"mt-4",inputClasses:"border-neutrals-600 mr-2",isLastFailed:W,onRetryFailed:$}):i.jsx(E.InlineAlert,{type:E.InlineAlertType.Error,children:U.assistantUnavailable});return i.jsxs("div",{className:V("h-full flex flex-col bg-white",B&&!f?"p-4":"pr-2"),children:[B&&!f?null:i.jsx(Lo,{conversation:n,locale:d,isOpenedAdvancedView:B,isShowShareButton:!M&&!ue,shareConversationProps:u}),i.jsx("div",{className:V("flex-1 min-h-0 flex flex-col items-end overflow-y-auto",o==null?void 0:o.messagesWrapperClass),children:i.jsx(Wa,{messages:(n==null?void 0:n.messages)||[],actions:de,isStreaming:L,isReadOnly:M,messageStyles:o,attachmentsStyles:r,formattingSettings:l,metadataSettings:c,expandStagesIcon:a,dataQuery:v,locale:d,titles:m,regenerateMessage:R=>P(R,n),selectMessageToSend:(R,F)=>Ae(R,n,F),messageActionsIcons:N,rateResponse:ge,editMessage:R=>ne(R,n),editMessageTitles:b,scrollBottomIcon:j,isReadOnlyConversation:M||ue,limitMessages:D,attachmentsConfig:T})}),ue?null:M?i.jsx("div",{className:"flex items-center justify-center mt-4",children:i.jsx(E.Button,{iconBefore:i.jsx(ye.IconCopy,{width:20,height:20}),title:(m==null?void 0:m.duplicate)??"Duplicate Chat",isSmallButton:!0,onClick:he,buttonClassName:V("text-button-secondary")})}):i.jsx("div",{className:V(s.inputContainerClass),children:me()}),ue&&_&&i.jsx(E.Button,{iconBefore:i.jsx(ye.IconPlus,{width:24,height:24}),title:m==null?void 0:m.onboardingFooterLink,onClick:ve,isSmallButton:!0,buttonClassName:"text-button-secondary self-center mb-3"})]})};exports.AdvancedView=Ra;exports.AdvancedViewProvider=Tr;exports.CUSTOM_CHOICE_ID=an;exports.ChartingIcon=tn;exports.ChatFooter=Io;exports.ChatMessagesProvider=Lr;exports.ChatOnboardingFooter=Ro;exports.ConversationView=ic;exports.ConversationViewMessagesProvider=Or;exports.ConversationWelcome=ni;exports.CustomContentProperties=nn;exports.OnboardingProvider=_r;exports.STAGE_STATUS=po;exports.useAdvancedView=Ie;exports.useChatMessages=go;exports.useConversationViewMessages=Sn;exports.useOnboarding=ke;