import{c as e,i as t}from"./preload-helper-B45gAKPr.js";import{pn as n,t as r}from"./iframe-NOj5DEP4.js";import{D as i,E as a,T as o,w as s}from"./odata-DsBT7AZ3.js";var c,l,u=t((()=>{c=[{code:`R01`,text:`Северный регион`,branches:[{code:`B0101`,text:`Подразделение Альфа`,teams:[{code:`T0101`,text:`Команда поддержки`,owners:[{code:`P0001`,text:`Ответственный 1`},{code:`P0002`,text:`Ответственный 2`},{code:`P0003`,text:`Ответственный 3`}]},{code:`T0102`,text:`Команда внедрения`,owners:[{code:`P0004`,text:`Ответственный 4`},{code:`P0005`,text:`Ответственный 5`}]}]},{code:`B0102`,text:`Подразделение Бета`,teams:[{code:`T0201`,text:`Команда аналитики`,owners:[{code:`P0006`,text:`Ответственный 6`},{code:`P0007`,text:`Ответственный 7`}]}]}]},{code:`R02`,text:`Южный регион`,branches:[{code:`B0201`,text:`Подразделение Гамма`,teams:[{code:`T0301`,text:`Команда сопровождения`,owners:[{code:`P0008`,text:`Ответственный 8`},{code:`P0009`,text:`Ответственный 9`}]}]}]},{code:`R03`,text:`Восточный регион`,branches:[{code:`B0301`,text:`Подразделение Дельта`,teams:[{code:`T0401`,text:`Команда развития`,owners:[{code:`P0010`,text:`Ответственный 10`},{code:`P0011`,text:`Ответственный 11`}]}]},{code:`B0302`,text:`Подразделение Омега`,teams:[{code:`T0501`,text:`Команда качества`,owners:[{code:`P0012`,text:`Ответственный 12`},{code:`P0013`,text:`Ответственный 13`}]}]}]}],l=c.flatMap(e=>e.branches.flatMap(t=>t.teams.flatMap(n=>n.owners.map(r=>({REGION:e.code,REGION_Text:e.text,BRANCH:t.code,BRANCH_Text:t.text,TEAM:n.code,TEAM_Text:n.text,OWNER:r.code,OWNER_Text:r.text})))))}));function d(e,t,n=200){return new Response(e,{status:n,headers:{"Content-Type":t}})}function f(e){return new Promise(t=>{setTimeout(t,e)})}var p,m,h,g,_,v,y,b,x,S,C,w=t((()=>{p=e(n(),1),o(),a(),u(),m=r(),h=`DEMO_REFERENCE_SRV`,g=`DemoReferenceItems`,_=`<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
	<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">
		<Schema Namespace="DEMO_REFERENCE_SRV" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:sap="http://www.sap.com/Protocols/SAPData">
			<EntityType Name="DemoReferenceItemsType" sap:semantics="aggregate" sap:label="Демо-справочник" sap:content-version="1">
				<Key>
					<PropertyRef Name="ID" />
				</Key>
				<Property Name="ID" Type="Edm.String" Nullable="false" sap:sortable="false" sap:filterable="false" />
				<Property Name="REGION" Type="Edm.String" MaxLength="4" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="REGION_Text" />
				<Property Name="REGION_Text" Type="Edm.String" MaxLength="40" sap:label="Регион" sap:quickinfo="Краткое описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="BRANCH" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="BRANCH_Text" />
				<Property Name="BRANCH_Text" Type="Edm.String" MaxLength="40" sap:label="Подразделение" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="TEAM" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="TEAM_Text" />
				<Property Name="TEAM_Text" Type="Edm.String" MaxLength="40" sap:label="Команда" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="OWNER" Type="Edm.String" MaxLength="8" sap:aggregation-role="dimension" sap:display-format="UpperCase" sap:text="OWNER_Text" />
				<Property Name="OWNER_Text" Type="Edm.String" MaxLength="40" sap:label="Ответственный" sap:quickinfo="Среднее описание" sap:creatable="false" sap:updatable="false" />
				<Property Name="CNT" Type="Edm.Byte" sap:aggregation-role="measure" sap:filterable="false" />
			</EntityType>
			<EntityContainer Name="DEMO_REFERENCE_SRV_Entities" m:IsDefaultEntityContainer="true">
				<EntitySet Name="DemoReferenceItems" EntityType="DEMO_REFERENCE_SRV.DemoReferenceItemsType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1" />
			</EntityContainer>
		</Schema>
	</edmx:DataServices>
</edmx:Edmx>`,v={region:`R01`,regionText:`Северный регион`,branch:`B0101`,branchAlt:`B0102`,team:`T0101`,teamAlt:`T0201`,owner:`P0001`,ownerAlt:`P0006`},y={REGION:{placeholder:`Регион`},BRANCH:{placeholder:`Подразделение`,hideCode:!0},TEAM:{placeholder:`Команда`},OWNER:{placeholder:`Ответственный`}},b=(e,t)=>{let n=(0,p.useMemo)(()=>s({}),[]),r=e;return(0,p.useLayoutEffect)(()=>{let e=window.fetch.bind(window),r=t.parameters.odataMockMode??`success`;return window.fetch=async(t,n)=>{let i=typeof t==`string`?t:t instanceof URL?t.toString():t.url,a=new URL(i,window.location.origin).pathname;return a.includes(`/DEMO_REFERENCE_SRV/`)?(r===`loading`&&await f(1200),a.endsWith(`/DEMO_REFERENCE_SRV/$metadata`)?r===`metadataError`?d(`Ошибка чтения metadata`,`text/plain`,500):d(_,`application/xml`):a.endsWith(`/DEMO_REFERENCE_SRV/DemoReferenceItems`)?r===`collectionError`?d(JSON.stringify({error:`Ошибка загрузки справочника`}),`application/json`,500):d(JSON.stringify({d:{results:l}}),`application/json`):e(t,n)):e(t,n)},()=>{window.fetch=e,n.clear()}},[t.id,t.parameters.odataMockMode,n]),(0,m.jsx)(i,{client:n,children:(0,m.jsx)(r,{})})},x={service:h,target:g},S={codeKey:`REGION`,minSearchTextLength:1,minSearchCodeLength:1,searchDebounceDelay:250,maxVisibleItems:100},C={placeholder:`Регион`},b.__docgenInfo={description:``,methods:[],displayName:`withMockedOData`}}));export{v as a,w as i,x as n,y as o,C as r,b as s,S as t};