package com.ifpdos.udi.sdk.service.doc.mkdocs;

import g.c0.g;
import g.h0.c.l;
import g.i;
import g.m0.f;
import java.util.Locale;

/* JADX INFO: compiled from: DocRenderer.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class DocRendererKt {
    private static final String APIS_DOCUMENT_TEMPLATE = "---\ntarget: \"{{target}}\"\ntitle: \"{{commentTitle}}\"\nhide:\n  - toc\n---\n{{commentDescription}}\n";
    private static final String DOC_TEMPLATE = "---\n{{#apis}}\n{{#summaries}}\n\ntarget: \"{{&uri}}\"\nendpoint: true\ntitle: \"{{&summary}}\"\naudit:\n    - linjiawei3046\n    - guorongfei\n    - hedelong\n    - linxuan\nhide:\n    - toc\n\n{{#hasPermission}}\n    permission:\n    {{#isGetSupport}}{{&tap}}get: {{&getPermission}} {{/isGetSupport}}\n    {{#isPostSupport}}{{&tap}}set: {{&postPermission}} {{/isPostSupport}}\n    {{#isNotifySupport}}{{&tap}}notify: {{&notifyPermission}} {{/isNotifySupport}}\n{{/hasPermission}}\n\n{{#hasAlso}}\n    also:\n    {{#also}}\n        {{&tap}}- \"{{&see}}\"\n    {{/also}}\n{{/hasAlso}}\n\n{{#hasDeprecated}}\n    deprecated: \"{{&deprecated}}\"\n{{/hasDeprecated}}\n\n{{#api.alias}}\n    alias: \"{{&api.alias}}\"\n{{/api.alias}}\n\n{{#apply}}\n    apply:\n    {{&tap}}UDI:\n{{/apply}}\n\n{{#hasOpensdks}}\nopensdk:\n    {{#opensdks}}\n    {{&tap}}{{&method}}: \"{{&api}}\"\n    {{/opensdks}}\n{{/hasOpensdks}}\n\n{{#hasFunctionBlocks}}\nfunblk:\n    {{#functionBlocks}}\n    {{&tap}}- \"{{.}}\"\n    {{/functionBlocks}}\n{{/hasFunctionBlocks}}\n\nclassification: \"{{&classification}}\"\n\n{{#hasDepends}}\ndepends: '{{&dependsString}}'\n{{/hasDepends}}\n\n{{/summaries}}\n{{/apis}}\n---\n\n{{#apis}}\n\n# {{&api.comment.summary}}\n\n{{&description}}\n\n{{#isGetSupport}}\n<!--GET BEGIN-->\n{{lineBreak}}\n## 获取\n\n    ### 接口\n    \n    ```http\n    GET {{&getUrl}}\n    ```\n\n    {{#hasGetRequest}}\n        ### URI 参数\n        | Name     | Required | In      | Type                                  | Description                                                                                                                |\n        | -------- | -------- | ------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |\n        {{#getRequestWrapper}}\n            |{{&filed.name}}| {{&isRequired}} |{{pos}}|{{jsonType}}|{{&filed.description}}|\n        {{/getRequestWrapper}}\n    {{/hasGetRequest}}\n\n    ### 响应\n    \n        | Status                    | Type                              | Description                  |\n        | ------------------------- | --------------------------------- | ---------------------------- |\n        |`200 OK`|{{getResponseClassName}}||\n        |`401 Unauthorized`||`token` 非法，或者无访问权限|\n    \n    ### 示例\n    \n    {{&api.get.demoCode}}\n<!-- GET END -->  \n{{/isGetSupport}}\n\n{{#isPostSupport}}\n<!--SET BEGIN-->\n{{lineBreak}}\n## 设置\n\n    ### 接口\n\n    ```http\n    POST {{&postUrl}}\n    ```\n\n    {{#hasPostRequest}}\n        {{#isUriParam}}\n            ### URI 参数 \n            | Name   | Required | In     | Type                                  | Description |\n            | ------ | -------- | ------ | ------------------------------------- | ----------- |\n            {{#postRequestWrapper}}\n                | {{&filed.name}} | {{isRequired}} | {{&pos}} | {{&jsonType}} |{{&filed.description}} |\n            {{/postRequestWrapper}}\n        {{/isUriParam}}\n\n        {{^isUriParam}}\n          ### 请求内容 \n          | Name       | Required | Type   | Description    |\n          | ---------- | -------- | ------ | -------------- |\n          {{#postRequestWrapper}}\n              | {{&filed.name}} | {{isRequired}} | {{&jsonType}} | {{&filed.description}} | \n          {{/postRequestWrapper}}\n        {{/isUriParam}}\n    {{/hasPostRequest}}\n    \n    {{^hasPostResponse}}\n    ### 响应\n    \n    | Status                    | Type | Description                   |\n    | ------------------------- | ---- | ----------------------------- |\n    | `200 OK`                |  {{postResponseDataClass}}  |                             |\n    | `401 Unauthorized`        |      |  `token` 非法，或者无访问权限|\n    {{/hasPostResponse}}\n   \n    ### 示例\n    \n    {{&api.post.demoCode}}\n<!--SET END-->\n{{/isPostSupport}}\n\n{{#isNotifySupport}}\n<!--NOTIFY BEGIN-->\n{{lineBreak}}\n## 监听\n    ### 接口\n\n    ```HTTP\n    POST /v1/event/add/single\n\n    {\n        {{tap}}\"uuid\": \"{uuid}\",\n        {{tap}}\"event\": \"{{&api.uri.path}}\"\n    }\n    ```\n    {{#hasNotify}}\n        ### 请求内容\n        | Name   | Required | Type                                | Description                                                  |\n        | ------ | -------- | ----------------------------------- | ------------------------------------------------------------ |\n        |`uuid`|`true`|`string`||\n        |`event`|`true`|`string`||\n    {{/hasNotify}}\n\n    ### 通知内容\n    | Status             | Type | Description                  |\n    | ------------------ | ---- | ---------------------------- |\n    | `200 OK`           |  {{notifyDataClass}} | 监听成功       |\n    | `401 Unauthorized` |      | `token` 非法，或者无访问权限 |\n\n    ### 示例\n    {{&api.notify.demoCode}}\n<!--NOTIFY END-->\n{{/isNotifySupport}}\n\n<!--DEPEND BEGIN-->\n\n{{#hasDepends}}\n<!-- ONLINE BEGIN -->\n## 系统依赖\n\n|方法|库|接口|功能|\n|-|-|-|-|\n{{#depends}}\n| {{&method}} | {{&lib}} | {{&api}} | {{&platform}} {{&description}} |\n{{/depends}}\n<!-- ONLINE END -->\n{{/hasDepends}}\n\n<!--DEPEND END-->\n\n\n{{/apis}}\n\n{{#classes}}\n<!--STRUCT BEGIN, USED BY:{{usedBy}}-->\n    ## {{&simpleType}}\n    {{#comment}}\n        {{&comment}}\n    {{/comment}}\n    {{lineBreak}}\n    |Name|Type|Description|  \n    |---|---|---|\n    {{#fields}}\n        | {{&name}} |{{&link}}|  {{&description}} |  \n    {{/fields}}\n<!--STRUCT END-->\n{{/classes}}\n\n{{#enums}}\n<!--STRUCT BEGIN, USED BY:{{usedBy}}-->\n    ## {{&simpleType}}\n    {{#comment}}\n        {{&comment}}\n    {{/comment}}\n    {{lineBreak}}\n    |Name|Description|  \n    |---|---|  \n    {{#fields}}\n        | {{&name}} | {{&description}} |  \n    {{/fields}}\n<!--STRUCT END-->\n{{/enums}}\n";

    /* JADX INFO: Access modifiers changed from: private */
    public static final String getGenericSimpleNameWithoutPackage(String str) {
        if (str == null) {
            return "";
        }
        if (!f.b(str, "<", false, 2)) {
            return (String) g.t(f.E(str, new String[]{"."}, false, 0, 6));
        }
        String strSubstring = str.substring(f.m(str, "<", 0, false, 6) + 1, f.m(str, ">", 0, false, 6) + 1);
        l.e(strSubstring, "this as java.lang.String…ing(startIndex, endIndex)");
        String strSubstring2 = str.substring(0, f.m(str, "<", 0, false, 6) + 1);
        l.e(strSubstring2, "this as java.lang.String…ing(startIndex, endIndex)");
        String str2 = ((String) g.t(f.E(strSubstring2, new String[]{"."}, false, 0, 6))) + ((String) g.t(f.E(strSubstring, new String[]{"."}, false, 0, 6)));
        l.e(str2, "simpleName.toString()");
        return str2;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final String getLink(String str) {
        StringBuilder sb = new StringBuilder();
        sb.append('[');
        sb.append(str);
        sb.append("](#");
        String lowerCase = str.toLowerCase(Locale.ROOT);
        l.e(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
        sb.append(lowerCase);
        sb.append(')');
        return sb.toString();
    }
}
