/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import a from"./6KLGSVI4.js";import{ja as u,mb as l,mc as m}from"./4Q4PZB7R.js";import{u as c}from"./3GWWHA4S.js";export default $arcgis.t(([,{m:f}])=>{function F(t){let e="",n="?";return t.forEach(r=>{r.k&&r.v&&(e+=n+r.k+"="+r.v,n="&")}),e}function O(t){return t?m(t,{}).then(e=>Promise.resolve(!!e)):Promise.resolve(!1)}async function y(t,e){let n=e,r=await n.getUsername(),a={q:new c().match(t).in("title").and().match(r).in("owner"),filter:"type:Solution",authentication:n},d=(await l(a)).results.map(s=>s.title),{folders:g}=await u(n),p=g.map(s=>s.title),i=[...d,...p].map(s=>s.trim().toLowerCase()),o=t.toLowerCase(),h=i.filter(s=>s===o),w=i.filter(s=>s.startsWith(o));return{conflictingNames:h,similiarNames:w}}async function A(t,e){return v(t)?{status:!1,type:"empty"}:x(t)?{status:!1,type:"exceed length"}:W(t,"folder")?{status:!1,type:"special character"}:(await y(t.trim(),e)).conflictingNames.length>0?{status:!1,type:"not unique"}:{status:!0,type:""}}function v(t){return t.length<=0}function x(t){return t.length>f}function W(t,e){return(e==="item"?/[><~`$^+=|]/u:/[/<>]/u).test(t)}function C(t){if(t){let e=t.trim();return e?"<div>"+e+"</div>":""}else return""}function k(t){let e="",n="?";return t.forEach(r=>{r.k&&r.v&&(e+=n+r.k+"="+r.v,n="&")}),e}function D(t,e,n,r){let a="";return e?a=r+"/sharing/rest/content/items/"+t+"/info/"+e+k([{k:"w",v:"400"}]):a=n,a}function E(t){let e=t?t.replace("https://","").replace("www.",""):"";return e.endsWith("devext.arcgis.com")||e.endsWith("mapsqa.arcgis.com")||e.endsWith("qaext.arcgis.com")?t??"https://www.arcgis.com":"https://www.arcgis.com"}function I(t,e,n){return e.some(r=>r.wkid===t?(n=r.defaultExtent,!0):!1),n}function b(t,e){return q(e||t)}function B(t,e="en"){return new Intl.DateTimeFormat(e,{year:"numeric",month:"long",day:"numeric"}).format(t)}function L(t,e){let n="";return t.some(r=>r.startsWith(e)?(n=r.substring(e.length),!0):!1),n}function q(t){let e=t.replace("www.","");return e.endsWith("devext.arcgis.com")?"dev":e.endsWith("mapsqa.arcgis.com")||e.endsWith("qaext.arcgis.com")?"qa":e==="arcgis.com"||e.endsWith(".arcgis.com")?"prod":"dev"}function P(t,e){let n=t?.reduce((r,a)=>(r.indexOf(a.id)<0&&r.push(a.id),r),[])||[];return e?n.sort((r,a)=>e.indexOf(r)-e.indexOf(a)):n}function T(t){return t.charAt(0).toUpperCase()+t.slice(1)}function j(t){return{relevance:"Relevance",title:"Title",new:"New",created:"Date deployed",updated:"Updated",suggested:"Suggested for you"}[t]||t}function G(t){if(!t)return"Unknown error";if(t.message)return t.message;try{let e=JSON.stringify(t);return e&&e!=="{}"?e:t.toString()}catch{return t.toString()}}function J(t){return t?parseFloat(((Date.now()-t)/1e3).toFixed(2)):0}return{a:F,b:O,c:y,d:A,e:W,f:C,g:k,h:D,i:E,j:I,k:b,l:B,m:L,n:P,o:T,p:j,q:G,r:J}},"intl",a)