stadata-js 0.4.0 → 2.0.0
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/README.md +99 -250
- package/dist/index.d.mts +254 -602
- package/dist/index.d.ts +254 -602
- package/dist/index.global.js +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +22 -18
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var neverthrow=require('neverthrow');var fe=class o{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return o.instance||(o.instance=new o),o.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var O=class o{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof o?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},N=class extends O{constructor(t,r,i){super(t,i);this.statusCode=r;}},be=class extends O{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},he=class extends O{constructor(e){super(e,"NETWORK_ERROR");}},we=class extends O{constructor(e="Request timeout"){super(e,"TIMEOUT");}},Se=class extends N{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},Pe=class extends N{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},Ae=class extends N{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},Ee=class extends N{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends O{constructor(e){super(e,"PARSE_ERROR");}},cr=class extends O{constructor(e){super(e,"VALIDATION_ERROR");}};var Ie=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),s={};e!=="GET"?Object.assign(s,this.defaultHeaders):Object.entries(this.defaultHeaders).forEach(([d,f])=>{d.toLowerCase()!=="content-type"&&(s[d]=f);}),Object.assign(s,r.headers);let l={method:e,headers:s};e!=="GET"&&r.body&&(l.body=JSON.stringify(r.body)),r.cancelToken&&(l.signal=r.cancelToken.signal);for(let d of this.interceptors)if(d.onRequest){let f=await d.onRequest(i,l);i=f.url,l=f.init;}let u=await this.fetchWithTimeout(i,l,r.timeout||this.timeout);for(let d of this.interceptors)d.onResponse&&(u=await d.onResponse(u));if(!u.ok)return neverthrow.err(await this.handleErrorResponse(u));let n=await u.json();return neverthrow.ok(n)}catch(i){return neverthrow.err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let l=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:l})}finally{clearTimeout(s);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new Pe(r);case 403:return new Ae(r);case 404:return new Se(r);case 500:case 502:case 503:case 504:return new Ee(r,t);default:return new N(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let s=await i.onError(r);s&&(r=s);}return t?.isCancelled||e.name==="AbortError"?new be(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new we:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new he(r.message):new N(r.message)}};var G=class{};var Ce=class extends G{constructor(t){super();this.apiKey=t;}onRequest(t,r){let i=new URL(t);return i.searchParams.set("key",this.apiKey),{url:i.toString(),init:r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var wt=(l=>(l[l.DEBUG=0]="DEBUG",l[l.INFO=1]="INFO",l[l.WARN=2]="WARN",l[l.ERROR=3]="ERROR",l[l.FATAL=4]="FATAL",l[l.NONE=5]="NONE",l))(wt||{}),ht=class{print(e){let t=wt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},J=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},V=class o{constructor(e=new ht,t=new J){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return o.instance||(o.instance=new o),o.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let s={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(s)&&this.printer.print(s);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var ur=class extends G{constructor(e){super(),this.logger=e||V.getInstance();}onRequest(e,t){return this.logger.debug(`HTTP Request: ${t.method||"GET"} ${e}`,{headers:t.headers,body:t.body}),{url:e,init:t}}onResponse(e){return this.logger.debug(`HTTP Response: ${e.status} ${e.url}`,{status:e.status,statusText:e.statusText,headers:Object.fromEntries(e.headers.entries())}),e}onError(e){return this.logger.error(`HTTP Error: ${e.message}`,e),e}};var mr=class extends G{constructor(t={},r){super();this.retryCount=new Map;this.logger=r||V.getInstance(),this.config={maxRetries:t.maxRetries??3,retryDelay:t.retryDelay??1e3,retryableStatusCodes:t.retryableStatusCodes??[408,429,500,502,503,504],exponentialBackoff:t.exponentialBackoff??true};}async onResponse(t){let r=t.url,i=this.retryCount.get(r)||0;if(!t.ok&&this.config.retryableStatusCodes.includes(t.status)&&i<this.config.maxRetries){this.retryCount.set(r,i+1);let s=this.config.exponentialBackoff?this.config.retryDelay*Math.pow(2,i):this.config.retryDelay;throw this.logger.warn(`Retrying request (${i+1}/${this.config.maxRetries}) after ${s}ms: ${t.url}`),await this.sleep(s),new Error(`RETRY_NEEDED:${r}`)}return (t.ok||i>=this.config.maxRetries)&&this.retryCount.delete(r),t}sleep(t){return new Promise(r=>setTimeout(r,t))}resetRetryCount(t){this.retryCount.delete(t);}clearAllRetryCounts(){this.retryCount.clear();}};var St={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var Ir=(t=>(t.ID="ind",t.EN="eng",t))(Ir||{});var Cr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(Cr||{});var vr=(s=>(s.KBLI_2009="kbli2009",s.KBLI_2015="kbli2015",s.KBLI_2017="kbli2017",s.KBLI_2020="kbli2020",s.KBKI_2015="kbki2015",s))(vr||{}),_r=(s=>(s.CATEGORY="kategori",s.PRIMARY_GROUP="golongan pokok",s.GROUP="golongan",s.SUB_GROUP="subgolongan",s.CLUSTER="kelompok",s))(_r||{}),Tr=(c=>(c.SECTION="seksi",c.DIVISION="divisi",c.GROUP="kelompok",c.CLASSES="kelas",c.SUB_CLASS="subkelas",c.COMMODITY_GROUP="kelompok komoditas",c.COMMODITY="komoditas",c))(Tr||{});var Dr=(i=>(i.ALL="all",i.PROVINCE="prov",i.REGENCY="kab",i.REGENCY_BY_PROVINCE="kabbyprov",i))(Dr||{});var p={DOMAIN_LIST:"/domain",PUBLICATION_LIST:"/list/model/publication",PUBLICATION_VIEW:"/view/model/publication",INFOGRAPHIC_LIST:"/list/model/infographic",INFOGRAPHIC_VIEW:"/view/model/infographic",STATIC_TABLE_LIST:"/list/model/statictable",STATIC_TABLE_VIEW:"/view/model/statictable",NEWS_LIST:"/list/model/news",NEWS_VIEW:"/view/model/news",NEWS_CATEGORY_LIST:"/list/model/newscategory",NEWS_CATEGORY_VIEW:"/view/model/newscategory",PRESS_RELEASE_LIST:"/list/model/pressrelease",PRESS_RELEASE_VIEW:"/view/model/pressrelease",SUBJECT_LIST:"/list/model/subject",SUBJECT_VIEW:"/view/model/subject",SUBJECT_CATEGORY_LIST:"/list/model/subcat",SUBJECT_CATEGORY_VIEW:"/view/model/subcat",STRATEGIC_INDICATOR_LIST:"/list/model/indicators",STRATEGIC_INDICATOR_VIEW:"/view/model/indicators",VARIABLE_LIST:"/list/model/var",VARIABLE_VIEW:"/view/model/var",VERTICAL_VARIABLE_LIST:"/list/model/vervar",VERTICAL_VARIABLE_VIEW:"/view/model/vervar",UNIT_LIST:"/list/model/unit",UNIT_VIEW:"/view/model/unit",PERIOD_LIST:"/list/model/th",PERIOD_VIEW:"/view/model/th",DERIVED_PERIOD_LIST:"/list/model/turth",DERIVED_PERIOD_VIEW:"/view/model/turth",DERIVED_VARIABLE_LIST:"/list/model/turvar",DERIVED_VARIABLE_VIEW:"/view/model/turvar",DYNAMIC_TABLE_LIST:"/list/model/data",statisticClassification:(o="kbli2020")=>`/view/model/${o}`,CENSUS:"/interoperabilitas/datasource/sensus",TRADE:"/dataexim"};var Ur={KEY:"key",DOMAIN:"domain",LANG:"lang",PAGE:"page",PER_PAGE:"per_page",KEYWORD:"keyword",MONTH:"month",YEAR:"year",SUBJECT:"subj",VARIABLE:"var",TURVAR:"turvar",TURTH:"turth",PERIOD:"th",TYPE:"type",TABLE:"table",MODEL:"model",ID:"id",SHOW_DELETED:"show_deleted"};var le=class o{constructor(){this._apiKey=null;}static getInstance(){return o.instance||(o.instance=new o),o.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var m=class o{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof o?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var ce=class{},pr=class extends ce{call(){return this.execute()}};var ve=class o extends m{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new o(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var _e=class extends ce{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var Pt=class{constructor(e){this.client=e;}async getAll(e){let t={type:e.type};e.provinceCode&&(t.prov=e.provinceCode),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.perPage&&(t.per_page=e.perPage.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${p.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var U=class o extends m{constructor(t,r,i,s,l){super();this.page=t;this.perPage=r;this.total=i;this.pages=s;this.count=l;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new o(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var dr=class o extends m{constructor(t,r,i){super();this.data=t;this.dataAvailability=r;this.pagination=i;}get isAvailable(){return this.dataAvailability==="available"}get totalItems(){return this.pagination?.total||this.data.length}get hasData(){return this.data.length>0}toJson(){return {data:this.data,data_availability:this.dataAvailability,pagination:this.pagination?.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(u=>r(u)),l=t.pagination,c=l?U.fromJson(l):void 0;return new o(s,t["data-availability"]||"available",c)}};var g=class o extends m{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let s=(t.data||[]).map(u=>r(u)),l=t.pagination,c=U.fromJson(l);return new o(s,c)}};var At=class{constructor(e){this.remoteDataSource=e;}async getAll(e){if(!e)throw new a("Domain list params are required");return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(d=>ve.fromJson(d)),c=Number(i.count)||s.length,u=Number(i.per_page)||c,n=new U(Number(i.page||1),u,Number(i.total||0),Number(i.pages||1),c);return new g(l,n)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var F=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new At(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new _e(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};F.REMOTE_DATA_SOURCE="DomainRemoteDataSource",F.REPOSITORY="DomainRepository",F.GET_ALL_USE_CASE="GetAllDomains";var Te=class o extends m{constructor(t,r,i,s,l){super();this.id=t;this.title=r;this.releaseDate=i;this.url=s;this.cover=l;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var M=class o extends m{constructor(t,r,i,s,l,c,u,n,d,f,lr,Lr,kr){super();this.id=t;this.title=r;this.issn=i;this.cover=s;this.pdf=l;this.size=c;this.scheduledDate=u;this.releaseDate=n;this.updateDate=d;this.abstract=f;this.catalogueNumber=lr;this.publicationNumber=Lr;this.relatedPublications=kr;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(s=>Te.fromJson(s)):[];return new o(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var De=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Le=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Et=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var It=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>M.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>M.fromJson(n))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return M.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Et(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new It(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new De(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Le(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",S.REPOSITORY="PublicationRepository",S.GET_ALL_USE_CASE="GetAllPublications",S.GET_BY_ID_USE_CASE="GetPublicationById";var W=class o extends m{constructor(t,r,i,s,l,c){super();this.id=t;this.title=r;this.image=i;this.category=s;this.downloadUrl=l;this.description=c;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new o(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ct=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${p.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>W.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>W.fromJson(n))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return W.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ct(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ke(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xe(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",P.REPOSITORY="InfographicRepository",P.GET_ALL_USE_CASE="GetAllInfographics",P.GET_BY_ID_USE_CASE="GetInfographicById";var K=class o extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,o.prototype);}},z=class o extends K{constructor(t,r,i){super(t);this.statusCode=r;this.response=i;this.name="ApiException",Object.setPrototypeOf(this,o.prototype);}},Ue=class o extends K{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,o.prototype);}},gr=class o extends K{constructor(e){super(e),this.name="NetworkException",Object.setPrototypeOf(this,o.prototype);}},yr=class o extends K{constructor(e="Request timeout"){super(e),this.name="TimeoutException",Object.setPrototypeOf(this,o.prototype);}},Rr=class o extends z{constructor(e="Resource not found"){super(e,404),this.name="NotFoundException",Object.setPrototypeOf(this,o.prototype);}},fr=class o extends z{constructor(e="Unauthorized"){super(e,401),this.name="UnauthorizedException",Object.setPrototypeOf(this,o.prototype);}},br=class o extends z{constructor(e="Forbidden"){super(e,403),this.name="ForbiddenException",Object.setPrototypeOf(this,o.prototype);}},hr=class o extends z{constructor(e="Server error",t=500){super(e,t),this.name="ServerException",Object.setPrototypeOf(this,o.prototype);}};var wr=class o{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new Ue(this._reason||"Request was cancelled")}static create(){return new o}static source(){let e=new o;return {token:e,cancel:t=>e.cancel(t)}}};var Sr=class{static parse(e){if(!e)return null;try{let t=new Date(e);return isNaN(t.getTime())?null:t}catch{return null}}static format(e){if(!e||!(e instanceof Date))return null;try{return e.toISOString()}catch{return null}}static formatReadable(e){if(!e||!(e instanceof Date))return null;try{return e.toLocaleDateString("id-ID",{year:"numeric",month:"long",day:"numeric"})}catch{return null}}static isValid(e){return this.parse(e)!==null}static toTimestamp(e){let t=this.parse(e);return t?t.getTime():null}static fromTimestamp(e){return new Date(e)}static now(){return new Date().toISOString()}static nowTimestamp(){return Date.now()}};var $=class o extends m{constructor(t,r,i,s,l,c){super();this.id=t;this.title=r;this.content=i;this.releaseDate=s;this.categoryId=l;this.picture=c;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new o(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ue=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ne=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Oe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>$.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>$.fromJson(n))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var b=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ne(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Oe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ue(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new me(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};b.REMOTE_DATA_SOURCE="NewsRemoteDataSource",b.REPOSITORY="NewsRepository",b.GET_ALL_USE_CASE="GetAllNews",b.GET_BY_ID_USE_CASE="GetNewsById";var H=class o extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {newscat_id:this.id,newscat_name:this.name}}static fromJson(t){return new o(String(t.newscat_id||t.id||""),String(t.newscat_name||t.name||""))}};var Ve=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Fe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var _t=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Tt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>H.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>H.fromJson(n))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return H.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new _t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Tt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ve(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Fe(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",A.REPOSITORY="NewsCategoryRepository",A.GET_ALL_USE_CASE="GetAllNewsCategories",A.GET_BY_ID_USE_CASE="GetNewsCategoryById";var Y=class o extends m{constructor(t,r,i,s,l,c,u,n,d,f,lr){super();this.id=t;this.subjectId=r;this.subject=i;this.title=s;this.abstract=l;this.releaseDate=c;this.updatedDate=u;this.pdf=n;this.size=d;this.slide=f;this.thumbnail=lr;}toJson(){return {brs_id:this.id,subj_id:this.subjectId,subj:this.subject,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,updt_date:this.updatedDate,pdf:this.pdf,size:this.size,slide:this.slide,thumbnail:this.thumbnail}}static fromJson(t){return new o(Number(t.brs_id||t.id||0),Number(t.subj_id||t.subjectId||0),String(t.subj||t.subject||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.updt_date?String(t.updt_date):null,String(t.pdf||""),String(t.size||""),String(t.slide||""),String(t.thumbnail||""))}};var pe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var de=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Be=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ge=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>Y.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>Y.fromJson(n))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return Y.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ge(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pe(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new de(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",h.REPOSITORY="PressReleaseRepository",h.GET_ALL_USE_CASE="GetAllPressReleases",h.GET_BY_ID_USE_CASE="GetPressReleaseById";var q=class o extends m{constructor(t,r,i,s,l,c){super();this.id=t;this.title=r;this.subjectId=i;this.size=s;this.updatedAt=l;this.excelUrl=c;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new o(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var ge=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Je=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $e=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>q.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>q.fromJson(n))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return q.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Je(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new $e(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ge(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ye(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",w.REPOSITORY="StaticTableRepository",w.GET_ALL_USE_CASE="GetAllStaticTables",w.GET_BY_ID_USE_CASE="GetStaticTableById";var Q=class o extends m{constructor(t,r,i,s){super();this.id=t;this.name=r;this.categoryId=i;this.category=s;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId,category:this.category}}static fromJson(t){return new o(Number(t.sub_id||t.id||0),String(t.title||t.name||""),Number(t.subcat_id||t.categoryId||0),String(t.category||t.subcat||""))}};var Ye=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Dt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Lt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>Q.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>Q.fromJson(n))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Dt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Lt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ye(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qe(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",E.REPOSITORY="SubjectRepository",E.GET_ALL_USE_CASE="GetAllSubjects",E.GET_BY_ID_USE_CASE="GetSubjectById";var Z=class o extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new o(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.title||t.name||""))}};var Me=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var We=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var kt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var xt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>Z.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>Z.fromJson(n))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return Z.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new kt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Me(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new We(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",I.REPOSITORY="SubjectCategoryRepository",I.GET_ALL_USE_CASE="GetAllSubjectCategories",I.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var X=class o extends m{constructor(t,r,i,s,l,c,u,n,d,f,lr){super();this.variableId=t;this.indicatorId=r;this.subjectCsa=i;this.title=s;this.name=l;this.dataSource=c;this.value=u;this.unit=n;this.category=d;this.hashId=f;this.period=lr;}toJson(){return {var:this.variableId,indicator_id:this.indicatorId,subject_csa:this.subjectCsa,title:this.title,name:this.name,data_source:this.dataSource,value:this.value,unit:this.unit,category:this.category,hash_id:this.hashId,periode:this.period}}static fromJson(t){return new o(Number(t.var||t.variableId||0),Number(t.indicator_id||t.indicatorId||0),Number(t.subject_csa||t.subjectCsa||0),String(t.title||""),String(t.name||""),String(t.data_source||t.dataSource||""),Number(t.value||0),String(t.unit||""),Number(t.category||0),String(t.hash_id||t.hashId||""),String(t.periode||t.period||""))}};var Ke=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ut=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Nt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>X.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>X.fromJson(n))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return X.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ut(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Nt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ke(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ze(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",C.REPOSITORY="StrategicIndicatorRepository",C.GET_ALL_USE_CASE="GetAllStrategicIndicators",C.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var j=class o extends m{constructor(t,r,i,s,l,c,u,n,d,f,lr,Lr,kr){super();this.id=t;this.title=r;this.subjectId=i;this.subjectName=s;this.statisticClassificationId=l;this.statisticClassificationName=c;this.definition=u;this.notes=n;this.unit=d;this.verticalVariableCount=f;this.derivedVariableCount=lr;this.graphId=Lr;this.graphName=kr;}toJson(){return {var_id:this.id,title:this.title,sub_id:this.subjectId,sub_name:this.subjectName,subcsa_id:this.statisticClassificationId,subcsa_name:this.statisticClassificationName,def:this.definition,notes:this.notes,vertical:this.verticalVariableCount,unit:this.unit,graph_id:this.graphId,graph_name:this.graphName}}static fromJson(t){return new o(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.sub_id||t.subject_id||t.subjectId||0),String(t.sub_name||t.subject_name||t.subjectName||""),Number(t.subcsa_id||t.statisticClassificationId||0),String(t.subcsa_name||t.statisticClassificationName||""),String(t.def||t.definition||""),String(t.notes||""),String(t.unit||""),Number(t.vertical||t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),Number(t.graph_id||t.graphId||0),String(t.graph_name||t.graphName||""))}};var He=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Qe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ot=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${p.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Vt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>j.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>j.fromJson(n))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return j.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var v=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ot(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Vt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new He(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qe(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};v.REMOTE_DATA_SOURCE="VariableRemoteDataSource",v.REPOSITORY="VariableRepository",v.GET_ALL_USE_CASE="GetAllVariables",v.GET_BY_ID_USE_CASE="GetVariableById";var ee=class o extends m{constructor(t,r,i,s,l){super();this.id=t;this.label=r;this.itemId=i;this.groupId=s;this.groupName=l;}toJson(){return {kode_ver_id:this.id,vervar:this.label,item_ver_id:this.itemId,group_ver_id:this.groupId,name_group_ver_id:this.groupName}}static fromJson(t){return new o(Number(t.kode_ver_id||t.id||0),String(t.vervar||t.label||""),Number(t.item_ver_id||t.itemId||0),Number(t.group_ver_id||t.groupId||0),String(t.name_group_ver_id||t.groupName||""))}};var Ze=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Xe=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Ft=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Bt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>ee.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>ee.fromJson(n))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return ee.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ft(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Bt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ze(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xe(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",_.REPOSITORY="VerticalVariableRepository",_.GET_ALL_USE_CASE="GetAllVerticalVariables",_.GET_BY_ID_USE_CASE="GetVerticalVariableById";var te=class o extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new o(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var je=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var et=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Gt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Jt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>te.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>te.fromJson(n))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Gt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Jt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new je(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new et(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="UnitRemoteDataSource",T.REPOSITORY="UnitRepository",T.GET_ALL_USE_CASE="GetAllUnits",T.GET_BY_ID_USE_CASE="GetUnitById";var re=class o extends m{constructor(t,r){super();this.id=t;this.period=r;}toJson(){return {th_id:this.id,th:this.period}}static fromJson(t){return new o(Number(t.th_id||t.id||0),Number(t.th||t.period||0))}};var tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var rt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var $t=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Yt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>re.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>re.fromJson(n))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $t(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Yt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",D.REPOSITORY="PeriodRepository",D.GET_ALL_USE_CASE="GetAllPeriods",D.GET_BY_ID_USE_CASE="GetPeriodById";var ie=class o extends m{constructor(t,r,i,s){super();this.id=t;this.period=r;this.groupId=i;this.groupName=s;}toJson(){return {turth_id:this.id,turth:this.period,group_turth_id:this.groupId,name_group_turth:this.groupName}}static fromJson(t){return new o(Number(t.turth_id||t.id||0),String(t.turth||t.period||""),Number(t.group_turth_id||t.groupId||0),String(t.name_group_turth||t.groupName||""))}};var it=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var ot=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var qt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Mt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>ie.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>ie.fromJson(n))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new qt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Mt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new it(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ot(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",L.REPOSITORY="DerivedPeriodRepository",L.GET_ALL_USE_CASE="GetAllDerivedPeriods",L.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var oe=class o extends m{constructor(t,r,i,s){super();this.id=t;this.name=r;this.groupId=i;this.groupName=s;}toJson(){return {turvar_id:this.id,turvar:this.name,group_turvar_id:this.groupId,name_group_turvar:this.groupName}}static fromJson(t){return new o(Number(t.turvar_id||t.id||0),String(t.turvar||t.name||""),Number(t.group_turvar_id||t.groupId||0),String(t.name_group_turvar||t.groupName||""))}};var st=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var at=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var Wt=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Kt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>oe.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>oe.fromJson(n))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var k=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Wt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Kt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new st(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new at(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};k.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",k.REPOSITORY="DerivedVariableRepository",k.GET_ALL_USE_CASE="GetAllDerivedVariables",k.GET_BY_ID_USE_CASE="GetDerivedVariableById";var se=class o extends m{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new o(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var nt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var lt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var zt=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword),e?.level&&(t.level=e.level);let r=new URLSearchParams(t).toString(),i=e?.type||"kbli2020",s=`${p.statisticClassification(i)}${r?`?${r}`:""}`;return this.client.get(s,{cancelToken:e?.cancelToken})}async getById(e){let t={id:e.id.toString()};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=e.type||"kbli2020",s=`${p.statisticClassification(i)}${r?`?${r}`:""}`;return this.client.get(s,{cancelToken:e.cancelToken})}};var Ht=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],s=r.data[1];if(!i||!s)throw new a("Invalid response structure");let l=s.map(n=>se.fromJson(n)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return g.fromJson({data:l,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:c}},n=>se.fromJson(n))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return se.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var x=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new zt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ht(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new nt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new lt(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};x.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",x.REPOSITORY="StatisticClassificationRepository",x.GET_ALL_USE_CASE="GetAllStatisticClassifications",x.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var ct=class o extends m{constructor(t,r,i,s,l){super();this.id=t;this.name=r;this.itemId=i;this.itemCode=s;this.itemName=l;}toJson(){return {id:this.id,name:this.name,itemID:this.itemId,itemCode:this.itemCode,itemName:this.itemName}}toJSON(){return this.toJson()}static fromJson(t){return new o(String(t.id||""),String(t.name||""),String(t.itemID||""),String(t.itemCode||""),String(t.itemName||""))}};var Re=class o extends m{constructor(t,r,i){super();this.id=t;this.name=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.name,tahun_kegiatan:this.year}}toJSON(){return this.toJson()}static fromJson(t){return new o(String(t.id||""),String(t.kegiatan||""),Number(t.tahun_kegiatan||0))}};var ut=class o extends m{constructor(t,r,i,s){super();this.id=t;this.topic=r;this.eventId=i;this.eventName=s;}toJson(){return {id:this.id,topik:this.topic,id_kegiatan:this.eventId,kegiatan:this.eventName}}toJSON(){return this.toJson()}static fromJson(t){return new o(Number(t.id||0),String(t.topik||""),String(t.id_kegiatan||""),String(t.kegiatan||""))}};var mt=class o extends m{constructor(t,r,i,s){super();this.id=t;this.mfdCode=r;this.name=i;this.slug=s;}toJson(){return {id:this.id,kode_mfd:this.mfdCode,nama:this.name,slug:this.slug}}toJSON(){return this.toJson()}static fromJson(t){return new o(Number(t.id||0),String(t.kode_mfd||""),String(t.nama||""),String(t.slug||""))}};var pt=class o extends m{constructor(t,r,i,s,l,c){super();this.id=t;this.topicId=r;this.topic=i;this.eventId=s;this.name=l;this.description=c;}toJson(){let t={id:this.id,id_topik:this.topicId,topik:this.topic,id_kegiatan:this.eventId,nama:this.name};return this.description!==void 0&&this.description!==null&&(t.deskripsi=this.description),t}toJSON(){return this.toJson()}static fromJson(t){return new o(Number(t.id||0),Number(t.id_topik||0),String(t.topik||""),Number(t.id_kegiatan||0),String(t.nama||""),t.deskripsi?String(t.deskripsi):null)}};var dt=class o extends m{constructor(t,r,i,s,l,c,u,n,d){super();this.regionId=t;this.regionCode=r;this.regionName=i;this.indicatorId=s;this.indicatorName=l;this.categories=c;this.period=u;this.value=n;this.regionLevel=d;}toJson(){let t={id_wilayah:this.regionId,kode_wilayah:this.regionCode,nama_wilayah:this.regionName,id_indikator:this.indicatorId,nama_indikator:this.indicatorName,categories:this.categories.map(r=>({id:r.id,name:r.name,item_id:r.itemId,item_code:r.itemCode,item_name:r.itemName})),period:this.period,nilai:this.value};return this.regionLevel!==void 0&&this.regionLevel!==null&&(t.level_wilayah=this.regionLevel),t}toJSON(){return this.toJson()}static fromJson(t){let r=[];for(let i=1;i<=5;i++){let s=String(t[`id_kategori_${i}`]||""),l=String(t[`nama_kategori_${i}`]||""),c=String(t[`id_item_kategori_${i}`]||""),u=String(t[`kode_item_kategori_${i}`]||""),n=String(t[`nama_item__kategori_${i}`]||"");!s||!l||!c||!u||!n||r.push(new ct(s,l,c,u,n));}return new o(String(t.id_wilayah||""),String(t.kode_wilayah||""),String(t.nama_wilayah||""),String(t.id_indikator||""),String(t.nama_indikator||""),r,String(t.period||""),Number(t.nilai||0),t.level_wilayah?String(t.level_wilayah):null)}};var gt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var yt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var Qt=class{constructor(e){this.client=e;}async getAll(e){let t={};switch(e?.type){case "topics":t.id="38",e.censusId&&(t.kegiatan=e.censusId);break;case "areas":t.id="39",e.censusId&&(t.kegiatan=e.censusId);break;case "datasets":t.id="40",e.censusId&&(t.kegiatan=e.censusId),e.topicId&&(t.topik=e.topicId.toString());break;case "data":t.id="41",e.censusId&&(t.kegiatan=e.censusId),e.censusAreaId&&(t.wilayah_sensus=e.censusAreaId),e.datasetId&&(t.dataset=e.datasetId);break;default:t.id="37";break}let r=new URLSearchParams(t).toString(),i=`${p.CENSUS}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={id:e.id.toString(),domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.CENSUS}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Zt=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||r.data===null)return this.createEmptyListResult(e);if(!Array.isArray(r.data)||r.data.length<2)return this.createEmptyListResult(e);let i=r.data[0],s=r.data[1];if(s&&!Array.isArray(s)&&typeof s=="object"){let n=s;n.data&&Array.isArray(n.data)&&(s=n.data);}if(!s||!Array.isArray(s))return this.createEmptyListResult(e,i);let l=s.map(n=>this.parseEntity(n,e?.type)),c=Number(i.count)||s.length,u=Number(i.per_page)||c;return new g(l,new U(Number(i.page||1),u,Number(i.total||0),Number(i.pages||1),c))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return Re.fromJson(r)}catch(i){throw new a(`Failed to parse census event: ${i instanceof Error?i.message:"Unknown error"}`)}})}parseEntity(e,t){switch(t){case "topics":return ut.fromJson(e);case "areas":return mt.fromJson(e);case "datasets":return pt.fromJson(e);case "data":return dt.fromJson(e);case "events":default:return Re.fromJson(e)}}createEmptyListResult(e,t){return g.fromJson({data:[],pagination:{page:Number(t?.page||1),per_page:Number(t?.per_page||10),total:Number(t?.total||0),pages:Number(t?.pages||0),count:0}},r=>this.parseEntity(r,e?.type))}};var y=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Qt(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Zt(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new gt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new yt(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};y.REMOTE_DATA_SOURCE="CensusRemoteDataSource",y.REPOSITORY="CensusRepository",y.GET_ALL_USE_CASE="GetAllCensuses",y.GET_BY_ID_USE_CASE="GetCensusById";var Xt=class o extends m{constructor(t,r,i,s,l,c,u){super();this.value=t;this.label=r;this.unit=i;this.subject=s;this.definition=l;this.notes=c;this.decimal=u;}toJson(){return {val:this.value,label:this.label,unit:this.unit,subj:this.subject,def:this.definition,note:this.notes,...this.decimal!==void 0&&{decimal:this.decimal}}}static fromJson(t){return new o(Number(t.val||0),String(t.label||""),String(t.unit||""),String(t.subj||""),String(t.def||""),String(t.note||""),t.decimal!==void 0?Number(t.decimal):void 0)}},ae=class o extends m{constructor(t,r){super();this.value=t;this.label=r;}toJson(){return {val:this.value,label:this.label}}static fromJson(t){let r=t.val;return new o(typeof r=="number"?r:String(r||""),String(t.label||""))}},jt=class o extends ae{static fromJson(e){let t=e.val;return new o(typeof t=="number"?t:String(t||""),String(e.label||""))}},er=class o extends m{constructor(t,r){super();this.value=t;this.label=r;}toJson(){return {val:this.value,label:this.label}}static fromJson(t){return new o(Number(t.val||0),String(t.label||""))}},tr=class o extends m{constructor(t,r,i,s,l){super();this.id=t;this.title=r;this.tableSource=i;this.lastUpdate=s;this.link=l;}toJson(){return {id:this.id,title:this.title,tablesource:this.tableSource,last_update:this.lastUpdate,link:this.link}}static fromJson(t){return new o(String(t.id||""),String(t.title||""),Number(t.tablesource||0),t.last_update!==null?String(t.last_update||""):null,String(t.link||""))}};var Rt=class o extends m{constructor(t,r,i,s,l,c,u,n,d,f){super();this.subjects=t;this.variables=r;this.verticalVariables=i;this.verticalVariableLabel=s;this.periods=l;this.derivedVariables=c;this.derivedPeriods=u;this.dataContent=n;this.related=d;this.lastUpdate=f;}toJson(){return {subject:this.subjects.map(t=>t.toJson()),var:this.variables.map(t=>t.toJson()),vervar:this.verticalVariables.map(t=>t.toJson()),labelvervar:this.verticalVariableLabel,tahun:this.periods.map(t=>t.toJson()),turvar:this.derivedVariables.map(t=>t.toJson()),turtahun:this.derivedPeriods.map(t=>t.toJson()),datacontent:this.dataContent,related:this.related.map(t=>t.toJson()),last_update:this.lastUpdate}}static fromJson(t){let r=Array.isArray(t.subject)?t.subject:[],i=Array.isArray(t.var)?t.var:[],s=Array.isArray(t.vervar)?t.vervar:[],l=Array.isArray(t.tahun)?t.tahun:[],c=Array.isArray(t.turvar)?t.turvar:[],u=Array.isArray(t.turtahun)?t.turtahun:[],n=Array.isArray(t.related)?t.related:[];return new o(r.map(d=>er.fromJson(d)),i.map(d=>Xt.fromJson(d)),s.map(d=>ae.fromJson(d)),String(t.labelvervar||""),l.map(d=>jt.fromJson(d)),c.map(d=>ae.fromJson(d)),u.map(d=>ae.fromJson(d)),t.datacontent||{},n.map(d=>tr.fromJson(d)),t.last_update!==void 0?t.last_update:void 0)}getDataValue(t,r,i,s,l){let c=`${t}${r}${i}${s}${l}`;return this.dataContent[c]}toStructuredData(){let t=this.subjects[0],r=this.variables[0],i=r?.value||0,s=this.derivedVariables.length>1||this.derivedVariables[0]?.value!==0&&this.derivedVariables[0]?.value!=="0",l=this.derivedPeriods.length>1||this.derivedPeriods[0]?.value!==0&&this.derivedPeriods[0]?.value!=="0",c=this.verticalVariables.map(u=>s?{id:u.value,label:u.label,data:this.derivedVariables.map(n=>({id:n.value,label:n.label,data:this.periods.map(d=>l?{id:d.value,label:d.label,data:this.derivedPeriods.map(f=>({id:f.value,label:f.label,value:this.getDataValue(u.value,i,n.value,d.value,f.value)??null}))}:{id:d.value,label:d.label,value:this.getDataValue(u.value,i,n.value,d.value,this.derivedPeriods[0]?.value||0)??null})}))}:{id:u.value,label:u.label,data:this.periods.map(n=>({id:n.value,label:n.label,data:l?this.derivedPeriods.map(d=>({id:d.value,label:d.label,value:this.getDataValue(u.value,i,0,n.value,d.value)??null})):[{id:n.value,label:n.label,value:this.getDataValue(u.value,i,0,n.value,this.derivedPeriods[0]?.value||0)??null}]}))});return {subject_id:t?.value||0,subject_label:t?.label||"",variable_id:r?.value||0,variable_label:r?.label||"",variable_unit:r?.unit||"",vertical_variable_label:this.verticalVariableLabel,last_update:this.lastUpdate,data:c}}};var ft=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var rr=class{constructor(e){this.client=e;}async getAll(e){let t={domain:e.domain||"",var:e.variableId.toString(),th:e.periodId.toString()};e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.verticalVariableId!==void 0&&(t.vervar=e.verticalVariableId.toString()),e.derivedVariableId!==void 0&&(t.turvar=e.derivedVariableId.toString()),e.derivedPeriodId!==void 0&&(t.turth=e.derivedPeriodId.toString());let r=new URLSearchParams(t).toString(),i=`${p.DYNAMIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ir=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{return Rt.fromJson(r)}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};var B=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new rr(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ir(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ft(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};B.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",B.REPOSITORY="DynamicTableRepository",B.GET_ALL_USE_CASE="GetAllDynamicTables";var or=class{constructor(e){this.injector=e;}async domains(e){return F.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return S.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return P.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return b.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return A.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return h.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return w.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return E.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return I.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return C.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return v.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return _.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return T.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return D.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return L.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return k.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return x.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censusEvents(){return y.getAllCensusesUseCase(this.injector).execute()}async censusTopics(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,type:"topics"})}async censusEventAreas(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,type:"areas"})}async censusEventDatasets(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,topicId:e.topicId,type:"datasets"})}async censusData(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,censusAreaId:e.censusAreaId,datasetId:e.datasetId,type:"data"})}async dynamicTables(e){return B.getAllDynamicTablesUseCase(this.injector).execute(e)}};var sr=class{constructor(e){this.injector=e;}async publication(e){return S.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return P.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return b.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return A.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return h.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return w.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return E.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return I.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return C.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return v.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return _.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return T.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return D.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return L.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return k.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return x.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return y.getCensusByIdUseCase(this.injector).execute(e)}};var Pr=class o extends m{constructor(t,r,i,s,l,c){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=s;this.country=l;this.year=c;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new o(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var bt=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var ar=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),tahun:e.year},r=new URLSearchParams(t).toString(),i=`${p.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var nr=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};var ne=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ar(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new nr(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new bt(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};ne.REMOTE_DATA_SOURCE="TradeRemoteDataSource",ne.REPOSITORY="TradeRepository",ne.GET_TRADE_USE_CASE="GetTrade";var R=class R{constructor(e){this.logger=V.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new J(e.logLevel??1)}),le.getInstance().setApiKey(e.apiKey),this.authInterceptor=new Ce(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Ie({baseURL:e.baseURL||St.BASE_URL,timeout:e.timeout||St.DEFAULT_TIMEOUT,interceptors:t}),this.injector=fe.getInstance(),this.setupDependencies(),this._list=new or(this.injector),this._view=new sr(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!R._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return R._instance}static init(e){return R._instance&&R._instance.logger.warn("StadataJS already initialized. Reinitializing..."),R._instance=new R(e),R._instance}static isInitialized(){return R._instance!==null}static destroy(){R._instance&&(R._instance.cleanup(),R._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){le.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new J(0)});}disableDebug(){this.logger.configure({filter:new J(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){F.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),b.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),v.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),k.register(this.injector,this.networkClient),x.register(this.injector,this.networkClient),y.register(this.injector,this.networkClient),B.register(this.injector,this.networkClient),ne.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),le.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};R._instance=null;var Ar=R;var Nr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Nr||{}),Or=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(Or||{}),Vr=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Vr||{});
|
|
2
|
-
exports.ApiConstant=
|
|
1
|
+
'use strict';var neverthrow=require('neverthrow');var B=class s{constructor(e,t){this.message=e;this.code=t;}toString(){return `${this.constructor.name}: ${this.message}${this.code?` (${this.code})`:""}`}equals(e){return e instanceof s?this.message===e.message&&this.code===e.code&&this.constructor.name===e.constructor.name:false}},V=class extends B{constructor(t,r,i){super(t,i);this.statusCode=r;}},Ze=class extends B{constructor(e="Request was cancelled"){super(e,"CANCELLED");}},Xe=class extends B{constructor(e){super(e,"NETWORK_ERROR");}},Qe=class extends B{constructor(e="Request timeout"){super(e,"TIMEOUT");}},je=class extends V{constructor(e="Resource not found"){super(e,404,"NOT_FOUND");}},et=class extends V{constructor(e="Unauthorized"){super(e,401,"UNAUTHORIZED");}},tt=class extends V{constructor(e="Forbidden"){super(e,403,"FORBIDDEN");}},rt=class extends V{constructor(e="Server error",t=500){super(e,t,"SERVER_ERROR");}},a=class extends B{constructor(e){super(e,"PARSE_ERROR");}},lr=class extends B{constructor(e){super(e,"VALIDATION_ERROR");}};var Y=class{constructor(e={}){this.baseURL=e.baseURL||"",this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.interceptors=e.interceptors||[];}addInterceptor(e){this.interceptors.push(e);}removeInterceptor(e){let t=this.interceptors.indexOf(e);t!==-1&&this.interceptors.splice(t,1);}async get(e,t){return this.request("GET",e,t)}async post(e,t){return this.request("POST",e,t)}async put(e,t){return this.request("PUT",e,t)}async delete(e,t){return this.request("DELETE",e,t)}async patch(e,t){return this.request("PATCH",e,t)}async request(e,t,r={}){try{let i=this.buildUrl(t),o={};e!=="GET"?Object.assign(o,this.defaultHeaders):Object.entries(this.defaultHeaders).forEach(([d,b])=>{d.toLowerCase()!=="content-type"&&(o[d]=b);}),Object.assign(o,r.headers);let c={method:e,headers:o};e!=="GET"&&r.body&&(c.body=JSON.stringify(r.body)),r.cancelToken&&(c.signal=r.cancelToken.signal);for(let d of this.interceptors)if(d.onRequest){let b=await d.onRequest(i,c);i=b.url,c=b.init;}let u=await this.fetchWithTimeout(i,c,r.timeout||this.timeout);for(let d of this.interceptors)d.onResponse&&(u=await d.onResponse(u));if(!u.ok)return neverthrow.err(await this.handleErrorResponse(u));let n=await u.json();return neverthrow.ok(n)}catch(i){return neverthrow.err(await this.handleError(i,r.cancelToken))}}async fetchWithTimeout(e,t,r){let i=new AbortController,o=setTimeout(()=>i.abort(),r);try{let c=t.signal&&t.signal instanceof AbortSignal?this.combineSignals(t.signal,i.signal):i.signal;return await fetch(e,{...t,signal:c})}finally{clearTimeout(o);}}combineSignals(e,t){let r=new AbortController,i=()=>r.abort();return e.addEventListener("abort",i),t.addEventListener("abort",i),r.signal}buildUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${this.baseURL}${e}`}async handleErrorResponse(e){let{status:t}=e,r;try{let i=await e.json();r=i.message||i.error||e.statusText;}catch{r=e.statusText;}switch(t){case 401:return new et(r);case 403:return new tt(r);case 404:return new je(r);case 500:case 502:case 503:case 504:return new rt(r,t);default:return new V(r,t)}}async handleError(e,t){let r=e instanceof Error?e:new Error(String(e));for(let i of this.interceptors)if(i.onError){let o=await i.onError(r);o&&(r=o);}return t?.isCancelled||e.name==="AbortError"?new Ze(t?.reason):r.name==="AbortError"||r.message.includes("timeout")||r.message.includes("aborted")?new Qe:r.message.includes("network")||r.message.includes("fetch")||r.message.includes("ECONNREFUSED")?new Xe(r.message):new V(r.message)}};var bt=class{};var de=class extends bt{constructor(t){super();this.apiKey=t;}onRequest(t,r){let i=new URL(t);return i.searchParams.set("key",this.apiKey),{url:i.toString(),init:r}}setApiKey(t){this.apiKey=t;}getApiKey(){return this.apiKey}};var wt=(c=>(c[c.DEBUG=0]="DEBUG",c[c.INFO=1]="INFO",c[c.WARN=2]="WARN",c[c.ERROR=3]="ERROR",c[c.FATAL=4]="FATAL",c[c.NONE=5]="NONE",c))(wt||{}),cr=class{print(e){let t=wt[e.level],i=`[${e.timestamp.toISOString()}] [${t}] ${e.message}`;switch(e.level){case 0:console.debug(i,e.data);break;case 1:console.info(i,e.data);break;case 2:console.warn(i,e.data);break;case 3:case 4:console.error(i,e.error||e.data);break}}},q=class{constructor(e=1){this.minLevel=e;}shouldLog(e){return e.level>=this.minLevel}},St=class s{constructor(e=new cr,t=new q){this.enabled=true;this.printer=e,this.filter=t;}static getInstance(){return s.instance||(s.instance=new s),s.instance}configure(e){e.printer&&(this.printer=e.printer),e.filter&&(this.filter=e.filter),e.enabled!==void 0&&(this.enabled=e.enabled);}debug(e,t){this.log(0,e,t);}info(e,t){this.log(1,e,t);}warn(e,t){this.log(2,e,t);}error(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(3,e,i,r);}fatal(e,t){let r=t instanceof Error?t:void 0,i=t instanceof Error?void 0:t;this.log(4,e,i,r);}log(e,t,r,i){if(!this.enabled)return;let o={level:e,message:t,timestamp:new Date,data:r,error:i};this.filter.shouldLog(o)&&this.printer.print(o);}enable(){this.enabled=true;}disable(){this.enabled=false;}};var M={BASE_URL:"https://webapi.bps.go.id/v1/api",DEFAULT_TIMEOUT:3e4,API_VERSION:"v1",DEFAULT_PAGE_SIZE:10,MAX_PAGE_SIZE:100};var yr=(t=>(t.ID="ind",t.EN="eng",t))(yr||{});var Rr=(r=>(r.AVAILABLE="available",r.NOT_AVAILABLE="not-available",r.LIST_NOT_AVAILABLE="list-not-available",r))(Rr||{});var br=(o=>(o.KBLI_2009="kbli2009",o.KBLI_2015="kbli2015",o.KBLI_2017="kbli2017",o.KBLI_2020="kbli2020",o.KBKI_2015="kbki2015",o))(br||{}),Sr=(o=>(o.CATEGORY="kategori",o.PRIMARY_GROUP="golongan pokok",o.GROUP="golongan",o.SUB_GROUP="subgolongan",o.CLUSTER="kelompok",o))(Sr||{}),wr=(l=>(l.SECTION="seksi",l.DIVISION="divisi",l.GROUP="kelompok",l.CLASSES="kelas",l.SUB_CLASS="subkelas",l.COMMODITY_GROUP="kelompok komoditas",l.COMMODITY="komoditas",l))(wr||{});var hr=(i=>(i.ALL="all",i.PROVINCE="prov",i.REGENCY="kab",i.REGENCY_BY_PROVINCE="kabbyprov",i))(hr||{});var p={DOMAIN_LIST:"/domain",PUBLICATION_LIST:"/list/model/publication",PUBLICATION_VIEW:"/view/model/publication",INFOGRAPHIC_LIST:"/list/model/infographic",INFOGRAPHIC_VIEW:"/view/model/infographic",STATIC_TABLE_LIST:"/list/model/statictable",STATIC_TABLE_VIEW:"/view/model/statictable",NEWS_LIST:"/list/model/news",NEWS_VIEW:"/view/model/news",NEWS_CATEGORY_LIST:"/list/model/newscategory",NEWS_CATEGORY_VIEW:"/view/model/newscategory",PRESS_RELEASE_LIST:"/list/model/pressrelease",PRESS_RELEASE_VIEW:"/view/model/pressrelease",SUBJECT_LIST:"/list/model/subject",SUBJECT_VIEW:"/view/model/subject",SUBJECT_CATEGORY_LIST:"/list/model/subcat",SUBJECT_CATEGORY_VIEW:"/view/model/subcat",STRATEGIC_INDICATOR_LIST:"/list/model/indicators",STRATEGIC_INDICATOR_VIEW:"/view/model/indicators",VARIABLE_LIST:"/list/model/var",VARIABLE_VIEW:"/view/model/var",VERTICAL_VARIABLE_LIST:"/list/model/vervar",VERTICAL_VARIABLE_VIEW:"/view/model/vervar",UNIT_LIST:"/list/model/unit",UNIT_VIEW:"/view/model/unit",PERIOD_LIST:"/list/model/th",PERIOD_VIEW:"/view/model/th",DERIVED_PERIOD_LIST:"/list/model/turth",DERIVED_PERIOD_VIEW:"/view/model/turth",DERIVED_VARIABLE_LIST:"/list/model/turvar",DERIVED_VARIABLE_VIEW:"/view/model/turvar",DYNAMIC_TABLE_LIST:"/list/model/data",statisticClassification:(s="kbli2020")=>`/view/model/${s}`,CENSUS:"/interoperabilitas/datasource/sensus",TRADE:"/dataexim"};var it=null;function Mr(s){return it=ur(s),it}function g(){if(!it)throw new Error('[stadata-js] Client not initialized. Call initStadata({ apiKey: "..." }) before using composables.');return it}function Wr(){it=null;}var ge=class{constructor(e){this.client=e;}async getAll(e){let t={type:e.type};e.provinceCode&&(t.prov=e.provinceCode),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.perPage&&(t.per_page=e.perPage.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${p.DOMAIN_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var m=class s{toString(){return JSON.stringify(this.toJson(),null,2)}equals(e){return e instanceof s?JSON.stringify(this.toJson())===JSON.stringify(e.toJson()):false}copyWith(e){let r={...this.toJson(),...e};return Object.assign(Object.create(Object.getPrototypeOf(this)),r)}};var ht=class{};var st=class s extends m{constructor(t,r,i){super();this.id=t;this.name=r;this.url=i;}toJson(){return {domain_id:this.id,domain_name:this.name,domain_url:this.url}}static fromJson(t){return new s(t.domain_id||t.id||"",t.domain_name||t.name||"",t.domain_url||t.url||"")}};var N=class s extends m{constructor(t,r,i,o,c){super();this.page=t;this.perPage=r;this.total=i;this.pages=o;this.count=c;}get hasNextPage(){return this.page<this.pages}get hasPreviousPage(){return this.page>1}get nextPage(){return this.hasNextPage?this.page+1:null}get previousPage(){return this.hasPreviousPage?this.page-1:null}toJson(){return {page:this.page,per_page:this.perPage,total:this.total,pages:this.pages,count:this.count}}static fromJson(t){return new s(t.page||1,t.per_page||10,t.total||0,t.pages||0,t.count||0)}};var f=class s extends m{constructor(t,r){super();this.data=t;this.pagination=r;}get hasMore(){return this.pagination.hasNextPage}get totalItems(){return this.pagination.total}get items(){return this.data}get itemCount(){return this.data.length}toJson(){return {data:this.data,pagination:this.pagination.toJson()}}static fromJson(t,r){let o=(t.data||[]).map(u=>r(u)),c=t.pagination,l=N.fromJson(c);return new s(o,l)}};var fe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){if(!e)throw new a("Domain list params are required");return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(d=>st.fromJson(d)),l=Number(i.count)||o.length,u=Number(i.per_page)||l,n=new N(Number(i.page||1),u,Number(i.total||0),Number(i.pages||1),l);return new f(c,n)}catch(i){throw new a(`Failed to parse domain data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Pr(s){let e=s??g(),t=new ge(e.networkClient),r=new fe(t);return {fetchDomainList:i=>r.getAll(i)}}var ye=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.PUBLICATION_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PUBLICATION_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ot=class s extends m{constructor(t,r,i,o,c){super();this.id=t;this.title=r;this.releaseDate=i;this.url=o;this.cover=c;}toJson(){return {id:this.id,title:this.title,rl_date:this.releaseDate.toISOString().split("T")[0],url:this.url,cover:this.cover}}static fromJson(t){return new s(String(t.id||""),String(t.title||""),new Date(String(t.rl_date||t.release_date||t.releaseDate||"")),String(t.url||""),String(t.cover||""))}};var W=class s extends m{constructor(t,r,i,o,c,l,u,n,d,b,nr,$r,Yr){super();this.id=t;this.title=r;this.issn=i;this.cover=o;this.pdf=c;this.size=l;this.scheduledDate=u;this.releaseDate=n;this.updateDate=d;this.abstract=b;this.catalogueNumber=nr;this.publicationNumber=$r;this.relatedPublications=Yr;}toJson(){return {id:this.id,title:this.title,issn:this.issn,cover:this.cover,pdf:this.pdf,size:this.size,scheduled_date:this.scheduledDate?.toISOString().split("T")[0]||null,rl_date:this.releaseDate?.toISOString().split("T")[0]||null,updt_date:this.updateDate?.toISOString().split("T")[0]||null,abstract:this.abstract,catalogue_number:this.catalogueNumber,publication_number:this.publicationNumber,related_publications:this.relatedPublications.map(t=>t.toJson())}}static fromJson(t){let r=t.related_publications||t.relatedPublications,i=Array.isArray(r)?r.map(o=>ot.fromJson(o)):[];return new s(String(t.id||""),String(t.title||""),String(t.issn||""),String(t.cover||""),String(t.pdf||""),String(t.size||""),t.scheduled_date||t.scheduledDate?new Date(String(t.scheduled_date||t.scheduledDate)):null,t.rl_date||t.release_date||t.releaseDate?new Date(String(t.rl_date||t.release_date||t.releaseDate)):null,t.updt_date||t.update_date||t.updateDate?new Date(String(t.updt_date||t.update_date||t.updateDate)):null,t.abstract?String(t.abstract):null,t.catalogue_number||t.catalogueNumber?String(t.catalogue_number||t.catalogueNumber):null,t.publication_number||t.publicationNumber?String(t.publication_number||t.publicationNumber):null,i)}};var Re=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>W.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>W.fromJson(n))}catch(i){throw new a(`Failed to parse publications: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Publication not found");let i=r.data[0];if(!i)throw new a("Publication data is empty");return W.fromJson(i)}catch(i){throw new a(`Failed to parse publication data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Ar(s){let e=s??g(),t=new ye(e.networkClient),r=new Re(t);return {fetchPublicationList:i=>r.getAll(i),fetchPublicationDetail:i=>r.getById(i)}}var K=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.PRESS_RELEASE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PRESS_RELEASE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Pt=class s{constructor(){this.container=new Map;this.factories=new Map;}static getInstance(){return s.instance||(s.instance=new s),s.instance}register(e,t){this.container.set(e,t);}registerFactory(e,t){this.factories.set(e,t);}resolve(e){if(this.container.has(e))return this.container.get(e);if(this.factories.has(e)){let t=this.factories.get(e);if(t){let r=t();return this.container.set(e,r),r}}throw new Error(`Dependency not found: ${e}`)}has(e){return this.container.has(e)||this.factories.has(e)}clear(){this.container.clear(),this.factories.clear();}remove(e){this.container.delete(e),this.factories.delete(e);}};var mr=class s extends Error{constructor(e){super(e),this.name="StadataException",Object.setPrototypeOf(this,s.prototype);}};var At=class s extends mr{constructor(e="Request was cancelled"){super(e),this.name="CancelledException",Object.setPrototypeOf(this,s.prototype);}};var pr=class s{constructor(){this._isCancelled=false;this.abortController=new AbortController;}get signal(){return this.abortController.signal}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isCancelled||(this._isCancelled=true,this._reason=e,this.abortController.abort());}throwIfCancelled(){if(this._isCancelled)throw new At(this._reason||"Request was cancelled")}static create(){return new s}static source(){let e=new s;return {token:e,cancel:t=>e.cancel(t)}}};var G=class s extends m{constructor(t,r,i,o,c,l,u,n,d,b,nr){super();this.id=t;this.subjectId=r;this.subject=i;this.title=o;this.abstract=c;this.releaseDate=l;this.updatedDate=u;this.pdf=n;this.size=d;this.slide=b;this.thumbnail=nr;}toJson(){return {brs_id:this.id,subj_id:this.subjectId,subj:this.subject,title:this.title,abstract:this.abstract,rl_date:this.releaseDate,updt_date:this.updatedDate,pdf:this.pdf,size:this.size,slide:this.slide,thumbnail:this.thumbnail}}static fromJson(t){return new s(Number(t.brs_id||t.id||0),Number(t.subj_id||t.subjectId||0),String(t.subj||t.subject||""),String(t.title||""),String(t.abstract||""),String(t.rl_date||t.releaseDate||""),t.updt_date?String(t.updt_date):null,String(t.pdf||""),String(t.size||""),String(t.slide||""),String(t.thumbnail||""))}};var z=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>G.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>G.fromJson(n))}catch(i){throw new a(`Failed to parse press releases: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Press release not found");let i=r.data[0];if(!i)throw new a("Press release data is empty");return G.fromJson(i)}catch(i){throw new a(`Failed to parse press release data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Cr(s){let e=s??g(),t=new K(e.networkClient),r=new z(t);return {fetchPressReleaseList:i=>r.getAll(i),fetchPressReleaseDetail:i=>r.getById(i)}}var H=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString());let r=new URLSearchParams(t).toString(),i=`${p.STATIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.STATIC_TABLE_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var J=class s extends m{constructor(t,r,i,o,c,l){super();this.id=t;this.title=r;this.subjectId=i;this.size=o;this.updatedAt=c;this.excelUrl=l;}toJson(){return {table_id:this.id,title:this.title,subj_id:this.subjectId,size:this.size,updt_date:this.updatedAt,excel:this.excelUrl}}static fromJson(t){return new s(String(t.table_id||t.id||""),String(t.title||""),Number(t.subj_id||t.subjectId||0),String(t.size||""),String(t.updt_date||t.updatedAt||""),String(t.excel||t.excelUrl||""))}};var Z=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>J.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>J.fromJson(n))}catch(i){throw new a(`Failed to parse static tables: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Static table not found");let i=r.data[0];if(!i)throw new a("Static table data is empty");return J.fromJson(i)}catch(i){throw new a(`Failed to parse static table data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Ir(s){let e=s??g(),t=new H(e.networkClient),r=new Z(t);return {fetchStaticTableList:i=>r.getAll(i),fetchStaticTableDetail:i=>r.getById(i)}}var be=class{constructor(e){this.client=e;}async getAll(e){let t={domain:e.domain||"",var:e.variableId.toString(),th:e.periodId.toString()};e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.verticalVariableId!==void 0&&(t.vervar=e.verticalVariableId.toString()),e.derivedVariableId!==void 0&&(t.turvar=e.derivedVariableId.toString()),e.derivedPeriodId!==void 0&&(t.turth=e.derivedPeriodId.toString());let r=new URLSearchParams(t).toString(),i=`${p.DYNAMIC_TABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Ct=class s extends m{constructor(t,r,i,o,c,l,u){super();this.value=t;this.label=r;this.unit=i;this.subject=o;this.definition=c;this.notes=l;this.decimal=u;}toJson(){return {val:this.value,label:this.label,unit:this.unit,subj:this.subject,def:this.definition,note:this.notes,...this.decimal!==void 0&&{decimal:this.decimal}}}static fromJson(t){return new s(Number(t.val||0),String(t.label||""),String(t.unit||""),String(t.subj||""),String(t.def||""),String(t.note||""),t.decimal!==void 0?Number(t.decimal):void 0)}},X=class s extends m{constructor(t,r){super();this.value=t;this.label=r;}toJson(){return {val:this.value,label:this.label}}static fromJson(t){let r=t.val;return new s(typeof r=="number"?r:String(r||""),String(t.label||""))}},It=class s extends X{static fromJson(e){let t=e.val;return new s(typeof t=="number"?t:String(t||""),String(e.label||""))}},Et=class s extends m{constructor(t,r){super();this.value=t;this.label=r;}toJson(){return {val:this.value,label:this.label}}static fromJson(t){return new s(Number(t.val||0),String(t.label||""))}},vt=class s extends m{constructor(t,r,i,o,c){super();this.id=t;this.title=r;this.tableSource=i;this.lastUpdate=o;this.link=c;}toJson(){return {id:this.id,title:this.title,tablesource:this.tableSource,last_update:this.lastUpdate,link:this.link}}static fromJson(t){return new s(String(t.id||""),String(t.title||""),Number(t.tablesource||0),t.last_update!==null?String(t.last_update||""):null,String(t.link||""))}};var at=class s extends m{constructor(t,r,i,o,c,l,u,n,d,b){super();this.subjects=t;this.variables=r;this.verticalVariables=i;this.verticalVariableLabel=o;this.periods=c;this.derivedVariables=l;this.derivedPeriods=u;this.dataContent=n;this.related=d;this.lastUpdate=b;}toJson(){return {subject:this.subjects.map(t=>t.toJson()),var:this.variables.map(t=>t.toJson()),vervar:this.verticalVariables.map(t=>t.toJson()),labelvervar:this.verticalVariableLabel,tahun:this.periods.map(t=>t.toJson()),turvar:this.derivedVariables.map(t=>t.toJson()),turtahun:this.derivedPeriods.map(t=>t.toJson()),datacontent:this.dataContent,related:this.related.map(t=>t.toJson()),last_update:this.lastUpdate}}static fromJson(t){let r=Array.isArray(t.subject)?t.subject:[],i=Array.isArray(t.var)?t.var:[],o=Array.isArray(t.vervar)?t.vervar:[],c=Array.isArray(t.tahun)?t.tahun:[],l=Array.isArray(t.turvar)?t.turvar:[],u=Array.isArray(t.turtahun)?t.turtahun:[],n=Array.isArray(t.related)?t.related:[];return new s(r.map(d=>Et.fromJson(d)),i.map(d=>Ct.fromJson(d)),o.map(d=>X.fromJson(d)),String(t.labelvervar||""),c.map(d=>It.fromJson(d)),l.map(d=>X.fromJson(d)),u.map(d=>X.fromJson(d)),t.datacontent||{},n.map(d=>vt.fromJson(d)),t.last_update!==void 0?t.last_update:void 0)}getDataValue(t,r,i,o,c){let l=`${t}${r}${i}${o}${c}`;return this.dataContent[l]}toStructuredData(){let t=this.subjects[0],r=this.variables[0],i=r?.value||0,o=this.derivedVariables.length>1||this.derivedVariables[0]?.value!==0&&this.derivedVariables[0]?.value!=="0",c=this.derivedPeriods.length>1||this.derivedPeriods[0]?.value!==0&&this.derivedPeriods[0]?.value!=="0",l=this.verticalVariables.map(u=>o?{id:u.value,label:u.label,data:this.derivedVariables.map(n=>({id:n.value,label:n.label,data:this.periods.map(d=>c?{id:d.value,label:d.label,data:this.derivedPeriods.map(b=>({id:b.value,label:b.label,value:this.getDataValue(u.value,i,n.value,d.value,b.value)??null}))}:{id:d.value,label:d.label,value:this.getDataValue(u.value,i,n.value,d.value,this.derivedPeriods[0]?.value||0)??null})}))}:{id:u.value,label:u.label,data:this.periods.map(n=>({id:n.value,label:n.label,data:c?this.derivedPeriods.map(d=>({id:d.value,label:d.label,value:this.getDataValue(u.value,i,0,n.value,d.value)??null})):[{id:n.value,label:n.label,value:this.getDataValue(u.value,i,0,n.value,this.derivedPeriods[0]?.value||0)??null}]}))});return {subject_id:t?.value||0,subject_label:t?.label||"",variable_id:r?.value||0,variable_label:r?.label||"",variable_unit:r?.unit||"",vertical_variable_label:this.verticalVariableLabel,last_update:this.lastUpdate,data:l}}};var Se=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{return at.fromJson(r)}catch(i){throw new a(`Failed to parse dynamic table: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Er(s){let e=s??g(),t=new be(e.networkClient),r=new Se(t);return {fetchDynamicTableList:i=>r.getAll(i)}}var we=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword);let r=new URLSearchParams(t).toString(),i=`${p.INFOGRAPHIC_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.INFOGRAPHIC_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var Q=class s extends m{constructor(t,r,i,o,c,l){super();this.id=t;this.title=r;this.image=i;this.category=o;this.downloadUrl=c;this.description=l;}toJson(){return {inf_id:this.id,title:this.title,img:this.image,category:this.category,dl:this.downloadUrl,desc:this.description}}static fromJson(t){return new s(String(t.inf_id||t.id||""),String(t.title||""),String(t.img||t.image||""),Number(t.category||0),String(t.dl||t.downloadUrl||""),t.desc||t.description?String(t.desc||t.description):null)}};var he=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>Q.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>Q.fromJson(n))}catch(i){throw new a(`Failed to parse infographics: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Infographic not found");let i=r.data[0];if(!i)throw new a("Infographic data is empty");return Q.fromJson(i)}catch(i){throw new a(`Failed to parse infographic data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function vr(s){let e=s??g(),t=new we(e.networkClient),r=new he(t);return {fetchInfographicList:i=>r.getAll(i)}}var j=class{constructor(e){this.client=e;}async getAll(e){let t={};e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString()),e.keyword&&(t.keyword=e.keyword),e.month&&(t.month=e.month.toString()),e.year&&(t.year=e.year.toString()),e.newsCategoryId&&(t.news_category_id=e.newsCategoryId);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var $=class s extends m{constructor(t,r,i,o,c,l){super();this.id=t;this.title=r;this.content=i;this.releaseDate=o;this.categoryId=c;this.picture=l;}toJson(){return {news_id:this.id,title:this.title,news_content:this.content,rl_date:this.releaseDate,category_id:this.categoryId,picture:this.picture}}static fromJson(t){return new s(String(t.news_id||t.id||""),String(t.title||""),String(t.news_content||t.content||""),String(t.rl_date||t.releaseDate||""),Number(t.category_id||t.categoryId||0),t.picture?String(t.picture):null)}};var ee=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>$.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>$.fromJson(n))}catch(i){throw new a(`Failed to parse news: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News not found");let i=r.data[0];if(!i)throw new a("News data is empty");return $.fromJson(i)}catch(i){throw new a(`Failed to parse news data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function _r(s){let e=s??g(),t=new j(e.networkClient),r=new ee(t);return {fetchNewList:i=>r.getAll(i),fetchNewDetail:i=>r.getById(i)}}var Pe=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.NEWS_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.NEWS_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var te=class s extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {newscat_id:this.id,newscat_name:this.name}}static fromJson(t){return new s(String(t.newscat_id||t.id||""),String(t.newscat_name||t.name||""))}};var Ae=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>te.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>te.fromJson(n))}catch(i){throw new a(`Failed to parse news category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("News category not found");let i=r.data[0];if(!i)throw new a("News category data is empty");return te.fromJson(i)}catch(i){throw new a(`Failed to parse news category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Dr(s){let e=s??g(),t=new Pe(e.networkClient),r=new Ae(t);return {fetchNewsCategoryList:i=>r.getAll(i)}}var Ce=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.subjectId&&(t.subject=e.subjectId.toString()),e?.showDeleted!==void 0&&(t.show_deleted=e.showDeleted?"1":"0");let r=new URLSearchParams(t).toString(),i=`${p.VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var re=class s extends m{constructor(t,r,i,o,c,l,u,n,d,b,nr,$r,Yr){super();this.id=t;this.title=r;this.subjectId=i;this.subjectName=o;this.statisticClassificationId=c;this.statisticClassificationName=l;this.definition=u;this.notes=n;this.unit=d;this.verticalVariableCount=b;this.derivedVariableCount=nr;this.graphId=$r;this.graphName=Yr;}toJson(){return {var_id:this.id,title:this.title,sub_id:this.subjectId,sub_name:this.subjectName,subcsa_id:this.statisticClassificationId,subcsa_name:this.statisticClassificationName,def:this.definition,notes:this.notes,vertical:this.verticalVariableCount,unit:this.unit,graph_id:this.graphId,graph_name:this.graphName}}static fromJson(t){return new s(Number(t.var_id||t.id||0),String(t.title||t.name||""),Number(t.sub_id||t.subject_id||t.subjectId||0),String(t.sub_name||t.subject_name||t.subjectName||""),Number(t.subcsa_id||t.statisticClassificationId||0),String(t.subcsa_name||t.statisticClassificationName||""),String(t.def||t.definition||""),String(t.notes||""),String(t.unit||""),Number(t.vertical||t.vertical_variable||t.verticalVariableCount||0),Number(t.derived_variable||t.derivedVariableCount||0),Number(t.graph_id||t.graphId||0),String(t.graph_name||t.graphName||""))}};var Ie=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>re.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>re.fromJson(n))}catch(i){throw new a(`Failed to parse variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Variable not found");let i=r.data[0];if(!i)throw new a("Variable data is empty");return re.fromJson(i)}catch(i){throw new a(`Failed to parse variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Tr(s){let e=s??g(),t=new Ce(e.networkClient),r=new Ie(t);return {fetchVariableList:i=>r.getAll(i),fetchVariableDetail:i=>r.getById(i)}}var Ee=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.VERTICAL_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.VERTICAL_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ie=class s extends m{constructor(t,r,i,o,c){super();this.id=t;this.label=r;this.itemId=i;this.groupId=o;this.groupName=c;}toJson(){return {kode_ver_id:this.id,vervar:this.label,item_ver_id:this.itemId,group_ver_id:this.groupId,name_group_ver_id:this.groupName}}static fromJson(t){return new s(Number(t.kode_ver_id||t.id||0),String(t.vervar||t.label||""),Number(t.item_ver_id||t.itemId||0),Number(t.group_ver_id||t.groupId||0),String(t.name_group_ver_id||t.groupName||""))}};var ve=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>ie.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>ie.fromJson(n))}catch(i){throw new a(`Failed to parse vertical variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Vertical variable not found");let i=r.data[0];if(!i)throw new a("Vertical variable data is empty");return ie.fromJson(i)}catch(i){throw new a(`Failed to parse vertical variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Lr(s){let e=s??g(),t=new Ee(e.networkClient),r=new ve(t);return {fetchVerticalVariableList:i=>r.getAll(i)}}var _e=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_VARIABLE_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_VARIABLE_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var se=class s extends m{constructor(t,r,i,o){super();this.id=t;this.name=r;this.groupId=i;this.groupName=o;}toJson(){return {turvar_id:this.id,turvar:this.name,group_turvar_id:this.groupId,name_group_turvar:this.groupName}}static fromJson(t){return new s(Number(t.turvar_id||t.id||0),String(t.turvar||t.name||""),Number(t.group_turvar_id||t.groupId||0),String(t.name_group_turvar||t.groupName||""))}};var De=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>se.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>se.fromJson(n))}catch(i){throw new a(`Failed to parse derived variable: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived variable not found");let i=r.data[0];if(!i)throw new a("Derived variable data is empty");return se.fromJson(i)}catch(i){throw new a(`Failed to parse derived variable data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function kr(s){let e=s??g(),t=new _e(e.networkClient),r=new De(t);return {fetchDerivedVariableList:i=>r.getAll(i)}}var Te=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var oe=class s extends m{constructor(t,r,i,o){super();this.id=t;this.name=r;this.categoryId=i;this.category=o;}toJson(){return {subj_id:this.id,title:this.name,subcatid:this.categoryId,category:this.category}}static fromJson(t){return new s(Number(t.sub_id||t.id||0),String(t.title||t.name||""),Number(t.subcat_id||t.categoryId||0),String(t.category||t.subcat||""))}};var Le=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>oe.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>oe.fromJson(n))}catch(i){throw new a(`Failed to parse subject: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject not found");let i=r.data[0];if(!i)throw new a("Subject data is empty");return oe.fromJson(i)}catch(i){throw new a(`Failed to parse subject data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function xr(s){let e=s??g(),t=new Te(e.networkClient),r=new Le(t);return {fetchSubjectList:i=>r.getAll(i),fetchSubjectDetail:i=>r.getById(i)}}var ke=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_CATEGORY_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.SUBJECT_CATEGORY_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ae=class s extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {subcat_id:this.id,subcat_name:this.name}}static fromJson(t){return new s(Number(t.subcat_id||t.id||0),String(t.subcat_name||t.title||t.name||""))}};var xe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>ae.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>ae.fromJson(n))}catch(i){throw new a(`Failed to parse subject category: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Subject category not found");let i=r.data[0];if(!i)throw new a("Subject category data is empty");return ae.fromJson(i)}catch(i){throw new a(`Failed to parse subject category data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Ur(s){let e=s??g(),t=new ke(e.networkClient),r=new xe(t);return {fetchSubjectCategoryList:i=>r.getAll(i)}}var Ue=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.UNIT_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.UNIT_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ne=class s extends m{constructor(t,r){super();this.id=t;this.name=r;}toJson(){return {unit_id:this.id,unit:this.name}}static fromJson(t){return new s(Number(t.unit_id||t.id||0),String(t.unit||t.name||""))}};var Ve=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>ne.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>ne.fromJson(n))}catch(i){throw new a(`Failed to parse unit: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Unit not found");let i=r.data[0];if(!i)throw new a("Unit data is empty");return ne.fromJson(i)}catch(i){throw new a(`Failed to parse unit data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Vr(s){let e=s??g(),t=new Ue(e.networkClient),r=new Ve(t);return {fetchUnitList:i=>r.getAll(i),fetchUnitDetail:i=>r.getById(i)}}var Ne=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var le=class s extends m{constructor(t,r){super();this.id=t;this.period=r;}toJson(){return {th_id:this.id,th:this.period}}static fromJson(t){return new s(Number(t.th_id||t.id||0),Number(t.th||t.period||0))}};var Fe=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>le.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>le.fromJson(n))}catch(i){throw new a(`Failed to parse period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Period not found");let i=r.data[0];if(!i)throw new a("Period data is empty");return le.fromJson(i)}catch(i){throw new a(`Failed to parse period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Nr(s){let e=s??g(),t=new Ne(e.networkClient),r=new Fe(t);return {fetchPeriodList:i=>r.getAll(i)}}var Oe=class{constructor(e){this.client=e;}async getAll(e){let t={};e.variableId!==void 0&&(t.var=e.variableId.toString()),e.domain&&(t.domain=e.domain),e.lang&&(t.lang=e.lang),e.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_PERIOD_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.DERIVED_PERIOD_VIEW}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ce=class s extends m{constructor(t,r,i,o){super();this.id=t;this.period=r;this.groupId=i;this.groupName=o;}toJson(){return {turth_id:this.id,turth:this.period,group_turth_id:this.groupId,name_group_turth:this.groupName}}static fromJson(t){return new s(Number(t.turth_id||t.id||0),String(t.turth||t.period||""),Number(t.group_turth_id||t.groupId||0),String(t.name_group_turth||t.groupName||""))}};var Be=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>ce.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>ce.fromJson(n))}catch(i){throw new a(`Failed to parse derived period: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Derived period not found");let i=r.data[0];if(!i)throw new a("Derived period data is empty");return ce.fromJson(i)}catch(i){throw new a(`Failed to parse derived period data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Fr(s){let e=s??g(),t=new Oe(e.networkClient),r=new Be(t);return {fetchDerivedPeriodList:i=>r.getAll(i)}}var Ge=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString());let r=new URLSearchParams(t).toString(),i=`${p.STRATEGIC_INDICATOR_LIST}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.STRATEGIC_INDICATOR_LIST}/${e.id}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ue=class s extends m{constructor(t,r,i,o,c,l,u,n,d,b,nr){super();this.variableId=t;this.indicatorId=r;this.subjectCsa=i;this.title=o;this.name=c;this.dataSource=l;this.value=u;this.unit=n;this.category=d;this.hashId=b;this.period=nr;}toJson(){return {var:this.variableId,indicator_id:this.indicatorId,subject_csa:this.subjectCsa,title:this.title,name:this.name,data_source:this.dataSource,value:this.value,unit:this.unit,category:this.category,hash_id:this.hashId,periode:this.period}}static fromJson(t){return new s(Number(t.var||t.variableId||0),Number(t.indicator_id||t.indicatorId||0),Number(t.subject_csa||t.subjectCsa||0),String(t.title||""),String(t.name||""),String(t.data_source||t.dataSource||""),Number(t.value||0),String(t.unit||""),Number(t.category||0),String(t.hash_id||t.hashId||""),String(t.periode||t.period||""))}};var Je=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>ue.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>ue.fromJson(n))}catch(i){throw new a(`Failed to parse strategic indicator: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Strategic indicator not found");let i=r.data[0];if(!i)throw new a("Strategic indicator data is empty");return ue.fromJson(i)}catch(i){throw new a(`Failed to parse strategic indicator data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Or(s){let e=s??g(),t=new Ge(e.networkClient),r=new Je(t);return {fetchStrategicIndicatorList:i=>r.getAll(i),fetchStrategicIndicatorDetail:i=>r.getById(i)}}var $e=class{constructor(e){this.client=e;}async getAll(e){let t={};e?.domain&&(t.domain=e.domain),e?.lang&&(t.lang=e.lang),e?.page&&(t.page=e.page.toString()),e?.keyword&&(t.keyword=e.keyword),e?.level&&(t.level=e.level);let r=new URLSearchParams(t).toString(),i=e?.type||"kbli2020",o=`${p.statisticClassification(i)}${r?`?${r}`:""}`;return this.client.get(o,{cancelToken:e?.cancelToken})}async getById(e){let t={id:e.id.toString()};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=e.type||"kbli2020",o=`${p.statisticClassification(i)}${r?`?${r}`:""}`;return this.client.get(o,{cancelToken:e.cancelToken})}};var me=class s extends m{constructor(t,r){super();this.id=t;this.title=r;}toJson(){return {kbli_id:this.id,title:this.title}}static fromJson(t){return new s(String(t.kbli_id||t.id||""),String(t.title||t.name||""))}};var Ye=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||!Array.isArray(r.data)||r.data.length<2)throw new a("Invalid response structure: missing or invalid data array");let i=r.data[0],o=r.data[1];if(!i||!o)throw new a("Invalid response structure");let c=o.map(n=>me.fromJson(n)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return f.fromJson({data:c,pagination:{page:Number(i.page||1),per_page:u,total:Number(i.total||0),pages:Number(i.pages||1),count:l}},n=>me.fromJson(n))}catch(i){throw new a(`Failed to parse statistic classification: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{if(r.data.length===0)throw new a("Statistic classification not found");let i=r.data[0];if(!i)throw new a("Statistic classification data is empty");return me.fromJson(i)}catch(i){throw new a(`Failed to parse statistic classification data: ${i instanceof Error?i.message:"Unknown error"}`)}})}};function Br(s){let e=s??g(),t=new $e(e.networkClient),r=new Ye(t);return {fetchStatisticClassificationList:i=>r.getAll(i),fetchStatisticClassificationDetail:i=>r.getById(i)}}var qe=class{constructor(e){this.client=e;}async getAll(e){let t={};switch(e?.type){case "topics":t.id="38",e.censusId&&(t.kegiatan=e.censusId);break;case "areas":t.id="39",e.censusId&&(t.kegiatan=e.censusId);break;case "datasets":t.id="40",e.censusId&&(t.kegiatan=e.censusId),e.topicId&&(t.topik=e.topicId.toString());break;case "data":t.id="41",e.censusId&&(t.kegiatan=e.censusId),e.censusAreaId&&(t.wilayah_sensus=e.censusAreaId),e.datasetId&&(t.dataset=e.datasetId);break;default:t.id="37";break}let r=new URLSearchParams(t).toString(),i=`${p.CENSUS}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e?.cancelToken})}async getById(e){let t={id:e.id.toString(),domain:e.domain};e.lang&&(t.lang=e.lang);let r=new URLSearchParams(t).toString(),i=`${p.CENSUS}${r?`?${r}`:""}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var nt=class s extends m{constructor(t,r,i,o,c){super();this.id=t;this.name=r;this.itemId=i;this.itemCode=o;this.itemName=c;}toJson(){return {id:this.id,name:this.name,itemID:this.itemId,itemCode:this.itemCode,itemName:this.itemName}}toJSON(){return this.toJson()}static fromJson(t){return new s(String(t.id||""),String(t.name||""),String(t.itemID||""),String(t.itemCode||""),String(t.itemName||""))}};var Me=class s extends m{constructor(t,r,i){super();this.id=t;this.name=r;this.year=i;}toJson(){return {id:this.id,kegiatan:this.name,tahun_kegiatan:this.year}}toJSON(){return this.toJson()}static fromJson(t){return new s(String(t.id||""),String(t.kegiatan||""),Number(t.tahun_kegiatan||0))}};var lt=class s extends m{constructor(t,r,i,o){super();this.id=t;this.topic=r;this.eventId=i;this.eventName=o;}toJson(){return {id:this.id,topik:this.topic,id_kegiatan:this.eventId,kegiatan:this.eventName}}toJSON(){return this.toJson()}static fromJson(t){return new s(Number(t.id||0),String(t.topik||""),String(t.id_kegiatan||""),String(t.kegiatan||""))}};var ct=class s extends m{constructor(t,r,i,o){super();this.id=t;this.mfdCode=r;this.name=i;this.slug=o;}toJson(){return {id:this.id,kode_mfd:this.mfdCode,nama:this.name,slug:this.slug}}toJSON(){return this.toJson()}static fromJson(t){return new s(Number(t.id||0),String(t.kode_mfd||""),String(t.nama||""),String(t.slug||""))}};var ut=class s extends m{constructor(t,r,i,o,c,l){super();this.id=t;this.topicId=r;this.topic=i;this.eventId=o;this.name=c;this.description=l;}toJson(){let t={id:this.id,id_topik:this.topicId,topik:this.topic,id_kegiatan:this.eventId,nama:this.name};return this.description!==void 0&&this.description!==null&&(t.deskripsi=this.description),t}toJSON(){return this.toJson()}static fromJson(t){return new s(Number(t.id||0),Number(t.id_topik||0),String(t.topik||""),Number(t.id_kegiatan||0),String(t.nama||""),t.deskripsi?String(t.deskripsi):null)}};var mt=class s extends m{constructor(t,r,i,o,c,l,u,n,d){super();this.regionId=t;this.regionCode=r;this.regionName=i;this.indicatorId=o;this.indicatorName=c;this.categories=l;this.period=u;this.value=n;this.regionLevel=d;}toJson(){let t={id_wilayah:this.regionId,kode_wilayah:this.regionCode,nama_wilayah:this.regionName,id_indikator:this.indicatorId,nama_indikator:this.indicatorName,categories:this.categories.map(r=>({id:r.id,name:r.name,item_id:r.itemId,item_code:r.itemCode,item_name:r.itemName})),period:this.period,nilai:this.value};return this.regionLevel!==void 0&&this.regionLevel!==null&&(t.level_wilayah=this.regionLevel),t}toJSON(){return this.toJson()}static fromJson(t){let r=[];for(let i=1;i<=5;i++){let o=String(t[`id_kategori_${i}`]||""),c=String(t[`nama_kategori_${i}`]||""),l=String(t[`id_item_kategori_${i}`]||""),u=String(t[`kode_item_kategori_${i}`]||""),n=String(t[`nama_item__kategori_${i}`]||"");!o||!c||!l||!u||!n||r.push(new nt(o,c,l,u,n));}return new s(String(t.id_wilayah||""),String(t.kode_wilayah||""),String(t.nama_wilayah||""),String(t.id_indikator||""),String(t.nama_indikator||""),r,String(t.period||""),Number(t.nilai||0),t.level_wilayah?String(t.level_wilayah):null)}};var We=class{constructor(e){this.remoteDataSource=e;}async getAll(e){return (await this.remoteDataSource.getAll(e)).map(r=>{try{if(!r.data||r.data===null)return this.createEmptyListResult(e);if(!Array.isArray(r.data)||r.data.length<2)return this.createEmptyListResult(e);let i=r.data[0],o=r.data[1];if(o&&!Array.isArray(o)&&typeof o=="object"){let n=o;n.data&&Array.isArray(n.data)&&(o=n.data);}if(!o||!Array.isArray(o))return this.createEmptyListResult(e,i);let c=o.map(n=>this.parseEntity(n,e?.type)),l=Number(i.count)||o.length,u=Number(i.per_page)||l;return new f(c,new N(Number(i.page||1),u,Number(i.total||0),Number(i.pages||1),l))}catch(i){throw new a(`Failed to parse census: ${i instanceof Error?i.message:"Unknown error"}`)}})}async getById(e){return (await this.remoteDataSource.getById(e)).map(r=>{try{return Me.fromJson(r)}catch(i){throw new a(`Failed to parse census event: ${i instanceof Error?i.message:"Unknown error"}`)}})}parseEntity(e,t){switch(t){case "topics":return lt.fromJson(e);case "areas":return ct.fromJson(e);case "datasets":return ut.fromJson(e);case "data":return mt.fromJson(e);case "events":default:return Me.fromJson(e)}}createEmptyListResult(e,t){return f.fromJson({data:[],pagination:{page:Number(t?.page||1),per_page:Number(t?.per_page||10),total:Number(t?.total||0),pages:Number(t?.pages||0),count:0}},r=>this.parseEntity(r,e?.type))}};function Gr(s){let e=s??g(),t=new qe(e.networkClient),r=new We(t);return {fetchCensusList:i=>r.getAll(i)}}var Ke=class{constructor(e){this.client=e;}async get(e){let t={sumber:e.source.toString(),periode:e.period.toString(),kodehs:e.hsCode,jenishs:e.hsType.toString(),tahun:e.year},r=new URLSearchParams(t).toString(),i=`${p.TRADE}?${r}`;return this.client.get(i,{cancelToken:e.cancelToken})}};var ze=class{constructor(e){this.remoteDataSource=e;}get(e){return this.remoteDataSource.get(e)}};function Jr(s){let e=s??g(),t=new Ke(e.networkClient),r=new ze(t);return {fetchTradeData:i=>r.get(i)}}function ur(s){let e=new de(s.apiKey),r={networkClient:new Y({baseURL:s.baseURL??M.BASE_URL,timeout:s.timeout??M.DEFAULT_TIMEOUT,interceptors:[e,...s.interceptors??[]]}),config:s};return {...r,useDomains:()=>Pr(r),usePublications:()=>Ar(r),usePressReleases:()=>Cr(r),useStaticTables:()=>Ir(r),useDynamicTables:()=>Er(r),useInfographics:()=>vr(r),useNews:()=>_r(r),useNewsCategories:()=>Dr(r),useVariables:()=>Tr(r),useVerticalVariables:()=>Lr(r),useDerivedVariables:()=>kr(r),useSubjects:()=>xr(r),useSubjectCategories:()=>Ur(r),useUnits:()=>Vr(r),usePeriods:()=>Nr(r),useDerivedPeriods:()=>Fr(r),useStrategicIndicators:()=>Or(r),useStatisticClassifications:()=>Br(r),useCensus:()=>Gr(r),useTrade:()=>Jr(r)}}var He=class s{constructor(){this._apiKey=null;}static getInstance(){return s.instance||(s.instance=new s),s.instance}setApiKey(e){this._apiKey=e;}getApiKey(){if(!this._apiKey)throw new Error("API key not set. Call setApiKey() first.");return this._apiKey}hasApiKey(){return this._apiKey!==null}clearApiKey(){this._apiKey=null;}};var _t=class extends ht{constructor(t){super();this.repository=t;}async execute(t){return this.repository.getAll(t)}};var F=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new fe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new _t(r)});}static getAllDomainsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};F.REMOTE_DATA_SOURCE="DomainRemoteDataSource",F.REPOSITORY="DomainRepository",F.GET_ALL_USE_CASE="GetAllDomains";var Dt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Tt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var P=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ye(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Re(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Dt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Tt(r)});}static getAllPublicationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPublicationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};P.REMOTE_DATA_SOURCE="PublicationRemoteDataSource",P.REPOSITORY="PublicationRepository",P.GET_ALL_USE_CASE="GetAllPublications",P.GET_BY_ID_USE_CASE="GetPublicationById";var Lt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var kt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var A=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new we(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new he(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Lt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new kt(r)});}static getAllInfographicsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getInfographicByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};A.REMOTE_DATA_SOURCE="InfographicRemoteDataSource",A.REPOSITORY="InfographicRepository",A.GET_ALL_USE_CASE="GetAllInfographics",A.GET_BY_ID_USE_CASE="GetInfographicById";var pt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var dt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var S=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new j(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ee(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new pt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new dt(r)});}static getAllNewsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};S.REMOTE_DATA_SOURCE="NewsRemoteDataSource",S.REPOSITORY="NewsRepository",S.GET_ALL_USE_CASE="GetAllNews",S.GET_BY_ID_USE_CASE="GetNewsById";var xt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ut=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var C=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Pe(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ae(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new xt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ut(r)});}static getAllNewsCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getNewsCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};C.REMOTE_DATA_SOURCE="NewsCategoryRemoteDataSource",C.REPOSITORY="NewsCategoryRepository",C.GET_ALL_USE_CASE="GetAllNewsCategories",C.GET_BY_ID_USE_CASE="GetNewsCategoryById";var gt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var ft=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var w=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new K(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new z(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new gt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ft(r)});}static getAllPressReleasesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPressReleaseByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};w.REMOTE_DATA_SOURCE="PressReleaseRemoteDataSource",w.REPOSITORY="PressReleaseRepository",w.GET_ALL_USE_CASE="GetAllPressReleases",w.GET_BY_ID_USE_CASE="GetPressReleaseById";var yt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Rt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var h=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new H(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Z(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new yt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Rt(r)});}static getAllStaticTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStaticTableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};h.REMOTE_DATA_SOURCE="StaticTableRemoteDataSource",h.REPOSITORY="StaticTableRepository",h.GET_ALL_USE_CASE="GetAllStaticTables",h.GET_BY_ID_USE_CASE="GetStaticTableById";var Vt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Nt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var I=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Te(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Le(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Vt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Nt(r)});}static getAllSubjectsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};I.REMOTE_DATA_SOURCE="SubjectRemoteDataSource",I.REPOSITORY="SubjectRepository",I.GET_ALL_USE_CASE="GetAllSubjects",I.GET_BY_ID_USE_CASE="GetSubjectById";var Ft=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Ot=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var E=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new ke(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new xe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ft(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ot(r)});}static getAllSubjectCategoriesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getSubjectCategoryByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};E.REMOTE_DATA_SOURCE="SubjectCategoryRemoteDataSource",E.REPOSITORY="SubjectCategoryRepository",E.GET_ALL_USE_CASE="GetAllSubjectCategories",E.GET_BY_ID_USE_CASE="GetSubjectCategoryById";var Bt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Gt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var v=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ge(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Je(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Bt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Gt(r)});}static getAllStrategicIndicatorsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStrategicIndicatorByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};v.REMOTE_DATA_SOURCE="StrategicIndicatorRemoteDataSource",v.REPOSITORY="StrategicIndicatorRepository",v.GET_ALL_USE_CASE="GetAllStrategicIndicators",v.GET_BY_ID_USE_CASE="GetStrategicIndicatorById";var Jt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var $t=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var _=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ce(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ie(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Jt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new $t(r)});}static getAllVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};_.REMOTE_DATA_SOURCE="VariableRemoteDataSource",_.REPOSITORY="VariableRepository",_.GET_ALL_USE_CASE="GetAllVariables",_.GET_BY_ID_USE_CASE="GetVariableById";var Yt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var qt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var D=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ee(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ve(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Yt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new qt(r)});}static getAllVerticalVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getVerticalVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};D.REMOTE_DATA_SOURCE="VerticalVariableRemoteDataSource",D.REPOSITORY="VerticalVariableRepository",D.GET_ALL_USE_CASE="GetAllVerticalVariables",D.GET_BY_ID_USE_CASE="GetVerticalVariableById";var Mt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var Wt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var T=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ue(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ve(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Mt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Wt(r)});}static getAllUnitsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getUnitByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};T.REMOTE_DATA_SOURCE="UnitRemoteDataSource",T.REPOSITORY="UnitRepository",T.GET_ALL_USE_CASE="GetAllUnits",T.GET_BY_ID_USE_CASE="GetUnitById";var Kt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var zt=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var L=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ne(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Fe(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Kt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new zt(r)});}static getAllPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};L.REMOTE_DATA_SOURCE="PeriodRemoteDataSource",L.REPOSITORY="PeriodRepository",L.GET_ALL_USE_CASE="GetAllPeriods",L.GET_BY_ID_USE_CASE="GetPeriodById";var Ht=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var Zt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var k=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Oe(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Be(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Ht(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Zt(r)});}static getAllDerivedPeriodsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedPeriodByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};k.REMOTE_DATA_SOURCE="DerivedPeriodRemoteDataSource",k.REPOSITORY="DerivedPeriodRepository",k.GET_ALL_USE_CASE="GetAllDerivedPeriods",k.GET_BY_ID_USE_CASE="GetDerivedPeriodById";var Xt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var Qt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var x=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new _e(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new De(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Xt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new Qt(r)});}static getAllDerivedVariablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getDerivedVariableByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};x.REMOTE_DATA_SOURCE="DerivedVariableRemoteDataSource",x.REPOSITORY="DerivedVariableRepository",x.GET_ALL_USE_CASE="GetAllDerivedVariables",x.GET_BY_ID_USE_CASE="GetDerivedVariableById";var jt=class{constructor(e){this.repository=e;}execute(e){return this.repository.getAll(e)}};var er=class{constructor(e){this.repository=e;}execute(e){return this.repository.getById(e)}};var U=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new $e(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Ye(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new jt(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new er(r)});}static getAllStatisticClassificationsUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getStatisticClassificationByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};U.REMOTE_DATA_SOURCE="StatisticClassificationRemoteDataSource",U.REPOSITORY="StatisticClassificationRepository",U.GET_ALL_USE_CASE="GetAllStatisticClassifications",U.GET_BY_ID_USE_CASE="GetStatisticClassificationById";var tr=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var rr=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getById(e)}};var y=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new qe(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new We(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new tr(r)}),e.registerFactory(this.GET_BY_ID_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new rr(r)});}static getAllCensusesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}static getCensusByIdUseCase(e){return e.resolve(this.GET_BY_ID_USE_CASE)}};y.REMOTE_DATA_SOURCE="CensusRemoteDataSource",y.REPOSITORY="CensusRepository",y.GET_ALL_USE_CASE="GetAllCensuses",y.GET_BY_ID_USE_CASE="GetCensusById";var ir=class{constructor(e){this.repository=e;}async execute(e){return this.repository.getAll(e)}};var O=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new be(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new Se(r)}),e.registerFactory(this.GET_ALL_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ir(r)});}static getAllDynamicTablesUseCase(e){return e.resolve(this.GET_ALL_USE_CASE)}};O.REMOTE_DATA_SOURCE="DynamicTableRemoteDataSource",O.REPOSITORY="DynamicTableRepository",O.GET_ALL_USE_CASE="GetAllDynamicTables";var sr=class{constructor(e){this.injector=e;}async domains(e){return F.getAllDomainsUseCase(this.injector).execute(e)}async publications(e){return P.getAllPublicationsUseCase(this.injector).execute(e)}async infographics(e){return A.getAllInfographicsUseCase(this.injector).execute(e)}async news(e){return S.getAllNewsUseCase(this.injector).execute(e)}async newsCategories(e){return C.getAllNewsCategoriesUseCase(this.injector).execute(e)}async pressReleases(e){return w.getAllPressReleasesUseCase(this.injector).execute(e)}async staticTables(e){return h.getAllStaticTablesUseCase(this.injector).execute(e)}async subjects(e){return I.getAllSubjectsUseCase(this.injector).execute(e)}async subjectCategories(e){return E.getAllSubjectCategoriesUseCase(this.injector).execute(e)}async strategicIndicators(e){return v.getAllStrategicIndicatorsUseCase(this.injector).execute(e)}async variables(e){return _.getAllVariablesUseCase(this.injector).execute(e)}async verticalVariables(e){return D.getAllVerticalVariablesUseCase(this.injector).execute(e)}async units(e){return T.getAllUnitsUseCase(this.injector).execute(e)}async periods(e){return L.getAllPeriodsUseCase(this.injector).execute(e)}async derivedPeriods(e){return k.getAllDerivedPeriodsUseCase(this.injector).execute(e)}async derivedVariables(e){return x.getAllDerivedVariablesUseCase(this.injector).execute(e)}async statisticClassifications(e){return U.getAllStatisticClassificationsUseCase(this.injector).execute(e)}async censusEvents(){return y.getAllCensusesUseCase(this.injector).execute()}async censusTopics(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,type:"topics"})}async censusEventAreas(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,type:"areas"})}async censusEventDatasets(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,topicId:e.topicId,type:"datasets"})}async censusData(e){return y.getAllCensusesUseCase(this.injector).execute({censusId:e.censusId,censusAreaId:e.censusAreaId,datasetId:e.datasetId,type:"data"})}async dynamicTables(e){return O.getAllDynamicTablesUseCase(this.injector).execute(e)}};var or=class{constructor(e){this.injector=e;}async publication(e){return P.getPublicationByIdUseCase(this.injector).execute(e)}async infographic(e){return A.getInfographicByIdUseCase(this.injector).execute(e)}async news(e){return S.getNewsByIdUseCase(this.injector).execute(e)}async newsCategory(e){return C.getNewsCategoryByIdUseCase(this.injector).execute(e)}async pressRelease(e){return w.getPressReleaseByIdUseCase(this.injector).execute(e)}async staticTable(e){return h.getStaticTableByIdUseCase(this.injector).execute(e)}async subject(e){return I.getSubjectByIdUseCase(this.injector).execute(e)}async subjectCategory(e){return E.getSubjectCategoryByIdUseCase(this.injector).execute(e)}async strategicIndicator(e){return v.getStrategicIndicatorByIdUseCase(this.injector).execute(e)}async variable(e){return _.getVariableByIdUseCase(this.injector).execute(e)}async verticalVariable(e){return D.getVerticalVariableByIdUseCase(this.injector).execute(e)}async unit(e){return T.getUnitByIdUseCase(this.injector).execute(e)}async period(e){return L.getPeriodByIdUseCase(this.injector).execute(e)}async derivedPeriod(e){return k.getDerivedPeriodByIdUseCase(this.injector).execute(e)}async derivedVariable(e){return x.getDerivedVariableByIdUseCase(this.injector).execute(e)}async statisticClassification(e){return U.getStatisticClassificationByIdUseCase(this.injector).execute(e)}async census(e){return y.getCensusByIdUseCase(this.injector).execute(e)}};var dr=class s extends m{constructor(t,r,i,o,c,l){super();this.value=t;this.netWeight=r;this.hsCode=i;this.port=o;this.country=c;this.year=l;}toJson(){return {value:this.value,netweight:this.netWeight,kodehs:this.hsCode,pod:this.port,ctr:this.country,tahun:this.year}}static fromJson(t){return new s(Number(t.value||0),Number(t.netweight||0),String(t.kodehs||""),String(t.pod||""),String(t.ctr||""),String(t.tahun||""))}};var ar=class{constructor(e){this.repository=e;}execute(e){return this.repository.get(e)}};var pe=class{static register(e,t){e.registerFactory(this.REMOTE_DATA_SOURCE,()=>new Ke(t)),e.registerFactory(this.REPOSITORY,()=>{let r=e.resolve(this.REMOTE_DATA_SOURCE);return new ze(r)}),e.registerFactory(this.GET_TRADE_USE_CASE,()=>{let r=e.resolve(this.REPOSITORY);return new ar(r)});}static getTradeUseCase(e){return e.resolve(this.GET_TRADE_USE_CASE)}};pe.REMOTE_DATA_SOURCE="TradeRemoteDataSource",pe.REPOSITORY="TradeRepository",pe.GET_TRADE_USE_CASE="GetTrade";var R=class R{constructor(e){this.logger=St.getInstance(),this.logger.configure({enabled:e.debug??false,filter:new q(e.logLevel??1)}),He.getInstance().setApiKey(e.apiKey),this.authInterceptor=new de(e.apiKey);let t=[this.authInterceptor,...e.interceptors||[]];this.networkClient=new Y({baseURL:e.baseURL||M.BASE_URL,timeout:e.timeout||M.DEFAULT_TIMEOUT,interceptors:t}),this.injector=Pt.getInstance(),this.setupDependencies(),this._list=new sr(this.injector),this._view=new or(this.injector),this.logger.info("StadataJS initialized successfully");}static get instance(){if(!R._instance)throw new Error("StadataJS not initialized. Call StadataJS.init() first.");return R._instance}static init(e){return R._instance&&R._instance.logger.warn("StadataJS already initialized. Reinitializing..."),R._instance=new R(e),R._instance}static isInitialized(){return R._instance!==null}static destroy(){R._instance&&(R._instance.cleanup(),R._instance=null);}get list(){return this._list}get view(){return this._view}setApiKey(e){He.getInstance().setApiKey(e),this.authInterceptor.setApiKey(e),this.logger.info("API key updated");}addInterceptor(e){this.networkClient.addInterceptor(e),this.logger.debug("Interceptor added");}removeInterceptor(e){this.networkClient.removeInterceptor(e),this.logger.debug("Interceptor removed");}enableDebug(){this.logger.enable(),this.logger.configure({filter:new q(0)});}disableDebug(){this.logger.configure({filter:new q(1)});}async trade(e){return this.injector.resolve("GetTrade").execute(e)}setupDependencies(){F.register(this.injector,this.networkClient),P.register(this.injector,this.networkClient),A.register(this.injector,this.networkClient),S.register(this.injector,this.networkClient),C.register(this.injector,this.networkClient),w.register(this.injector,this.networkClient),h.register(this.injector,this.networkClient),I.register(this.injector,this.networkClient),E.register(this.injector,this.networkClient),v.register(this.injector,this.networkClient),_.register(this.injector,this.networkClient),D.register(this.injector,this.networkClient),T.register(this.injector,this.networkClient),L.register(this.injector,this.networkClient),k.register(this.injector,this.networkClient),x.register(this.injector,this.networkClient),U.register(this.injector,this.networkClient),y.register(this.injector,this.networkClient),O.register(this.injector,this.networkClient),pe.register(this.injector,this.networkClient);}cleanup(){this.injector.clear(),He.getInstance().clearApiKey(),this.logger.info("StadataJS cleaned up");}};R._instance=null;var gr=R;var Kr=(t=>(t[t.Export=1]="Export",t[t.Import=2]="Import",t))(Kr||{}),zr=(t=>(t[t.Monthly=1]="Monthly",t[t.Annually=2]="Annually",t))(zr||{}),Hr=(t=>(t[t.TwoDigit=1]="TwoDigit",t[t.Full=2]="Full",t))(Hr||{});
|
|
2
|
+
exports.ApiConstant=M;exports.ApiEndpoint=p;exports.ApiFailure=V;exports.CancelToken=pr;exports.CancelledFailure=Ze;exports.CensusArea=ct;exports.CensusCategory=nt;exports.CensusData=mt;exports.CensusDataset=ut;exports.CensusEvent=Me;exports.CensusTopic=lt;exports.ClassificationType=br;exports.DataAvailability=Rr;exports.DataLanguage=yr;exports.DerivedPeriod=ce;exports.DerivedVariable=se;exports.Domain=st;exports.DomainType=hr;exports.DynamicTable=at;exports.ForbiddenFailure=tt;exports.HSCodeType=Hr;exports.Infographic=Q;exports.KBKILevel=wr;exports.KBLILevel=Sr;exports.ListResult=f;exports.LogLevel=wt;exports.NetworkClient=Y;exports.NetworkFailure=Xe;exports.News=$;exports.NewsCategory=te;exports.NotFoundFailure=je;exports.Pagination=N;exports.ParseFailure=a;exports.Period=le;exports.PressRelease=G;exports.Publication=W;exports.RelatedPublication=ot;exports.ServerFailure=rt;exports.StadataJS=gr;exports.StaticTable=J;exports.StatisticClassification=me;exports.StrategicIndicator=ue;exports.Subject=oe;exports.SubjectCategory=ae;exports.TimeoutFailure=Qe;exports.Trade=dr;exports.TradePeriod=zr;exports.TradeSource=Kr;exports.UnauthorizedFailure=et;exports.Unit=ne;exports.ValidationFailure=lr;exports.Variable=re;exports.VerticalVariable=ie;exports.createStadataClient=ur;exports.getGlobalClient=g;exports.initStadata=Mr;exports.resetGlobalClient=Wr;exports.useCensus=Gr;exports.useDerivedPeriods=Fr;exports.useDerivedVariables=kr;exports.useDomains=Pr;exports.useDynamicTables=Er;exports.useInfographics=vr;exports.useNews=_r;exports.useNewsCategories=Dr;exports.usePeriods=Nr;exports.usePressReleases=Cr;exports.usePublications=Ar;exports.useStaticTables=Ir;exports.useStatisticClassifications=Br;exports.useStrategicIndicators=Or;exports.useSubjectCategories=Ur;exports.useSubjects=xr;exports.useTrade=Jr;exports.useUnits=Vr;exports.useVariables=Tr;exports.useVerticalVariables=Lr;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|