/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import a from"./4AFANEZZ.js";export default $arcgis.t(([u])=>{var v={User:"user",Translation:"translation"},x={TextEditor:"textEditor"},S={ExpandCollapse:"list-merge",SettingIndicator:"list-button",Popover:"information",Expanded:"chevron-down",Collapsed:"chevron-right",Copy:"copy-to-clipboard",Title:"title",Subtitle:"subheading",Text:"text",Button:"button",String:"string"},L={Light:"calcite-mode-light",Dark:"calcite-mode-dark"},b=`
  .instant-apps-language-translator-item__nested-input .ck.ck-reset.ck-editor.ck-rounded-corners {
    margin-left: 30px !important;
  }
`,c=u({uiData:null,currentLanguage:null,lastSave:null,saving:!1,currentLocaleSettingItem:null,portalItemResource:null,portalItemResourceT9n:null}),h=c.state;c.onChange;var l=c;function T(t,o){if(!t)return;let e=l.get("uiData"),a=new Map;a.set("locales",o),a.set("translatedLanguageLabels",{...t.translatedLanguageLabels}),t.content.forEach(n=>{let{type:d,label:p,value:g,uiLocation:m}=n,f=e?.get(n.id);a.set(n.id,{userLocaleData:{type:d??null,label:p??null,value:g??null},expanded:!0,selected:f?.selected??!1,uiLocation:m,tip:n?.tip??null})});let s=t.content.map(n=>n.id),r=s.every(n=>!a.get(n).selected),i=a.get(s[0]);if(r&&i){let n=e?.get(s[0]);i.selected=n?.selected??!0}return a}function k(){let t=[];return h.uiData?.forEach((o,e)=>{e!=="locales"&&e!=="translatedLanguageLabels"&&t.push(e)}),t}function D(t,o){let e=l.get("portalItemResourceT9n")||{},a;return e[t]||(e[t]={}),a={...e,[t]:{...typeof e[t]=="object"?e[t]:{},...o}},a}function E(t){return t?.map(o=>o.locale)??[]}function I(){return document.body.classList.contains(L.Dark)}function C(){let t=document.createElement("style");t.innerHTML=b,document.head.appendChild(t)}async function w(t){let o=l.get("portalItemResourceT9n"),e=Date.now();l.set("lastSave",e);let a=[JSON.stringify({...o,lastSave:e})],s={type:"application/json"},r=new Blob(a,s);t.update(r)}return{a:v,b:x,c:S,d:L,e:h,f:l,g:T,h:k,i:D,j:E,k:I,l:C,m:w}},a)